Accessibility: filter touches to Enable button

To prevent tap-jacking, filter touches to the enable button if there is
another window obscuring the screen.

Bug: 11242907
Change-Id: I0228cd480faf8e7ebf70394d9bb60fa2e4138fb4
This commit is contained in:
Alan Viverette
2013-12-09 19:08:36 -08:00
parent 38bd642e23
commit 96118a4d53

View File

@@ -159,7 +159,7 @@ public class ToggleAccessibilityServicePreferenceFragment
if (info == null) { if (info == null) {
return null; return null;
} }
return new AlertDialog.Builder(getActivity()) AlertDialog ad = new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.enable_service_title, .setTitle(getString(R.string.enable_service_title,
info.getResolveInfo().loadLabel(getPackageManager()))) info.getResolveInfo().loadLabel(getPackageManager())))
.setIconAttribute(android.R.attr.alertDialogIcon) .setIconAttribute(android.R.attr.alertDialogIcon)
@@ -168,6 +168,9 @@ public class ToggleAccessibilityServicePreferenceFragment
.setPositiveButton(android.R.string.ok, this) .setPositiveButton(android.R.string.ok, this)
.setNegativeButton(android.R.string.cancel, this) .setNegativeButton(android.R.string.cancel, this)
.create(); .create();
ad.getButton(AlertDialog.BUTTON_POSITIVE)
.setFilterTouchesWhenObscured(true);
return ad;
} }
case DIALOG_ID_DISABLE_WARNING: { case DIALOG_ID_DISABLE_WARNING: {
mShownDialogId = DIALOG_ID_DISABLE_WARNING; mShownDialogId = DIALOG_ID_DISABLE_WARNING;