Allow self blames to be trusted

Test: manual
Fixes: 173659119
Change-Id: I6f413dd6430f096590dadf87dad32264523b13c3
Merged-In: I6f413dd6430f096590dadf87dad32264523b13c3
This commit is contained in:
Nate Myren
2020-11-19 18:49:02 +00:00
parent d411e94a6f
commit 5ddb7fa4cd

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;