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

Commit 57602f1c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clear binder identity when checking shell proxy permissions"

parents 1d4059d2 55c2b484
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -18479,7 +18479,12 @@ public class ActivityManagerService extends IActivityManager.Stub
        public int checkPermission(String permName, String pkgName, int userId,
                TriFunction<String, String, Integer, Integer> superImpl) {
            if (mTargetPackageName.equals(pkgName) && isTargetPermission(permName)) {
                final long identity = Binder.clearCallingIdentity();
                try {
                    return superImpl.apply(permName, "com.android.shell", userId);
                } finally {
                    Binder.restoreCallingIdentity(identity);
                }
            }
            return superImpl.apply(permName, pkgName, userId);
        }
@@ -18488,7 +18493,12 @@ public class ActivityManagerService extends IActivityManager.Stub
        public int checkUidPermission(String permName, int uid,
                BiFunction<String, Integer, Integer> superImpl) {
            if (uid == mTargetUid  && isTargetPermission(permName)) {
                final long identity = Binder.clearCallingIdentity();
                try {
                    return superImpl.apply(permName, Process.SHELL_UID);
                } finally {
                    Binder.restoreCallingIdentity(identity);
                }
            }
            return superImpl.apply(permName, uid);
        }