[automerge] Limit HotwordDetection process number to 10 2p: d47ad7b279

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17344425

Bug: 216095923
Change-Id: Ie875d8f70a3b3918dd11092db101b0767b92fb19
Merged-In: I73d12ad84e2dce108dcc923c6ad400a2a1bdddd6
This commit is contained in:
Presubmit Automerger Backend
2022-03-23 09:08:07 +00:00

View File

@@ -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);