From 11bf78028ebd6e99b9b7b50f329a38b8f0a27f73 Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Fri, 10 Feb 2017 16:12:20 +0000 Subject: [PATCH] CredentialFragment anti-pocket dialing measures. Now it is necessary to actually press the exact "OK" or Back button to get the dialog to dismiss. This makes pocket wiping that little bit less likely. Bug: 32934848 Test: manual, enter the password too many times. The dialog should appear. Attempt to dismiss it by tapping outside the dialog. This should not happen. Test: correctness of .setCanceledOnTouchOutside is outside scope. Change-Id: Icff8bd9068f636c0a75decb787b8a5c9161a8cbd --- .../settings/ConfirmDeviceCredentialBaseFragment.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java index a5f98308775..40972aca7cb 100644 --- a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java +++ b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java @@ -366,13 +366,22 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends OptionsMenuFra } } + /** + * Dialog setup. + *

+ * To make it less likely that the dialog is dismissed accidentally, for example if the + * device is malfunctioning or if the device is in a pocket, we set + * {@code setCanceledOnTouchOutside(false)}. + */ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - return new AlertDialog.Builder(getActivity()) + Dialog dialog = new AlertDialog.Builder(getActivity()) .setTitle(getArguments().getString(ARG_TITLE)) .setMessage(getArguments().getInt(ARG_MESSAGE)) .setPositiveButton(getArguments().getInt(ARG_BUTTON), null) .create(); + dialog.setCanceledOnTouchOutside(false); + return dialog; } @Override