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

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

HDMI: On <Report PA> on the same active path, send <Set Stream Path>

When a new device is connected and sends <Report PA> with same PA as the
active path, it might not be aware that is on the active path. The
TV sends a <Set Stream Path> to announce that such that the device will
broadcast <Active Source>.

Test: atest com.android.server.hdmi
Flag: EXEMPT bugfix
Bug: 374218178
Change-Id: I0e853bfbfb09ea863b1f59bb78edc7d83c8ea316
parent 78183707
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -471,6 +471,10 @@ public class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
    void startRoutingControl(int oldPath, int newPath, IHdmiControlCallback callback) {
        assertRunOnServiceThread();
        if (oldPath == newPath) {
            HdmiCecMessage setStreamPath =
                    HdmiCecMessageBuilder.buildSetStreamPath(getDeviceInfo().getLogicalAddress(),
                            oldPath);
            mService.sendCecCommand(setStreamPath);
            return;
        }
        HdmiCecMessage routingChange =
@@ -642,7 +646,8 @@ public class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
        int address = message.getSource();
        int type = message.getParams()[2];

        if (!mService.getHdmiCecNetwork().isInDeviceList(address, path)) {
        if (!ActiveSource.of(address, path).equals(getActiveSource())) {
            HdmiLogger.debug("Check if a new device is connected to the active path");
            handleNewDeviceAtTheTailOfActivePath(path);
        }
        startNewDeviceAction(ActiveSource.of(address, path), type);
+19 −0
Original line number Diff line number Diff line
@@ -2233,6 +2233,25 @@ public class HdmiCecLocalDeviceTvTest {
        assertThat(mNativeWrapper.getResultMessages()).doesNotContain(giveOsdName);
    }

    @Test
    public void handleReportPhysicalAddress_samePathAsActiveSource_differentLA_newActiveSource() {
        // This scenario can be reproduced if active source is hotplugged out and replaced with
        // another device that might have another LA.
        int physicalAddress = 0x1000;
        mHdmiControlService.setActiveSource(Constants.ADDR_PLAYBACK_1, physicalAddress,
                "HdmiControlServiceTest");
        mHdmiCecLocalDeviceTv.setActivePath(physicalAddress);
        HdmiCecMessage reportPhysicalAddressFromPlayback2 =
                HdmiCecMessageBuilder.buildReportPhysicalAddressCommand(ADDR_PLAYBACK_2,
                        physicalAddress, HdmiDeviceInfo.DEVICE_PLAYBACK);
        HdmiCecMessage setStreamPath = HdmiCecMessageBuilder.buildSetStreamPath(ADDR_TV,
                physicalAddress);
        mNativeWrapper.onCecMessage(reportPhysicalAddressFromPlayback2);
        mTestLooper.dispatchAll();

        assertThat(mNativeWrapper.getResultMessages()).contains(setStreamPath);
    }

    @Test
    public void onOneTouchPlay_wakeUp_addCecDevice() {
        assertThat(mHdmiControlService.getHdmiCecNetwork().getDeviceInfoList(false))