Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b923cbee authored by Nicholas Ambur's avatar Nicholas Ambur Committed by Automerger Merge Worker
Browse files

Merge changes from topic "hotword-unbind-on-destroy" into udc-dev am: 054c430b

parents 5aec21e3 054c430b
Loading
Loading
Loading
Loading
+0 −15
Original line number Original line Diff line number Diff line
@@ -1063,21 +1063,6 @@ public class VoiceInteractionService extends Service {
                mActiveVisualQueryDetector = null;
                mActiveVisualQueryDetector = null;
            }
            }
            mActiveDetectors.remove(detector);
            mActiveDetectors.remove(detector);
            shutdownHotwordDetectionServiceIfRequiredLocked();
        }
    }

    private void shutdownHotwordDetectionServiceIfRequiredLocked() {
        for (HotwordDetector detector : mActiveDetectors) {
            if (detector.isUsingSandboxedDetectionService()) {
                return;
            }
        }

        try {
            mSystemService.shutdownHotwordDetectionService();
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
        }
    }
    }


+4 −2
Original line number Original line Diff line number Diff line
@@ -913,8 +913,10 @@ final class HotwordDetectionConnection {
        }
        }
        // Handle case where all hotword detector sessions are destroyed with only the visual
        // Handle case where all hotword detector sessions are destroyed with only the visual
        // detector session left
        // detector session left
        if (mDetectorSessions.size() == 1
        boolean allHotwordDetectionServiceSessionsRemoved = mDetectorSessions.size() == 0
                && mDetectorSessions.get(0) instanceof VisualQueryDetectorSession) {
                || (mDetectorSessions.size() == 1 && mDetectorSessions.get(0)
                instanceof VisualQueryDetectorSession);
        if (allHotwordDetectionServiceSessionsRemoved) {
            unbindHotwordDetectionService();
            unbindHotwordDetectionService();
        }
        }
    }
    }