Perform checking for restarting SandboxedDetectionProcesses

SandboxedDetectionServices should not be started unexpectedly if the
service is not specified. This change adds a checking to fix this.

Bug: 265535257
Test: atest CtsVoiceInteractionTestCases
Change-Id: I6143079bbf3288039246ce5f9af27164a84b0958
This commit is contained in:
Charles Chen
2023-01-25 11:44:20 +00:00
parent a95c39d602
commit 57b3fe5ad9

View File

@@ -432,9 +432,15 @@ final class HotwordDetectionConnection {
mLastRestartInstant = Instant.now();
// Recreate connection to reset the cache.
mRemoteHotwordDetectionService = mHotwordDetectionServiceConnectionFactory.createLocked();
mRemoteVisualQueryDetectionService =
mVisualQueryDetectionServiceConnectionFactory.createLocked();
if (oldHotwordConnection != null) {
mRemoteHotwordDetectionService =
mHotwordDetectionServiceConnectionFactory.createLocked();
}
if (oldVisualQueryDetectionConnection != null) {
mRemoteVisualQueryDetectionService =
mVisualQueryDetectionServiceConnectionFactory.createLocked();
}
Slog.v(TAG, "Started the new process, dispatching processRestarted to detector");
runForEachDetectorSessionLocked((session) -> {