From 4c8cc2f348b8536be71d16450877b7f0410cf953 Mon Sep 17 00:00:00 2001 From: Oliver Scott Date: Mon, 5 Dec 2022 15:27:10 +0100 Subject: [PATCH] Do not exit if setup complete for managed profiles Previously a call to mark user setup as completed for managed profiles was removed from the device policy manager service to avoid exiting the setup wizard while launching it after successfully provisioning. If a the setup wizard did not finish correctly it had side effects (e.g. work profile apps would not remain in recent activities). Allow managed profiles to launch the setup wizard even if user setup is marked as completed. Issue: calyxos#1024 Issue: calyxos#1123 Change-Id: I940937dd02f2d4991677da886bb3a4f522661210 --- src/org/lineageos/setupwizard/BaseSetupWizardActivity.java | 4 +++- src/org/lineageos/setupwizard/SetupWizardActivity.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java b/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java index 2ec668c7..21d34c47 100644 --- a/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java +++ b/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java @@ -124,7 +124,9 @@ public abstract class BaseSetupWizardActivity extends Activity implements Naviga logActivityState("onStart"); } super.onStart(); - exitIfSetupComplete(); + if (!SetupWizardUtils.isManagedProfile(this)) { + exitIfSetupComplete(); + } } @Override diff --git a/src/org/lineageos/setupwizard/SetupWizardActivity.java b/src/org/lineageos/setupwizard/SetupWizardActivity.java index dfb5e19c..d6ee9b72 100644 --- a/src/org/lineageos/setupwizard/SetupWizardActivity.java +++ b/src/org/lineageos/setupwizard/SetupWizardActivity.java @@ -45,7 +45,8 @@ public class SetupWizardActivity extends BaseSetupWizardActivity { if (SetupWizardUtils.hasGMS(this)) { SetupWizardUtils.disableHome(this); finish(); - } else if (WizardManagerHelper.isUserSetupComplete(this)) { + } else if (WizardManagerHelper.isUserSetupComplete(this) + && !SetupWizardUtils.isManagedProfile(this)) { SetupWizardUtils.finishSetupWizard(this); finish(); } else {