Page 1 of 1

Toggling Bedtime Mode (Wind down) or Reading Mode

Posted: 17 May 2020 07:05
by andirs
Hey there is it possible to toggle Bedtime Mode or Reading Mode via Automagic?
At least Bedtime Mode is part of Digital Wellbeing. Have not found a way yet, not even with "Set System Settings".

I am on a rooted Lineage OS device running Android 9

Thanks in advance.

Re: Toggling Bedtime Mode (Wind down) or Reading Mode

Posted: 17 May 2020 18:00
by Desmanto
LOS has extra "LineageOS System Setting". But AFAIR, AM 1.37 doesn't work well with LOS 16 above (pie 9.0 above). Try to find the value in the set LineageOS System Setting. It should has less value to find. There is currently no quick way to find it, other than checking the value one by one and guess which one has changed.

Re: Toggling Bedtime Mode (Wind down) or Reading Mode

Posted: 17 May 2020 20:20
by andirs
Thanks for your reply.
Did a one on one comparison for the LOS settings but nothing changes except for "battery light enabled" which is obvious because it is changed by the bedtime mode function :(

Re: Toggling Bedtime Mode (Wind down) or Reading Mode

Posted: 18 May 2020 04:54
by andirs
The maybe most relevant hint that i found is in the sysui_qs_tiles.
The ones i am looking for are:
1. custom(com.google.android.apps.wellbeing/.screen.ui.GrayscaleTileService)
2. reading_mode

But i am still not finding them anywhere else. Is it possible to toggle tile items via automagic regardless of what they are behind the scenes?

Re: Toggling Bedtime Mode (Wind down) or Reading Mode

Posted: 23 May 2020 19:33
by Desmanto
I tried to toggle Reading mode in my AEX 6.7 Pie 9.0 ROM, surprisingly it doesn't produce any system setting changed. No logcat available too, no intent catched. This seems to use special API to call the feature directly from the kernel.

sysui_sq_tiles only define the qs tile you add. Try to change the order of your qs tile, you can see the value changed too. It seems no visible way to toggle the value without using Control UI.

Re: Toggling Bedtime Mode (Wind down) or Reading Mode

Posted: 24 May 2020 04:33
by andirs
Hey Desmanto, thanks fpr your efforts. In the meantime i also found the way using the ui

Execute Root Command: cmd statusbar click-tile com.google.android.apps.wellbeing/.screen.ui.GrayscaleTileService

However i do not really like it because obviously you can only toggle the mode and have no reliable way of finding out if the mode is on or off right now.
Therefore i use a condition to ask if DND is on, but of course this could have also been turned on manually...

Re: Toggling Bedtime Mode (Wind down) or Reading Mode

Posted: 24 May 2020 14:36
by Desmanto
Thanks for that cmd command, just know that we have that feature. Unfortunately, it is not working in my ROM. Issuing that root command will cause the SystemUI crash.

In your ROM, since it is working, you can use that. Then save the state using a global variable. It is not the exact solution, but best solution currently. Everytime you enable, save the true state to the glovar; and vice versa. You need to make sure never try to toggle the QS tile outside of automagic flow, as it will reverse the logic state.