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
This commit is contained in:
Oliver Scott
2022-12-05 15:27:10 +01:00
committed by Michael Bestas
parent fb6285a35e
commit 4c8cc2f348
2 changed files with 5 additions and 2 deletions

View File

@@ -124,7 +124,9 @@ public abstract class BaseSetupWizardActivity extends Activity implements Naviga
logActivityState("onStart"); logActivityState("onStart");
} }
super.onStart(); super.onStart();
exitIfSetupComplete(); if (!SetupWizardUtils.isManagedProfile(this)) {
exitIfSetupComplete();
}
} }
@Override @Override

View File

@@ -45,7 +45,8 @@ public class SetupWizardActivity extends BaseSetupWizardActivity {
if (SetupWizardUtils.hasGMS(this)) { if (SetupWizardUtils.hasGMS(this)) {
SetupWizardUtils.disableHome(this); SetupWizardUtils.disableHome(this);
finish(); finish();
} else if (WizardManagerHelper.isUserSetupComplete(this)) { } else if (WizardManagerHelper.isUserSetupComplete(this)
&& !SetupWizardUtils.isManagedProfile(this)) {
SetupWizardUtils.finishSetupWizard(this); SetupWizardUtils.finishSetupWizard(this);
finish(); finish();
} else { } else {