Loading core/java/android/service/voice/AlwaysOnHotwordDetector.java +28 −12 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import android.annotation.SystemApi; import android.annotation.TestApi; import android.app.ActivityThread; import android.app.compat.CompatChanges; import android.compat.annotation.ChangeId; import android.compat.annotation.EnabledSince; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.Intent; Loading Loading @@ -257,6 +259,16 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { }) public @interface ModelParams {} /** * Gates returning {@code IllegalStateException} in {@link #initialize( * PersistableBundle, SharedMemory, SoundTrigger.ModuleProperties)} when no DSP module * is available. If the change is not enabled, the existing behavior of not throwing an * exception and delivering {@link STATE_HARDWARE_UNAVAILABLE} is retained. */ @ChangeId @EnabledSince(targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE) static final long THROW_ON_INITIALIZE_IF_NO_DSP = 269165460L; /** * Controls the sensitivity threshold adjustment factor for a given model. * Negative value corresponds to less sensitive model (high threshold) and Loading Loading @@ -870,8 +882,10 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { .equals(SoundTrigger.FAKE_HAL_ARCH)) .findFirst() .orElse(null); // (@atneya) intentionally let a null moduleProperties through until // all CTS tests are fixed if (CompatChanges.isChangeEnabled(THROW_ON_INITIALIZE_IF_NO_DSP) && moduleProperties == null) { throw new IllegalStateException("No DSP module available to attach to"); } } mSoundTriggerSession = mModelManagementService.createSoundTriggerSessionAsOriginator( Loading Loading @@ -1753,6 +1767,7 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { } } if (!CompatChanges.isChangeEnabled(THROW_ON_INITIALIZE_IF_NO_DSP)) { ModuleProperties dspModuleProperties; try { dspModuleProperties = Loading @@ -1765,6 +1780,7 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { if (dspModuleProperties == null) { return STATE_HARDWARE_UNAVAILABLE; } } return STATE_NOT_READY; } Loading core/java/android/service/voice/VoiceInteractionService.java +18 −0 Original line number Diff line number Diff line Loading @@ -463,6 +463,10 @@ public class VoiceInteractionService extends Service { * @param callback The callback to notify of detection events. * @return An always-on hotword detector for the given keyphrase and locale. * * @throws SecurityException if the caller does not hold required permissions * @throws IllegalStateException if there is no DSP hardware support when a caller has a * target SDK of API level 34 or above. * * @deprecated Use {@link #createAlwaysOnHotwordDetector(String, Locale, Executor, * AlwaysOnHotwordDetector.Callback)} instead. * @hide Loading Loading @@ -500,6 +504,10 @@ public class VoiceInteractionService extends Service { * @param callback The callback to notify of detection events. * @return An always-on hotword detector for the given keyphrase and locale. * * @throws SecurityException if the caller does not hold required permissions * @throws IllegalStateException if there is no DSP hardware support when a caller has a * target SDK of API level 34 or above. * * @hide */ @SystemApi Loading Loading @@ -581,6 +589,11 @@ public class VoiceInteractionService extends Service { * @param callback The callback to notify of detection events. * @return An always-on hotword detector for the given keyphrase and locale. * * @throws SecurityException if the caller does not hold required permissions * @throws IllegalStateException if the hotword detection service is not set, isolated process * is not set, or there is no DSP hardware support when a caller has a target SDK of API * level 34 or above. * * @deprecated Use {@link #createAlwaysOnHotwordDetector(String, Locale, PersistableBundle, * SharedMemory, Executor, AlwaysOnHotwordDetector.Callback)} instead. * @hide Loading Loading @@ -631,6 +644,11 @@ public class VoiceInteractionService extends Service { * @param callback The callback to notify of detection events. * @return An always-on hotword detector for the given keyphrase and locale. * * @throws SecurityException if the caller does not hold required permissions * @throws IllegalStateException if the hotword detection service is not set, isolated process * is not set, or there is no DSP hardware support when a caller has a target SDK of API level * 34 or above. * * @hide */ @SystemApi Loading Loading
core/java/android/service/voice/AlwaysOnHotwordDetector.java +28 −12 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import android.annotation.SystemApi; import android.annotation.TestApi; import android.app.ActivityThread; import android.app.compat.CompatChanges; import android.compat.annotation.ChangeId; import android.compat.annotation.EnabledSince; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.Intent; Loading Loading @@ -257,6 +259,16 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { }) public @interface ModelParams {} /** * Gates returning {@code IllegalStateException} in {@link #initialize( * PersistableBundle, SharedMemory, SoundTrigger.ModuleProperties)} when no DSP module * is available. If the change is not enabled, the existing behavior of not throwing an * exception and delivering {@link STATE_HARDWARE_UNAVAILABLE} is retained. */ @ChangeId @EnabledSince(targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE) static final long THROW_ON_INITIALIZE_IF_NO_DSP = 269165460L; /** * Controls the sensitivity threshold adjustment factor for a given model. * Negative value corresponds to less sensitive model (high threshold) and Loading Loading @@ -870,8 +882,10 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { .equals(SoundTrigger.FAKE_HAL_ARCH)) .findFirst() .orElse(null); // (@atneya) intentionally let a null moduleProperties through until // all CTS tests are fixed if (CompatChanges.isChangeEnabled(THROW_ON_INITIALIZE_IF_NO_DSP) && moduleProperties == null) { throw new IllegalStateException("No DSP module available to attach to"); } } mSoundTriggerSession = mModelManagementService.createSoundTriggerSessionAsOriginator( Loading Loading @@ -1753,6 +1767,7 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { } } if (!CompatChanges.isChangeEnabled(THROW_ON_INITIALIZE_IF_NO_DSP)) { ModuleProperties dspModuleProperties; try { dspModuleProperties = Loading @@ -1765,6 +1780,7 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { if (dspModuleProperties == null) { return STATE_HARDWARE_UNAVAILABLE; } } return STATE_NOT_READY; } Loading
core/java/android/service/voice/VoiceInteractionService.java +18 −0 Original line number Diff line number Diff line Loading @@ -463,6 +463,10 @@ public class VoiceInteractionService extends Service { * @param callback The callback to notify of detection events. * @return An always-on hotword detector for the given keyphrase and locale. * * @throws SecurityException if the caller does not hold required permissions * @throws IllegalStateException if there is no DSP hardware support when a caller has a * target SDK of API level 34 or above. * * @deprecated Use {@link #createAlwaysOnHotwordDetector(String, Locale, Executor, * AlwaysOnHotwordDetector.Callback)} instead. * @hide Loading Loading @@ -500,6 +504,10 @@ public class VoiceInteractionService extends Service { * @param callback The callback to notify of detection events. * @return An always-on hotword detector for the given keyphrase and locale. * * @throws SecurityException if the caller does not hold required permissions * @throws IllegalStateException if there is no DSP hardware support when a caller has a * target SDK of API level 34 or above. * * @hide */ @SystemApi Loading Loading @@ -581,6 +589,11 @@ public class VoiceInteractionService extends Service { * @param callback The callback to notify of detection events. * @return An always-on hotword detector for the given keyphrase and locale. * * @throws SecurityException if the caller does not hold required permissions * @throws IllegalStateException if the hotword detection service is not set, isolated process * is not set, or there is no DSP hardware support when a caller has a target SDK of API * level 34 or above. * * @deprecated Use {@link #createAlwaysOnHotwordDetector(String, Locale, PersistableBundle, * SharedMemory, Executor, AlwaysOnHotwordDetector.Callback)} instead. * @hide Loading Loading @@ -631,6 +644,11 @@ public class VoiceInteractionService extends Service { * @param callback The callback to notify of detection events. * @return An always-on hotword detector for the given keyphrase and locale. * * @throws SecurityException if the caller does not hold required permissions * @throws IllegalStateException if the hotword detection service is not set, isolated process * is not set, or there is no DSP hardware support when a caller has a target SDK of API level * 34 or above. * * @hide */ @SystemApi Loading