-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8.3
-
None
-
-
2025wk38s2QtforAndroid
If the Qt Android Activity is destroyed by the system (eg. to automatically free resources) with an active Qt foreground Service running, the next time it is started, it freezes with a black screen on startup.
This is because the QtNative.m_stateDetails.isStarted flag is restored from the Activity instance state (QtActivityBase.onRestoreInstanceState()).
The flag is then checked in QtNative.startApplication() whose execution is skipped entirely, resulting in no call to the C++ main() function.
The bug did not exist in Qt 6.4.3 where the flag existed in QtActivityDelegate and was also restored but was not checked in QtNative.startApplication().
Note that the bug seems to only happen when an active Service is running, because otherwise the system will just kill the application on shutdown without saving an instance state. It also does not happen when closing the app manually, eg. from the task manager or by quitting Qt from within the application.
It can be reproduce by setting "do not keep activities" in system developer settings, then starting a Service from the app and putting the app to the background, resulting in the Activity being destroyed and the instance state being saved.