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

Commit 870cbf1d authored by Tang Lee's avatar Tang Lee
Browse files

Improve avoiding focus stealing due to queued ActiveSourceAction

If the device receives <Routing Change> to another device, always cancel ActiveSourceAction whether itself was active source or not to further avoid focus stealing.

Bug: 411539277
Test: atest com.android.server.hdmi.HdmiCecLocalDevicePlaybackTest
atest com.android.server.hdmi.ActiveSourceActionTest
Flag: EXEMPT bug fix
Change-Id: I8119af56275ce8c72df29c8544af4bc9f4825c3c
parent 9bbd4b7d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -200,12 +200,14 @@ abstract class HdmiCecLocalDeviceSource extends HdmiCecLocalDevice {
    void setActiveSource(int logicalAddress, int physicalAddress, String caller) {
        boolean wasActiveSource = isActiveSource();
        super.setActiveSource(logicalAddress, physicalAddress, caller);
        if (wasActiveSource && !isActiveSource()) {
        if (!isActiveSource()) {
            // Prevent focus stealing when losing active source.
            removeAction(ActiveSourceAction.class);
            if (wasActiveSource) {
                onActiveSourceLost();
            }
        }
    }

    @ServiceThreadOnly
    protected void setActiveSource(int physicalAddress, String caller) {