Catch Security and IllegalStateExceptions when enabling overlays
As part of changes in R, it is now possible for OverlayManager to throw SecurityExceptions for failure cases besides the change overlays permission. This can include actor enforcement, or app visibility, or something like a package not being installed for a user. Previously, these checks were not done and the OM would continue silently as normal. Now it will fail. This behavior has been gated on targetSdk R, but requires changes for existing code in the tree, as they target the platform development version. This treats them as general failures. Bug: 147340954 Change-Id: If921e4ddf855e9162efb46abb4557b6c98c1e6b9
This commit is contained in:
@@ -126,8 +126,8 @@ public class OverlayCategoryPreferenceController extends DeveloperOptionsPrefere
|
||||
return mOverlayManager.setEnabledExclusiveInCategory(packageName,
|
||||
USER_SYSTEM);
|
||||
}
|
||||
} catch (RemoteException re) {
|
||||
Log.w(TAG, "Error enabling overlay.", re);
|
||||
} catch (SecurityException | IllegalStateException | RemoteException e) {
|
||||
Log.w(TAG, "Error enabling overlay.", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user