[APP][OPEN SOURCE][ROOT][5.0+] Night Light (KCAL)

corphish

Recognized Developer / Inactive Recognized Contrib
Apr 16, 2014
1,014
2,452
153
Durgapur
Version 3.0 preview

The next major version of Night Light is in works, and the preview of the same is available in beta channels of XDA Labs and Google Play (will go live shortly). Feel free to try it out and let me know how it works. While the UI is not final, it is definitely usable. Here are the features added so far.
  • Option to disable Night Light in lock screen - Inspired from OxygenOS (or maybe other OEMs also who implements this) where the Night Light is temporarily turned off in the lock screen so that finger print unlock can work better, the same is now available as an option in the app. Night Light will be turned off when in lock screen, while it will be turned back on when you unlock.
  • More accurate intensity information in dashboard.
  • Switched to Android framework preferences - Mostly to make it easier for me to maintain the settings section.

As you will notice while using the "Disable Night Light in Lock screen" feature, a foreground service will run in order to detect screen off/unlock events, and then the first thing that will probably come to your mind would be "Y no u add fade in when you are running a service?". Yes, the very reason why I held back from implementing the much requested fade in feature was because of the service that would run continuously, compromising memory efficiency and battery life. But since we are running a service, it now makes sense to implement the fade in feature. And I tried... But it looks like we would need another service for fade in, which would mean 2 notifications and unnecessary clutter, and the continuous running of the fade in polling would mean unexplainable ANRs even though the UI would run smoothly, so I had to ditch the idea.

Luckily, I was able to figure out another way of implementing this feature without using any foreground or background service using some neat automation techniques which were already being implemented by the app. Yep, fade in feature is finally here, with a greatly efficient implementation. Not only that, but this also resulted in a significantly improved and efficient automation implementation. Earlier, there would be a minimum of 2 alarms set if automation was enabled (one for start time and other for end time), it would be 3 if dark hours was used. Now, at any given time, no matter how less fade polling is used, there will only be 1 alarm set. As far as fade in goes, it avoids all the reasons which held me back from implementing it in the first place.
  • No background service? Check!
  • No unnecessary KCAL manipulation while screen is off? Check!
  • No continuous polling which hogs CPU and battery? Check!
  • Respects battery saving features of Android and does not hold a wakelock? Check!

So yeah, it took a while, but its here, in the best way possible (probably). I would also like to thank all the people who offered their interest and support in helping me bringing this feature. Enjoy! Please do tell me how its working for you. Thanks!
 

corphish

Recognized Developer / Inactive Recognized Contrib
Apr 16, 2014
1,014
2,452
153
Durgapur
Night Light 3.0 is here!

  • Automation routines - Brand new way of automating Night Light is here.
    • Setup routines where you can define the Night Light settings that you would want to apply in a specific time period of the day.
    • You can have as many routines as you want. They will be automatically applied in the time period specified.
    • There is only one thumb rule: Time periods of routines cannot overlap, which means you cannot have more than 1 routine for a specific time period.
    • Routines are easy to set up with a step wise interface.
  • Night Light intensity fading in/out.
    • You can have Night Light intensity to fade in/out from intensity to other as part of an automation routine.
    • Set fade poll rate which defines the interval at which faded settings are applied.
  • Removed the maximum and minimum intensities since we now have automation routines.
  • Added an option to automatically disable Night Light in lock screen and automatically turn it back on when the device is unlocked.
  • Redesigned settings section.
  • Updated the interface for creating and listing profiles.
  • Fixed launcher shortcut toggle.
  • Added tutorials in various sections.
  • Other bug fixes.

It is available in Play Store (RIP XDA Labs). Do let me know if you have any ideas to enhance any functionality. Thank you and happy new year!
 

ghnomb

New member
Jul 10, 2019
1
1
3
Thank you so very much for this app, it's one of the first apps I recommend to anyone who roots their phone, and has also been a reason for some to root, most don't live or work in places where the ambient light is near 5000k and it's a major eye fatigue relief to be able to set it lower for anything except outdoors during the day. I know it could be adjusted just through kcal but this app, especially with the new automation system, is so very convenient, and for someone who's light sensitive like me this app would pretty much class as a medical must have. Thank you again for making it and maintaining it, even if you never add a single feature again this app will always be in the absolutely necessary category for me.
 
  • Like
Reactions: corphish

ziedje

Senior Member
Feb 28, 2014
110
24
38
Dhaka
Hello I love your app, been using it on my oneplus 8 pro since the beginning, but I've had some problems since the last update.
I've noticed that since the last update that my battery is draining (way) more quickly. (I'm not 100% sure this is due to the new update however.)
Also, I have a few bugs:
- when I open the app, it applies the filter even when it's the routine hasn't started yet (my routine is from 9pm to 7am, but when I open the app at 11am for example, the filter gets applied automatically)
- "disable in lockscreen" is turned on, but has never worked. When I get a fingerprint prompt (/when I'm on the lockscreen), the filter does not get turned off
 

corphish

Recognized Developer / Inactive Recognized Contrib
Apr 16, 2014
1,014
2,452
153
Durgapur
Hello I love your app, been using it on my oneplus 8 pro since the beginning, but I've had some problems since the last update.
I've noticed that since the last update that my battery is draining (way) more quickly. (I'm not 100% sure this is due to the new update however.)
Also, I have a few bugs:
- when I open the app, it applies the filter even when it's the routine hasn't started yet (my routine is from 9pm to 7am, but when I open the app at 11am for example, the filter gets applied automatically)
- "disable in lockscreen" is turned on, but has never worked. When I get a fingerprint prompt (/when I'm on the lockscreen), the filter does not get turned off
1. That's strange, shouldn't happen. Will have a look.
2. Disable in lockscreen could be buggy, as I only have few devices to test. Will check and test in more devices.