Prevent back key from cancelling BYOD mid-provisioning
If we start provisioning and MP calls
DPM#createAndProvisionManagedProfile, and if the end-user taps the
back key to cancel provisioning, it won't cancel the execution
of that API. Therefore, the work profile will still be created,
which prevents a subsequent provisioning from succeeding.
This fix is BYOD-only and is part of a long-term fix,
tracked in b/213306538, to remove the cancel dialog
from all the provisioning flows (including org-owned).
Fixes: 208814313
Fixes: 140290732
Test: manual
Change-Id: Iafaa23324fb591e18d7fde54ec495fee702323a7
diff --git a/src/com/android/managedprovisioning/provisioning/ProvisioningActivity.java b/src/com/android/managedprovisioning/provisioning/ProvisioningActivity.java
index ad62a9e..a11f1ec 100644
--- a/src/com/android/managedprovisioning/provisioning/ProvisioningActivity.java
+++ b/src/com/android/managedprovisioning/provisioning/ProvisioningActivity.java
@@ -314,8 +314,8 @@
@Override
protected void decideCancelProvisioningDialog() {
- if ((mState == STATE_PROVISIONING_COMPLETED || mState == STATE_PROVISIONING_FINALIZED)
- && !mParams.isOrganizationOwnedProvisioning) {
+ // TODO(b/213306538): Improve behaviour when cancelling BYOD mid-provisioning
+ if (!mParams.isOrganizationOwnedProvisioning) {
return;
}