I am working on a minimal open-source Launcher (wikipedia) for Android.
When I run it on a phone, put that on standby and unlock it after 4 - 6 hours, all I get is a black screen.
I hope this has some general solution and is not only caused by my code. That way answers to this question will also be useful to everyone else on here.
Relevant mentions for my code
In the Android Manifest XML I declared the main activity to be a launcher (home screen). The main activity (MainActivity.kt) has an onCreate function, only refreshes a clock and checks for some OnTouch events. The full project code can also be seen on GitHub.