diff options
| author | 2022-10-26 08:02:26 +0000 | |
|---|---|---|
| committer | 2022-10-26 08:02:26 +0000 | |
| commit | d589ad6a8889c0114e07734d85310a57f1a78f4c (patch) | |
| tree | fc1906732226143bc0fe688b8990a44d457aaa3e | |
| parent | ed3a1137d42a5790b30f93725cae1dd1e7965558 (diff) | |
| parent | d7f17038f3f148eae6103eb7a5b752c0f7e15cfe (diff) | |
Merge "Correct VALIDATION_TIMEOUT_MILLIS value to 3000 ms"
| -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, |