Shutdown hotword detection service when software hotword detector is shutdown
Currently we have AlwaysOnHotwordDetector and SoftwareHotwordDetector, when the app creates the detector, it will create a HotwordDetectionConnection to communicate with HotwordDetectionService. Problem: AlwaysOnHotwordDetector will work incorrectly if the app creates SoftwareHotwordDetector first, then creates AlwaysOnHotwordDetector later. A simple flow is that the app created a SoftwareHotwordDetector and used it. After a while, the app may want to use AlwaysOnHotwordDetector, so it will create a new AlwaysOnHotwordDetector. By the original flow, it only allows to keep one detector, so the system will shutdown the old detector(SoftwareHotwordDetector) and create the new detector(AlwaysOnHotwordDetector). Because we don't clear the connection when shutdowning SoftwareHotwordDetector (PS: We clear the connection when shutdowning AlwaysOnHotwordDetector), it will use the previous connection when creating the AlwaysOnHotwordDetector. Root cause: Because we don't shutdown hotword detection service when software hotword detector is shutdown, the new creating AlwaysOnHotwordDetector will use the previous HotwordDetectionConnection to communicate with HotwordDetectionService. Due to the callback in HotwordDetectionConnection is for SoftwareHotwordDetector, it can not pass the right data to AlwaysOnHotwordDetector. Solution: Shutdown hotword detection service when software hotword detector is shutdown. Bug: 195604579 Test: atest CtsVoiceInteractionTestCases Test: atest CtsVoiceInteractionTestCases --instant Test: manual - DSP and non-DSP Change-Id: I999dc4cc9d5ce858127a9b44db261d7abee98929
Loading
Please register or sign in to comment