Only finish Setup Wizard Activity when fully done

Wait for the ACTION_FINISHED broadcast before finishing the Activity.
This prevents the Setup Wizard from being re-launched when it is still
set as the default home screen, which it continues to be until the
exit worker changes as part of its finishSetupWizard call.

Skip SetupWizardExitActivity during the normal finish process, moving
common exit operations to SetupWizardUtils.

Change-Id: I1c59553e7dcaf934fb81dce9bf901ec0f2bb7b59
This commit is contained in:
Tommy Webb
2023-12-20 11:59:48 -05:00
committed by Michael Bestas
parent f58c0f4b83
commit 63bbec0258
12 changed files with 92 additions and 126 deletions

View File

@@ -113,9 +113,6 @@ public abstract class BaseSetupWizardActivity extends AppCompatActivity implemen
logActivityState("onStart");
}
super.onStart();
if (!SetupWizardUtils.isManagedProfile(this)) {
exitIfSetupComplete();
}
}
@Override
@@ -263,15 +260,6 @@ public abstract class BaseSetupWizardActivity extends AppCompatActivity implemen
}
}
private void exitIfSetupComplete() {
if (WizardManagerHelper.isUserSetupComplete(this)) {
Log.i(TAG, "Starting activity with USER_SETUP_COMPLETE=true");
startSetupWizardExitActivity();
setResult(RESULT_CANCELED, null);
finishAllAppTasks();
}
}
protected final void finishAllAppTasks() {
List<ActivityManager.AppTask> appTasks =
getSystemService(ActivityManager.class).getAppTasks();
@@ -392,13 +380,6 @@ public abstract class BaseSetupWizardActivity extends AppCompatActivity implemen
return wifiManager.setWifiEnabled(true);
}
private void startSetupWizardExitActivity() {
if (LOGV) {
Log.v(TAG, "startSetupWizardExitActivity()");
}
startActivity(new Intent(this, SetupWizardExitActivity.class));
}
private boolean isFirstRun() {
return true;
}