The answer
It's the screensaver (Daydream).
FLAG_KEEP_SCREEN_ON and disabling sleep run on a separate track from the screensaver. It fires in the instant the flag isn't in effect , so it's the one thing left standing after you've blocked everything else.
adb shell settings put secure screensaver_enabled 0 adb shell settings put secure screensaver_activate_on_sleep 0 adb shell settings put secure screensaver_activate_on_dock 0
Enter fullscreen mode
Exit fullscreen mode
And these settings reset on reboot . Stop before that step and you'll think it's fixed when it isn't.
The symptom
A display meant to stay on goes black after a while
The device itself is alive β processing keeps running
FLAG_KEEP_SCREEN_ON is already set
Sleep timeout is already extended
It still goes dark, and you can't predict when
The unpredictability is the tell.β¦