From d47ad7b2791106ec50844698dfd99be1328f3fff Mon Sep 17 00:00:00 2001 From: Sergey Volnov Date: Mon, 24 Jan 2022 18:18:05 +0000 Subject: [PATCH] Limit HotwordDetection process number to 10 Bug: 216095923 Test: existing CTS tests Change-Id: I73d12ad84e2dce108dcc923c6ad400a2a1bdddd6 (cherry picked from commit bef5d91b67799c97b6b119e9e8e6d86da0be7451) (cherry picked from commit 6db1879a192cec789a29507eb4eabd63dbb5fbd7) Merged-in: I73d12ad84e2dce108dcc923c6ad400a2a1bdddd6 --- .../server/voiceinteraction/HotwordDetectionConnection.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java index 823cc07d9f7b4..d7a5f0a52ddf5 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java @@ -115,6 +115,7 @@ final class HotwordDetectionConnection { private static final Duration MAX_UPDATE_TIMEOUT_DURATION = Duration.ofMillis(MAX_UPDATE_TIMEOUT_MILLIS); private static final long RESET_DEBUG_HOTWORD_LOGGING_TIMEOUT_MILLIS = 60 * 60 * 1000; // 1 hour + private static final int MAX_ISOLATED_PROCESS_NUMBER = 10; // Hotword metrics private static final int METRICS_INIT_UNKNOWN_TIMEOUT = @@ -873,7 +874,8 @@ final class HotwordDetectionConnection { ServiceConnection createLocked() { ServiceConnection connection = new ServiceConnection(mContext, mIntent, mBindingFlags, mUser, - IHotwordDetectionService.Stub::asInterface, ++mRestartCount); + IHotwordDetectionService.Stub::asInterface, + mRestartCount++ % MAX_ISOLATED_PROCESS_NUMBER); connection.connect(); updateAudioFlinger(connection, mAudioFlinger);