Merge "Allow self blames to be trusted" into rvc-qpr-dev

This commit is contained in:
Nate Myren
2020-11-20 15:41:59 +00:00
committed by Android (Google) Code Review

View File

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