Maybe the question should be - "how to keep the CPU awake with screen off", but I'm not sure yet, here's why:
I'm trying to use my android device as a DLNA player, that streams music to a DLNA renderer. The problem is that the playback keeps stopping with the screen off, using apps like n7player and doubleTwist music player. Logically, these apps should keep the CPU awake when the music is playing, but if they don't, I have tried the following to keep the CPU awake:
- Disabling battery optimizations on these apps;
- an Automate script without the "keep screen on" option;
- This command - echo mylockname >/sys/power/wake_lock;
But these solutions didn't solve my problem, the playback keeps stopping after awhile, when the screen turns off. If the screen is kept on, by using the caffeine function for example, there are no issues, but I would like to keep the screen off to save some battery and maybe prolong the life of the device.
So if the solutions I have mentioned really keep the CPU awake, maybe there is something else that these players need to keep the playback going.
Update: Screen backlight off app - this seems like the most promising approach and maybe works on some devices as expected, but not on mine (Samsung SM-T585 tablet). It should turn off the screen backlight and it does so by setting the brightness level to 0. Maybe some devices completely turn off the backlight in this case, but my tablet keeps emmiting very low light. So if anyone knows a way to completely turn off the backlight - please let me know.