Merge "Add null checking when deleting hotword detectors" into udc-dev
diff --git a/core/java/android/service/voice/VoiceInteractionService.java b/core/java/android/service/voice/VoiceInteractionService.java
index 4b761c1..ab9ae0a 100644
--- a/core/java/android/service/voice/VoiceInteractionService.java
+++ b/core/java/android/service/voice/VoiceInteractionService.java
@@ -1066,7 +1066,9 @@
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();
}