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

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

Merge "HDMI: Do not re-send <Set Stream Path> when selected path is active" into main

parents 13a778e5 dc7e9725
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -167,7 +167,11 @@ final class DeviceSelectActionFromTv extends HdmiCecFeatureAction {
    private boolean handleReportPowerStatus(int powerStatus) {
        switch (powerStatus) {
            case HdmiControlManager.POWER_STATUS_ON:
                if (tv().getActiveSource().physicalAddress == mTarget.getPhysicalAddress()) {
                    finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
                } else {
                    selectDevice();
                }
                return true;
            case HdmiControlManager.POWER_STATUS_TRANSIENT_TO_STANDBY:
                if (mPowerStatusCounter < 4) {
+29 −0
Original line number Diff line number Diff line
@@ -250,6 +250,35 @@ public class DeviceSelectActionFromTvTest {
        assertThat(callback.getResult()).isEqualTo(HdmiControlManager.RESULT_SUCCESS);
    }

    @Test
    public void testDeviceSelect_DeviceAssertsActiveSource_singleSetStreamPathMessage() {
        // TV was watching playback2 device connected at port 2, and wants to select
        // playback1.
        TestActionTimer actionTimer = new TestActionTimer();
        TestCallback callback = new TestCallback();
        DeviceSelectActionFromTv action = createDeviceSelectAction(actionTimer, callback,
                /*isCec20=*/false);
        mHdmiCecLocalDeviceTv.updateActiveSource(ADDR_PLAYBACK_2, PHYSICAL_ADDRESS_PLAYBACK_2,
                "testDeviceSelect");
        action.start();
        mTestLooper.dispatchAll();

        assertThat(mNativeWrapper.getResultMessages()).contains(SET_STREAM_PATH);
        mNativeWrapper.clearResultMessages();
        mHdmiCecLocalDeviceTv.updateActiveSource(ADDR_PLAYBACK_1, PHYSICAL_ADDRESS_PLAYBACK_1,
                "testDeviceSelect");
        mTestLooper.dispatchAll();

        assertThat(actionTimer.getState()).isEqualTo(STATE_WAIT_FOR_POWER_STATE_CHANGE);
        action.handleTimerEvent(STATE_WAIT_FOR_POWER_STATE_CHANGE);
        assertThat(actionTimer.getState()).isEqualTo(STATE_WAIT_FOR_REPORT_POWER_STATUS);
        action.processCommand(REPORT_POWER_STATUS_ON);
        mTestLooper.dispatchAll();

        assertThat(mNativeWrapper.getResultMessages()).doesNotContain(SET_STREAM_PATH);
        assertThat(callback.getResult()).isEqualTo(HdmiControlManager.RESULT_SUCCESS);
    }

    @Test
    public void testDeviceSelect_DeviceInStandbyStatus_Cec14b() {
        mHdmiCecLocalDeviceTv.updateActiveSource(ADDR_PLAYBACK_2, PHYSICAL_ADDRESS_PLAYBACK_2,