Call noteOperation() in ShellDelegate so that noteOp() really passes.

Previously it was calling noteProxyOperation() (with a wrong
proxy/proxied relationship) in the hope that we can attribute the
operation to the original app instead of only the shell. However,
noteProxyOperation() requires both the proxy and the proxied app to have
the app op, which defeats the purpose of ShellDelegate. So change the
implementation to call noteOperation() as shell directly instead.

Bug: 153676562
Test: presubmit
Change-Id: I783d7a7473e2622cb0ed379b109cf511c20cc876
This commit is contained in:
Hai Zhang
2020-04-22 14:04:56 -07:00
parent 87adee8718
commit 799ee34558

View File

@@ -20045,8 +20045,7 @@ public class ActivityManagerService extends IActivityManager.Stub
if (uid == mTargetUid && isTargetOp(code)) {
final long identity = Binder.clearCallingIdentity();
try {
return mAppOpsService.noteProxyOperation(code, Process.SHELL_UID,
"com.android.shell", null, uid, packageName, featureId,
return superImpl.apply(code, Process.SHELL_UID, "com.android.shell", featureId,
shouldCollectAsyncNotedOp, message);
} finally {
Binder.restoreCallingIdentity(identity);