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

Commit 8d843cea authored by Christoph Studer's avatar Christoph Studer Committed by Android Git Automerger
Browse files

am 5a7068ee: Merge "SysUI: Correctly compare MediaControllers" into lmp-dev

* commit '5a7068eec454df33575176d9f4ee58de577a6401':
  SysUI: Correctly compare MediaControllers
parents 651def48 231dc0a6
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -434,6 +434,14 @@ public final class MediaController {
        return mSessionBinder;
        return mSessionBinder;
    }
    }


    /**
     * @hide
     */
    public boolean controlsSameSession(MediaController other) {
        if (other == null) return false;
        return mSessionBinder.asBinder() == other.getSessionBinder().asBinder();
    }

    private void addCallbackLocked(Callback cb, Handler handler) {
    private void addCallbackLocked(Callback cb, Handler handler) {
        if (getHandlerForCallbackLocked(cb) != null) {
        if (getHandlerForCallbackLocked(cb) != null) {
            Log.w(TAG, "Callback is already added, ignoring");
            Log.w(TAG, "Callback is already added, ignoring");
+7 −1
Original line number Original line Diff line number Diff line
@@ -1758,7 +1758,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                }
                }
            }
            }


            if (controller != mMediaController) {
            if (!sameSessions(mMediaController, controller)) {
                // We have a new media session
                // We have a new media session


                if (mMediaController != null) {
                if (mMediaController != null) {
@@ -1807,6 +1807,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        updateMediaMetaData(metaDataChanged);
        updateMediaMetaData(metaDataChanged);
    }
    }


    private boolean sameSessions(MediaController a, MediaController b) {
        if (a == b) return true;
        if (a == null) return false;
        return a.controlsSameSession(b);
    }

    /**
    /**
     * Hide the album artwork that is fading out and release its bitmap.
     * Hide the album artwork that is fading out and release its bitmap.
     */
     */