Loading core/java/android/service/voice/AbstractHotwordDetector.java +2 −18 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ abstract class AbstractHotwordDetector implements HotwordDetector { /** * Detect hotword from an externally supplied stream of data. * * @return true if the request to start recognition succeeded * @return {@code true} if the request to start recognition succeeded */ @Override public boolean startRecognition( Loading @@ -102,23 +102,7 @@ abstract class AbstractHotwordDetector implements HotwordDetector { return true; } /** * Set configuration and pass read-only data to hotword detection service. * * @param options Application configuration data to provide to the * {@link HotwordDetectionService}. PersistableBundle does not allow any remotable * objects or other contents that can be used to communicate with other processes. * @param sharedMemory The unrestricted data blob to provide to the * {@link HotwordDetectionService}. Use this to provide the hotword models data or other * such data to the trusted process. * @throws IllegalDetectorStateException Thrown when a caller has a target SDK of * Android Tiramisu or above and attempts to start a recognition when the detector is * not able based on the state. Because the caller receives updates via an asynchronous * callback and the state of the detector can change without caller's knowledge, a * checked exception is thrown. * @throws IllegalStateException if this HotwordDetector wasn't specified to use a * {@link HotwordDetectionService} when it was created. */ /** {@inheritDoc} */ @Override public void updateState(@Nullable PersistableBundle options, @Nullable SharedMemory sharedMemory) throws IllegalDetectorStateException { Loading core/java/android/service/voice/AlwaysOnHotwordDetector.java +8 −46 Original line number Diff line number Diff line Loading @@ -728,53 +728,24 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { */ public abstract void onDetected(@NonNull EventPayload eventPayload); /** * Called when the detection fails due to an error. */ /** {@inheritDoc} */ public abstract void onError(); /** * Called when the recognition is paused temporarily for some reason. * This is an informational callback, and the clients shouldn't be doing anything here * except showing an indication on their UI if they have to. */ /** {@inheritDoc} */ public abstract void onRecognitionPaused(); /** * Called when the recognition is resumed after it was temporarily paused. * This is an informational callback, and the clients shouldn't be doing anything here * except showing an indication on their UI if they have to. */ /** {@inheritDoc} */ public abstract void onRecognitionResumed(); /** * Called when the {@link HotwordDetectionService second stage detection} did not detect the * keyphrase. * * @param result Info about the second stage detection result, provided by the * {@link HotwordDetectionService}. */ /** {@inheritDoc} */ public void onRejected(@NonNull HotwordRejectedResult result) { } /** * Called when the {@link HotwordDetectionService} is created by the system and given a * short amount of time to report it's initialization state. * * @param status Info about initialization state of {@link HotwordDetectionService}; the * allowed values are {@link HotwordDetectionService#INITIALIZATION_STATUS_SUCCESS}, * 1<->{@link HotwordDetectionService#getMaxCustomInitializationStatus()}, * {@link HotwordDetectionService#INITIALIZATION_STATUS_UNKNOWN}. */ /** {@inheritDoc} */ public void onHotwordDetectionServiceInitialized(int status) { } /** * Called with the {@link HotwordDetectionService} is restarted. * * Clients are expected to call {@link HotwordDetector#updateState} to share the state with * the newly created service. */ /** {@inheritDoc} */ public void onHotwordDetectionServiceRestarted() { } } Loading @@ -785,14 +756,8 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { * @param callback A non-null Callback for receiving the recognition events. * @param modelManagementService A service that allows management of sound models. * @param targetSdkVersion The target SDK version. * @param supportHotwordDetectionService {@code true} if hotword detection service should be * @param supportHotwordDetectionService {@code true} if HotwordDetectionService should be * triggered, otherwise {@code false}. * @param options Application configuration data provided by the * {@link VoiceInteractionService}. PersistableBundle does not allow any remotable objects or * other contents that can be used to communicate with other processes. * @param sharedMemory The unrestricted data blob provided by the * {@link VoiceInteractionService}. Use this to provide the hotword models data or other * such data to the trusted process. * * @hide */ Loading Loading @@ -1422,10 +1387,7 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { return mKeyphraseEnrollmentInfo.getManageKeyphraseIntent(action, mText, mLocale); } /** * Invalidates this hotword detector so that any future calls to this result * in an IllegalStateException. */ /** {@inheritDoc} */ @Override public void destroy() { synchronized (mLock) { Loading core/java/android/service/voice/HotwordDetector.java +8 −6 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ public interface HotwordDetector { * <p> * Calling this again while recognition is active does nothing. * * @return true if the request to start recognition succeeded * @return {@code true} if the request to start recognition succeeded * @throws IllegalDetectorStateException Thrown when a caller has a target SDK of API level 33 * or above and attempts to start a recognition when the detector is not able based on * the state. This can be thrown even if the state has been checked before calling this Loading @@ -109,7 +109,7 @@ public interface HotwordDetector { /** * Stops hotword recognition. * * @return true if the request to stop recognition succeeded * @return {@code true} if the request to stop recognition succeeded * @throws IllegalDetectorStateException Thrown when a caller has a target SDK of API level 33 * or above and attempts to stop a recognition when the detector is not able based on * the state. This can be thrown even if the state has been checked before calling this Loading @@ -129,7 +129,7 @@ public interface HotwordDetector { * source of the audio. This will be provided to the {@link HotwordDetectionService}. * PersistableBundle does not allow any remotable objects or other contents that can be * used to communicate with other processes. * @return true if the request to start recognition succeeded * @return {@code true} if the request to start recognition succeeded * @throws IllegalDetectorStateException Thrown when a caller has a target SDK of API level 33 * or above and attempts to start a recognition when the detector is not able based on * the state. This can be thrown even if the state has been checked before calling this Loading Loading @@ -164,7 +164,9 @@ public interface HotwordDetector { /** * Invalidates this hotword detector so that any future calls to this result * in an {@link IllegalStateException}. * in an {@link IllegalStateException} when a caller has a target SDK below API level 33 * or an {@link IllegalDetectorStateException} when a caller has a target SDK of API level 33 * or above. * * <p>If there are no other {@link HotwordDetector} instances linked to the * {@link HotwordDetectionService}, the service will be shutdown. Loading Loading @@ -234,7 +236,7 @@ public interface HotwordDetector { void onRecognitionResumed(); /** * Called when the {@link HotwordDetectionService second stage detection} did not detect the * Called when the {@link HotwordDetectionService} second stage detection did not detect the * keyphrase. * * @param result Info about the second stage detection result, provided by the Loading @@ -244,7 +246,7 @@ public interface HotwordDetector { /** * Called when the {@link HotwordDetectionService} is created by the system and given a * short amount of time to report it's initialization state. * short amount of time to report its initialization state. * * @param status Info about initialization state of {@link HotwordDetectionService}; the * allowed values are {@link HotwordDetectionService#INITIALIZATION_STATUS_SUCCESS}, Loading Loading
core/java/android/service/voice/AbstractHotwordDetector.java +2 −18 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ abstract class AbstractHotwordDetector implements HotwordDetector { /** * Detect hotword from an externally supplied stream of data. * * @return true if the request to start recognition succeeded * @return {@code true} if the request to start recognition succeeded */ @Override public boolean startRecognition( Loading @@ -102,23 +102,7 @@ abstract class AbstractHotwordDetector implements HotwordDetector { return true; } /** * Set configuration and pass read-only data to hotword detection service. * * @param options Application configuration data to provide to the * {@link HotwordDetectionService}. PersistableBundle does not allow any remotable * objects or other contents that can be used to communicate with other processes. * @param sharedMemory The unrestricted data blob to provide to the * {@link HotwordDetectionService}. Use this to provide the hotword models data or other * such data to the trusted process. * @throws IllegalDetectorStateException Thrown when a caller has a target SDK of * Android Tiramisu or above and attempts to start a recognition when the detector is * not able based on the state. Because the caller receives updates via an asynchronous * callback and the state of the detector can change without caller's knowledge, a * checked exception is thrown. * @throws IllegalStateException if this HotwordDetector wasn't specified to use a * {@link HotwordDetectionService} when it was created. */ /** {@inheritDoc} */ @Override public void updateState(@Nullable PersistableBundle options, @Nullable SharedMemory sharedMemory) throws IllegalDetectorStateException { Loading
core/java/android/service/voice/AlwaysOnHotwordDetector.java +8 −46 Original line number Diff line number Diff line Loading @@ -728,53 +728,24 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { */ public abstract void onDetected(@NonNull EventPayload eventPayload); /** * Called when the detection fails due to an error. */ /** {@inheritDoc} */ public abstract void onError(); /** * Called when the recognition is paused temporarily for some reason. * This is an informational callback, and the clients shouldn't be doing anything here * except showing an indication on their UI if they have to. */ /** {@inheritDoc} */ public abstract void onRecognitionPaused(); /** * Called when the recognition is resumed after it was temporarily paused. * This is an informational callback, and the clients shouldn't be doing anything here * except showing an indication on their UI if they have to. */ /** {@inheritDoc} */ public abstract void onRecognitionResumed(); /** * Called when the {@link HotwordDetectionService second stage detection} did not detect the * keyphrase. * * @param result Info about the second stage detection result, provided by the * {@link HotwordDetectionService}. */ /** {@inheritDoc} */ public void onRejected(@NonNull HotwordRejectedResult result) { } /** * Called when the {@link HotwordDetectionService} is created by the system and given a * short amount of time to report it's initialization state. * * @param status Info about initialization state of {@link HotwordDetectionService}; the * allowed values are {@link HotwordDetectionService#INITIALIZATION_STATUS_SUCCESS}, * 1<->{@link HotwordDetectionService#getMaxCustomInitializationStatus()}, * {@link HotwordDetectionService#INITIALIZATION_STATUS_UNKNOWN}. */ /** {@inheritDoc} */ public void onHotwordDetectionServiceInitialized(int status) { } /** * Called with the {@link HotwordDetectionService} is restarted. * * Clients are expected to call {@link HotwordDetector#updateState} to share the state with * the newly created service. */ /** {@inheritDoc} */ public void onHotwordDetectionServiceRestarted() { } } Loading @@ -785,14 +756,8 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { * @param callback A non-null Callback for receiving the recognition events. * @param modelManagementService A service that allows management of sound models. * @param targetSdkVersion The target SDK version. * @param supportHotwordDetectionService {@code true} if hotword detection service should be * @param supportHotwordDetectionService {@code true} if HotwordDetectionService should be * triggered, otherwise {@code false}. * @param options Application configuration data provided by the * {@link VoiceInteractionService}. PersistableBundle does not allow any remotable objects or * other contents that can be used to communicate with other processes. * @param sharedMemory The unrestricted data blob provided by the * {@link VoiceInteractionService}. Use this to provide the hotword models data or other * such data to the trusted process. * * @hide */ Loading Loading @@ -1422,10 +1387,7 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { return mKeyphraseEnrollmentInfo.getManageKeyphraseIntent(action, mText, mLocale); } /** * Invalidates this hotword detector so that any future calls to this result * in an IllegalStateException. */ /** {@inheritDoc} */ @Override public void destroy() { synchronized (mLock) { Loading
core/java/android/service/voice/HotwordDetector.java +8 −6 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ public interface HotwordDetector { * <p> * Calling this again while recognition is active does nothing. * * @return true if the request to start recognition succeeded * @return {@code true} if the request to start recognition succeeded * @throws IllegalDetectorStateException Thrown when a caller has a target SDK of API level 33 * or above and attempts to start a recognition when the detector is not able based on * the state. This can be thrown even if the state has been checked before calling this Loading @@ -109,7 +109,7 @@ public interface HotwordDetector { /** * Stops hotword recognition. * * @return true if the request to stop recognition succeeded * @return {@code true} if the request to stop recognition succeeded * @throws IllegalDetectorStateException Thrown when a caller has a target SDK of API level 33 * or above and attempts to stop a recognition when the detector is not able based on * the state. This can be thrown even if the state has been checked before calling this Loading @@ -129,7 +129,7 @@ public interface HotwordDetector { * source of the audio. This will be provided to the {@link HotwordDetectionService}. * PersistableBundle does not allow any remotable objects or other contents that can be * used to communicate with other processes. * @return true if the request to start recognition succeeded * @return {@code true} if the request to start recognition succeeded * @throws IllegalDetectorStateException Thrown when a caller has a target SDK of API level 33 * or above and attempts to start a recognition when the detector is not able based on * the state. This can be thrown even if the state has been checked before calling this Loading Loading @@ -164,7 +164,9 @@ public interface HotwordDetector { /** * Invalidates this hotword detector so that any future calls to this result * in an {@link IllegalStateException}. * in an {@link IllegalStateException} when a caller has a target SDK below API level 33 * or an {@link IllegalDetectorStateException} when a caller has a target SDK of API level 33 * or above. * * <p>If there are no other {@link HotwordDetector} instances linked to the * {@link HotwordDetectionService}, the service will be shutdown. Loading Loading @@ -234,7 +236,7 @@ public interface HotwordDetector { void onRecognitionResumed(); /** * Called when the {@link HotwordDetectionService second stage detection} did not detect the * Called when the {@link HotwordDetectionService} second stage detection did not detect the * keyphrase. * * @param result Info about the second stage detection result, provided by the Loading @@ -244,7 +246,7 @@ public interface HotwordDetector { /** * Called when the {@link HotwordDetectionService} is created by the system and given a * short amount of time to report it's initialization state. * short amount of time to report its initialization state. * * @param status Info about initialization state of {@link HotwordDetectionService}; the * allowed values are {@link HotwordDetectionService#INITIALIZATION_STATUS_SUCCESS}, Loading