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
diff --git a/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java b/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java
index 2ec668c..21d34c4 100644
--- a/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java
+++ b/src/org/lineageos/setupwizard/BaseSetupWizardActivity.java
@@ -124,7 +124,9 @@
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 dfb5e19..d6ee9b7 100644
--- a/src/org/lineageos/setupwizard/SetupWizardActivity.java
+++ b/src/org/lineageos/setupwizard/SetupWizardActivity.java
@@ -45,7 +45,8 @@
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 {