From 4b9d1fa96366b83b5cf795e4c602793422dec866 Mon Sep 17 00:00:00 2001 From: Joanne Chung Date: Thu, 8 Dec 2022 13:51:50 +0000 Subject: [PATCH] Fix javadoc typo for HotwordDetector classes. Bug: 241041976 Test: build Change-Id: I9ffa1686fe91d5994e77395981967d6d066b5ba9 --- .../voice/AbstractHotwordDetector.java | 20 +------ .../voice/AlwaysOnHotwordDetector.java | 54 +++---------------- .../service/voice/HotwordDetector.java | 14 ++--- 3 files changed, 18 insertions(+), 70 deletions(-) diff --git a/core/java/android/service/voice/AbstractHotwordDetector.java b/core/java/android/service/voice/AbstractHotwordDetector.java index 5d3852b8e81e6..28357efeafd0c 100644 --- a/core/java/android/service/voice/AbstractHotwordDetector.java +++ b/core/java/android/service/voice/AbstractHotwordDetector.java @@ -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( @@ -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 { diff --git a/core/java/android/service/voice/AlwaysOnHotwordDetector.java b/core/java/android/service/voice/AlwaysOnHotwordDetector.java index d58f6d35981f6..320280b9e68be 100644 --- a/core/java/android/service/voice/AlwaysOnHotwordDetector.java +++ b/core/java/android/service/voice/AlwaysOnHotwordDetector.java @@ -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() { } } @@ -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 */ @@ -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) { diff --git a/core/java/android/service/voice/HotwordDetector.java b/core/java/android/service/voice/HotwordDetector.java index 1a0dc8945b631..7112dc6665092 100644 --- a/core/java/android/service/voice/HotwordDetector.java +++ b/core/java/android/service/voice/HotwordDetector.java @@ -96,7 +96,7 @@ public interface HotwordDetector { *

* 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 @@ -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 @@ -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 @@ -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. * *

If there are no other {@link HotwordDetector} instances linked to the * {@link HotwordDetectionService}, the service will be shutdown. @@ -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 @@ -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},