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

Commit 0b6c0bae authored by Amy's avatar Amy
Browse files

Set with local device info when TV sends out <System Audio Mode Request>

with the current device's physical address

When we receive <System Audio Mode Request> from TV with a new Active
Path, we check if this path matches any device info in the local device
list. But the local device itself is not in the list. So it's possible
that we set Active Source as an unregistered device with the same
physical address as ourselves. This patch fixes the issue.

Test: manual
Bug: 131629012
Change-Id: I74180f86c0e905507d6262e13c783a43f7e25adf
parent dcb97fd6
Loading
Loading
Loading
Loading
+14 −4
Original line number Original line Diff line number Diff line
@@ -846,12 +846,22 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
            if (sourcePhysicalAddress != getActiveSource().physicalAddress) {
            if (sourcePhysicalAddress != getActiveSource().physicalAddress) {
                // If the Active Source recorded by the current device is not synced up with TV,
                // If the Active Source recorded by the current device is not synced up with TV,
                // update the Active Source internally.
                // update the Active Source internally.
                if (sourcePhysicalAddress == mService.getPhysicalAddress()) {
                    // If the active path is the current device itself, update with local info
                    if (mService.playback() != null) {
                        setActiveSource(mService.playback().mAddress, sourcePhysicalAddress);
                    } else {
                        setActiveSource(mAddress, sourcePhysicalAddress);
                    }
                } else {
                    // If it's not the current device, look for the device info from the list
                    for (HdmiDeviceInfo info : HdmiUtils.sparseArrayToList(mDeviceInfos)) {
                    for (HdmiDeviceInfo info : HdmiUtils.sparseArrayToList(mDeviceInfos)) {
                        if (info.getPhysicalAddress() == sourcePhysicalAddress) {
                        if (info.getPhysicalAddress() == sourcePhysicalAddress) {
                            setActiveSource(info.getLogicalAddress(), info.getPhysicalAddress());
                            setActiveSource(info.getLogicalAddress(), info.getPhysicalAddress());
                            break;
                            break;
                        }
                        }
                    }
                    }
                }
                // If the Active path from TV's System Audio Mode request does not belong to any
                // 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
                // device in the local device list, record the new Active physicalAddress with an
                // unregistered logical address first. Then query the Active Source again.
                // unregistered logical address first. Then query the Active Source again.