Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7dd8586d authored by Hui Yu's avatar Hui Yu Committed by Automerger Merge Worker
Browse files

Merge "Call ActivityTaskManagerService's version of...

Merge "Call ActivityTaskManagerService's version of hasSystemAlertWindowPermission()." into sc-dev am: c264f71b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13933466

Change-Id: Id678767f4c3de41aa60e6dec292828b712a18bfb
parents 55f56ebd c264f71b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
            }
        }
+6 −0
Original line number Diff line number Diff line
@@ -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);
}
+9 −1
Original line number Diff line number Diff line
@@ -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