SetupWizardActivity: better documentation again

This commit is contained in:
Peter Cai 2022-08-26 21:15:53 -04:00
parent 7202151378
commit 14a4ca6cd2
2 changed files with 8 additions and 5 deletions

View File

@ -28,7 +28,7 @@ public class ShelterDeviceAdminReceiver extends DeviceAdminReceiver {
Intent i = new Intent(context.getApplicationContext(), DummyActivity.class);
i.setAction(DummyActivity.FINALIZE_PROVISION);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Delegate starting activity to notification so we won't break on Android 10
// Delegate starting activity to notification to work around background limitations
// And also maybe this will fix bugs on stupid custom OSes like MIUI / EMUI
Notification notification = Utility.buildNotification(context, true,
"shelter-finish-provision",

View File

@ -31,7 +31,8 @@ import net.typeblog.shelter.util.Utility;
public class SetupWizardActivity extends AppCompatActivity {
// RESUME_SETUP should be used when MainActivity detects the provisioning has been
// finished by the system, but the Shelter inside the profile has never been brought up
// due to the user having not clicked on the notification yet.
// due to the user having not clicked on the notification yet (on Android 7 or lower).
// TODO: When we remove support for Android 7, get rid of all of these nonsense :)
public static final String ACTION_RESUME_SETUP = "net.typeblog.shelter.RESUME_SETUP";
public static final String ACTION_PROFILE_PROVISIONED = "net.typeblog.shelter.PROFILE_PROVISIONED";
@ -115,9 +116,11 @@ public class SetupWizardActivity extends AppCompatActivity {
private void setupProfileCb(Boolean result) {
if (result) {
if (Utility.isWorkProfileAvailable(this)) {
// The setup could be already finalized at this point
// (post-Oreo, since there is the activity intent ACTION_PROVISIONING_SUCCESSFUL,
// the work profile provisioning UI will not finish until that activity finishes.)
// On Oreo and later versions, since we make use of the activity intent
// ACTION_PROVISIONING_SUCCESSFUL, the provisioning UI will not finish
// until that activity returns. In this case, there is really no need for us
// to do anything else here (and this callback may not even be called because
// the activity will likely be already finished by this point).
// There is no need for more action
finishWithResult(true);
return;