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
diff --git a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
index a5f9830..40972ac 100644
--- a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
+++ b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
@@ -366,13 +366,22 @@
             }
         }
 
+        /**
+         * Dialog setup.
+         * <p>
+         * 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