Loading core/java/android/service/voice/VoiceInteractionService.java +8 −5 Original line number Diff line number Diff line Loading @@ -389,7 +389,7 @@ public class VoiceInteractionService extends Service { // It's still guaranteed to have been stopped. // This helps with cases where the voice interaction implementation is changed // by the user. safelyShutdownAllHotwordDetectors(); safelyShutdownAllHotwordDetectors(true); } /** Loading Loading @@ -715,7 +715,7 @@ public class VoiceInteractionService extends Service { synchronized (mLock) { if (!CompatChanges.isChangeEnabled(MULTIPLE_ACTIVE_HOTWORD_DETECTORS)) { // Allow only one concurrent recognition via the APIs. safelyShutdownAllHotwordDetectors(); safelyShutdownAllHotwordDetectors(false); } else { for (HotwordDetector detector : mActiveDetectors) { if (detector.isUsingSandboxedDetectionService() Loading Loading @@ -878,7 +878,7 @@ public class VoiceInteractionService extends Service { synchronized (mLock) { if (!CompatChanges.isChangeEnabled(MULTIPLE_ACTIVE_HOTWORD_DETECTORS)) { // Allow only one concurrent recognition via the APIs. safelyShutdownAllHotwordDetectors(); safelyShutdownAllHotwordDetectors(false); } else { for (HotwordDetector detector : mActiveDetectors) { if (!detector.isUsingSandboxedDetectionService()) { Loading Loading @@ -1062,11 +1062,14 @@ public class VoiceInteractionService extends Service { return mKeyphraseEnrollmentInfo.getKeyphraseMetadata(keyphrase, locale) != null; } private void safelyShutdownAllHotwordDetectors() { private void safelyShutdownAllHotwordDetectors(boolean shouldShutDownVisualQueryDetector) { synchronized (mLock) { mActiveDetectors.forEach(detector -> { try { if (detector != mActiveVisualQueryDetector.getInitializationDelegate() || shouldShutDownVisualQueryDetector) { detector.destroy(); } } catch (Exception ex) { Log.i(TAG, "exception destroying HotwordDetector", ex); } Loading Loading
core/java/android/service/voice/VoiceInteractionService.java +8 −5 Original line number Diff line number Diff line Loading @@ -389,7 +389,7 @@ public class VoiceInteractionService extends Service { // It's still guaranteed to have been stopped. // This helps with cases where the voice interaction implementation is changed // by the user. safelyShutdownAllHotwordDetectors(); safelyShutdownAllHotwordDetectors(true); } /** Loading Loading @@ -715,7 +715,7 @@ public class VoiceInteractionService extends Service { synchronized (mLock) { if (!CompatChanges.isChangeEnabled(MULTIPLE_ACTIVE_HOTWORD_DETECTORS)) { // Allow only one concurrent recognition via the APIs. safelyShutdownAllHotwordDetectors(); safelyShutdownAllHotwordDetectors(false); } else { for (HotwordDetector detector : mActiveDetectors) { if (detector.isUsingSandboxedDetectionService() Loading Loading @@ -878,7 +878,7 @@ public class VoiceInteractionService extends Service { synchronized (mLock) { if (!CompatChanges.isChangeEnabled(MULTIPLE_ACTIVE_HOTWORD_DETECTORS)) { // Allow only one concurrent recognition via the APIs. safelyShutdownAllHotwordDetectors(); safelyShutdownAllHotwordDetectors(false); } else { for (HotwordDetector detector : mActiveDetectors) { if (!detector.isUsingSandboxedDetectionService()) { Loading Loading @@ -1062,11 +1062,14 @@ public class VoiceInteractionService extends Service { return mKeyphraseEnrollmentInfo.getKeyphraseMetadata(keyphrase, locale) != null; } private void safelyShutdownAllHotwordDetectors() { private void safelyShutdownAllHotwordDetectors(boolean shouldShutDownVisualQueryDetector) { synchronized (mLock) { mActiveDetectors.forEach(detector -> { try { if (detector != mActiveVisualQueryDetector.getInitializationDelegate() || shouldShutDownVisualQueryDetector) { detector.destroy(); } } catch (Exception ex) { Log.i(TAG, "exception destroying HotwordDetector", ex); } Loading