Android: Skip restoring bundle state on process restart

When the app process is restarted (e.g. after revoking a permission), Qt
isn't running yet, so we must not restore the saved bundle state.

Fixes: QTBUG-136497
Fixes: QTBUG-136077
Fixes: QTBUG-135961
Pick-to: 6.9.1 6.9 6.8
Change-Id: I5ec594ec93dd3ba13b088d63ec77a3649e21d798
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Jarkko Koivikko 2025-04-30 15:53:40 +03:00
parent 47e3a5b804
commit 270d59f65b

View File

@ -277,6 +277,11 @@ public class QtActivityBase extends Activity
protected void onRestoreInstanceState(Bundle savedInstanceState) protected void onRestoreInstanceState(Bundle savedInstanceState)
{ {
super.onRestoreInstanceState(savedInstanceState); super.onRestoreInstanceState(savedInstanceState);
// only restore when this Activity is being recreated for a config change
if (getLastNonConfigurationInstance() == null)
return;
QtNative.setStarted(savedInstanceState.getBoolean("Started")); QtNative.setStarted(savedInstanceState.getBoolean("Started"));
boolean isFullScreen = savedInstanceState.getBoolean("isFullScreen"); boolean isFullScreen = savedInstanceState.getBoolean("isFullScreen");
boolean expandedToCutout = savedInstanceState.getBoolean("expandedToCutout"); boolean expandedToCutout = savedInstanceState.getBoolean("expandedToCutout");