Loading core/java/android/service/voice/VoiceInteractionService.java +19 −2 Original line number Diff line number Diff line Loading @@ -546,6 +546,10 @@ public class VoiceInteractionService extends Service { @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); Loading Loading @@ -612,6 +616,11 @@ public class VoiceInteractionService extends Service { @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); Loading Loading @@ -664,6 +673,10 @@ public class VoiceInteractionService extends Service { @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. Objects.requireNonNull(keyphrase); Objects.requireNonNull(locale); Loading @@ -690,6 +703,10 @@ public class VoiceInteractionService extends Service { @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); Loading services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +19 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import android.os.Handler; 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; Loading @@ -67,6 +68,7 @@ import android.os.SharedMemory; 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; Loading Loading @@ -1286,6 +1288,17 @@ public class VoiceInteractionManagerService extends SystemService { } } // 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( Loading @@ -1295,7 +1308,13 @@ public class VoiceInteractionManagerService extends SystemService { @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(); Loading Loading
core/java/android/service/voice/VoiceInteractionService.java +19 −2 Original line number Diff line number Diff line Loading @@ -546,6 +546,10 @@ public class VoiceInteractionService extends Service { @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); Loading Loading @@ -612,6 +616,11 @@ public class VoiceInteractionService extends Service { @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); Loading Loading @@ -664,6 +673,10 @@ public class VoiceInteractionService extends Service { @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. Objects.requireNonNull(keyphrase); Objects.requireNonNull(locale); Loading @@ -690,6 +703,10 @@ public class VoiceInteractionService extends Service { @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); Loading
services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +19 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import android.os.Handler; 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; Loading @@ -67,6 +68,7 @@ import android.os.SharedMemory; 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; Loading Loading @@ -1286,6 +1288,17 @@ public class VoiceInteractionManagerService extends SystemService { } } // 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( Loading @@ -1295,7 +1308,13 @@ public class VoiceInteractionManagerService extends SystemService { @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(); Loading