From c0ddc95a8669acc4a02fada774a4b241430f2023 Mon Sep 17 00:00:00 2001 From: Faye Yan Date: Wed, 4 Oct 2023 21:16:32 +0000 Subject: Enable the voice_activation_permission_apis flag control, replace the static boolean control. When flags are set as default: false 1) no voice activation op noted:https://paste.googleplex.com/5323105500135424 Privacy dashboard: https://screenshot.googleplex.com/4kpXpp2tbsdRuhh When set flags : true I. Enable voice activation op to be noted: i) adb shell device_config put permissions android.permission.flags.voice_activation_permission_apis true ii) Trigger the Assisstant app by i.e. "OK Google...". iii) adb shell dumpsys appops --package com.google.android.googlequicksearchbox Should see the voice activation op "RECEIVE_SANDBOX_TRIGGER_AUDIO" noted. sample output: https://paste.googleplex.com/6143516865462272 Bug: 289087412 Change-Id: Ib29972c59e8a1305860a3c8d326d957b50cc0b5a Test: presubmit --- services/core/java/com/android/server/policy/AppOpsPolicy.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/policy/AppOpsPolicy.java b/services/core/java/com/android/server/policy/AppOpsPolicy.java index ebc7163cd05c..b83421fe78d7 100644 --- a/services/core/java/com/android/server/policy/AppOpsPolicy.java +++ b/services/core/java/com/android/server/policy/AppOpsPolicy.java @@ -42,6 +42,7 @@ import android.os.PackageTagsList; import android.os.Process; import android.os.SystemProperties; import android.os.UserHandle; +import android.permission.flags.Flags; import android.service.voice.VoiceInteractionManagerInternal; import android.service.voice.VoiceInteractionManagerInternal.HotwordDetectionServiceIdentity; import android.text.TextUtils; @@ -75,9 +76,6 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat private static final boolean SYSPROP_HOTWORD_DETECTION_SERVICE_REQUIRED = SystemProperties.getBoolean("ro.hotword.detection_service_required", false); - //TODO(b/289087412): import this from the flag value in set up in device config. - private static final boolean IS_VOICE_ACTIVATION_OP_ENABLED = false; - @NonNull private final Object mLock = new Object(); @@ -212,7 +210,7 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat * @return the op that should be noted for the voice activations of the app by detected hotword. */ public static int getVoiceActivationOp() { - if (IS_VOICE_ACTIVATION_OP_ENABLED) { + if (Flags.voiceActivationPermissionApis()) { return OP_RECEIVE_SANDBOX_TRIGGER_AUDIO; } return OP_RECORD_AUDIO_HOTWORD; -- cgit v1.2.3-59-g8ed1b