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

Commit 7aa17979 authored by Amy's avatar Amy Committed by Amy Zhang
Browse files

Update the Active Source internallty when Active Path from <System Audio

Mode Request> does not match the internal active source physical
address.

Test: manual
Change-Id: I46df70ffd17f72215d894eb449edbdcb9e704c68
(cherry picked from commit 7ff832785e3af604e58fe7f4e1bcdfb280bb19fa)
parent 42be9e60
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -791,7 +791,21 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
            int sourcePhysicalAddress = HdmiUtils.twoBytesToInt(message.getParams());
            if (sourcePhysicalAddress != getActiveSource().physicalAddress) {
                // If the Active Source recorded by the current device is not synced up with TV,
                // TODO(amyjojo): update Active Source internally
                // update the Active Source internally.
                for (HdmiDeviceInfo info : HdmiUtils.sparseArrayToList(mDeviceInfos)) {
                    if (info.getPhysicalAddress() == sourcePhysicalAddress) {
                        setActiveSource(info.getLogicalAddress(), info.getPhysicalAddress());
                        break;
                    }
                }
                // If the Active path from TV's System Audio Mode request does not belong to any
                // device in the local device list, record the new Active physicalAddress with an
                // unregistered logical address first. Then query the Active Source again.
                if (sourcePhysicalAddress != getActiveSource().physicalAddress) {
                    setActiveSource(Constants.ADDR_UNREGISTERED, sourcePhysicalAddress);
                    mService.sendCecCommand(
                        HdmiCecMessageBuilder.buildRequestActiveSource(mAddress));
                }
            }
            switchInputOnReceivingNewActivePath(sourcePhysicalAddress);
        }