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

Commit ea7d74a2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Reset HotwordDetectionConnection when VoiceInteractionService crashes"...

Merge "Reset HotwordDetectionConnection when VoiceInteractionService crashes" into sc-dev am: a687e13f am: 584fa3e8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15269082

Change-Id: I37cb99d03770a19d9b54798fec9ab588a81ce68e
parents 69e0fd3d 584fa3e8
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -126,6 +126,9 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
    final ServiceConnection mConnection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            if (DEBUG) {
                Slog.d(TAG, "onServiceConnected to " + name + " for user(" + mUser + ")");
            }
            synchronized (mServiceStub) {
                mService = IVoiceInteractionService.Stub.asInterface(service);
                try {
@@ -137,7 +140,13 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne

        @Override
        public void onServiceDisconnected(ComponentName name) {
            if (DEBUG) {
                Slog.d(TAG, "onServiceDisconnected to " + name);
            }
            synchronized (mServiceStub) {
                mService = null;
                resetHotwordDetectionConnectionLocked();
            }
        }
    };

@@ -575,6 +584,20 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
        mHotwordDetectionConnection.forceRestart();
    }

    void resetHotwordDetectionConnectionLocked() {
        if (DEBUG) {
            Slog.d(TAG, "resetHotwordDetectionConnectionLocked");
        }
        if (mHotwordDetectionConnection == null) {
            if (DEBUG) {
                Slog.w(TAG, "reset, but no hotword detection connection");
            }
            return;
        }
        mHotwordDetectionConnection.cancelLocked();
        mHotwordDetectionConnection = null;
    }

    public void dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args) {
        if (!mValid) {
            pw.print("  NOT VALID: ");