Merge "Revert "Enforce voice activation permission check on VoiceInteractionManagerService API."" into main
diff --git a/core/java/android/service/voice/VoiceInteractionService.java b/core/java/android/service/voice/VoiceInteractionService.java
index 20adc54..306410c 100644
--- a/core/java/android/service/voice/VoiceInteractionService.java
+++ b/core/java/android/service/voice/VoiceInteractionService.java
@@ -519,7 +519,7 @@
@NonNull String keyphrase, @SuppressLint("UseIcu") @NonNull Locale locale,
@NonNull @CallbackExecutor Executor executor,
@NonNull AlwaysOnHotwordDetector.Callback callback) {
- // TODO(b/269080850): Resolve AndroidFrameworkRequiresPermission lint warning
+ // TODO (b/269080850): Resolve AndroidFrameworkRequiresPermission lint warning
Objects.requireNonNull(keyphrase);
Objects.requireNonNull(locale);
@@ -545,10 +545,6 @@
@NonNull SoundTrigger.ModuleProperties moduleProperties,
@NonNull @CallbackExecutor Executor executor,
@NonNull AlwaysOnHotwordDetector.Callback callback) {
- // TODO(b/305787465): Remove the MANAGE_HOTWORD_DETECTION permission enforcement on the
- // {@link #createAlwaysOnHotwordDetectorForTest(String, Locale,
- // SoundTrigger.ModuleProperties, AlwaysOnHotwordDetector.Callback)} and replace with the
- // permission RECEIVE_SANDBOX_TRIGGER_AUDIO when it is fully launched.
Objects.requireNonNull(keyphrase);
Objects.requireNonNull(locale);
@@ -615,11 +611,6 @@
@Nullable PersistableBundle options,
@Nullable SharedMemory sharedMemory,
@SuppressLint("MissingNullability") AlwaysOnHotwordDetector.Callback callback) {
- // TODO(b/305787465): Remove the MANAGE_HOTWORD_DETECTION permission enforcement on the
- // {@link #createAlwaysOnHotwordDetector(String, Locale, PersistableBundle, SharedMemory,
- // AlwaysOnHotwordDetector.Callback)} and replace with the permission
- // RECEIVE_SANDBOX_TRIGGER_AUDIO when it is fully launched.
-
return createAlwaysOnHotwordDetectorInternal(keyphrase, locale,
/* supportHotwordDetectionService= */ true, options, sharedMemory,
/* modulProperties */ null, /* executor= */ null, callback);
@@ -671,11 +662,7 @@
@Nullable PersistableBundle options, @Nullable SharedMemory sharedMemory,
@NonNull @CallbackExecutor Executor executor,
@NonNull AlwaysOnHotwordDetector.Callback callback) {
- // TODO(b/269080850): Resolve AndroidFrameworkRequiresPermission lint warning
- // TODO(b/305787465): Remove the MANAGE_HOTWORD_DETECTION permission enforcement on the
- // {@link #createAlwaysOnHotwordDetector(String, Locale, PersistableBundle, SharedMemory,
- // Executor, AlwaysOnHotwordDetector.Callback)} and replace with the permission
- // RECEIVE_SANDBOX_TRIGGER_AUDIO when it is fully launched.
+ // TODO (b/269080850): Resolve AndroidFrameworkRequiresPermission lint warning
Objects.requireNonNull(keyphrase);
Objects.requireNonNull(locale);
@@ -702,10 +689,6 @@
@NonNull SoundTrigger.ModuleProperties moduleProperties,
@NonNull @CallbackExecutor Executor executor,
@NonNull AlwaysOnHotwordDetector.Callback callback) {
- // TODO(b/305787465): Remove the MANAGE_HOTWORD_DETECTION permission enforcement on the
- // {@link #createAlwaysOnHotwordDetectorForTest(String, Locale, PersistableBundle,
- // SharedMemory, SoundTrigger.ModuleProperties, Executor, AlwaysOnHotwordDetector.Callback)}
- // and replace with the permission RECEIVE_SANDBOX_TRIGGER_AUDIO when it is fully launched.
Objects.requireNonNull(keyphrase);
Objects.requireNonNull(locale);
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index 1e1dd00..5a52968 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -66,7 +66,6 @@
import android.os.IBinder;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
-import android.os.PermissionEnforcer;
import android.os.PersistableBundle;
import android.os.RemoteCallback;
import android.os.RemoteCallbackList;
@@ -76,7 +75,6 @@
import android.os.ShellCallback;
import android.os.Trace;
import android.os.UserHandle;
-import android.permission.flags.Flags;
import android.provider.Settings;
import android.service.voice.IMicrophoneHotwordDetectionVoiceInteractionCallback;
import android.service.voice.IVisualQueryDetectionVoiceInteractionCallback;
@@ -1407,17 +1405,6 @@
}
}
- // Enforce permissions that are flag controlled. The flag value decides if the permission
- // should be enforced.
- private void initAndVerifyDetector_enforcePermissionWithFlags() {
- PermissionEnforcer enforcer = mContext.getSystemService(PermissionEnforcer.class);
- if (Flags.voiceActivationPermissionApis()) {
- enforcer.enforcePermission(
- android.Manifest.permission.RECEIVE_SANDBOX_TRIGGER_AUDIO,
- getCallingPid(), getCallingUid());
- }
- }
-
@android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_HOTWORD_DETECTION)
@Override
public void initAndVerifyDetector(
@@ -1427,13 +1414,7 @@
@NonNull IBinder token,
IHotwordRecognitionStatusCallback callback,
int detectorType) {
- // TODO(b/305787465): Remove the MANAGE_HOTWORD_DETECTION permission enforcement on the
- // {@link #initAndVerifyDetector(Identity, PersistableBundle, ShareMemory, IBinder,
- // IHotwordRecognitionStatusCallback, int)}
- // and replace with the permission RECEIVE_SANDBOX_TRIGGER_AUDIO when it is fully
- // launched.
super.initAndVerifyDetector_enforcePermission();
- initAndVerifyDetector_enforcePermissionWithFlags();
synchronized (this) {
enforceIsCurrentVoiceInteractionService();