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
This commit is contained in:
Robin Lee
2017-02-10 16:12:20 +00:00
parent c1cb8a4c2d
commit 11bf78028e

View File

@@ -366,13 +366,22 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends OptionsMenuFra
}
}
/**
* 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