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

Search This thread

MishaalRahman

Editor in Chief
Nov 2, 2015
1,039
2,123
www.xda-developers.com
Hello, I'm just wondering does the always on display work like on the pixel 2? I know there is a substratum overlay for always on display but it doesn't work very well on OG pixel XL stock 8.1. is it possible to use this method on OG pixel XL?
Thanks

Sent from my Pixel XL using XDA Labs

Yes, it will work better than the Substratum overlay. Yes, this should work on the OG Pixel XL (though I should probably strip all of the other stuff out first).

if i want to downgrade to 8.0 would i need to remove this overlay first before downgrading?

I am not sure what would happen. I suspect you should be fine, though.
 

skiely666

Senior Member
May 26, 2011
557
164
Yes, it will work better than the Substratum overlay. Yes, this should work on the OG Pixel XL (though I should probably strip all of the other stuff out first).


Should I push to vendor/overlay & also run commands too?
There's already a framework-res__auto_generated_rro.apk in that folder.
Here it is, there's a lot going on inside it ?

Sent from my Pixel XL using XDA Labs
 

Attachments

  • framework-res__auto_generated_rro.apk
    1.7 MB · Views: 289

skiely666

Senior Member
May 26, 2011
557
164
Don't override the original framework overlay. Lots of very important Pixel stuff in there.

Yeah I was thinking that. So if I merge your code into the original framework overlay, in theory I could have pixel 2 always on display on my pixel XL?
Is this possible?

Sent from my Pixel XL using XDA Labs
 

MishaalRahman

Editor in Chief
Nov 2, 2015
1,039
2,123
www.xda-developers.com
Yeah I was thinking that. So if I merge your code into the original framework overlay, in theory I could have pixel 2 always on display on my pixel XL?
Is this possible?

Sent from my Pixel XL using XDA Labs

It's really just one line you would need to add. You can decompile my overlay and change the package name so it won't interfere with the existing framework overlay.
 
  • Like
Reactions: skiely666

rufik

Senior Member
Jan 18, 2010
331
84
Łódź
@MishaalRahman How did you get config_autoBrightnessLevels and config_autoBrightnessLcdBacklightValues arrays from stock huawei's rom? I can't decompile it because apktool complains about some errors (known problem: https://github.com/iBotPeaches/Apktool/issues/1521).
What is max value for config_autoBrightnessLevels?

I'd like to tune levels because yours are not really fluent for me / too bright.
 
Last edited:

phhusson

Recognized Developer
Jul 23, 2009
2,448
4,694
Paris
@MishaalRahman How did you get config_autoBrightnessLevels and config_autoBrightnessLcdBacklightValues arrays from stock huawei's rom? I can't decompile it because apktool complains about some errors (known problem: https://github.com/iBotPeaches/Apktool/issues/1521).
What is max value for config_autoBrightnessLevels?

I'd like to tune levels because yours are not really fluent for me / too bright.
IIRC, if you look at the apktool code, you'll see there is an argument to the function "failIfSomething", just set that to false, and you'll be able to decompile (this breaks recompilation obviously though)
 

rufik

Senior Member
Jan 18, 2010
331
84
Łódź
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.
 

Attachments

  • original-values.png
    original-values.png
    10.5 KB · Views: 2,972
  • optimized-values.png
    optimized-values.png
    10.7 KB · Views: 2,961
  • framework-res__auto_generated_rro.apk
    3.9 KB · Views: 885

pchatzop

Senior Member
Oct 16, 2015
264
330
I would like to build a vendor overlay for org.lineageos.platform-res . I tried modifying your overlay to fit the needed values, but i had no luck. Can someone point me in the right direction to build my own overlays?
 

AndroidNazi

Senior Member
Jul 24, 2017
135
33
I enabled this overlay (although it was hard because mounting vendor as r/w on my phone causes Android to freeze) and always on display shows up in settings but it doesn't do anything
 

sebx_g1

Senior Member
Nov 6, 2009
2,913
708
I enabled this overlay (although it was hard because mounting vendor as r/w on my phone causes Android to freeze) and always on display shows up in settings but it doesn't do anything

The same situation on Moto Z Play and AEX rom - ambient display don't work with wave hands-on notification . But Always ON dispaly work :cyclops: and also new events are shown once on screen .

Is this a way to enable NFC via overlay if phone supports it ?
 
Last edited:

AndroidNazi

Senior Member
Jul 24, 2017
135
33
The same situation on Moto Z Play and AEX rom - ambient display don't work with wave hands-on notification . But Always ON dispaly work :cyclops: and also new events are shown once on screen .

Is this a way to enable NFC via overlay if phone supports it ?
NFC and camera don't work on the GSIs because of the way TeamMex implemented treble. I would have stayed on aex if it weren't for the camera not working
 
  • Like
Reactions: sebx_g1

osk4rin

Senior Member
Sep 7, 2015
643
119
San Diego
I running a treble Rom, but Nigh tlight, Auto-Brightness, Ambient Display are not enabled.
What is the proper way to install via Es file Root explorer and Terminal Emulator?
I always get an error when I tried to enable the overlay, it might be the code.
 

sebx_g1

Senior Member
Nov 6, 2009
2,913
708
NFC and camera don't work on the GSIs because of the way TeamMex implemented treble. I would have stayed on aex if it weren't for the camera not working
Maybe he could fix it in future. However his first treble builds had on GSI worked NFC and camera i think [emoji848]

Wysłane z mojego XT1635-02 przy użyciu Tapatalka
 
Last edited:

VincentJoshuaET

Senior Member
Jun 5, 2016
1,293
474
21
Angat
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.
Is that the overlay with AoD? Can you make a version without it? Thanks!

Sent from my Xiaomi Redmi Note 5 using XDA Labs
 

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.