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

Commit 8c7aa1f1 authored by Marie Janssen's avatar Marie Janssen Committed by android-build-merger
Browse files

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

am: aae5bbe4

Change-Id: I93fdc396831bd94828fe70a158105f3a4e09d8cb
parents 2db7aff0 aae5bbe4
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);