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

Commit 24360fd4 authored by Amy Zhang's avatar Amy Zhang Committed by Android (Google) Code Review
Browse files

Merge "Remove routing change and Active Source update by the payload of the SAM request message"

parents b5fe6d0d 7f682abc
Loading
Loading
Loading
Loading
+16 −27
Original line number Diff line number Diff line
@@ -850,37 +850,26 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
                        mAddress, Constants.ADDR_BROADCAST, systemAudioStatusOn));

        if (systemAudioStatusOn) {
            // If TV sends out SAM Request with a path of a non-CEC device, which should not show
            // up in the CEC device list and not under the current AVR device, the AVR would switch
            // to ARC.
            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,
                // 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);
            if (HdmiUtils.getLocalPortFromPhysicalAddress(
                    sourcePhysicalAddress, getDeviceInfo().getPhysicalAddress())
                            != HdmiUtils.TARGET_NOT_UNDER_LOCAL_DEVICE) {
                return true;
            }
                } else {
                    // If it's not the current device, look for the device info from the list
            boolean isDeviceInCecDeviceList = false;
            for (HdmiDeviceInfo info : HdmiUtils.sparseArrayToList(mDeviceInfos)) {
                if (info.getPhysicalAddress() == sourcePhysicalAddress) {
                            setActiveSource(info.getLogicalAddress(), info.getPhysicalAddress());
                    isDeviceInCecDeviceList = true;
                    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));
                }
            }
            if (!isDeviceInCecDeviceList) {
                switchInputOnReceivingNewActivePath(sourcePhysicalAddress);
            }
        }
        return true;
    }