From 5ddb7fa4cd281316a85636d4a5758a15d384ea92 Mon Sep 17 00:00:00 2001 From: Nate Myren Date: Thu, 19 Nov 2020 18:49:02 +0000 Subject: Allow self blames to be trusted Test: manual Fixes: 173659119 Change-Id: I6f413dd6430f096590dadf87dad32264523b13c3 Merged-In: I6f413dd6430f096590dadf87dad32264523b13c3 --- services/core/java/com/android/server/appop/AppOpsService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java index 847be514b419..12eb8f214121 100644 --- a/services/core/java/com/android/server/appop/AppOpsService.java +++ b/services/core/java/com/android/server/appop/AppOpsService.java @@ -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; -- cgit v1.2.3-59-g8ed1b