Loading core/java/android/app/AppOpsManager.java +12 −8 Original line number Diff line number Diff line Loading @@ -7664,8 +7664,8 @@ public class AppOpsManager { } else if (collectionMode == COLLECT_SYNC // Only collect app-ops when the proxy is trusted && (mContext.checkPermission(Manifest.permission.UPDATE_APP_OPS_STATS, -1, myUid) == PackageManager.PERMISSION_GRANTED || isTrustedVoiceServiceProxy(mContext, mContext.getOpPackageName(), op))) { myUid) == PackageManager.PERMISSION_GRANTED || isTrustedVoiceServiceProxy( mContext, mContext.getOpPackageName(), op, mContext.getUserId()))) { collectNotedOpSync(op, proxiedAttributionTag); } } Loading @@ -7683,7 +7683,7 @@ public class AppOpsManager { * @hide */ public static boolean isTrustedVoiceServiceProxy(Context context, String packageName, int code) { int code, int userId) { // 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. if (code != OP_RECORD_AUDIO) { Loading @@ -7695,7 +7695,7 @@ public class AppOpsManager { final String voiceRecognitionServicePackageName = getComponentPackageNameFromString(voiceRecognitionComponent); return (Objects.equals(packageName, voiceRecognitionServicePackageName)) && isPackagePreInstalled(context, packageName); && isPackagePreInstalled(context, packageName, userId); } private static String getComponentPackageNameFromString(String from) { Loading @@ -7703,10 +7703,11 @@ public class AppOpsManager { return componentName != null ? componentName.getPackageName() : ""; } private static boolean isPackagePreInstalled(Context context, String packageName) { private static boolean isPackagePreInstalled(Context context, String packageName, int userId) { try { final PackageManager pm = context.getPackageManager(); final ApplicationInfo info = pm.getApplicationInfo(packageName, 0); final ApplicationInfo info = pm.getApplicationInfoAsUser(packageName, 0, userId); return ((info.flags & ApplicationInfo.FLAG_SYSTEM) != 0); } catch (PackageManager.NameNotFoundException e) { return false; Loading Loading @@ -8069,12 +8070,15 @@ public class AppOpsManager { collectNotedOpForSelf(opInt, proxiedAttributionTag); } else if (collectionMode == COLLECT_SYNC // Only collect app-ops when the proxy is trusted && mContext.checkPermission(Manifest.permission.UPDATE_APP_OPS_STATS, -1, Process.myUid()) == PackageManager.PERMISSION_GRANTED) { && (mContext.checkPermission(Manifest.permission.UPDATE_APP_OPS_STATS, -1, Process.myUid()) == PackageManager.PERMISSION_GRANTED || isTrustedVoiceServiceProxy(mContext, mContext.getOpPackageName(), opInt, mContext.getUserId()))) { collectNotedOpSync(opInt, proxiedAttributionTag); } } return mode; } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading services/core/java/com/android/server/appop/AppOpsService.java +4 −4 Original line number Diff line number Diff line Loading @@ -3032,8 +3032,8 @@ 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 = AppOpsManager.isTrustedVoiceServiceProxy(mContext, proxyPackageName, code); final boolean isTrustVoiceServiceProxy = AppOpsManager.isTrustedVoiceServiceProxy(mContext, proxyPackageName, code, UserHandle.getUserId(proxyUid)); final boolean isSelfBlame = Binder.getCallingUid() == proxiedUid; final boolean isProxyTrusted = mContext.checkPermission( Manifest.permission.UPDATE_APP_OPS_STATS, -1, proxyUid) Loading Loading @@ -3502,8 +3502,8 @@ 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 = AppOpsManager.isTrustedVoiceServiceProxy(mContext, proxyPackageName, code); final boolean isTrustVoiceServiceProxy = AppOpsManager.isTrustedVoiceServiceProxy(mContext, proxyPackageName, code, UserHandle.getUserId(proxyUid)); final boolean isSelfBlame = Binder.getCallingUid() == proxiedUid; final boolean isProxyTrusted = mContext.checkPermission( Manifest.permission.UPDATE_APP_OPS_STATS, -1, proxyUid) Loading Loading
core/java/android/app/AppOpsManager.java +12 −8 Original line number Diff line number Diff line Loading @@ -7664,8 +7664,8 @@ public class AppOpsManager { } else if (collectionMode == COLLECT_SYNC // Only collect app-ops when the proxy is trusted && (mContext.checkPermission(Manifest.permission.UPDATE_APP_OPS_STATS, -1, myUid) == PackageManager.PERMISSION_GRANTED || isTrustedVoiceServiceProxy(mContext, mContext.getOpPackageName(), op))) { myUid) == PackageManager.PERMISSION_GRANTED || isTrustedVoiceServiceProxy( mContext, mContext.getOpPackageName(), op, mContext.getUserId()))) { collectNotedOpSync(op, proxiedAttributionTag); } } Loading @@ -7683,7 +7683,7 @@ public class AppOpsManager { * @hide */ public static boolean isTrustedVoiceServiceProxy(Context context, String packageName, int code) { int code, int userId) { // 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. if (code != OP_RECORD_AUDIO) { Loading @@ -7695,7 +7695,7 @@ public class AppOpsManager { final String voiceRecognitionServicePackageName = getComponentPackageNameFromString(voiceRecognitionComponent); return (Objects.equals(packageName, voiceRecognitionServicePackageName)) && isPackagePreInstalled(context, packageName); && isPackagePreInstalled(context, packageName, userId); } private static String getComponentPackageNameFromString(String from) { Loading @@ -7703,10 +7703,11 @@ public class AppOpsManager { return componentName != null ? componentName.getPackageName() : ""; } private static boolean isPackagePreInstalled(Context context, String packageName) { private static boolean isPackagePreInstalled(Context context, String packageName, int userId) { try { final PackageManager pm = context.getPackageManager(); final ApplicationInfo info = pm.getApplicationInfo(packageName, 0); final ApplicationInfo info = pm.getApplicationInfoAsUser(packageName, 0, userId); return ((info.flags & ApplicationInfo.FLAG_SYSTEM) != 0); } catch (PackageManager.NameNotFoundException e) { return false; Loading Loading @@ -8069,12 +8070,15 @@ public class AppOpsManager { collectNotedOpForSelf(opInt, proxiedAttributionTag); } else if (collectionMode == COLLECT_SYNC // Only collect app-ops when the proxy is trusted && mContext.checkPermission(Manifest.permission.UPDATE_APP_OPS_STATS, -1, Process.myUid()) == PackageManager.PERMISSION_GRANTED) { && (mContext.checkPermission(Manifest.permission.UPDATE_APP_OPS_STATS, -1, Process.myUid()) == PackageManager.PERMISSION_GRANTED || isTrustedVoiceServiceProxy(mContext, mContext.getOpPackageName(), opInt, mContext.getUserId()))) { collectNotedOpSync(opInt, proxiedAttributionTag); } } return mode; } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading
services/core/java/com/android/server/appop/AppOpsService.java +4 −4 Original line number Diff line number Diff line Loading @@ -3032,8 +3032,8 @@ 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 = AppOpsManager.isTrustedVoiceServiceProxy(mContext, proxyPackageName, code); final boolean isTrustVoiceServiceProxy = AppOpsManager.isTrustedVoiceServiceProxy(mContext, proxyPackageName, code, UserHandle.getUserId(proxyUid)); final boolean isSelfBlame = Binder.getCallingUid() == proxiedUid; final boolean isProxyTrusted = mContext.checkPermission( Manifest.permission.UPDATE_APP_OPS_STATS, -1, proxyUid) Loading Loading @@ -3502,8 +3502,8 @@ 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 = AppOpsManager.isTrustedVoiceServiceProxy(mContext, proxyPackageName, code); final boolean isTrustVoiceServiceProxy = AppOpsManager.isTrustedVoiceServiceProxy(mContext, proxyPackageName, code, UserHandle.getUserId(proxyUid)); final boolean isSelfBlame = Binder.getCallingUid() == proxiedUid; final boolean isProxyTrusted = mContext.checkPermission( Manifest.permission.UPDATE_APP_OPS_STATS, -1, proxyUid) Loading