Merge "Allow self blames to be trusted" into rvc-qpr-dev am: 35c4f102e4

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

Change-Id: Ib39cbf57cdd908e0edaf9a47fc254a4689c727e2
This commit is contained in:
Nate Myren
2020-11-20 16:07:16 +00:00
committed by Automerger Merge Worker

View File

@@ -2993,9 +2993,10 @@ public class AppOpsService extends IAppOpsService.Stub {
// voice recognizer is also the voice interactor to noteproxy op.
final boolean isTrustVoiceServiceProxy =
AppOpsManager.isTrustedVoiceServiceProxy(mContext, proxyPackageName, code);
final boolean isSelfBlame = Binder.getCallingUid() == proxiedUid;
final boolean isProxyTrusted = mContext.checkPermission(
Manifest.permission.UPDATE_APP_OPS_STATS, -1, proxyUid)
== PackageManager.PERMISSION_GRANTED || isTrustVoiceServiceProxy;
== PackageManager.PERMISSION_GRANTED || isTrustVoiceServiceProxy || isSelfBlame;
final int proxyFlags = isProxyTrusted ? AppOpsManager.OP_FLAG_TRUSTED_PROXY
: AppOpsManager.OP_FLAG_UNTRUSTED_PROXY;