Merge "Call ActivityTaskManagerService's version of hasSystemAlertWindowPermission()." into sc-dev
This commit is contained in:
@@ -5663,8 +5663,8 @@ public final class ActiveServices {
|
||||
}
|
||||
|
||||
if (ret == REASON_DENIED) {
|
||||
if (mAm.checkPermission(SYSTEM_ALERT_WINDOW, callingPid,
|
||||
callingUid) == PERMISSION_GRANTED) {
|
||||
if (mAm.mAtmInternal.hasSystemAlertWindowPermission(callingUid, callingPid,
|
||||
callingPackage)) {
|
||||
ret = REASON_SYSTEM_ALERT_WINDOW_PERMISSION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,4 +607,10 @@ public abstract class ActivityTaskManagerInternal {
|
||||
*/
|
||||
void commit() throws RemoteException;
|
||||
}
|
||||
|
||||
/**
|
||||
* A utility method to check AppOps and PackageManager for SYSTEM_ALERT_WINDOW permission.
|
||||
*/
|
||||
public abstract boolean hasSystemAlertWindowPermission(int callingUid, int callingPid,
|
||||
String callingPackage);
|
||||
}
|
||||
|
||||
@@ -933,7 +933,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
return getUserManager().hasUserRestriction(restriction, userId);
|
||||
}
|
||||
|
||||
boolean hasSystemAlertWindowPermission(int callingUid, int callingPid, String callingPackage) {
|
||||
boolean hasSystemAlertWindowPermission(int callingUid, int callingPid,
|
||||
String callingPackage) {
|
||||
final int mode = getAppOpsManager().noteOpNoThrow(AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
|
||||
callingUid, callingPackage, /* featureId */ null, "");
|
||||
if (mode == AppOpsManager.MODE_DEFAULT) {
|
||||
@@ -6370,6 +6371,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
return new PackageConfigurationUpdaterImpl(Binder.getCallingPid());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSystemAlertWindowPermission(int callingUid, int callingPid,
|
||||
String callingPackage) {
|
||||
return ActivityTaskManagerService.this.hasSystemAlertWindowPermission(callingUid,
|
||||
callingPid, callingPackage);
|
||||
}
|
||||
}
|
||||
|
||||
final class PackageConfigurationUpdaterImpl implements
|
||||
|
||||
Reference in New Issue
Block a user