Merge "Add null checking when deleting hotword detectors" into udc-dev

This commit is contained in:
Charles Chen
2023-05-24 05:43:48 +00:00
committed by Android (Google) Code Review

View File

@@ -1066,7 +1066,9 @@ public class VoiceInteractionService extends Service {
synchronized (mLock) {
mActiveDetectors.forEach(detector -> {
try {
if (detector != mActiveVisualQueryDetector.getInitializationDelegate()
// Skip destroying VisualQueryDetector if HotwordDetectors are created
if (!(mActiveVisualQueryDetector != null
&& detector == mActiveVisualQueryDetector.getInitializationDelegate())
|| shouldShutDownVisualQueryDetector) {
detector.destroy();
}