diff options
| author | 2022-10-25 13:21:16 +0000 | |
|---|---|---|
| committer | 2022-10-25 13:21:16 +0000 | |
| commit | d7f17038f3f148eae6103eb7a5b752c0f7e15cfe (patch) | |
| tree | 28e3e7ef615671657f57c26b505776c4aae39603 | |
| parent | 5568769a3b9285799c59e8ac2eb1d2d981790f22 (diff) | |
Correct VALIDATION_TIMEOUT_MILLIS value to 3000 ms
By trusted hotword design doc, the VALIDATION_TIMEOUT_MILLIS value
should be 3000 ms. We correct the VALIDATION_TIMEOUT_MILLIS.
Test: atest CtsVoiceInteractionTestCases
Bug: 193232191
Change-Id: I4e8f3fbaeb305373e4b964a45e5e26b3e3684bd5
| -rw-r--r-- | services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java index 921f6e20c3ad..372fdaf08bf9 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java @@ -129,7 +129,10 @@ final class HotwordDetectionConnection { private static final String KEY_RESTART_PERIOD_IN_SECONDS = "restart_period_in_seconds"; // TODO: These constants need to be refined. - private static final long VALIDATION_TIMEOUT_MILLIS = 4000; + // The validation timeout value is 3 seconds for onDetect of DSP trigger event. + private static final long VALIDATION_TIMEOUT_MILLIS = 3000; + // Write the onDetect timeout metric when it takes more time than MAX_VALIDATION_TIMEOUT_MILLIS. + private static final long MAX_VALIDATION_TIMEOUT_MILLIS = 4000; private static final long MAX_UPDATE_TIMEOUT_MILLIS = 30000; private static final long EXTERNAL_HOTWORD_CLEANUP_MILLIS = 2000; private static final Duration MAX_UPDATE_TIMEOUT_DURATION = @@ -659,6 +662,10 @@ final class HotwordDetectionConnection { synchronized (mLock) { mValidatingDspTrigger = true; mRemoteHotwordDetectionService.run(service -> { + // We use the VALIDATION_TIMEOUT_MILLIS to inform that the client needs to invoke + // the callback before timeout value. In order to reduce the latency impact between + // server side and client side, we need to use another timeout value + // MAX_VALIDATION_TIMEOUT_MILLIS to monitor it. mCancellationKeyPhraseDetectionFuture = mScheduledExecutorService.schedule( () -> { // TODO: avoid allocate every time @@ -673,7 +680,7 @@ final class HotwordDetectionConnection { Slog.w(TAG, "Failed to report onError status: ", e); } }, - VALIDATION_TIMEOUT_MILLIS, + MAX_VALIDATION_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); service.detectFromDspSource( recognitionEvent, |