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

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

Remove routing change and Active Source update by the payload of the SAM

request message

Tests show that the TV sends out SAM request message with incorrect
active path in a very high possibility. This makes Atom switch into the
wrong input.

Previously this change is to make sure that we have more reliable Active
Source updating, but now it seems lower the accuracy and bringing more
side effect.

Changing the logic to: only cover the user case when the TV notifies the
AVR with a non-CEC active path and it should not be under the AVR
itself.

Based on Amlogic's suggestion:
https://partner-android-review.googlesource.com/c/platform/frameworks/base/+/1439739

Bug: 133668717
Bug: 138854438
Test: manual
Change-Id: Ic41dd4920a1de0af1d3755f760e3f2327f9010f7
(cherry picked from commit 066301a097377199a16cd80227f7b8ccee7e0c5b)
parent a55998b5
Loading
Loading
Loading
Loading
+16 −27
Original line number Original line Diff line number Diff line
@@ -850,37 +850,26 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
                        mAddress, Constants.ADDR_BROADCAST, systemAudioStatusOn));
                        mAddress, Constants.ADDR_BROADCAST, systemAudioStatusOn));


        if (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());
            int sourcePhysicalAddress = HdmiUtils.twoBytesToInt(message.getParams());
            if (sourcePhysicalAddress != getActiveSource().physicalAddress) {
            if (HdmiUtils.getLocalPortFromPhysicalAddress(
                // If the Active Source recorded by the current device is not synced up with TV,
                    sourcePhysicalAddress, getDeviceInfo().getPhysicalAddress())
                // update the Active Source internally.
                            != HdmiUtils.TARGET_NOT_UNDER_LOCAL_DEVICE) {
                if (sourcePhysicalAddress == mService.getPhysicalAddress()) {
                return true;
                    // 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 {
            boolean isDeviceInCecDeviceList = false;
                    // 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());
                    isDeviceInCecDeviceList = true;
                    break;
                    break;
                }
                }
            }
            }
                }
            if (!isDeviceInCecDeviceList) {
                // 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);
                switchInputOnReceivingNewActivePath(sourcePhysicalAddress);
            }
            }
        }
        return true;
        return true;
    }
    }