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

Commit aae5bbe4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "AVRCP: Fix crash when app change during shutdown"

parents 5a142ac8 8336dbda
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -334,16 +334,18 @@ public final class Avrcp {

    public void doQuit() {
        if (DEBUG) Log.d(TAG, "doQuit");
        if (mMediaController != null) mMediaController.unregisterCallback(mMediaControllerCb);
        if (mMediaSessionManager != null) {
            mMediaSessionManager.setCallback(null, null);
            mMediaSessionManager.removeOnActiveSessionsChangedListener(mActiveSessionListener);
        }

        mHandler.removeCallbacksAndMessages(null);
        Looper looper = mHandler.getLooper();
        if (looper != null) {
            looper.quit();
        }

        if (mMediaController != null) mMediaController.unregisterCallback(mMediaControllerCb);

        mMediaSessionManager.removeOnActiveSessionsChangedListener(mActiveSessionListener);

        mHandler = null;
        mContext.unregisterReceiver(mAvrcpReceiver);
        mContext.unregisterReceiver(mBootReceiver);