Merge "Use per-user Shell UID for adoptShellPermissionIdentity()." into rvc-qpr-dev am: 91596432c2

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0597c4aedf0d02fdc16e89c6716d7cb7699c95b3
This commit is contained in:
Hai Zhang
2020-12-09 23:53:52 +00:00
committed by Automerger Merge Worker

View File

@@ -20195,10 +20195,11 @@ public class ActivityManagerService extends IActivityManager.Stub
public int checkOperation(int code, int uid, String packageName, boolean raw,
QuadFunction<Integer, Integer, String, Boolean, Integer> superImpl) {
if (uid == mTargetUid && isTargetOp(code)) {
final int shellUid = UserHandle.getUid(UserHandle.getUserId(uid),
Process.SHELL_UID);
final long identity = Binder.clearCallingIdentity();
try {
return superImpl.apply(code, Process.SHELL_UID,
"com.android.shell", raw);
return superImpl.apply(code, shellUid, "com.android.shell", raw);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -20210,10 +20211,11 @@ public class ActivityManagerService extends IActivityManager.Stub
public int checkAudioOperation(int code, int usage, int uid, String packageName,
QuadFunction<Integer, Integer, Integer, String, Integer> superImpl) {
if (uid == mTargetUid && isTargetOp(code)) {
final int shellUid = UserHandle.getUid(UserHandle.getUserId(uid),
Process.SHELL_UID);
final long identity = Binder.clearCallingIdentity();
try {
return superImpl.apply(code, usage, Process.SHELL_UID,
"com.android.shell");
return superImpl.apply(code, usage, shellUid, "com.android.shell");
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -20228,9 +20230,11 @@ public class ActivityManagerService extends IActivityManager.Stub
@NonNull HeptFunction<Integer, Integer, String, String, Boolean, String, Boolean,
Integer> superImpl) {
if (uid == mTargetUid && isTargetOp(code)) {
final int shellUid = UserHandle.getUid(UserHandle.getUserId(uid),
Process.SHELL_UID);
final long identity = Binder.clearCallingIdentity();
try {
return superImpl.apply(code, Process.SHELL_UID, "com.android.shell", featureId,
return superImpl.apply(code, shellUid, "com.android.shell", featureId,
shouldCollectAsyncNotedOp, message, shouldCollectMessage);
} finally {
Binder.restoreCallingIdentity(identity);