Wednesday, February 1, 2017

Setting up Auto day and night live display with tasker and cm14.1 - LineageOS - cyanogenmod - nougat - klte

Greetings, root-a-holics! If you are reading this you are likely similar to me in that you have to have the latest and greatest in terms of phone features and software but are not interested in shelling out tons of cash for a physical upgrade every other year. I recently upgraded to LineageOS 14.1, which replaced Cyanogenmod, which was discontinued. I had been using it for years. This isn't the first time that live display has quit working or been finicky. This time I found a few posts that helped me put together two tasker tasks that can automate day and night live display with a little extra work, namely, setting up a profile to kick off the tasks at a set time of day that can themselves be variablesn that are configured to sunrise and sunset.

The first clue was listed here. And many sites pointed to this post but it didn't work for me.

The second clue was here. And this site provided some valuable info but it didn't list live display on the post nor when I ran the commands. This is likely because live display is something specific in the kernel for cyanogenmod and lineageos, I believe.

Lastly, I ran the initial part of that command in the shell that is provided under development tools in lineageos, 'settings list' or just 'settings'. This command gives an error but tells you the allowed/permitted command flags, one of which is --cm for cm command key/values. Eureeka!!

OK, so that 2nd link has 3 commands that can be modified in the following manner to produce the cm or lineageos specific key/values:

settings --cm list system
settings --cm list global
settings --cm list secure

The first of these gives me the key/value that is referenced in the first link but requires the addition of the '--cm':

To change display mode (Auto=2, Off=0, Day=4, Night=1):

settings --cm put system display_temperature_mode 1

To change color temperature (although this can be done adequately from within the normal setting area):

settings --cm put system display_temperature_day 6500
settings --cm put system display_temperature_night 3400

And VoilĂ !

See the following pastebin for the two tasker tasks that you can automate in whatever way you see fit:

http://pastebin.com/pmyZHjRK