From ba40fe89a43218b39b68cb6cdfb5b53c6dbc2c92 Mon Sep 17 00:00:00 2001 From: Nate Myren Date: Wed, 5 May 2021 11:20:06 -0700 Subject: [PATCH] TEMP: trust recognition service providers temporarily trust select recognition service packages Bug: 184963112 Test: manual Change-Id: I374ae2809dbd51b7d6af0cbbe170529743bb0785 --- .../java/com/android/server/appop/AppOpsService.java | 10 +++++++++- 1 file changed, 9 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 7eaf18fc971b5..e8de6e6ff07d1 100644 --- a/services/core/java/com/android/server/appop/AppOpsService.java +++ b/services/core/java/com/android/server/appop/AppOpsService.java @@ -3065,6 +3065,13 @@ public class AppOpsService extends IAppOpsService.Stub { shouldCollectAsyncNotedOp, message, shouldCollectMessage, skipProxyOperation); } + // TODO b/184963112: remove once full blaming is implemented + private boolean isRecognitionServiceTemp(int code, String packageName) { + return code == OP_RECORD_AUDIO + && (packageName.equals("com.google.android.googlequicksearchbox") + || packageName.equals("com.google.android.tts")); + } + private SyncNotedAppOp noteProxyOperationImpl(int code, AttributionSource attributionSource, boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage, boolean skipProxyOperation) { @@ -3091,7 +3098,8 @@ public class AppOpsService extends IAppOpsService.Stub { final boolean isSelfBlame = Binder.getCallingUid() == proxiedUid; final boolean isProxyTrusted = mContext.checkPermission( Manifest.permission.UPDATE_APP_OPS_STATS, -1, proxyUid) - == PackageManager.PERMISSION_GRANTED || isSelfBlame; + == PackageManager.PERMISSION_GRANTED || isSelfBlame + || isRecognitionServiceTemp(code, proxyPackageName); if (!skipProxyOperation) { final int proxyFlags = isProxyTrusted ? AppOpsManager.OP_FLAG_TRUSTED_PROXY