summaryrefslogtreecommitdiffstats
path: root/src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java
diff options
context:
space:
mode:
authorSander Alewijnse <salewijnse@google.com>2014-09-11 15:15:23 +0100
committerSander Alewijnse <salewijnse@google.com>2014-09-12 13:28:21 +0100
commitab18ea7a517c14fd46fd211e81846326ff7b60d1 (patch)
tree2fcde85ac3b091f3a15df4e8de17bc878cd5357b /src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java
parenteed2f48f383ec7506fe4d38afa9f5e5d2658b0d7 (diff)
downloadandroid_packages_apps_ManagedProvisioning-ab18ea7a517c14fd46fd211e81846326ff7b60d1.tar.gz
android_packages_apps_ManagedProvisioning-ab18ea7a517c14fd46fd211e81846326ff7b60d1.tar.bz2
android_packages_apps_ManagedProvisioning-ab18ea7a517c14fd46fd211e81846326ff7b60d1.zip
Intercept HOME intent that is send by the Setup Wizard.
Only after interception send the complete intent to the mdm. Bug:17370665 Change-Id: I82ab41c7b6fafed6ad756fe8d190ad3f0bde2144
Diffstat (limited to 'src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java')
-rw-r--r--src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java32
1 files changed, 4 insertions, 28 deletions
diff --git a/src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java b/src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java
index ecd144f6..5d010fb0 100644
--- a/src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java
+++ b/src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java
@@ -16,9 +16,6 @@
package com.android.managedprovisioning;
-import static android.app.admin.DeviceAdminReceiver.ACTION_PROFILE_PROVISIONING_COMPLETE;
-import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE;
-
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -80,8 +77,6 @@ public class DeviceOwnerProvisioningActivity extends Activity {
// Run when wifi picker activity reports success.
private Runnable mOnWifiConnectedRunnable;
- private Intent mProvisioningCompleteIntent;
-
// Indicates whether user consented by clicking on positive button of interstitial.
private boolean mUserConsented = false;
@@ -209,8 +204,6 @@ public class DeviceOwnerProvisioningActivity extends Activity {
if (action.equals(DeviceOwnerProvisioningService.ACTION_PROVISIONING_SUCCESS)) {
ProvisionLogger.logd("Successfully provisioned");
- mProvisioningCompleteIntent = getProvisioningCompleteIntent(intent);
-
synchronized(this) {
if (mDialog == null) {
onProvisioningSuccess();
@@ -241,31 +234,14 @@ public class DeviceOwnerProvisioningActivity extends Activity {
}
}
- private Intent getProvisioningCompleteIntent(Intent serviceIntent) {
- ProvisioningParams paramsFromService = (ProvisioningParams) serviceIntent.getExtra(
- DeviceOwnerProvisioningService.EXTRA_PROVISIONING_PARAMS);
-
- Intent result = new Intent(ACTION_PROFILE_PROVISIONING_COMPLETE);
- result.setPackage(paramsFromService.mDeviceAdminPackageName);
- result.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES |
- Intent.FLAG_RECEIVER_FOREGROUND);
- if (paramsFromService.mAdminExtrasBundle != null) {
- result.putExtra(EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE,
- paramsFromService.mAdminExtrasBundle);
- }
- return result;
- }
-
private void onProvisioningSuccess() {
- stopService(new Intent(DeviceOwnerProvisioningActivity.this,
- DeviceOwnerProvisioningService.class));
-
- // Skip the setup wizard.
+ // The Setup wizards listens to this flag and finishes itself when it is set.
+ // It then fires a home intent, which we catch in the HomeReceiverActivity before sending
+ // the intent to notify the mdm that provisioning is complete.
Global.putInt(getContentResolver(), Global.DEVICE_PROVISIONED, 1);
Secure.putInt(getContentResolver(), Secure.USER_SETUP_COMPLETE, 1);
- sendBroadcast(mProvisioningCompleteIntent);
-
+ // Note: the DeviceOwnerProvisioningService will stop itself.
setResult(Activity.RESULT_OK);
finish();
}