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

Commit c556aa36 authored by Amy's avatar Amy Committed by Amy Zhang
Browse files

Playback device should broadcast Inactive Source when it does not have

video to broadcast any more

According to the spec, no video to show or standby state should both
trigger Active Source to lose its Acitve state.

We should not only send out inactive source when the device is not
holding a wake lock. Screen can still be turned off with a
PARTIAL_WAKE_LOCK.

Test: manual
Change-Id: I8f9973859ee98a0223cc995610dfb4edc949d57d
(cherry picked from commit bb30a6a99672ecff53ef450889b20db3376fe94c)
parent 6844778e
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -163,10 +163,17 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
    @ServiceThreadOnly
    protected void onStandby(boolean initiatedByCec, int standbyAction) {
        assertRunOnServiceThread();
        if (!mService.isControlEnabled()) {
            return;
        }
        if (mIsActiveSource) {
            mService.sendCecCommand(HdmiCecMessageBuilder.buildInactiveSource(
                mAddress, mService.getPhysicalAddress()));
        }
        // Invalidate the internal active source record when goes to standby
        // This set will also update mIsActiveSource
        mService.setActiveSource(Constants.ADDR_INVALID, Constants.INVALID_PHYSICAL_ADDRESS);
        if (!mService.isControlEnabled() || initiatedByCec || !mAutoTvOff) {
        if (initiatedByCec || !mAutoTvOff) {
            return;
        }
        switch (standbyAction) {
@@ -349,11 +356,6 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
        super.disableDevice(initiatedByCec, callback);

        assertRunOnServiceThread();
        if (!initiatedByCec && mIsActiveSource && mService.isControlEnabled()) {
            mService.sendCecCommand(HdmiCecMessageBuilder.buildInactiveSource(
                    mAddress, mService.getPhysicalAddress()));
        }
        setIsActiveSource(false);
        checkIfPendingActionsCleared();
    }