summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRubin Xu <rubinxu@google.com>2015-07-13 23:01:06 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-13 23:01:06 +0000
commita7a0d81b40526c5c7a1c5accc44fd78149c578dc (patch)
treebdd8a23cf02a4ea8185f7a461dfcd4facaf934c9
parent62e6170e71b7a25a1702fd9fa16eefdd1010dcde (diff)
parent073c85a31d3b97460aad6e92dca1ed9d593a2c48 (diff)
downloadandroid_packages_apps_ManagedProvisioning-a7a0d81b40526c5c7a1c5accc44fd78149c578dc.tar.gz
android_packages_apps_ManagedProvisioning-a7a0d81b40526c5c7a1c5accc44fd78149c578dc.tar.bz2
android_packages_apps_ManagedProvisioning-a7a0d81b40526c5c7a1c5accc44fd78149c578dc.zip
am 073c85a3: Merge "Warn about theft protection in all provisioning flows." into mnc-dev
* commit '073c85a31d3b97460aad6e92dca1ed9d593a2c48': Warn about theft protection in all provisioning flows.
-rw-r--r--res/layout/learn_more_dialog.xml6
-rw-r--r--src/com/android/managedprovisioning/DeviceOwnerPreProvisioningActivity.java25
-rw-r--r--src/com/android/managedprovisioning/UserConsentDialog.java7
-rw-r--r--src/com/android/managedprovisioning/Utils.java6
4 files changed, 40 insertions, 4 deletions
diff --git a/res/layout/learn_more_dialog.xml b/res/layout/learn_more_dialog.xml
index 16dd93ae..3ab5a705 100644
--- a/res/layout/learn_more_dialog.xml
+++ b/res/layout/learn_more_dialog.xml
@@ -36,6 +36,12 @@
android:paddingTop="@dimen/row_padding_top"/>
<TextView
+ android:id="@+id/learn_more_frp_warning"
+ style="@style/MainText"
+ android:text="@string/theft_protection_disabled_warning"
+ android:visibility="gone"/>
+
+ <TextView
android:id="@+id/learn_more_text2"
android:text="@string/contact_your_admin_for_more_info"
style="@style/MainText"/>
diff --git a/src/com/android/managedprovisioning/DeviceOwnerPreProvisioningActivity.java b/src/com/android/managedprovisioning/DeviceOwnerPreProvisioningActivity.java
index 569962d7..5849cf90 100644
--- a/src/com/android/managedprovisioning/DeviceOwnerPreProvisioningActivity.java
+++ b/src/com/android/managedprovisioning/DeviceOwnerPreProvisioningActivity.java
@@ -210,7 +210,11 @@ public class DeviceOwnerPreProvisioningActivity extends SetupLayoutActivity
}
private void askForConsentOrStartProvisioning() {
- if (mUserConsented || mParams.startedByNfc || !Utils.isCurrentUserOwner()) {
+ // If we are started by Nfc and the device supports FRP, we need to ask for user consent
+ // since FRP will not be activated at the end of the flow.
+ if (mParams.startedByNfc && Utils.isFrpSupported(this)) {
+ showUserConsentDialog();
+ } else if (mUserConsented || mParams.startedByNfc || !Utils.isCurrentUserOwner()) {
startDeviceOwnerProvisioning();
} else {
showStartProvisioningButton();
@@ -328,13 +332,26 @@ public class DeviceOwnerPreProvisioningActivity extends SetupLayoutActivity
@Override
public void onDialogCancel() {
- // Do nothing.
+ // For Nfc provisioning, we automatically show the user consent dialog if applicable.
+ // If the user then decides to cancel, we should finish the entire activity and exit.
+ // For other cases, dismissing the consent dialog will lead back to
+ // DeviceOwnerPreProvisioningActivity, and we do nothing here.
+ if (mParams.startedByNfc) {
+ setResult(RESULT_CANCELED);
+ finish();
+ }
}
@Override
public void onNavigateNext() {
- // Notify the user that the admin will have full control over the device,
- // then start provisioning.
+ showUserConsentDialog();
+ }
+
+ /**
+ * Notify the user that the admin will have full control over the device,
+ * then start provisioning.
+ */
+ private void showUserConsentDialog() {
UserConsentDialog.newInstance(UserConsentDialog.DEVICE_OWNER)
.show(getFragmentManager(), "UserConsentDialogFragment");
}
diff --git a/src/com/android/managedprovisioning/UserConsentDialog.java b/src/com/android/managedprovisioning/UserConsentDialog.java
index 79c88bf0..943126e2 100644
--- a/src/com/android/managedprovisioning/UserConsentDialog.java
+++ b/src/com/android/managedprovisioning/UserConsentDialog.java
@@ -73,6 +73,13 @@ public class UserConsentDialog extends DialogFragment {
text1.setText(R.string.admin_has_ability_to_monitor_device);
}
+ TextView textFrpWarning = (TextView) dialog.findViewById(R.id.learn_more_frp_warning);
+ if (ownerType == DEVICE_OWNER && Utils.isFrpSupported(getActivity())) {
+ textFrpWarning.setVisibility(View.VISIBLE);
+ } else {
+ textFrpWarning.setVisibility(View.GONE);
+ }
+
TextView linkText = (TextView) dialog.findViewById(R.id.learn_more_link);
if (ownerType == PROFILE_OWNER) {
linkText.setOnClickListener(new OnClickListener() {
diff --git a/src/com/android/managedprovisioning/Utils.java b/src/com/android/managedprovisioning/Utils.java
index 1d36278f..21b247d8 100644
--- a/src/com/android/managedprovisioning/Utils.java
+++ b/src/com/android/managedprovisioning/Utils.java
@@ -347,4 +347,10 @@ public class Utils {
ProvisionLogger.logw("Exception removing account from the primary user.", e);
}
}
+
+ public static boolean isFrpSupported(Context context) {
+ Object pdbManager = context.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ return pdbManager != null;
+ }
+
}