by F. F.
Flow to control AOD mode based on certain conditions (27 blocks).
This flow toggles the 'Always On Display' mode based on posted notifications, battery charging and the 'Do Not Disturb' mode.
The flow has been created and tested on a Google Pixel 4a (Android 11), so no warranties are given it will run smoothly on any other device.
Setting the AOD mode requires the WRITE_SECURE_SETTINGS right on the device. You may be able (as me) to unlook it using the 'Android Debug Bridge' (ADB). Consult the Automate documentation for further details. There should be no issues on a rooted device either.
Synchronization between the processing fiber and the blocking fibers monitoring the conditions is done by applying 'Variables Give' and 'Variables Take' blocks.
Since disabling AOD does not take effect until it is inactive (at least on the Google Pixel 4a), the device needs to be woken up with a 'Device Keep Awake' block for that matter.