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

Commit 02cf1abe authored by Amy's avatar Amy Committed by Amy Zhang
Browse files

Reset mIsActiveSource in source local device when new Active Source is

recorded

In Hdmi local source device, mIsActiveSource is used to represent if the
current device is the current Active Source or not. But when we receive
<System Audio Mode Request> or <Active Source> with a new Active Source,
we did not update mIsActiveSource when reset Active Source.

Test: manual
Bug: 131629012
Change-Id: Ief369a724fe9c2bac13db7af24cdbbfb5b732185
(cherry picked from commit cf0c95a51776f7a3b54f50d61709abcb362c324c)
parent 20b25eb1
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