Loading services/core/java/com/android/server/hdmi/PowerStatusMonitorActionFromPlayback.java +9 −1 Original line number Diff line number Diff line Loading @@ -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. Loading services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -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( Loading Loading @@ -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(); Loading Loading @@ -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(); Loading Loading
services/core/java/com/android/server/hdmi/PowerStatusMonitorActionFromPlayback.java +9 −1 Original line number Diff line number Diff line Loading @@ -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. Loading
services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -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( Loading Loading @@ -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(); Loading Loading @@ -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(); Loading