Merge changes from topic "hotword-unbind-on-destroy" into udc-dev
* changes: AOHD do not unbind HotwordDetectionService on destroy unbind from HotwordDetectionService when all sessions are destroyed
This commit is contained in:
committed by
Android (Google) Code Review
commit
054c430b7e
@@ -1063,21 +1063,6 @@ public class VoiceInteractionService extends Service {
|
||||
mActiveVisualQueryDetector = null;
|
||||
}
|
||||
mActiveDetectors.remove(detector);
|
||||
shutdownHotwordDetectionServiceIfRequiredLocked();
|
||||
}
|
||||
}
|
||||
|
||||
private void shutdownHotwordDetectionServiceIfRequiredLocked() {
|
||||
for (HotwordDetector detector : mActiveDetectors) {
|
||||
if (detector.isUsingSandboxedDetectionService()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
mSystemService.shutdownHotwordDetectionService();
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -913,8 +913,10 @@ final class HotwordDetectionConnection {
|
||||
}
|
||||
// Handle case where all hotword detector sessions are destroyed with only the visual
|
||||
// detector session left
|
||||
if (mDetectorSessions.size() == 1
|
||||
&& mDetectorSessions.get(0) instanceof VisualQueryDetectorSession) {
|
||||
boolean allHotwordDetectionServiceSessionsRemoved = mDetectorSessions.size() == 0
|
||||
|| (mDetectorSessions.size() == 1 && mDetectorSessions.get(0)
|
||||
instanceof VisualQueryDetectorSession);
|
||||
if (allHotwordDetectionServiceSessionsRemoved) {
|
||||
unbindHotwordDetectionService();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user