From 14a4ca6cd23b80bff919550102f9e501a5396c9f Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Fri, 26 Aug 2022 21:15:53 -0400 Subject: [PATCH] SetupWizardActivity: better documentation again --- .../shelter/receivers/ShelterDeviceAdminReceiver.java | 2 +- .../net/typeblog/shelter/ui/SetupWizardActivity.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/net/typeblog/shelter/receivers/ShelterDeviceAdminReceiver.java b/app/src/main/java/net/typeblog/shelter/receivers/ShelterDeviceAdminReceiver.java index c82190b..0053e52 100644 --- a/app/src/main/java/net/typeblog/shelter/receivers/ShelterDeviceAdminReceiver.java +++ b/app/src/main/java/net/typeblog/shelter/receivers/ShelterDeviceAdminReceiver.java @@ -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", diff --git a/app/src/main/java/net/typeblog/shelter/ui/SetupWizardActivity.java b/app/src/main/java/net/typeblog/shelter/ui/SetupWizardActivity.java index f892519..8785570 100644 --- a/app/src/main/java/net/typeblog/shelter/ui/SetupWizardActivity.java +++ b/app/src/main/java/net/typeblog/shelter/ui/SetupWizardActivity.java @@ -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;