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

Commit c4d4948f authored by Paul Colta's avatar Paul Colta
Browse files

HDMI: When TV reports standby, playback devices lose active source

Make sure PowerStatusMonitorActionFromPlayback re-uses the same logic
from onActiveSourceLost when TV consistently reports power off. This way
the user is visually notified in case they have a faulty CEC setup (e.g.
old TV panel) where they can easily disable the setting that sends their
playback device to sleep.

Bug: 390708778
Bug: 420516708
Test: atest com.android.server.hdmi
Flag: EXEMPT bugfix
Change-Id: Ib3209096e5913eb14c341d4bf14023377f86589d
parent 5bc7e19f
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -77,8 +77,16 @@ public class PowerStatusMonitorActionFromPlayback extends HdmiCecFeatureAction {
        }

        if (mConsecutiveStandbyReports >= REQUIRED_CONSECUTIVE_STANDBY_REPORTS) {
            HdmiCecLocalDeviceSource source = source();
            Slog.d(TAG, "TV reported standby, going to sleep.");
            source().getService().standby();
            // Invalidate the internal active source record before calling the active source logic.
            // This logic allows the user to be visually notified in case they have a faulty CEC
            // setup (e.g. an old TV panel) where they can easily disable the setting that sends
            // their source device to sleep.
            source.mService
                    .setActiveSource(Constants.ADDR_INVALID, Constants.INVALID_PHYSICAL_ADDRESS,
                    "HdmiCecLocalDevicePlayback#onStandby()");
            source.onActiveSourceLost();
            finish();
        }
        // Schedule next monitoring.
+9 −0
Original line number Diff line number Diff line
@@ -2943,6 +2943,9 @@ public class HdmiCecLocalDevicePlaybackTest {
        mNativeWrapper.onCecMessage(reportPowerStatusTvStandby);
        mTestLooper.dispatchAll();

        // After 30s of device inactivity, device would go to sleep.
        skipActiveSourceLostUi(STANDBY_AFTER_ACTIVE_SOURCE_LOST_DELAY_MS, false,
                false);
        // Playback device should go to sleep
        assertThat(mPowerManager.isInteractive()).isFalse();
        assertThat(mHdmiCecLocalDevicePlayback.getActions(
@@ -3008,6 +3011,9 @@ public class HdmiCecLocalDevicePlaybackTest {
        mNativeWrapper.onCecMessage(reportPowerStatusTvStandby);
        mTestLooper.dispatchAll();

        // After 30s of device inactivity, device would go to sleep.
        skipActiveSourceLostUi(STANDBY_AFTER_ACTIVE_SOURCE_LOST_DELAY_MS, false,
                false);
        assertThat(mPowerManager.isInteractive()).isFalse();
        assertThat(mHdmiCecLocalDevicePlayback.getActions(
                PowerStatusMonitorActionFromPlayback.class)).isEmpty();
@@ -3069,6 +3075,9 @@ public class HdmiCecLocalDevicePlaybackTest {
        mNativeWrapper.onCecMessage(reportPowerStatusTvStandby);
        mTestLooper.dispatchAll();

        // After 30s of device inactivity, device would go to sleep.
        skipActiveSourceLostUi(STANDBY_AFTER_ACTIVE_SOURCE_LOST_DELAY_MS, false,
                false);
        assertThat(mPowerManager.isInteractive()).isFalse();
        assertThat(mHdmiCecLocalDevicePlayback.getActions(
                PowerStatusMonitorActionFromPlayback.class)).isEmpty();