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

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

Merge "Reset mIsActiveSource in source local device when new Active Source is recorded"

parents 5bb8ae06 02cf1abe
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -2819,6 +2819,21 @@ public class HdmiControlService extends SystemService {
            mActiveSource.logicalAddress = logicalAddress;
            mActiveSource.physicalAddress = physicalAddress;
        }
        // If the current device is a source device, check if the current Active Source matches
        // the local device info. Set mIsActiveSource of the local device accordingly.
        for (HdmiCecLocalDevice device : getAllLocalDevices()) {
            // mIsActiveSource only exists in source device, ignore this setting if the current
            // device is not an HdmiCecLocalDeviceSource.
            if (!(device instanceof HdmiCecLocalDeviceSource)) {
                continue;
            }
            if (logicalAddress == device.getDeviceInfo().getLogicalAddress()
                && physicalAddress == getPhysicalAddress()) {
                ((HdmiCecLocalDeviceSource) device).setIsActiveSource(true);
            } else {
                ((HdmiCecLocalDeviceSource) device).setIsActiveSource(false);
            }
        }
    }

    // This method should only be called when the device can be the active source