Migrate to new overlay-stopping flag

Bug: 62196835
Test: Started an accessibility service that displays an app
overlay and verified that it disappears when approving an
accessibility service's capabilities.

Change-Id: I7c8d8b4143a5dd1cb684c31c4503608c8d5be0e3
This commit is contained in:
Phil Weaver
2017-07-05 10:02:38 -07:00
parent d5612408af
commit 633c9be21c
5 changed files with 9 additions and 41 deletions

View File

@@ -1285,20 +1285,6 @@ public final class Utils extends com.android.settingslib.Utils {
return info.enabled ? R.string.installed : R.string.disabled;
}
/**
* Control if other apps can display overlays. By default this is allowed. Be sure to
* re-enable overlays, as the effect is system-wide.
*/
public static void setOverlayAllowed(Context context, IBinder token, boolean allowed) {
AppOpsManager appOpsManager = context.getSystemService(AppOpsManager.class);
if (appOpsManager != null) {
appOpsManager.setUserRestriction(AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
!allowed, token);
appOpsManager.setUserRestriction(AppOpsManager.OP_TOAST_WINDOW,
!allowed, token);
}
}
private static boolean isVolumeValid(VolumeInfo volume) {
return (volume != null) && (volume.getType() == VolumeInfo.TYPE_PRIVATE)
&& volume.isMountedReadable();