From 4ed687c330274ff568df2c451e3b4e9ca820ebc3 Mon Sep 17 00:00:00 2001 From: Tommy Webb Date: Thu, 1 Aug 2024 15:52:03 +0000 Subject: [PATCH] Workaround for back press through SIM Missing page Make sure the prior activity (NetworkSetupActivity) knows that back was pressed - as it must have been - when the user returns to it. Otherwise, the wizard gets stuck on a "Just a sec" page forever. Change-Id: I35f7a78c4decc13b9dee267bfaf195fb2241395d --- src/org/lineageos/setupwizard/SimMissingActivity.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/org/lineageos/setupwizard/SimMissingActivity.java b/src/org/lineageos/setupwizard/SimMissingActivity.java index f0864bca..73dc0db3 100644 --- a/src/org/lineageos/setupwizard/SimMissingActivity.java +++ b/src/org/lineageos/setupwizard/SimMissingActivity.java @@ -20,7 +20,16 @@ public class SimMissingActivity extends BaseSetupWizardActivity { protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!SetupWizardUtils.simMissing(this) || !SetupWizardUtils.hasTelephony(this)) { - finishAction(RESULT_SKIP); + // NetworkSetupActivity comes before us. DateTimeActivity comes after. + // If the user presses the back button on DateTimeActivity, we can only pass along + // that information to NetworkSetupActivity if we are still around. But if we finish + // here, we're gone, and NetworkSetupActivity will get whatever result we give here. + // We can't predict the future, but we can reasonably assume that the only way for + // NetworkSetupActivity to be reached later is if the user went backwards. So, we + // finish this activity faking that the user pressed the back button, which is required + // for subactivities like NetworkSetupActivity to work properly on backward navigation. + // TODO: Resolve all this. + finishAction(RESULT_SKIP, new Intent().putExtra("onBackPressed", true)); return; } getGlifLayout().setDescriptionText(getString(R.string.sim_missing_summary));