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

Commit dcd208d1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixing issue with play/pause buttons being inverted."

parents 5a0d2115 b0103abf
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -83,9 +83,7 @@ public class PipMediaController {
    private MediaController.Callback mPlaybackChangedListener = new MediaController.Callback() {
        @Override
        public void onPlaybackStateChanged(PlaybackState state) {
            if (!mListeners.isEmpty()) {
                notifyActionsChanged(getMediaActions());
            }
            notifyActionsChanged();
        }
    };

@@ -146,9 +144,9 @@ public class PipMediaController {
        boolean isPlaying = MediaSession.isActiveState(state);
        long actions = mMediaController.getPlaybackState().getActions();
        if (!isPlaying && ((actions & PlaybackState.ACTION_PLAY) != 0)) {
            mediaActions.add(mPauseAction);
        } else if (isPlaying && ((actions & PlaybackState.ACTION_PAUSE) != 0)) {
            mediaActions.add(mPlayAction);
        } else if (isPlaying && ((actions & PlaybackState.ACTION_PAUSE) != 0)) {
            mediaActions.add(mPauseAction);
        }
        return mediaActions;
    }
@@ -202,9 +200,7 @@ public class PipMediaController {
            if (controller != null) {
                controller.registerCallback(mPlaybackChangedListener);
            }
            if (!mListeners.isEmpty()) {
                notifyActionsChanged(getMediaActions());
            }
            notifyActionsChanged();

            // TODO(winsonc): Consider if we want to close the PIP after a timeout (like on TV)
        }
@@ -213,8 +209,9 @@ public class PipMediaController {
    /**
     * Notifies all listeners that the actions have changed.
     */
    private void notifyActionsChanged(List<RemoteAction> actions) {
    private void notifyActionsChanged() {
        if (!mListeners.isEmpty()) {
            List<RemoteAction> actions = getMediaActions();
            mListeners.forEach(l -> l.onMediaActionsChanged(actions));
        }
    }