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

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

Merge "Fix getActiveSource api in HdmiControlService"

parents d7015dd5 8a9eae71
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -876,7 +876,7 @@ abstract class HdmiCecLocalDevice {
    }

    ActiveSource getActiveSource() {
        return mService.getActiveSource();
        return mService.getLocalActiveSource();
    }

    void setActiveSource(ActiveSource newActive) {
+18 −9
Original line number Diff line number Diff line
@@ -1484,25 +1484,34 @@ public class HdmiControlService extends SystemService {
                        return playback().getDeviceInfo();
                    }
                    // Otherwise get the active source and look for it from the device list
                    ActiveSource activeSource = mActiveSource;
                    // If the active source is not set yet, return null
                    if (!activeSource.isValid()) {
                    ActiveSource activeSource = getLocalActiveSource();
                    // If the physical address is not set yet, return null
                    if (activeSource.physicalAddress == Constants.INVALID_PHYSICAL_ADDRESS) {
                        return null;
                    }
                    if (audioSystem() != null) {
                        HdmiCecLocalDeviceAudioSystem audioSystem = audioSystem();
                        for (HdmiDeviceInfo info : audioSystem.getSafeCecDevicesLocked()) {
                            if (info.getLogicalAddress() == activeSource.logicalAddress) {
                            if (info.getPhysicalAddress() == activeSource.physicalAddress) {
                                return info;
                            }
                        }
                    }
                    // If the device info is not in the list yet, return a device info with minimum
                    // information from mActiveSource.
                    return new HdmiDeviceInfo(activeSource.logicalAddress,
                        activeSource.physicalAddress, pathToPortId(activeSource.physicalAddress),
                    // If the Active Source has unregistered logical address, return with an
                    // HdmiDeviceInfo built from physical address information only.
                    return HdmiUtils.isValidAddress(activeSource.logicalAddress)
                        ?
                        new HdmiDeviceInfo(activeSource.logicalAddress,
                            activeSource.physicalAddress,
                            pathToPortId(activeSource.physicalAddress),
                            HdmiUtils.getTypeFromAddress(activeSource.logicalAddress), 0,
                        HdmiUtils.getDefaultDeviceName(activeSource.logicalAddress));
                            HdmiUtils.getDefaultDeviceName(activeSource.logicalAddress))
                        :
                            new HdmiDeviceInfo(activeSource.physicalAddress,
                                pathToPortId(activeSource.physicalAddress));

                }
                return null;
            }
@@ -2831,7 +2840,7 @@ public class HdmiControlService extends SystemService {
        setLastInputForMhl(Constants.INVALID_PORT_ID);
    }

    ActiveSource getActiveSource() {
    ActiveSource getLocalActiveSource() {
        synchronized (mLock) {
            return mActiveSource;
        }