summaryrefslogtreecommitdiffstats
path: root/src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java
diff options
context:
space:
mode:
authorSander Alewijnse <salewijnse@google.com>2014-10-02 14:57:05 +0100
committerSander Alewijnse <salewijnse@google.com>2014-10-06 10:23:45 +0100
commit3bad02dec85f3946f4ded0751f2ad7966318e474 (patch)
treee699195a7ccbf2dee4a857b00b14a150e5a1a0d3 /src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java
parent93476d618e562ab5e25beed7a3498ec73601ae11 (diff)
downloadandroid_packages_apps_ManagedProvisioning-3bad02dec85f3946f4ded0751f2ad7966318e474.tar.gz
android_packages_apps_ManagedProvisioning-3bad02dec85f3946f4ded0751f2ad7966318e474.tar.bz2
android_packages_apps_ManagedProvisioning-3bad02dec85f3946f4ded0751f2ad7966318e474.zip
Allow orientation change (restart) for the learn more dialog.
This does NOT fix the orientation change issues in the managed provisioning activity. Bug:17384624 Change-Id: Iac89f8b5eca228bb6f3408fef54f42e7db513470
Diffstat (limited to 'src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java')
-rw-r--r--src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java b/src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java
index f7f33e97..c2b521eb 100644
--- a/src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java
+++ b/src/com/android/managedprovisioning/DeviceOwnerProvisioningActivity.java
@@ -19,6 +19,7 @@ package com.android.managedprovisioning;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
+import android.app.DialogFragment;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
@@ -63,7 +64,9 @@ import java.util.Locale;
* repeated. We made sure that all tasks can be done twice without causing any problems.
* </p>
*/
-public class DeviceOwnerProvisioningActivity extends Activity {
+public class DeviceOwnerProvisioningActivity extends Activity
+ implements UserConsentDialog.ConsentCallback {
+
private static final String KEY_USER_CONSENTED = "user_consented";
private static final int ENCRYPT_DEVICE_REQUEST_CODE = 1;
@@ -80,6 +83,9 @@ public class DeviceOwnerProvisioningActivity extends Activity {
// Indicates whether user consented by clicking on positive button of interstitial.
private boolean mUserConsented = false;
+ // Params that will be used after user consent.
+ private ProvisioningParams mParamsToConsent;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -160,22 +166,23 @@ public class DeviceOwnerProvisioningActivity extends Activity {
} else {
// Notify the user that the admin will have full control over the device,
// then start provisioning.
- new UserConsentDialog(this, UserConsentDialog.DEVICE_OWNER, new Runnable() {
- @Override
- public void run() {
- mUserConsented = true;
- startDeviceOwnerProvisioningService(params);
- }
- } /* onUserConsented */ , new Runnable() {
- @Override
- public void run() {
- finish();
- }
- } /* onCancel */).show(getFragmentManager(),
- "UserConsentDialogFragment");
+ mParamsToConsent = params;
+ UserConsentDialog.newInstance(UserConsentDialog.DEVICE_OWNER)
+ .show(getFragmentManager(), "UserConsentDialogFragment");
}
}
+ @Override
+ public void onDialogConsent() {
+ mUserConsented = true;
+ startDeviceOwnerProvisioningService(mParamsToConsent);
+ }
+
+ @Override
+ public void onDialogCancel() {
+ finish();
+ }
+
private void startDeviceOwnerProvisioningService(ProvisioningParams params) {
Intent intent = new Intent(this, DeviceOwnerProvisioningService.class);
intent.putExtra(DeviceOwnerProvisioningService.EXTRA_PROVISIONING_PARAMS, params);