[MOD][Kernel] K-Lapse : A kernel-level livedisplay module [GPLv2] - Android Software/Hacking General [Developers Only]

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
K-Lapse : A kernel level livedisplay module
​
Intro - What is K-Lapse?
Kernel-based Lapse ("K-Lapse") is a linear RGB scaling module that 'shifts' RGB based on time (of the day/selected by the user), or (since v2.0) brightness. This concept is inspired by LineageOS (formerly known as 'CyanogenMod') ROM's feature "Livedisplay" which also changes the display settings (RGB, hue, temperature, etc) based on time. This is very very similar to f.lux for desktop too.
Why did I decide to make this? (A short story)
I (personally) am a big fan of the Livedisplay feature found on LineageOS. I used it every single day, since Android Lollipop. Starting from Android Nougat, a native night mode solution was added to AOSP and it felt like Livedisplay was still way superior, thanks to its various options (you could say it spoiled me, sure). I also maintained a kernel (Venom kernel) for the device I was using at that time. It was all good until the OEM dropped support for the device at Android M, and XDA being XDA, was already working on N ROMs. The issue was, these ROMs weren't LineageOS or based on it, so Livedisplay was... gone. I decided I'll try to bring that feature to every other ROM. How would I do that? Of course! The kernel! It worked on every single ROM, it was the key! I started to work on it ASAP and here it is, up on GitHub, licensed under GPL (check klapse.c), open to everyone
How does it work?
Think of it like a fancy night mode, but not really. Klapse is dependent on an RGB interface (like Gamma on MTK and KCAL on SD chipsets). In mode 1, it fetches time from the kernel, converts it to local time, and selects and RGB set based on the time. The result is really smooth shifting of RGB over time. Mode 2 uses the current brightness level to scale RGB, with the concept behind it being that lower brightness usually implies a dark environment, so a slight color temperature shift should help with eye strain.
There's also an option for a "brightness factor" that can reduce your brightness down to 80% below the minimum brightness that your phone allows. The catch is, it doesn't actually reduce the brightness, but rather uses a clever trick to fade away the RGB of the screen by the same amount so it "appears" to be lower brightness.
How does it really work (dev)?
Klapse mode 1 (time-based scaling) uses a method void klapse_pulse(unsigned long data) that should ideally be called every minute. This is done using a kernel timer, that is asynchronous so it should be handled with care, which I did. The pulse function fetches the current time and makes calculations based on the current hour and the values of the tunables listed down below.
Klapse mode 2 (brightness-based scaling) uses a method void set_rgb_slider(<type> bl_lvl) where type is the data type of the brightness level used in your kernel source. (OnePlus 6 uses u32 data type for bl_lvl) set_rgb_slider needs to be called/injected inside a function that sets brightness for your device. (OnePlus 6 uses dsi_panel.c for that, check out the diff for that file in op6 branch)
What all stuff can it do?
Emulate night mode with the proper RGB settings
Smoothly scale from one set of RGB to another set of RGB in integral intervals over time.
Reduce perceived brightness using brightness_factor by reducing the amount of color on screen. Allows lower apparent brightness than system permits.
Scale RGB based on brightness of display (low brightness usually implies a dark environment, where yellowness is probably useful).
Automate the perceived brightness independent of whether klapse is enabled, using its own set of start and stop hours.
Theoretically more efficient, faster by residing inside the kernel instead of having to use the HWC HAL like android's night mode. This is unproven and probably has no practical significance.
(On older devices) Reduce stuttering or frame lags caused by native night mode.
An easier solution against overlay-based apps that run as service in userspace/Android and sometimes block apps asking for permissions.
Give you a Livedisplay alternative if it doesn't work in your ROM.
Impress your crush so you can get a date (Hey, don't forget to credit me if it works).
Alright, so this is a replacement for night mode?
NO! Kinda, but no. Lemme explain. One can say this is an alternative for LineageOS' Livedisplay, but inside a kernel. Night mode is a sub-function of both Livedisplay and KLapse. Most comparisons here were made with night mode because that's what an average user uses, and will relate to the most. There is absolutely no reason for your Android kernel to not have KLapse. Go ahead and add it or ask your kernel maintainer to. It's super-easy!
What can it NOT do (yet)?
Calculate scaling to the level of minutes, like "Start from 5:37pm till 7:19am". --TODO
Make coffee for you.
Fly you to the moon.
Get you a monthly subscription of free food, cereal and milk included.
I want more! Tell me what can I customize!
All these following tunables are found in their respective files in /sys/klapse/
Code:
1. enable_klapse : A switch to enable or disable klapse. Values : 0 = off, 1 = on (since v2.0, 2 = brightness-dependent mode)
2. klapse_start_hour : The hour at which klapse should start scaling the RGB values from daytime to target (see next points). Values : 0-23
3. klapse_stop_hour : The hour by which klapse should scale back the RGB values from target to daytime (see next points). Values : 0-23
4. daytime_r,g,b : The RGB set that must be used for all the time outside of start and stop hour range.
5. target_r,g,b : The RGB set that must be scaled towards for all the time inside of start and stop hour range.
6. klapse_scaling_rate : Controls how soon the RGB reaches from daytime to target inside of start and stop hour range. Once target is reached, it remains constant till fadeback_minutes (#13) before stop hour, where target RGB scales back to daytime RGB. (Pre-v4.2 value was a factor, now it is a minute value)
7. brightness_factor : From the name itself, this value has the ability to bend perception and make your display appear as if it is at a lesser brightness level than it actually is at. It works by reducing the RGB values by the same factor. Values : 2-10, (10 means accurate brightness, 5 means 50% of current brightness, you get it)
8. brightness_factor_auto : A switch that allows you to automatically set the brightness factor in a set time range. Value : 0 = off, 1 = on
9. brightness_factor_auto_start_hour : The hour at which brightness_factor should be applied. Works only if #8 is 1. Values : 0-23
10. brightness_factor_auto_stop_hour : The hour at which brightness_factor should be reverted to 10. Works only if #8 is 1. Values : 0-23
11. backlight_range : The brightness range within which klapse should scale from daytime to target_rgb. Works only if #1 is 2. Values : MIN_BRIGHTNESS-MAX_BRIGHTNESS
12. pulse_freq : The amount of milliseconds after which klapse_pulse is called. A more developer-targeted tunable. Only works when one or both of #1 and #8 are 1. Values : 1000-600000 (Represents 1sec to 10 minutes)
13. fadeback_minutes : The number of minutes before klapse_stop_hour when RGB should start going back to daytime_rgb. Only works when #1 is 1. Values : 0-minutes between #2 and #3
Impact on performance or battery...
Fortunately, as per practical testing there is absolutely no negative effect on performance or battery backup!
"I'm a kernel maintainer. How do I add it to my source?"
Note : I'm currently maintaining klapse for OnePlus6 (enchilada), using the snapshot branch.
The klapse.c file is pretty much generic, but depending on your device you may need to change some of the #define values
The klapse.h file should be edited in order to make the K_RED etc. defines point to the correct RGB interface variable. OnePlus 6 simply uses kcal_red, kcal_green and kcal_blue in sde. Some devices have a struct or pointers instead of a variable. Those devices must edit their kcal files to keep a copy of the address that klapse will access. An example of a source with struct-based kcal with klapse support is this: commit (thanks to @rupanshji for this commit)
The KCONFIG is pretty understandable too, but you may wanna remove the "DEPENDS" line for your device.
The Makefile is just one line, and so is enabling klapse in the defconfig.
Now you must change the file that provides the kcal/gamma (mtk) interface. Thanks to other developers, all I had to do on the OnePlus 6 was to remove the keyword "static" from the variable declaration.
Great work! Can I pay for your next meal?
I'm just a university CS student so sure, any amount is much appreciated! You can donate via PayPal here :
Donate
XDA:DevDB Information
K-Lapse, Kernel for all devices (see above for details)
Contributors
tanish2k09
Source Code: https://github.com/tanish2k09/KLapse-Livedisplay
Kernel Special Features: RGB shifting based on a context
Version Information
Status: Stable
Current Stable Version: 4.3
Stable Release Date: 2019-03-02
Created 2019-03-04
Last Updated 2019-03-19

TODO :
Add custom-minute support
Add full-smooth scaling algorithm that actually scales from node to node to make the shift smoother
Add a third "intelligent" mode that uses both time-based and brightness-based values to magically come up with an RGB set that's perfect for that environment
A grayscale feature, that maybe also would support a yellow tint over it, so it's like a grayscale night mode.
Telegram support?
Yeah yeah, I know. Telegram links are common now. In compliance with the xda rule of "Only one TG link per thread" that I saw on some other sub-forums, maybe a link would be fine but mods can remove it per will.
Here's the official klapse telegram group, with commit notifications too:
t.me/klapse or from within telegram you can just join klapse but with an @ in front of it (I didn't use it to prevent an unintended mention to some person)
Notes :
I'm open to any other contructive feedback or suggestions
Klapse doesn't conflict with night mode of Android. They both can work TOGETHER, the result would be an overlap of both their colors.
Credits :
I pretty much wrote all the code for k-lapse myself, but it would be useless without these awesome people who put it to use -
@pappschlumpf for getting k-lapse working for the first time on any snapdragon device, with Smurf kernel for OnePlus 6
@Eliminater74 for tips along the way, very helpful
@HolyAngel for a collab to add support to HolyDragon, and indirectly SkyDragon, and suggesting some tunable structuring
@rupanshji for the commit used for an example of a structured kcal implementation
@flar2 for debugging and adding k-lapse support to his app EX kernel manager, purchase the app here - EXKM
 @franciscofranco for adding k-lapse support to his app Franco Kernel Manager, purchase the app here - FKM

Screenshots
Screenshots from EXKM v4.04, Mixplorer and FKM v4.0 have been attached.
Note that these screenshots were taken while v4.3 was the active version. May change in future.

It's pretty common now
@apophis9283 Seeing you're one of the mods here, would you please be kind enough to delete the other 3 clones of this thread that got created due to XDA request failure?
Also, in case this thread is in the wrong sub-forum, please feel free to move it to the correct one but notify me via PM or email. Many thanks

Been using this on Smurf kernel for awhile now. Absolutely love it. Great job.

Glad your work is posted on XDA now works good in sky dragon.

Great alternative to night mode that does way more than that if you're interested in other features.
It's lightweight and won't bloat your system at all.
Any proper kernel should include this as there are only benefits and no drawbacks. 8)
As a last addition/compliment/support: it's been very well maintained and as you can tell just from reading OP, the dev is friendly and will help you if you have issues with it.

On Smurf kernel on op6. I have the gray scale option on digital wellbeing in the night and after switching on this mod (light mode) it automatically turns off the gray scale. Is it a bug?

akiwiz said:
On Smurf kernel on op6. I have the gray scale option on digital wellbeing in the night and after switching on this mod (light mode) it automatically turns off the grayscale. Is it a bug?
Click to expand...
Click to collapse
It is not a bug, it's actually expected behaviour.
First of all, we both know that the screen can't be both grayscale AND have a yellow tint at the same time, because yellow isn't gray.
Only one of them can stay active. The fact that klapse works from the kernelspace makes klapse more powerful. As soon as klapse refreshes, which happens every 30 seconds by default, the grayscale RGB will be overridden.
It also depends on how digital wellbeing's grayscale option works. I'm assuming it uses the same HWC HAL that android uses, but I have not the slightest clue. In case I'm right, both klapse and grayscale will work together to give you a black-n-white + slight yellow tinted screen.
As an alternative, how about I add grayscale as a feature to klapse itself? I can't add it to klapse right away but I can mark it in my TODO post above. Sounds good? Maybe I can come up with a solution that overlaps the grayscale with the yellow tint to create a grayscale night mode?
I don't know about you but it seems like an amazing idea to me

tanish2k09 said:
It is not a bug, it's actually expected behaviour.
First of all, we both know that the screen can't be both grayscale AND have a yellow tint at the same time, because yellow isn't gray.
Only one of them can stay active. The fact that klapse works from the kernelspace makes klapse more powerful. As soon as klapse refreshes, which happens every 30 seconds by default, the grayscale RGB will be overridden.
It also depends on how digital wellbeing's grayscale option works. I'm assuming it uses the same HWC HAL that android uses, but I have not the slightest clue. In case I'm right, both klapse and grayscale will work together to give you a black-n-white + slight yellow tinted screen.
As an alternative, how about I add grayscale as a feature to klapse itself? I can't add it to klapse right away but I can mark it in my TODO post above. Sounds good? Maybe I can come up with a solution that overlaps the grayscale with the yellow tint to create a grayscale night mode?
I don't know about you but it seems like an amazing idea to me
Click to expand...
Click to collapse
Thank you for the explanation ? is there a way I can switch off klapse at night when grey scale from digital wellbeing kicks in? Also your alternative would be ideal if it's possible in future! Thanks again

akiwiz said:
Thank you for the explanation ? is there a way I can switch off klapse at night when grey scale from digital wellbeing kicks in? Also your alternative would be ideal if it's possible in future! Thanks again
Click to expand...
Click to collapse
A tester just told me that klapse's yellow tint worked on gray-scale too.
But to answer your question, the only possible solution is to either disable Klapse or keep the schedule of start and stop outside the range of grayscale's schedule.
Btw I totally recommend you to use Klapse at night because yellow tint in the dark is better than grayscale to look at

tanish2k09 said:
A tester just told me that klapse's yellow tint worked on gray-scale too.
But to answer your question, the only possible solution is to either disable Klapse or keep the schedule of start and stop outside the range of grayscale's schedule.
Btw I totally recommend you to use Klapse at night because yellow tint in the dark is better than grayscale to look at
Click to expand...
Click to collapse
So I need EXM to set a schedule start?

akiwiz said:
So I need EXM to set a schedule start?
Click to expand...
Click to collapse
EXKM is one way. You can create your own tunables in Franco kernel manager too like. Here's a couple screenshots of an example.
You can use those same paths in kernel adiutor too. I haven't talked to the dev for klapse support yet, maybe I should but next weekend probably.
You can also use a file manager to change those files. Remember that pretty much everything in /sys is rebuilt during each boot so all values reset. That's why an apply-on-boot method is used for fixing values.
Info for which file does what is in OP.

This doesn't seem to work for me. OnePlus 6 with xXx NoLimits and Smurf Kernel. Latest stable versions for all. I have changed settings with EXKM and rebooted multiple times. /sys/klapse files accurately reflect the settings in EXKM. Setting K-Lapse alternately to time and light have failed to demonstrate any color changes as would be expected from the settings. I turned off the phone's night mode so that I can see more purely what K-Lapse does.
Thoughts?

maigre said:
This doesn't seem to work for me. OnePlus 6 with xXx NoLimits and Smurf Kernel. Latest stable versions for all. I have changed settings with EXKM and rebooted multiple times. /sys/klapse files accurately reflect the settings in EXKM. Setting K-Lapse alternately to time and light have failed to demonstrate any color changes as would be expected from the settings. I turned off the phone's night mode so that I can see more purely what K-Lapse does.
Thoughts?
Click to expand...
Click to collapse
I'm guessing you're using the wrong display calibration mode.
On the OnePlus 6 stock ROM it only works with custom and adaptive display modes in settings.

tanish2k09 said:
I'm guessing you're using the wrong display calibration mode.
On the OnePlus 6 stock ROM it only works with custom and adaptive display modes in settings.
Click to expand...
Click to collapse
That was it exactly. Thanks!

I can't find any settings for K-lapse in the latest EX Kernel Manager. I went through every section of the app. No K-lapse settings.

majikfox said:
I can't find any settings for K-lapse in the latest EX Kernel Manager. I went through every section of the app. No K-lapse settings.
Click to expand...
Click to collapse
Tools > Color Control > K-Lapse Settings

maigre said:
Tools > Color Control > K-Lapse Settings
Click to expand...
Click to collapse
Nope. Not there.

majikfox said:
I can't find any settings for K-lapse in the latest EX Kernel Manager. I went through every section of the app. No K-lapse settings.
Click to expand...
Click to collapse
I don't own EX kernel manager yet but I was given a v4.04 build to test, and it was under Graphics > Klapse-settings
They'll obviously only show up if the kernel supports it.
Also, some users reported that the update isn't live for them yet, so you may have to wait. That's not in my control either and flar2 handles EXKM.

Related

[APP][2.3+] Lux Auto Brightness

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Lux - The Original Android Auto-Brightness App
So I thought I should make an XDA thread for Lux, over a year after releasing it to the Play Store!
FULL or FREE​
Issues/Suggestions
If you have any issues or suggestions, please add them to the public issue tracker found here. Be sure to search first, duplicated issues will not work in your favour.
News
Update to 1.51 released to Play Store!
- Profiles. Have different behaviour for day and night!
- Root plug-ins. Custom kernel with RGB control? Make a plug-in to utilise it!
- Improved notification
- Low pass filter
- Cubic interpolation
- Polish/French/Russian/German/Italian translation
- Manual sunrise location input
- Control Dashboard slider with vol. keys
- Fade duration/step
- Reduced battery usage
- Fixes
Update to 1.06 released to Play Store!
- Automatic night mode (uses location for sunset/sunrise).
- Notification priority
- Enhanced dashboard and notification UI
- Enable/disable and refresh Lux via Tasker
- Bug fixes
Update to 0.76 released to Play Store!
- Fixed brightness issues after call
Update to 0.74 released to Play Store!
- Fixed max/phone brightness preferences swapped
- Added ignore 0 lux option
- Made static phone brightness optional
Update to 0.70 released to Play Store!
- New 'ascending' automatic mode for zero jitter!
- Expandable notification for added control (Android 4.1+)
- Improved efficiency
- Install to OS functionality
- Set min/max brightness bounds
- Adjustable night mode
- Improved persistence (Android won't kill it!)
- Fixed Nexus 7 255 luma bug
- Fixed Tasker 'on wake' revert bug
- Compat. mode is now known as 'sleep mode'
- Night Mode now default Dashboard action (hold for Astro. mode)
- Misc. tweaks and fixes.
App Description
Lux isn't your ordinary brightness app. It intelligently adjusts the brightness of your display based on the environment you're in. If, for example, you step into a dimly lit room, Lux will automatically lower the brightness of your display to make it not only comfortable to read, but to also preserve battery power.
Lux provides the option to automatically adjust the backlight at fixed intervals (periodic mode), when a change in environment is detected (dynamic mode), or when the phone wakes from sleep. It's also possible to adjust the backlight manually. Simply disable automatic mode and you can use it like a traditional brightness tool!
Perhaps the best thing about Lux is that you can teach it how to behave. If the backlight is too bright or dim for your liking, simply open the provided Dashboard, adjust the brightness slider to the level you desire, then hold the link button. Lux will use this new 'link' as a reference in future.
Give it a go! I want you to test Lux for more than the 15 minute refund period offered by Google. I understand that some devices may not have the best quality light sensor, and that you may need more time to play around with settings. If you find that Lux doesn't suit you after the 15 minutes is up, you can request a refund at any time via e-mail - no questions asked.
★FEATURES★
■ Custom auto brightness.
■ Sub-zero brightness to make reading in the dark significantly less irritating.
■ Battery efficient
■ Handy brightness widget
■ Option to use the camera to read in ambient light.
■ Power-user settings such as choice of interpolation, sensor debugging, and linked sample editing.
■ Backup to SD.
■ 'Ascending' auto mode for phones with inaccurate light sensors.
■ Gradual fade for backlight adjustments.
■ Astronomer mode adds a red filter to the screen to preserve the eyesight of stargazers.
■ Jitter control to prevent constant small changes to the backlight.
■ Automatic night mode, to change the colour temperature of the display for comfortable night time viewing.
■ Add app specific exceptions via sleep mode
■ No ads, or other nuisances.
■ Tasker and Locale support!
Note: Please disable other brightness apps before using Lux. The author is not liable for any issues caused when using this app.
★PERMISSIONS★
TAKE PICTURES AND VIDEOS: Used to read in luma values, if camera input is selected.
DRAW OVER OTHER APPS: Required for night/astro mode.
READ PHONE STATE: Required to prevent Lux from interfering with phone controls in Android 4.1.
MODIFY SYSTEM SETTINGS: Brightness is a system setting, as is toggling the default auto brightness.
RETRIEVE RUNNING APPS: Required to make the 'sleep list' functionality work, so Lux can disable itself when certain apps are in the foreground.
COARSE LOCATION: Required to automatically calculate sunrise/sunset times.
IN APP BILLING: Required for purchasing future device specific root only plug-ins, to enhance functionality.​
Lux Low-Level Plug-ins
Soon Lux will support plug-ins to bypass Android API limitations. These plug-ins serve to replace the overlay system Lux uses to make adjustments for Night/Astronomer modes and brightness in general. The plug-in library is free to use for non-commercial development, and can be found here:
Lux Plug-in Library | Nexus 4 Sample Plug-in Code​
How to make a plug-in
There are two approaches to making a plug-in for Lux. The passive and the active method. The former is as easy as providing a set of superuser commands for Lux to interpret and apply. These command correlate to functions such as setting pixel RGB or brightness levels. This is the type of plug-in the Nexus 4 sample linked above takes.
The active method requires you produce your own code to perform RGB/brightness adjustments. This might include importing a device specific library to do the heavy lifting, and then returning empty superuser commands back to Lux.
Getting Started
Simply import the Lux Plug-in Library source into your IDE as an Android Library Project, and then create a new Android app which extends PassiveDisplay.java.
PassiveDisplay provides hooks into Lux's plug-in framework, which you can use to provide superuser commands for Lux to execute. These commands correlate to functions such as setting RGB values. Take a look at the sample Nexus 4 project to see how it's all done.
Finally, in your new project's AndroidManifest.xml file, add the following:
Code:
<activity
android:name="com.vitocassisi.lux.plugin.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.vitocassisi.lux.plugin.LuxBroadcastReceiver"
android:exported="true" >
<intent-filter>
<action android:name="com.vitocassisi.lux.plugin.search" />
</intent-filter>
</receiver>
<service
android:name=".[B]MY_PLUGIN[/B]"
android:exported="true" >
<intent-filter>
<action android:name="[B]YOUR_PACKAGE_NAME_HERE[/B]" />
</intent-filter>
</service>
Be sure to replace YOUR_PACKAGE_NAME_HERE with the name of your plug-in's package, and MY_PLUGIN with your extended PassiveDisplay class.
And that's it! Now you're ready to test!
Enabling Plug-In support within Lux
To enable plug-in support, you must check 'Enable plug-in support' in the Advanced section of Lux settings. Enabling this option forfeits all responsibility of mine for any issues caused while using Lux. Plug-in's can cause very real damage to your device if they're written incorrectly - don't use plug-ins from sources you don't trust!
Testing your plug-in
Testing is critical for creating a good plug-in. You are dealing directly with system files, and can easily cause damage if you do not know what you're doing.
DO NOT RELEASE A PLUG-IN WITHOUT TESTING IT ON THE TARGET DEVICE FIRST!
Ensure that the following work with your plug-in installed:
Astronomer Mode
Night Mode
General brightness adjustment
Lux readings functional
BE METICULOUS WITH YOUR IMPLEMENTATION OF isSupportedDevice()!
Modifying system files on the wrong model/kernel may cause irreversible issues!
Licence
Code:
Copyright © 2013 Vito Cassisi
You may not use this library except in compliance with the following:
- It cannot be used for commercial purposes under any circumstances, unless explicit permission is granted in writing from the author.
- Modifications to this library may not be distributed.
Unless required by applicable law or agreed to in writing, software
distributed under this licence is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Great App!
I bought the App about 2 months ago and all I can say is that it works really good with my Nexus 7.
I can just recommend buying this - clearly the best solution for Auto brightness on the play store
Regards,
Rashiq
Best brightness adjustment app available. It fixed the screen flickering issue on my Nexus 7.
Im already using it for more than a month, and it works like it said.
Sent from my SCH-I500 using Tapatalk 2
If anyone wants to beta test the next update, send me a PM.
Subscribed. Because this app rocks.
And because the upcoming v0.70 (beta) rocks even harder. (Thanks for letting me test that, btw.)
Just added people who PM'ed me to the beta test.
i want to test beta too.
how it is different than stock auto brightness function?>
You can teach Lux to react a specific way under different light conditions, whereas with stock you get whatever the ROM's defaults are.
Edit: Oh, and PM be with your Dropbox account email if you want to beta test.
App missing in Play store. Please check.
xavierroy said:
App missing in Play store. Please check.
Click to expand...
Click to collapse
I briefly took the free version off the market. It should be back whenever Google updates their servers.
Just tested it.
Works great
thanks
Added new beta build to Dropbox.
Thanks for adding me to beta testing!
I just tried to use the tasker plugin, however it's not working, just gives 'no plugin config data' error. I tried to set the night mode to on.
Looking forward to further testing!
Regards
So far everything is working great for me. No random brightness changes or jittery transitions. Trying the latest beta now.
Sent from my SCH-I535 using Tapatalk 2
flash5000 said:
Thanks for adding me to beta testing!
I just tried to use the tasker plugin, however it's not working, just gives 'no plugin config data' error. I tried to set the night mode to on.
Looking forward to further testing!
Regards
Click to expand...
Click to collapse
I can't reproduce this issue. What steps did you take to create the plug-in?
Has been using the free version and it's been very reliable! One trouble is that when I m installing from APK I need to disable lux first otherwise O can't hit the OK button...
Sent from my GT-I9300 using xda app-developers app
lou2s said:
Has been using the free version and it's been very reliable! One trouble is that when I m installing from APK I need to disable lux first otherwise O can't hit the OK button...
Sent from my GT-I9300 using xda app-developers app
Click to expand...
Click to collapse
I believe the paid version addresses this issue by temporarily disabling Lux when a package installer is opened.
Sent from my SAMSUNG-SGH-I747 using Tapatalk 2
zerkai said:
I believe the paid version addresses this issue by temporarily disabling Lux when a package installer is opened.
Sent from my SAMSUNG-SGH-I747 using Tapatalk 2
Click to expand...
Click to collapse
Free version does it too, but I haven't had time to tweak the free version to be more responsive. Will be better with v0.70.

[APP][5.0+][2020.12.22] CF.lumen v3.74

About
CF.lumen adapts the colors on your Android device based on the position of the sun, or your custom configuration.
When using the default settings, your display will get a warmer tint (lower color temperature) when the sun is down, vastly reducing strain on the eyes. This will take some getting used to, though! The colors also match closer to common artificial light sources, than the daytime light you get from the sun. Blue light makes your brain want to stay awake, and a lower color temperatures reduces the amount of blue displayed; using this in the evening also reduces your brain's effort to keep you awake at night, and can be beneficial to your sleeping pattern.
During sleeping hours by default a red filter is used. Red strains your eyes the least, and retains your night vision.
Light sensor
The light sensor can be used to automagically adjust the color: switch to the sleep filter in full dark, or to the day filter (usually none) under bright lights.
Because light sensor quality varies wildly between devices, a calibration option is provided. Most devices seem to work fine with sliders set all the way to the left, others need them to be set all the way to the right. Experiment as needed, but be warned that some devices simply cannot distinguish between evening indoor lighting and full darkness, and this feature may thus not work well for you.
Color filters
Several filters are provided. Those named after a color (red, green, blue, amber, salmon) do not limit the display to those colors, but convert the displayed image to grayscale first, then display that image in levels of the selected color, instead of levels of all channels (white). This preserves details that would otherwise be lost.
Grayscale, invert colors, temperature adjustment and custom R/G/B adjustment filters are also provided.
Colorblindness
The master color filter setting also has an option for colorblindness enhancement, with settings for protanopia/anomaly, deuteranopia/anomaly and tritanopia/anomaly. These options redistribute colors across the spectrum, in theory enhancing clarity and color detail.
No claims are made to the effectiveness of these filters, but positive reports have been received from testers. Also note that these filters were thought up by Google engineers - CF.lumen just includes them.
Pro version
Upgrading to CF.lumen Pro will support my developments, remove all nags, unlock the option to start at device boot (make sure you test your configuration first), and unlocks notification options. It also enabled Tasker integration.
In Pro mode, the notification adds convenient buttons to quickly disable the current filter or switch to sleep mode, and you can switch the notification to when enabled mode, which shows the notification only when a color filter is active.
In non-Pro mode, the notification only asks you to upgrade to Pro. It may seem that notification is just there to annoy you, but it actually prevents Android from randomly killing the background service taking care of all the work. Getting rid of it without getting the service killed can be done by going to Settings -> Apps -> CF.lumen and unticking Show notifications.
As in the past CF.lumen was part of Chainfire3D, if you have the Pro package of the latter installed, Pro mode will also be enabled.
Drivers
CF.lumen currently supports three driver backends to adjust the display: the original CF.lumen driver, the KCAL kernel driver, and the rootless (non-root) overlay. See the driver section below for further details.
Performance
When no color filter is active, there should not be any noticeable performance impact. When a filter is active, impact depends on device and what you are doing. On some devices we have tested there was no performance impact at all, on others it was slightly noticeable.
Performance characteristics change based on the driver you are using. See the driver section below for further details.
History
Nightmode - now called 'sleep mode' in CF.lumen - was actually the kick-off of Chainfire3D's development, and the later arrival of the original CF.lumen additionally containing the functionality to change color temperature based on the sun's position. Completely different (and no longer possible) techniques were used to get similar results. There were fewer options, and the filters limited display to the selected channels instead of the currently used much higher quality method of displaying luminance levels on the selected channel.
Future
Keep in mind that Android's rendering system changes over time. This app was possible in the old days of Android, and then wasn't possible for a long time. Only with KitKat did it become possible to make this work again. As such, you should be aware that this app may simply stop working on future Android versions without the possibility of a fix.
Scary permissions
By far most permissions are used only for Google Maps to set your location, and Google Play to provide for In-App Purchases. I cannot make any claims as to what information the Google components do or do not send to Google servers, but no information is sent to me or anyone else (than Google).
Download
Get CF.lumen at Google Play
It needs Android 5.0 Lollipop or newer!
Screenshots
Walkthrough video
GIF
Drivers
CF.lumen currently supports several driver backends to adjust the display: the original CF.lumen driver, the KCAL kernel driver, the PCC/RGB kernel driver, and the rootless (non-root) overlay. Driver selection will only be presented to you if multiple drivers are actually supported on your device.
Drivers: performance background
Software compositing is when your device takes the different surfaces on screen (the app's display, the status bar, the navigation bar, a popup window, these are all surfaces), draws them into a single buffer, then lets the hardware display this buffer. Virtually all modern devices can also do hardware compositing, where these different surfaces are presented to display hardware themselves, skipping one drawing step. It should be noted however, that hardware compositing only supports three surfaces (usually), so only the most basic scenes can be rendered this way. If more than the number of supported surfaces are displayed, the system falls back to software compositing automatically. Performance is slightly lower when this happens, but it happens all the time, and I doubt you've ever noticed it without looking for it.
One specific note about this is that "secure" content (DRM protected video rendering, for example) can only be hardware composited, as the software is not allowed to gain access to the surface. So if you are experiencing video disappearing, it's because the system has switched to software compositing. This can be due to CF.lumen's driver, a color overlay, or even just a system popup pushing the number of surfaces beyond the number of supported surfaces by the hardware compositor.
Drivers: CF.lumen
The CF.lumen driver requires software compositing, as it changes the colors displayed during the software compositing step. Of course, it lets the system go back to hardware compositing if it's not actively changing colors. This can slightly impact performance.
This driver changes colors on the surface content level, and can perform all sorts of calculus before deciding what to display. This usually gives it the highest possible image quality output. For example, in the color channel modes (red - night mode, green, blue, amber, salmon), the image is first converted to a luminance-based grayscale image, and then output in the selected color channels. This dramatically improves clarity and detail over only displaying the selected channels. Taking red mode as an example, this means that green and blue image content still shows up in a shade of red, whereas normally all colors devoid of a red component would show up as full black. Because of the surface-based manipulation, the invert filter may sometimes show unexpected results.
This driver affects both full-screen screenshots as well as app screenshots. Aside from normal screenshot/cast purposes, these are also used by the system for animations and in the recent task lists, and thus it may sometimes appear like a filter is applied twice during rotation or while browsing the tasks list.
Since v3.65 this driver comes in three different modes:
Drivers: CF.lumen: Compatibility mode
This driver mode should work on virtually all devices out there, however, on many firmwares it comes with an extra large performance penalty. Rendering quality is generally excellent, but various internal actions of Android itself (such as screen on, pattern unlock, app install, etc), as well as any app that triggers Android's accessibility options, may temporarily interfere with the rendering. This can cause a flash of the original colors being shown, instead of our manipulated colors.
Drivers: CF.lumen: Performance mode
This driver mode overrides Android's rendering system in a different way. While it doesn't work on all devices and firmwares, if it does work, it is often significantly faster than the compatibility mode. It also doesn't suffer from short flashes of the original colors being shown. This mode causes visible artifacts on some devices, though it isn't common.
Drivers: CF.lumen: Anti-flicker mode
This driver mode is a hybrid of compatibility and performance modes. It uses the same subsystem as performance mode, and thus it doesn't work on all devices and firmwares. This mode keeps the rendering from compatibility mode, but attempts to prevent the short flashes of the original colors being shown.
Drivers: KCAL
The KCAL driver is quickly becoming a popular kernel mod for Qualcomm devices. It allows color adjustments in the display hardware itself. There is no performance difference with this driver, but of course your kernel must support it. This is the fastest driver.
This driver changes colors on the display level, and is limited in the operations it can perform. It is fast, but the image quality can be less. In color temperature modes (probably your most used mode) there is no difference with the CF.lumen driver. In the color channel modes however, there is no luminance conversion. If you select for example the red mode, you will only see the red component of colors. Pure blue, pure green, or any color which is a mix of blue and green but not red, will appear black.
A gamma correction option is available for this driver. Some devices automatically gamma correct the values CF.lumen gives the kernel, the app needs to know about this, so it can take this into account in its calculations.
This driver affects neither full-screen screenshots nor app screenshots. It does not support the colorblind filter.
Drivers: PCC/RGB
This driver is very closely related to the KCAL driver, as they use the same hardware, so please read that section. Some kernels provide support for one but not the other. If both are supported, KCAL generally gives you a few more options than PCC/RGB, but there is no performance difference between the two.
This driver does not support the grayscale, invert or colorblind filters.
Drivers: rootless
The rootless fallback driver (for non-root users) uses a color overlay. This is an additional surface, causes at least one additional expensive full-screen rendering step, and is likely to throw your system into software compositing mode most of the time. This is the slowest (and ugliest) driver.
Image quality wise, it is no competition for the other drivers, but not everyone has root. Like the other screen color tint apps on the market (there are quite a few, and while CF.lumen is older than all of those, it is certainly not the best known or most popular one), a color overlay is used. Where the other drivers properly manipulate the displayed colors, this driver is more like putting a half-transparent colored sheet over a picture. While it somewhat does the job, it lowers contrast significantly.
On Android 6.0, various Android functions refuse to work when an overlay is present. This includes apps asking for permission, installing apps, etc. The app attempts to detect these situations and automatically turn off the filter. If you spot a situation where the filter is not automatically temporarily disabled, please let me know.
This driver affects only full-screen screenshots (but not full-screen animations), not app screenshots. It does not support the grayscale, invert, or colorblind filters.
Non-GApps firmwares
This app uses Maps for manual location setting, and Play for purchasing Pro. An increasing number of users do not have GApps, for privacy, security, and other concerns. If the app is installed on such a firmware, your location will be determined using the normal location API (without manual override, so your phone has to be able to determine your location). As I do not want to deprive anyone from the potential health benefits of sleeping better, the app operates in Pro mode if you do not have the Play store installed (PayPal'ing me beer money is always an option).
The APK is attached to this post for those not using Google Play (only).
Under no circumstances are you allowed to (re-)distribute this APK
(v2.00: 32, v2.05: 180, v2.10: 164, v2.16: 288, v2.25: 118, v2.40: 555, v2.50: 546, v2.60: 39, v2.61: 132, v2.66: 27, v2.71: 563, v2.74: 388, v2.75: 1042, v3.00: 4320; v3.65: 1376)
Changelogs
2020.12.22 - v3.74
- (c) 2020
- Remove references to G+
- Android 11 support
- Android 10+: Show warning about notification options not working
- Android 10+: Disable rootless mode
- Android 10+: Disable advanced/injection/anti-flicker/performance driver (needs further investigation to make work)
- Add foreground service permission
- Built for API 29
- Fix notification spam issue
- Fix maps crashing
2018.12.20 - v3.72-TEST
- Pie: Fix soft-bar transparency
- Pie: Fix boot-up launch
- Pie: Fix maps not working
- Pie: Fix greylist violations
- Oreo/Pie: Fix notifications
- Fix Magisk detection / root warning
- Fix system settings modification permission handling
- Fix location permission handling
- Fix performance driver injection on some 7.0 devices
- Fix several deadlocks
- Add option to detect which driver mode is the fastest
- Support for new KCAL paths
- Replaced root sockets with Binder-based IPC
- Removed colorblind options (available in Developer Options on all recent devices)
- Greyscale/Saturation filter: allow up to 2.0x factor (oversaturate)
2018.11.28 - v3.71-TEST
- (c) 2018
- Basic Pie fixes (far from complete!)
- Updated libsuperuser and librootjava
- CF.lumen performance driver: fixed injector for newer Android versions
2017.02.09 - v3.70
- (c) 2017
- Upgrade grayscale filter from a toggle to a saturation slider
- CF.lumen driver: fix 'performance mode' on Nougat (bypass new linker protections)
- CF.lumen driver: fix darken filter math issue (still doesn't work on invert, though)
2016.03.30 - v3.66
- CF.lumen driver: smoother filter switching
- CF.lumen driver in Performance mode: fix disable hardware overlays option sticking when CF.lumen is disabled
- Tasker: fix black screen on filter selection
- Tasker: fix brightness change on filter selection
2016.03.01 - v3.65
- Reworked raw remote control receiver
- Fix logcat spammed with notification errors regarding a missing icon
- Fix issue with "Bright light" setting
- Fix flicker on location update
- Reduce frequency of notification updates
- Add color checker to rgb/custom and temperature filter selection dialogs
- Underlined numbers next to sliders can now be tapped to input a text value
- CF.lumen driver: fix not closing properly when switching to KCAL
- CF.lumen driver: better monitor accessibility settings
- CF.lumen driver: added anti-flicker and performance modes
- KCAL driver: add gamma correction feature
- KCAL/CF.lumen drivers: Tune color temperature algorithm
- PCC RGB driver added
- Add "Darken filter" setting to "Brightness" option (sub-zero)
- Made "Brightness" setting on filter selection an icon
- Moved "Auto-update location" option to the Map activity
2016.02.18 - v3.62
- Fix driver not initializing on various devices
2016.02.17 - v3.61
- Slight performance improvement in root driver
- Change timeout handling code in root service
- Fix background ANR
2016.02.16 - v3.60 - RELEASE NOTES
- Play release of v3.53
2016.02.16 - v3.53 BETA
- Add notice to reboot first after installation if old driver found
- Fix some options in the settings screen not being disabled when they should be
- Adjust light sensor calibration texts and min/max values
- Add option to auto update location (enabled by default, passive listener, no power use)
- Add welcome message
2016.02.13 - v3.52 BETA
- Fix issue with system-based SuperSU
- Fix old driver not always being reset when switching drivers
- Fix KCAL driver not always resetting when setting to disabled (screen power cycle also works)
- Fix rootless overlay being applied twice on service restart
- Periodically and on certain actions, reset color matrix
2016.02.08 - v3.51 BETA
- Fix grayscale channel rendering
- Allow master mode without location
- Improve Marshmallow doze/standby handling
- Fix filters sometimes not showing on initial setup in Rootless mode
- Added warning if drawing over other apps is disabled in M+Rootless mode
- Added capability to detect permission dialogs and hide overlay in M+Rootless mode
2016.02.08 - v3.49 BETA
- Should work again on MIPS
- 4.4 support dropped, now 5.0+
- Fix FC on SuperSU prompt
- Completely new CF.lumen driver code
- Improved driver switching
- (C) 2016
2015.10.28 - v3.16
- Detect Enforcing SELinux without supolicy availability and warn user
2015.10.27 - v3.15
- Fixed a case of the new root driver not being injected (and thus nothing happening)
2015.10.26 - v3.11 BETA - RELEASE NOTES
- Fixed freezing issue
- Fixed Note5 (and others?) support
2015.10.19 - v3.10 BETA - RELEASE NOTES
- New root driver method
- Adjusted slider layouts
- Dropped MIPS support
2015.02.24 - v3.00 - RELEASE NOTES
- (C) 2015
- Added KCAL driver (see XDA thread for details)
- Added Rootless driver (see XDA thread for details)
- Added freeload option
- Backuptool script updated (requires un-/reinstall of driver to become active)
2014.12.22 - v2.75
- Change notification flags
- Fix driver detection issue which could lead to bootloops on devices with symlinked busybox
- Work-around one case of bootloops, detect that case, and warn about it
2014.12.02 - v2.74
- Fix remote control issue
2014.11.19 - v2.72
- Fix issue with in-app billing
2014.11.14 - v2.71
- Hide notification from (secure) lockscreens on L
- Check free space before installing driver
2014.11.06 - v2.70
- Tasker integration (Pro only)
2014.11.05 - v2.66 - RELEASE NOTES
- Android 5.0 fixes
- 64-bit fixes
- Performance improvement
2014.10.22 - 2.61
- Fix UI bug where settings wouldn't open sometimes
2014.10.22 - 2.60 - RELEASE NOTES
- Fixed a name issue with the recovery installer
- Automatically restart service when app is updated
- Expanded theme options, including material (basic)
- SELinux policy patches for LPX13D
- Experimental support for arm64, x86-64, mips64
2014.07.02 - 2.51
- Fix: ignore light sensor triggered sleep if forced awake during sleep hours
2014.07.01 - 2.50
- Installer fixes for latest AOSP
- Installer fixes for Android "L" Preview
- Added wake button to notification during sleep mode, which goes to sundown mode and is the default tap response - in contrast to disable, which disables all filters and is the default tap response while not sleeping
- Fixed issue where starting CF.lumen would not start the driver/service when not using Pro, and nothing would happen regarding screen colors, no matter which buttons you push
2014.04.16 - 2.40 - RELEASE NOTES
- Added brightness control to filters (actionbar option)
- Added option to wake from sleep mode when an alarm goes off
- Added option to install via custom recovery
- Added backuptool support (survive custom ROM nightlies) - un/re-install driver to activate if coming from an older version
- Fixed setting sleep filter to disabled using day filter at night instead of sundown filter
- Fixed filters occasionally sticking while modifying settings
2014.04.14 - 2.25 - RELEASE NOTES
- Various UI tweaks
- Added gradual filter fading, configurable for sunrise, sunset, sleep and sensor events
- Added notification icon options (keep notification but hide icon)
- Added light sensor based wake from sleep option
- Added driver update needed notification
- Added option to switch between light, dark, and device themes
- Added quick toggle menu items to main activity
- Improved (Pro) notification behavior - en/disable now default tap option when active
- Fixed kelvin and R/G/B choices not being saved between filter selections
- Fixed "Upgrade to Pro" from notification sometimes not working
- Fixed text wrapping on light calibration dialog
2014.04.11 - 2.15
- Fixed driver installation problem when using Superuser instead of SuperSU
2014.04.11 - 2.10
- Fixed crash on driver (un)install
2014.04.10 - v2.05
- Fixed a number of force closes
2014.04.10 - v2.00
- Initial public release
Is there any practical difference between this and Lux?
Sent from my Nexus 5 using XDA Premium 4 mobile app
rlaw said:
Is there any practical difference between this and Lux?
Sent from my Nexus 5 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
See walkthrough video on YouTube, and you will get the answer.
Sent from my Nexus 4 using Tapatalk
Is it possible that you could add Tasker compatibility? If not, are there public intents available to control cf.lumen through Tasker intents? Thanks for updating this great app.
EDIT: The latest update(s) fixed my problems. Thanks CF! Will buy if I like the app after a few days of use.
BUG:
I would love to include a logcat, but I simply don't have the time today or tomorrow. If needed, I'll post one this weekend.
When the app runs for the first time: grant su access, then I see the "please install cf.lumen driver". I click install, device reboots after a few secs, after reboot I wait for some time before opening the app again. When I open it, it asks me the same thing: install the driver. Wasn't the driver installed, or doesn't it detect the driver?
PHONE: Nexus 4, ROM: Paranoid Android 4.2 BETA 4 (that's Android 4.4.2 if you don't know), KERNEL: franco.Kernel #204.
On my first try I had Nexus Display Control (also by Franco) installed. My guess was the apps aren't compatible. After uninstalling both apps, reboot, installed cf.lumen again, install driver, reboot: same problem. So for now no cf.lumen for me. Just eye strain.
I hope this helps you find the bug or incompatibility I have!
4.0+
Excellent, and we need it for Android 4.0+
No love for 4.1 - 4.3 makes me a sad panda
kodirovshchik said:
Excellent, and we need it for Android 4.0+
Click to expand...
Click to collapse
+1. Although I favour the cool-factor and performance of custom ROMs, it's always nice to be able to get a similar experience on stock ROM (which is ICS for me), considering that there are no stable custom ROMs on my device at the moment. I'm actually in the midst of custom ROM development for my device, though I work on CM10.2. (There are others who work on KitKat). It would be much appreciated if the @Chainfire could add support for lower Android versions.
rlaw said:
Is there any practical difference between this and Lux?
Click to expand...
Click to collapse
Seems to me (haven't actually tried), Lux (like several other solutions) uses an overlay for things like colortemperature and nightmode, which usually gives a lot worse image quality.
It's auto-brightness features on the other hand should work fine, and is something not really available from CF.lumen. Maybe one day one app will also be able to control the other.
jackattack said:
Is it possible that you could add Tasker compatibility? If not, are there public intents available to control cf.lumen through Tasker intents? Thanks for updating this great app.
Click to expand...
Click to collapse
This is not available right now, but I've added it to my to-do list.
erikieperikie said:
BUG:
I would love to include a logcat, but I simply don't have the time today or tomorrow. If needed, I'll post one this weekend.
When the app runs for the first time: grant su access, then I see the "please install cf.lumen driver". I click install, device reboots after a few secs, after reboot I wait for some time before opening the app again. When I open it, it asks me the same thing: install the driver. Wasn't the driver installed, or doesn't it detect the driver?
PHONE: Nexus 4, ROM: Paranoid Android 4.2 BETA 4 (that's Android 4.4.2 if you don't know), KERNEL: franco.Kernel #204.
On my first try I had Nexus Display Control (also by Franco) installed. My guess was the apps aren't compatible. After uninstalling both apps, reboot, installed cf.lumen again, install driver, reboot: same problem. So for now no cf.lumen for me. Just eye strain.
I hope this helps you find the bug or incompatibility I have!
Click to expand...
Click to collapse
A logcat will not help for this (its not a crash) - we'll need to investigate some other way. Can you confirm /system/lib/libcflumen.so is present?
SirBindy said:
No love for 4.1 - 4.3 makes me a sad panda
Click to expand...
Click to collapse
Codename13 said:
+1. Although I favour the cool-factor and performance of custom ROMs, it's always nice to be able to get a similar experience on stock ROM (which is ICS for me), considering that there are no stable custom ROMs on my device at the moment. I'm actually in the midst of custom ROM development for my device, though I work on CM10.2. (There are others who work on KitKat). It would be much appreciated if the @Chainfire could add support for lower Android versions.
Click to expand...
Click to collapse
If I could easily do this, I would, but I can't, so I won't.
Chainfire said:
A logcat will not help for this (its not a crash) - we'll need to investigate some other way. Can you confirm /system/lib/libcflumen.so is present?
Click to expand...
Click to collapse
Same issue here on N4 running CM11 M5 4.4.2. I do not have the system/lib/libcflumen.so file. I tried pressing install and reboot a couple of times to no avail.
Edit: just got an update from the play store. Ironically this update that says it fixes force closes now causes the app to force close when pressing ok to install the driver. Using ART by the way.
It does not seem to work at all in Cm11. It crashed once but even when it does not it don't change anything. It does flicker a small black square though.
The app crashes when I tap okay for the driver installation. I am using a Nexus 4 on 4.4.2 SlimKat build 3 with Matr1x 13.5 kernel and ART. I've added a Logcat for you, not sure if I did it right, let me know if it doesn't contain all the information you need. I think ART might be breaking it.
Max Dark level - 100
Min Bright level - 250
Could you change Min Bright level to 101? Its logical, and I really need it on my nexus 7 2013.
Or, even better, could you make dynamic Max Dark/Min Bright level?
Max Dark - ( N ),
Min Bright - ( N + 1 )
I also get fc after driver install on cm11 with my vs980. No work:/
Sent from my LG-VS980 using Tapatalk
I stand by XXCoder and tacosdelicioso on the CM11 issue. App crashes when asking for reboot, soon after permissions are given. I am running ART, FYI.
Enviado de meu XT925 usando Tapatalk
Dante897 said:
The app crashes when I tap okay for the driver installation. I am using a Nexus 4 on 4.4.2 SlimKat build 3 with Matr1x 13.5 kernel and ART. I've added a Logcat for you, not sure if I did it right, let me know if it doesn't contain all the information you need. I think ART might be breaking it.
Click to expand...
Click to collapse
Happens the same to me. Using latest temasek v64, devil's kernel and dalvik.
FCs on me as soon as I press OK to restart to install the driver. Happens every single time. Restarted manually and opeed it up again and same thing

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

Night light is an open-source app which uses KCAL to adjust blue light intensity of the display colors, so that viewing the screen at dark becomes pleasant for the eyes, and help you fall asleep faster (this is what science have proven so...).
Features
Easy to use user interface. Settings are easier to find.
Uses KCAL to adjust screen RGB colors, hence its efficient and changes are seen everywhere on screen.
Supports older KCAL implementations as well as newer KCAL implementation for v4.4 kernels.
Simple color controls for normal users through color temperature control.
Manual KCAL controls for advanced users.
Automation routines lets you define routines where you specify Night Light settings which you wish to apply, and they will be automatically applied for you in specified times.
Intensity fading in/out is supported as part of automation routines.
Supports sunset/sunrise timings.
Set on boot delay.
Original KCAL settings of user is backed up and applied when night light is turned off. And it can be configured as well.
Support for user profiles, which are collections of settings that user can apply with one click.
And to fulfill your all kinds of automation needs, app is supported as a Tasker plugin. You can use it with Profiles.
Option to automatically disable Night Light in lock screen, and turn it back on after the device is unlocked.
Quick Setting tile for easy toggling on/off night light anywhere.
Launcher icon shortcut for toggling Night Light on/off and toggling intensities.
Dark and Light theme.
Advantages
No overlays.
Background service is only used for lock screen option. The entire automation (including the fading) is done using neat AlarmManager tricks (which not only is battery friendly, but memory friendly as well).
Requirements
Kernel supporting KCAL.
Root access.
Download
Source - https://github.com/corphish/NightLight
Wow. Thanks for this awesome app. This is my best daily night light app.
Thanks
sounds good
let me have a try brother......
corphish said:
Night light is an open-source app which uses KCAL to adjust blue light intensity of the display colors, so that viewing the screen at dark becomes pleasant for the eyes, and help you fall asleep faster (this is what science have proven so...).
Features
Easy one touch toggles, with a single slider to tweak blue light intensity.
Quick Setting tile for easy toggling on/off night light anywhere.
Automatic switching on/off night light at user specifed timings. (Limitation - Start time must be lesser in value than ending time, that is if you choose starting time at 2300 hrs and ending time at 0600 hrs (next day) it won't work for now).
Requirements
Kernel supporting KCAL.
Root access.
Download
Source - https://github.com/corphish/NightLight
Click to expand...
Click to collapse
The automatic switch doesn't seem to be reliable. Could you add intents so it can be toggled with Tasker? I already have a profile that triggers at sunset so that would be perfect.
Sent from my Nexus 5X using XDA Labs
Great app, thanks. Have been using CF.lumen until now, but that seems unsupported (and is closed source).
Please keep improving it. Would also like to donate a beer.
Can you explain whats this KCAL thing ??? ??
thanks for this app apreciate it i got ADD and Slightly Autism and i already have an issue sleeping my brain get supercharged and i can't get to sleep but this app helps [email protected]
Loving the app so far, however, I notice it won't trigger at the time I have set unless I manually open the app. I've removed it from Android's battery optimization so I don't think that can be it. Any ideas?
rickysidhu_ said:
Loving the app so far, however, I notice it won't trigger at the time I have set unless I manually open the app. I've removed it from Android's battery optimization so I don't think that can be it. Any ideas?
Click to expand...
Click to collapse
Same here. I forgot to report it. I use Tasker to launch it at sunset & sunrise along with switching between dark / light app themes.
Sent from my Nexus 6P using XDA Labs
yochananmarqos said:
Same here. I forgot to report it. I use Tasker to launch it at sunset & sunrise along with switching between dark / light apo themes.
Click to expand...
Click to collapse
I ended up doing this as well! Now the other thing I'm hoping gets implemented is a smooth transition to the orange hue.
zaibansari20 said:
Can you explain whats this KCAL thing ??? [emoji848][emoji848]
Click to expand...
Click to collapse
Kcal is a kernel tweak that lets you customize colors at lower (kernel) level, so there won't be any filter or layer on screen, but in most stock kernels it isn't available, so you have to find a custom kernel for your phone/rom that has it.
Thanks for the app, but I've used tasker with the command "echo 180 75 35> /sys/devices/platform/kcal_ctrl.0/kcal" for a long time (echo 256 256 256 > /sys/devices/platform/kcal_ctrl.0/kcal to get the color back.)
Obviously you can change the values to whatever you want.
But the app will be much more easy for many people
Envoyé de mon ONEPLUS A5000 en utilisant Tapatalk
J0kker said:
Kcal is a kernel tweak that lets you customize colors at lower (kernel) level, so there won't be any filter or layer on screen, but in most stock kernels it isn't available, so you have to find a custom kernel for your phone/rom that has it.
Click to expand...
Click to collapse
I'm using LineageOS with a custom kernel which allows mein to change RGB values from any kernel modification app...
Sent from my LG G2 using XDA Labs
zaibansari20 said:
I'm using LineageOS with a custom kernel which allows mein to change RGB values from any kernel modification app...
Click to expand...
Click to collapse
So it should work for you, you can try with a kernel manager like kernel adiutor but the app should work.
J0kker said:
Kcal is a kernel tweak that lets you customize colors at lower (kernel) level, so there won't be any filter or layer on screen, but in most stock kernels it isn't available, so you have to find a custom kernel for your phone/rom that has it.
Thanks for the app, but I've used tasker with the command "echo 180 75 35> /sys/devices/platform/kcal_ctrl.0/kcal" for a long time (echo 256 256 256 > /sys/devices/platform/kcal_ctrl.0/kcal to get the color back.)
Obviously you can change the values to whatever you want.
But the app will be much more easy for many people
Envoyé de mon ONEPLUS A5000 en utilisant Tapatalk
Click to expand...
Click to collapse
I tried the Tasker method and it works great. I had no idea that command existed and could be used in Tasker. Thank you for sharing! :good: :highfive:
rickysidhu_ said:
Loving the app so far, however, I notice it won't trigger at the time I have set unless I manually open the app. I've removed it from Android's battery optimization so I don't think that can be it. Any ideas?
Click to expand...
Click to collapse
Does it fail to trigger if a reboot had happened sometime before the time it should have triggered?
For example, if it was to trigger at 5pm, but a device reboot happened in, say, 3pm, then does it fail to trigger at 5pm?
Anyway, set on boot is broken (again), will need to fix it, but normal timers should work fine.
corphish said:
Does it fail to trigger if a reboot had happened sometime before the time it should have triggered?
For example, if it was to trigger at 5pm, but a device reboot happened in, say, 3pm, then does it fail to trigger at 5pm?
Anyway, set on boot is broken (again), will need to fix it, but normal timers should work fine.
Click to expand...
Click to collapse
Ahh, that might be it. I think it stops working after a reboot, so I'd be going back into the app to get it going again.
Very minor issue though, great app - thank you for your hard work!!:highfive:
corphish said:
Does it fail to trigger if a reboot had happened sometime before the time it should have triggered?
For example, if it was to trigger at 5pm, but a device reboot happened in, say, 3pm, then does it fail to trigger at 5pm?
Anyway, set on boot is broken (again), will need to fix it, but normal timers should work fine.
Click to expand...
Click to collapse
Launcher shortcut (toggle on/off) switch is also seems somewhat broken, it toggle on but fails to toggle off.
@jineshpatel30 @rickysidhu_
Here is an experimental version (in the attachment of this reply), with launcher shortcut toggle and set on boot fixed.
The reason why it is experimental :
- Now written in kotlin
- Uses some of the new stuff announced in I/O 18, like ktx and the new material design style
- Uses different font called 'Acme'. (Feel free to suggest fonts)
- I decided to ditch cards because normal layouts look better in this new style.
Source - https://github.com/corphish/NightLight/tree/p
corphish said:
@[email protected]_
Here is an experimental version (in the attachment of this reply), with launcher shortcut toggle and set on boot fixed.
The reason why it is experimental :
- Now written in kotlin
- Uses some of the new stuff announced in I/O 18, like ktx and the new material design style
- Uses different font called 'Acme'. (Feel free to suggest fonts)
- I decided to ditch cards because normal layouts look better in this new style.
Source - https://github.com/corphish/NightLight/tree/p
Click to expand...
Click to collapse
It kicked in automagically at sunset tonight which reminded me to come back and comment. That was unreliable previously.
What does the save button do at the bottom? I assume it saves something, but there's no toast message to acknowledge it's been pressed.
I don't like the font, myself. Since you're going for new and fancy code and styling, why not use ProductSans? I like the new font used in the Wear OS app, I think that's it.
Could you add the numerical values for the sliders for more accurate fine tuning? I like the way the new XDA Navigation Gestures app does it. It's in the latest beta posted in the thread and should be pushed to the Play Store soon.
Since CF.lumen is EOL now, this app is going to be a great alternative especially when it eventually breaks.
Thank you!
Sent from my Nexus 6P using XDA Labs

[Kernel][FEATURED] Venom Kernel v3.1 [aio_otfp][MM][N]

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Venom Kernel for K3 Note (aio_otfp) -- Based on Renice kernel source
Venom is designed for maximum performance and battery backup. It is made for people who depend on their phone every day.
It is feature Enriched kernel which makes your device even better than before.
Compiled with UBERTC 6.x​
Features :
RGB color control
Working LED.
Vibration control using thunderquake engine module by varun.chitre15
Performance optimizations
USB fast Charging enabled by default
TCP Congestion Algorithm (TCPCA) set to Westwood by default
All other TCPCA added
Double tap to wake enabled
So much customisable dt2w, like screen area, time for tap, relative distance between taps... Much more
Fixes for blueborne bluetooth vulnerability at kernel level
Entropy tweaks -- Increased entropy values in random.c
Network tcp window tweak -- Lock window size to full for maximum speed
Enabled Forced fast charge
CPU governors :
(In alphabetical order)
Alucard
Conservative
Darkness
Intelliactive
Intellidemand
InteractiveB
InteractivePlus
Ondemand
Pegasusq
Performance
Poison --- Default custom governor made by me (based on ThunderX)
Powersaver
Renice
ThunderX
Userspace
Wheatley
Features of my Poison governor :
Dynamic CPU frequency transition mode engine. More info in Poison governor thread.
Smoothness tuning.
Best governor for this device because it is K3-specific
Custom tunables :
Can be found here, in my poison governor thread.
Has a total of 12 custom tuneables !!!!! :laugh::victory::highfive:
NOTE : There are 21 only for A7000-a and K3 release only has 12 tunables.
https://forum.xda-developers.com/lenovo-a7000/development/explanation-poison-cpu-governor-t3691304
(All information about the modes and tuneables in Poison governor thread)
Installation :
For custom roms:
Reboot to recovery
Flash the Kernel Zip
Reboot to system and Enjoy
For Vibe/Bootlooping Roms:
Reboot to Recovery
Take Nandroid backup of boot partition
Unpack ROM's boot.img (present in ROM zip almost always)
Replace the kernel file (Image-gz.dtb, bootimg-kernel, zImage) with proper name
Repack the boot image and flash
Reboot to System and Enjoy
Download links and Changelog :
See second post
Works Better in Custom roms (MM and N (based on MM libs) only)
Stock + Vibe Roms also Supported [MM only]
Note:
* Take a Nandroid backup before installing
Appreciate me by thanking me... Or... You could donate to me if you're an Indian!!!
Donation :
How to donate ??
---> Simple. Send me a PM or mail me ( [email protected] ) and say that you're willing to donate. Further instructions will be sent by me.
---> Or you can simply gift me xda ad-free
I also want to build venom for myself!
Sure! You can find the link for the venom kernel source below in xda DevDB info.
The source link is for A7000 device only so it doesn't work on K3 out of the box.
Everything that venom has is present in the given source link.
You can pick the features from there and Base it on renice source by sandeep.sethi
XDA:DevDB Information
Venom Kernel for aio_otfp [MM][N], Kernel for the Lenovo K3 Note
Contributors
tanish2k09, Sandeep.sethi, GSandeep, daniel_hk, Aryan Kedare, Rohan Taneja, Team M.A.D
Source Code: https://github.com/tanish2k09/Kernel_aio_row-Venom-S/
Kernel Special Features: Custom CPU governor, custom code, dynamic tuneables
Version Information
Status: Stable
Current Stable Version: 3.1
Stable Release Date: 2017-11-15
Created 2017-11-15
Last Updated 2018-04-22
Latest build :
Venom carnage edition :
http://goo.gl/r5KhkA
Old builds :
http://goo.gl/BuwKEh
(Venom kernel initial maximum edition)
Changelog :
Latest Build (Carnage) (25122017) :
Code:
1) Tweaked poison for more performance. Now you will feel that kernel is much more smooth than ever.
2) Added vibrator engine with real-time linking with poison. You'll feel it when you try yourself and see what this means.
3) Upgraded to dt2w 2.0 with haptic feedback (customisable vibration level) and more efficient structure and checks. My code is 1/3 of original code. Now dt2w is much faster and smoother.
4) Livedisplay fixed thax to painkiller3
5) WiFi autoconnect fixed thax to [user=4948627]@daniel_hk[/user]
6) Open hotspot fixed (use hotspot fix zip by sandeep) with venom
7) Added pocket mode override mechanism. Now you can tap 3 times within 0.8 seconds to override proximity sensor. Number of taps and timeout is customisable with poison.
8) New tunables details :
a) dt2w_vibe : Control vibration level on dt2w. Change to 0 to disable dt2w haptic feedback.
b) vibrator_on_lock : Disables vibrator on screen off completely. Capacitive buttons won't vibrate on screen off, notifications won't vibrate phone on screen off, but calls will turn screen on and then vibrator will activate. This is a good feature for those who want no notification disturbances but also don't want to enable silent mode.
c) pocket_mode_dt2w_override_taps_number : This is the value of the number of taps that you will have to tap within timeout to wake up the screen even in proximity mode.
d) pocket_mode_dt2w_override_taps_timeout : This is the value of the time in milliseconds within which you will have to tap to override pocket mode.
e) dt2w_tap_distance : Merged dt2w_tap_distance_x and _y into a single variable and changed the distance calculation from rectangular linear to circular radial. This us the radius of the circular region with the center as the first tap coordinates, within which you will have to tap second time within timeout to activate dt2w. Easy.
9) Merged x and y distance tunables into a single radius.
10) Enabled 5Ghz WiFi by default (thanks to daniel_hk) (request by [user=4695623]@FPSUsername[/user])
11) Enabled 7 cores while booting. (Thax to gsandeep)
Build 15112017-1244 :
Code:
Initial release.
Misc
Deleted and reserved again.
Users told me that the link I posted was bootlooping.
I've uploaded a last known working stable build instead.
Link in post 2 updated.
Kindly re-flash
tanish2k09 said:
Users told me that the link I posted was bootlooping.
I've uploaded a last known working stable build instead.
Link in post 2 updated.
Kindly re-flash
Click to expand...
Click to collapse
Great Work!
And
Im here for testing your kernel.
Works on stock 6.0 roms?
Or just for 7.0 LOS based?
Is there a posivility having bootloop if normal flashing it kn vibesavon 3.6?
inouext said:
Works on stock 6.0 roms?
Or just for 7.0 LOS based?
Click to expand...
Click to collapse
It works on all roms which are compatible with renice kernel.
TatsuyaKaneki2015 said:
Is there a posivility having bootloop if normal flashing it kn vibesavon 3.6?
Click to expand...
Click to collapse
Same behaviour like renice kernel.
I have mentioned that I don't have device so you can't expect me to tell you anything related to working or not working.
However, since this kernel is based on renice, it will do the exact same things like renice kernel. Think of this kernel as a renice kernel but with some extra features.
Anyone tested this, how the performance after this??
Eduardo27 said:
Anyone tested this, how the performance after this??
Click to expand...
Click to collapse
You should try yourself instead of asking others.
Your own opinion matters. :good::highfive:
u did a good job on poison...getting good screen on time...but there's some drawbacks like it lags while trying to play 1080p 60 fps in youtube...and lags while browsing with chrome
yup it's kind of laggy... even while browsing through photos..using es file manager+so on......
I'm in mode 1....I know mode 2 would be smoother....
but I'm liking the battery backup.....is there any possible way to tune up it a little more to get a little more performance +backup balance?
@tanish2k09
Cpt.mactavish said:
u did a good job on poison...getting good screen on time...but there's some drawbacks like it lags while trying to play 1080p 60 fps in youtube...and lags while browsing with chrome
yup it's kind of laggy... even while browsing through photos..using es file manager+so on......
I'm in mode 1....I know mode 2 would be smoother....
but I'm liking the battery backup.....is there any possible way to tune up it a little more to get a little more performance +backup balance?
@tanish2k09
Click to expand...
Click to collapse
It is quite obvious that battery backup and performance are inverse of each other. Both can't be perfect at the same time. One of them has to be sacrificed for other.
I'm warning you that increasing performance WILL decrease BB.
In case you still want to proceed to a better performance, do following :
1) Change poison tuneable "Awake_ideal_freq" to the max freq (16xx)
2) Or use some more powerful governor. Note that others aren't mtk-specific so battery backup will be less than poison 100%
3) While the step 1 should be enough for faster processing, you may use poison with addition to mode 2.
4) Change ROM to other than compiled nougat ones. They have a lag problem with low cpu frequencies. Marshmallow should be fine.
5) For faster pic loading, it has been tested that fiops iosched performs fastest. Slightly noticable.
6) Use darkness governor as an alternative for slightly performance oriented device.
// Destroy the thanks button on my post and kernel if you like it
Sir, does this kernel support with lenovo a7000 plus? Because i got bootloop when flash the kernel. Not even reaching the boot animation, its just get on the first lenovo logo then just black screen, and sometimes keep rebooting. Really wanted to try it.
device : Lenovo a7000 plus
twrp : 3.1.1-3 when install rom then 3.0.2-7 to install modem patch for a7k plus.
rom : Daniel_hk's latest LineageOs rom, (31oct)
tanish2k09 said:
It is quite obvious that battery backup and performance are inverse of each other. Both can't be perfect at the same time. One of them has to be sacrificed for other.
I'm warning you that increasing performance WILL decrease BB.
In case you still want to proceed to a better performance, do following :
1) Change poison tuneable "Awake_ideal_freq" to the max freq (16xx)
2) Or use some more powerful governor. Note that others aren't mtk-specific so battery backup will be less than poison 100%
3) While the step 1 should be enough for faster processing, you may use poison with addition to mode 2.
4) Change ROM to other than compiled nougat ones. They have a lag problem with low cpu frequencies. Marshmallow should be fine.
5) For faster pic loading, it has been tested that fiops iosched performs fastest. Slightly noticable.
6) Use darkness governor as an alternative for slightly performance oriented device.
// Destroy the thanks button on my post and kernel if you like it
Click to expand...
Click to collapse
your fastcharging seems to be good too.....I'm using gsandeep's unofficial RR....so far it is the best rom for k3.....
I've changed to mode 2..which is performance oriented ....and performance has increased..... but I thought is there any tweak to be made for tweaking mode 1...for slight performance increase...
Cpt.mactavish said:
your fastcharging seems to be good too.....I'm using gsandeep's unofficial RR....so far it is the best rom for k3.....
I've changed to mode 2..which is performance oriented ....and performance has increased..... but I thought is there any tweak to be made for tweaking mode 1...for slight performance increase...
Click to expand...
Click to collapse
Step 1 and step 6
Good to hear that you're liking the kernel. Unfortunately there are only 12 customisable variables in k3 version. My a7000 has almost everything customisable from cpu modes to dt2w screen trigger area to gesture sensitivity...
tanish2k09 said:
Step 1 and step 6
Good to hear that you're liking the kernel. Unfortunately there are only 12 customisable variables in k3 version. My a7000 has almost everything customisable from cpu modes to dt2w screen trigger area to gesture sensitivity...
Click to expand...
Click to collapse
btw,your kernel doesn't support livedisplay of LOS/LOS based roms...any fix for that?
Cpt.mactavish said:
btw,your kernel doesn't support livedisplay of LOS/LOS based roms...any fix for that?
Click to expand...
Click to collapse
I didn't get the time to add that.
I can't help you with it this year at least.
My main motive for releasing this kernel was to prove my skills with my poison governor. There are people like daniel_hk himself who doubt me greatly. He is failing to understand that I am not underskilled, but rather I prefer to not spend the time I have right now as a student, into ROM development.
With poison, you would experience at least 10-15% battery increase and a decent performance, unless needed for heavier tasks, which can be adopted to using the modes.
I hope you liked poison. Maybe early 2018 I will update this kernel with more new features. One of them being livedisplay. If you actually see, there isn't too much time to wait. It's just a month approx and you'll not even know when it passes. That's the thing about time. It's mind-boggling
//Some people need to learn to press the thanks button.
looking for your next updates....with livedisplay....and hope to have more optimizations...on backup+minimum usable performance
Battery Backup
Please tell me about battery backup of k3 note after flash this kernel in vibe os . ???
Like Renice kernel v11, sometimes wifi dropped and not auto reconnect. Can you fix that in next version?

K-Lapse : A kernel-level livedisplay module

KLapse - A kernel level livedisplay module​
Intro - What is K-Lapse?
Kernel-based Lapse ("K-Lapse") is a linear RGB scaling module that 'shifts' RGB based on time (of the day/selected by the user), or (since v2.0) brightness. This concept is inspired by LineageOS (formerly known as 'CyanogenMod') ROM's feature "Livedisplay" which also changes the display settings (RGB, hue, temperature, etc) based on time.
Why did I decide to make this? (A short story)
I (personally) am a big fan of the Livedisplay feature found on LineageOS ROM. I used it every single day, since Android Lollipop. Starting from Android Nougat, a native night mode solution was added to AOSP and it felt like Livedisplay was still way superior, thanks to its various options (you could say it spoiled me, sure). I also maintained a kernel (Venom kernel) for the device I was using at that time. It was all good until the OEM dropped support for the device at Android M, and XDA being XDA, was already working on N ROMs. The issue was, these ROMs weren't LineageOS or based on it, so Livedisplay was... gone. I decided I'll try to bring that feature to every other ROM. How would I do that? Of course! The kernel! It worked on every single ROM, it was the key! I started to work on it ASAP and here it is, up on GitHub, licensed under GPL (check klapse.c), open to everyone
How does it work?
Think of it like a fancy night mode, but not really. Klapse is dependent on an RGB interface (like Gamma on MTK and KCAL on SD chipsets). In mode 1, it fetches time from the kernel, converts it to local time, and selects and RGB set based on the time. The result is really smooth shifting of RGB over time. Mode 2 uses the current brightness level to scale RGB, with the concept behind it being that lower brightness usually implies a dark environment, so a slight color temperature shift should help with eye strain.
How does it really work (dev)?
Klapse mode 1 (time-based scaling) uses a method void klapse_pulse(unsigned long data) that should ideally be called every minute. This is done using a kernel timer, that is asynchronous so it should be handled with care, which I did. The pulse function fetches the current time and makes calculations based on the current hour and the values of the tunables listed down below.
Klapse mode 2 (brightness-based scaling) uses a method void set_rgb_slider(<type> bl_lvl) where type is the data type of the brightness level used in your kernel source. (OnePlus 6 uses u32 data type for bl_lvl) set_rgb_slider needs to be called/injected inside a function that sets brightness for your device. (OnePlus 6 uses dsi_panel.c for that, check out the diff for that file in op6 branch)
What all stuff can it do?
Emulate night mode with the proper RGB settings
Smoothly scale from one set of RGB to another set of RGB in integral intervals over time.
Reduce perceived brightness using brightness_factor by reducing the amount of color on screen. Allows lower apparent brightness than system permits.
Scale RGB based on brightness of display (low brightness usually implies a dark environment, where yellowness is probably useful).
Automate the perceived brightness independent of whether klapse is enabled, using its own set of start and stop hours.
Theoretically more efficient, faster by residing inside the kernel instead of having to use the HWC HAL like android's night mode. This is unproven and probably has no practical significance.
(On older devices) Reduce stuttering or frame lags caused by native night mode.
An easier solution against overlay-based apps that run as service in userspace/Android and sometimes block apps asking for permissions.
Give you a Livedisplay alternative if it doesn't work in your ROM.
Impress your crush so you can get a date (Hey, don't forget to credit me if it works).
Alright, so this is a replacement for night mode?
NO! Not at all. One can say this is merely an alternative for LineageOS' Livedisplay, but inside a kernel. Night mode is a sub-function of both Livedisplay and KLapse. Most comparisons here were made with night mode because that's what an average user uses, and will relate to the most. There is absolutely no reason for your Android kernel to not have KLapse. Go ahead and add it or ask your kernel maintainer to. It's super-easy!
What can it NOT do (yet)?
Calculate scaling to the level of minutes, like "Start from 5:37pm till 7:19am". --TODO
Make coffee for you.
Fly you to the moon.
Get you a monthly subscription of free food, cereal and milk included.
I want more! Tell me what can I customize!
All these following tunables are found in their respective files in /sys/klapse/
Code:
1. enable_klapse : A switch to enable or disable klapse. Values : 0 = off, 1 = on (since v2.0, 2 = brightness-dependent mode)
2. klapse_start_hour : The hour at which klapse should start scaling the RGB values from daytime to target (see next points). Values : 0-23
3. klapse_stop_hour : The hour by which klapse should scale back the RGB values from target to daytime (see next points). Values : 0-23
4. daytime_r,g,b : The RGB set that must be used for all the time outside of start and stop hour range.
5. target_r,g,b : The RGB set that must be scaled towards for all the time inside of start and stop hour range.
6. klapse_scaling_rate : Controls how soon the RGB reaches from daytime to target inside of start and stop hour range. Once target is reached, it remains constant till fadeback_minutes (#13) before stop hour, where target RGB scales back to daytime RGB. (Pre-v4.2 value was a factor, now it is a minute value)
7. brightness_factor : From the name itself, this value has the ability to bend perception and make your display appear as if it is at a lesser brightness level than it actually is at. It works by reducing the RGB values by the same factor. Values : 2-10, (10 means accurate brightness, 5 means 50% of current brightness, you get it)
8. brightness_factor_auto : A switch that allows you to automatically set the brightness factor in a set time range. Value : 0 = off, 1 = on
9. brightness_factor_auto_start_hour : The hour at which brightness_factor should be applied. Works only if #8 is 1. Values : 0-23
10. brightness_factor_auto_stop_hour : The hour at which brightness_factor should be reverted to 10. Works only if #8 is 1. Values : 0-23
11. backlight_range : The brightness range within which klapse should scale from daytime to target_rgb. Works only if #1 is 2. Values : MIN_BRIGHTNESS-MAX_BRIGHTNESS
12. pulse_freq : The amount of milliseconds after which klapse_pulse is called. A more developer-targeted tunable. Only works when one or both of #1 and #8 are 1. Values : 1000-600000 (Represents 1sec to 10 minutes)
13. fadeback_minutes : The number of minutes before klapse_stop_hour when RGB should start going back to daytime_rgb. Only works when #1 is 1. Values : 0-minutes between #2 and #3
Impact on performance or battery...
Fortunately, as per practical testing there is absolutely no negative effect on performance or battery backup!
"I'm a kernel maintainer. How do I add it to my source?"
The klapse.c file is pretty much generic, but depending on your device you may need to change some of the #define values
The klapse.h file should be edited in order to make the K_RED etc. defines point to the correct RGB interface variable. OnePlus 6 simply uses kcal_red, kcal_green and kcal_blue in sde. Some devices have a struct or pointers instead of a variable. Those devices must edit their kcal files to keep a copy of the address that klapse will access. An example of a source with struct-based kcal with klapse support is this: commit (thanks to @rupanshji for this commit)
The KCONFIG is pretty understandable too, but you may wanna remove the "DEPENDS" line for your device.
The Makefile is just one line, and so is enabling klapse in the defconfig.
Now you must change the file that provides the kcal/gamma (mtk) interface. Thanks to other developers, all I had to do on the OnePlus 6 was to remove the keyword "static" from the variable declaration.
Great work! Can I pay for your next meal?
I'm just a university CS student so sure, any amount is much appreciated! You can donate via paypal here :
Donate
XDA:DevDB Information
KLapse, Kernel for all devices (see above for details)
Contributors
tanish2k09
Source Code: https://github.com/tanish2k09/KLapse-Livedisplay
Kernel Special Features: RGB shifting based on a context
Version Information
Status: Stable
Current Stable Version: 4.3
Stable Release Date: 2019-03-02
Created 2019-03-04
Last Updated 2019-03-03
Hi, thanks for bring this KLapse. Actually i heard about this on other kernel (i forgot which one) thread, someone asking about have KLapse support and my favorite kernel also have support this kernel.
Great work, keep it up, all the best.
Anyone can share best settings KLapse? ?
duplicate thread closed
please follow this one https://forum.xda-developers.com/an...apse-kernel-level-livedisplay-module-t3907031

Categories

Resources