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

Commit bf6fdf73 authored by Paul Colta's avatar Paul Colta Committed by Android (Google) Code Review
Browse files

Merge "HDMI: When TV reports standby, playback devices lose active source" into main

parents ab860bc9 c4d4948f
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();