[Overlay] Enable Night Light, Auto-Brightness, Ambient Display & more on Treble ROM

Search This thread

MishaalRahman

Retired Editor in Chief
Nov 2, 2015
1,045
2,151
www.xda-developers.com
[Overlay] Enable Night Light, Auto-Brightness, Ambient Display & more on Treble ROM

Hello.

By default, phhusson's generic AOSP Treble ROM is bare bones. That means it does not include features such as Night Light, Ambient Display, or Adaptive Brightness. Luckily all you need is the right overlay and you can bring these features back.

I tested this on the Huawei Mate 10 Pro and everything seems to work save for the lift-to-wake gesture. I am not sure if a simple overlay can enable that, as I already target the right boolean value for it. As for Adaptive Brightness, the lux and corresponding backlight values were borrowed from the Huawei Mate 9's framework-res.

Update 2/19/18

With the release of phhusson's Android 8.1 Oreo Treble GSI, I thought I would take the time to update my overlay as well with a new feature: Always on Display. You can download the overlay from the attachment in this comment, and install it using the same set of instructions below (don't install the overlay attached in this post if you want AOD). Please read the warnings carefully. I accept no responsibility for anything you do with your phone.

Update 2/6/18

I have updated the attached framework overlay to include the following features:
  1. WiFi automatic wakeup
  2. Pinner service for the default camera app and critical framework files

This should work on any device that can boot phhusson's Treble ROM.

Installation Instructions

  1. Download the attached overlay
  2. With root, push the overlay to /vendor/overlay. Create the folder if it doesn't exist.
  3. Run the following command in a rooted terminal or ADB shell:
    Code:
    chcon u:object_r:vendor_overlay_file:s0 /vendor/overlay;chcon u:object_r:vendor_overlay_file:s0 /vendor/overlay/framework-res__auto_generated_rro.apk
  4. Reboot

XDA Labs adds emojis in the command for some reason. Open this thread in a browser to get the right command.

Why do you need to run that command? Without it, the overlay won't be seen as installed and isn't enabled. I'm not sure why, but according to phhusson it's an SELinux-related issue and this command fixes that.

Enjoy!
 

Attachments

  • framework-res__auto_generated_rro.apk
    5.7 KB · Views: 7,923
Last edited:
What is the code?
 

Attachments

  • Screenshot_20180129-175534.jpg
    Screenshot_20180129-175534.jpg
    252.1 KB · Views: 11,511
  • Like
Reactions: niggyq

mrassol

Senior Member
May 31, 2007
231
19
Rennes
Hello, not working on mate 9, all commands OK - no output error (I added mount -o rw,remount /system and mount -o rw,remount /vendor) to copy your files, but even after reboot no new things

EDIT : after "installing" the app (click on it with a root explorer), all options are now visible but not working
 
Last edited:

MishaalRahman

Retired Editor in Chief
Nov 2, 2015
1,045
2,151
www.xda-developers.com
Hello, not working on mate 9, all commands OK - no output error (I added mount -o rw,remount /system and mount -o rw,remount /vendor) to copy your files, but even after reboot no new things

EDIT : after "installing" the app (click on it with a root explorer), all options are now visible but not working

If you install it as a regular app, it won't work. It MUST be pushed to /vendor/overlay manually, and you MUST run that command.

how can i get the root access on the rom?:)

Install phhusson's SuperUser from the Play Store.

It is also not working on honor v9 .

Did you follow the steps exactly? This can't be installed like a regular app.
 
  • Like
Reactions: Beetle84

mrassol

Senior Member
May 31, 2007
231
19
Rennes
you did'nt read my post ;)

I did all you wrote (I even add mount -o rw,remount /system and mount -o rw,remount /vendor) and nothing changed
AFTER that, I install the apk from /vendor/overlay using a root explorer and now the options are visible, brightness is working (I didn't saw it first), night mode is also working, ambiant display is also working but the option to turn on phone on pickup don't work.

So my bad, I didn't test it so much
 
If you install it as a regular app, it won't work. It MUST be pushed to /vendor/overlay manually, and you MUST run that command.



Install phhusson's SuperUser from the Play Store.



Did you follow the steps exactly? This can't be installed like a regular app.
When I try to open it as a regular app , my phone display it can not open .I am sure it be pushed to /vendor/overlay .,and I have run the commed and rebooted system at least 5 times.but it still useless.(I am sorry my English is poor.)
 

etern1ty

Senior Member
Aug 6, 2010
126
13
Took me a while to get it to work on my mate 10 pro, then realised I had to manually set the permissions on the folder, and file for it to work. Great job!

Is there a way I could edit the minimum and maximum brightness it reaches?

Thanks again :)
 

MishaalRahman

Retired Editor in Chief
Nov 2, 2015
1,045
2,151
www.xda-developers.com
Took me a while to get it to work on my mate 10 pro, then realised I had to manually set the permissions on the folder, and file for it to work. Great job!

Is there a way I could edit the minimum and maximum brightness it reaches?

Thanks again :)

Ah, I forgot about that. I believe the folder permissions are 755 and the APK should be 644, correct? As for setting the brightness, do you want to increase the minimum and lower the maximum of the adaptive brightness?
 

etern1ty

Senior Member
Aug 6, 2010
126
13
Ah, I forgot about that. I believe the folder permissions are 755 and the APK should be 644, correct? As for setting the brightness, do you want to increase the minimum and lower the maximum of the adaptive brightness?

Yeah, that sounds right :) I just matched the other folders and APKs. I was hoping to decrease the minimum (so it's darker), I don't notice a big effect on my mate 10 pro.

Is there a guide for going about this? I'm interested to learn how to make these sorts of modifications myself.

Cheers
 

MishaalRahman

Retired Editor in Chief
Nov 2, 2015
1,045
2,151
www.xda-developers.com
Yeah, that sounds right :) I just matched the other folders and APKs. I was hoping to decrease the minimum (so it's darker), I don't notice a big effect on my mate 10 pro.

Is there a guide for going about this? I'm interested to learn how to make these sorts of modifications myself.

Cheers

Decompile my overlay. Look in /res/values/arrays.xml. Look at "config_autoBrightnessLcdBacklightValues" array and change the first item, <item>6</item> to <item>1</item>. Build the APK, sign it, and then push.
 
  • Like
Reactions: etern1ty

Top Liked Posts

  • There are no posts matching your filters.
  • 50
    [Overlay] Enable Night Light, Auto-Brightness, Ambient Display & more on Treble ROM

    Hello.

    By default, phhusson's generic AOSP Treble ROM is bare bones. That means it does not include features such as Night Light, Ambient Display, or Adaptive Brightness. Luckily all you need is the right overlay and you can bring these features back.

    I tested this on the Huawei Mate 10 Pro and everything seems to work save for the lift-to-wake gesture. I am not sure if a simple overlay can enable that, as I already target the right boolean value for it. As for Adaptive Brightness, the lux and corresponding backlight values were borrowed from the Huawei Mate 9's framework-res.

    Update 2/19/18

    With the release of phhusson's Android 8.1 Oreo Treble GSI, I thought I would take the time to update my overlay as well with a new feature: Always on Display. You can download the overlay from the attachment in this comment, and install it using the same set of instructions below (don't install the overlay attached in this post if you want AOD). Please read the warnings carefully. I accept no responsibility for anything you do with your phone.

    Update 2/6/18

    I have updated the attached framework overlay to include the following features:
    1. WiFi automatic wakeup
    2. Pinner service for the default camera app and critical framework files

    This should work on any device that can boot phhusson's Treble ROM.

    Installation Instructions

    1. Download the attached overlay
    2. With root, push the overlay to /vendor/overlay. Create the folder if it doesn't exist.
    3. Run the following command in a rooted terminal or ADB shell:
      Code:
      chcon u:object_r:vendor_overlay_file:s0 /vendor/overlay;chcon u:object_r:vendor_overlay_file:s0 /vendor/overlay/framework-res__auto_generated_rro.apk
    4. Reboot

    XDA Labs adds emojis in the command for some reason. Open this thread in a browser to get the right command.

    Why do you need to run that command? Without it, the overlay won't be seen as installed and isn't enabled. I'm not sure why, but according to phhusson it's an SELinux-related issue and this command fixes that.

    Enjoy!
    8
    Updated overlay is attached here with support for Always on Display (please use your best judgment and do not install this on a device with an LCD screen). THIS ONLY WORKS ON ANDROID 8.1 OREO!!!!

    Install as usual and run the same command.
    7
    autobrightness levels - optimized

    I've modified yours overlay on term of autobrightness - much more levels with different curve (low backlight at start, then goes to higher values for bright env), see attached pics.
    Installation - just replace MishaalRahman's apk.
    5
    For everyone that can't get it to work in a way that describet in first post, try to run this script on any terminal emulator app:
    1. put this lines in a text file and rename it to <any name>.sh
    Code:
    #!/bin/sh
    mount -o rw,remount /vendor; cp -rf framework-res__auto_generated_rro.apk /vendor/overlay/; chmod 755 /vendor/overlay/framework-res__auto_generated_rro.apk; chown root:shell /vendor/overlay/framework-res__auto_generated_rro.apk; chcon u:object_r:vendor_overlay_file:s0 /vendor/overlay;chcon u:object_r:vendor_overlay_file:s0 /vendor/overlay/framework-res__auto_generated_rro.apk; mount -o ro,remount /vendor
    2. place this file and framework-res__auto_generated_rro.apk in a root of sdcard
    3. open terminal app, and run this commands
    Code:
    su
    cd /sdcard
    sh <anyname>.sh
    5. reboot


    PS
    I'm using Pixel Experience 9.0 GSI on Le max 2
    3
    doesnt seem to work correctly for me either. or i did smth wrong. honor 9 lite with the phh treble rom (gapps+su a-only variant).
    copied overlay to /vendor/overlay (had to creat the folder)
    set permissions folder 755 overlay.apk 644
    ran command: output looked as if it worked.
    can select overlays in display settings. without any selected nothing is differnt. with nightlight overlay selected i have a option for night light but enebling it and changing the slider does nothing. the other 2 overlays do nothing either.
    what could i have done wrong?

    UPDATE:
    I got it working.
    first i needed root which i thought any "adb shell <command here>" would have, it didnt. also /vendor needs to be remounted as read-write. so i did:
    Code:
    adb shell
    su
    mount -o rw,remount /system      (though that isnt neccessary i think)
    mount -o rw,remount /vendor      (got /vendor/overlay read-only file-system error without it)
    command from OP
    after a reboot everything works.
    nightmode overlay is still selected in settings -> display but thats unimportant i think.

    nightmode works, ambient display works (not using it) and adaptive brightness works as well. nice work. maybe change OP with su and mount commands.