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

Commit f1f7b861 authored by tim peng's avatar tim peng Committed by Android (Google) Code Review
Browse files

Merge "Transferring to a cast device should not close the output switcher" into rvc-dev

parents f97c675c 6fb40599
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -259,7 +259,9 @@ public class MediaOutputPanel implements PanelContent, LocalMediaManager.DeviceC

        @Override
        public void onPlaybackStateChanged(PlaybackState state) {
            if (mCallback != null && state.getState() != PlaybackState.STATE_PLAYING) {
            final int playState = state.getState();
            if (mCallback != null && (playState == PlaybackState.STATE_STOPPED
                    || playState == PlaybackState.STATE_PAUSED)) {
                mCallback.forceClose();
            }
        }
+15 −0
Original line number Diff line number Diff line
@@ -295,4 +295,19 @@ public class MediaOutputPanelTest {

        verify(mCallback).forceClose();
    }

    @Test
    public void onPlaybackStateChanged_stateFromPlayingToPaused_verifyCallForceClose() {
        mPanel.onStart();
        verify(mMediaController).registerCallback(mControllerCbs.capture());
        final MediaController.Callback controllerCallbacks = mControllerCbs.getValue();
        when(mPlaybackState.getState()).thenReturn(PlaybackState.STATE_PLAYING);
        controllerCallbacks.onPlaybackStateChanged(mPlaybackState);
        verify(mCallback, never()).forceClose();

        when(mPlaybackState.getState()).thenReturn(PlaybackState.STATE_PAUSED);
        controllerCallbacks.onPlaybackStateChanged(mPlaybackState);

        verify(mCallback).forceClose();
    }
}