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

Commit ec4922d2 authored by Paul Colta's avatar Paul Colta
Browse files

HDMI: Retry one time to send <Request Active Source>

When TV is finishing the logical address allocation it will send a
<Request Active Source> message. This message is often ignored by
connected devices because they are still finishing their address
allocation. In ag/25261376 we introduced that if the <Request AS>
message is not answered within 2s, the TV will broadcast <Active
Source>.
With this CL we retry sending <Request Active Source> one more time, to
be more confident there is no device answering this message.

Bug: 314709633
Test: atest HdmiCecLocalDeviceTvTest
Change-Id: Ic80f6a958bc662d356b611c97303a0cb704905fe
parent 6ea41f31
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -29,6 +29,12 @@ public class RequestActiveSourceAction extends HdmiCecFeatureAction {
    // State to wait for the <Active Source> message.
    private static final int STATE_WAIT_FOR_ACTIVE_SOURCE = 1;

    // Number of retries <Request Active Source> is sent if no device answers this message.
    private static final int MAX_SEND_RETRY_COUNT = 1;

    private int mSendRetryCount = 0;


    RequestActiveSourceAction(HdmiCecLocalDevice source, IHdmiControlCallback callback) {
        super(source, callback);
    }
@@ -60,7 +66,12 @@ public class RequestActiveSourceAction extends HdmiCecFeatureAction {
            return;
        }
        if (mState == STATE_WAIT_FOR_ACTIVE_SOURCE) {
            if (mSendRetryCount++ < MAX_SEND_RETRY_COUNT) {
                sendCommand(HdmiCecMessageBuilder.buildRequestActiveSource(getSourceAddress()));
                addTimer(mState, HdmiConfig.TIMEOUT_MS);
            } else {
                finishWithCallback(HdmiControlManager.RESULT_TIMEOUT);
            }
        }
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -1720,7 +1720,11 @@ public class HdmiCecLocalDeviceTvTest {
        mNativeWrapper.clearResultMessages();
        mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS);
        mTestLooper.dispatchAll();
        assertThat(mNativeWrapper.getResultMessages()).doesNotContain(activeSourceFromTv);

        // Skip the retry.
        mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS);
        mTestLooper.dispatchAll();
        assertThat(mNativeWrapper.getResultMessages()).contains(activeSourceFromTv);
    }
}