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
Change-Id: I5ec594ec93dd3ba13b088d63ec77a3649e21d798
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 270d59f65be53a13263ba840b077b47026df4d0e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit da6c71569105eb09f17078614047957d104990ee)
This commit is contained in:
Jarkko Koivikko 2025-04-30 15:53:40 +03:00 committed by Qt Cherry-pick Bot
parent 1926f88b24
commit a003aafd86

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");