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:
Kenny Root
2013-10-16 10:10:45 -07:00
parent f88e5442f5
commit 94d4f23dcc

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;