Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d4d8e2f authored by Nate Myren's avatar Nate Myren
Browse files

Allow self blames to be trusted

Test: manual
Fixes: 173659119
Change-Id: I6f413dd6430f096590dadf87dad32264523b13c3
parent 9c969a65
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -3058,9 +3058,10 @@ public class AppOpsService extends IAppOpsService.Stub {
        // This is a workaround for R QPR, new API change is not allowed. We only allow the current
        // voice recognizer is also the voice interactor to noteproxy op.
        final boolean isTrustVoiceServiceProxy = isTrustedVoiceServiceProxy(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;
@@ -3525,9 +3526,10 @@ public class AppOpsService extends IAppOpsService.Stub {
        // This is a workaround for R QPR, new API change is not allowed. We only allow the current
        // voice recognizer is also the voice interactor to noteproxy op.
        final boolean isTrustVoiceServiceProxy = isTrustedVoiceServiceProxy(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;