Loading services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +10 −7 Original line number Diff line number Diff line Loading @@ -654,14 +654,17 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { protected int handleTextViewOn(HdmiCecMessage message) { assertRunOnServiceThread(); // Note that <Text View On> (and <Image View On>) command won't be handled here in // most cases. A dedicated microcontroller should be in charge while Android system // is in sleep mode, and the command need not be passed up to this service. // The only situation where the command reaches this handler is that sleep mode is // implemented in such a way that Android system is not really put to standby mode // but only the display is set to blank. Then the command leads to the effect of // Note that if the device is in sleep mode, the <Text View On> (and <Image View On>) // command won't be handled here in most cases. A dedicated microcontroller should be in // charge while the Android system is in sleep mode, and the command doesn't need to be // passed up to this service. // The only situations where the command reaches this handler are // 1. if sleep mode is implemented in such a way that Android system is not really put to // standby mode but only the display is set to blank. Then the command leads to // turning on the display by the invocation of PowerManager.wakeUp(). if (mService.isPowerStandbyOrTransient() && getAutoWakeup()) { // 2. if the device is in dream mode, not sleep mode. Then this command leads to // waking up the device from dream mode by the invocation of PowerManager.wakeUp(). if (getAutoWakeup()) { mService.wakeUp(); } return Constants.HANDLED; Loading services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class HdmiCecLocalDeviceTvTest { private ArrayList<HdmiCecLocalDevice> mLocalDevices = new ArrayList<>(); private int mTvPhysicalAddress; private int mTvLogicalAddress; private boolean mWokenUp; @Mock private AudioManager mAudioManager; Loading @@ -104,6 +105,11 @@ public class HdmiCecLocalDeviceTvTest { new HdmiControlService(InstrumentationRegistry.getTargetContext(), Collections.emptyList()) { @Override void wakeUp() { mWokenUp = true; super.wakeUp(); } @Override boolean isControlEnabled() { return true; } Loading Loading @@ -307,6 +313,22 @@ public class HdmiCecLocalDeviceTvTest { assertThat(mPowerManager.isInteractive()).isFalse(); } @Test public void handleTextViewOn_Dreaming() { mHdmiCecLocalDeviceTv.mService.getHdmiCecConfig().setIntValue( HdmiControlManager.CEC_SETTING_NAME_TV_WAKE_ON_ONE_TOUCH_PLAY, HdmiControlManager.TV_WAKE_ON_ONE_TOUCH_PLAY_ENABLED); mTestLooper.dispatchAll(); mPowerManager.setInteractive(true); mWokenUp = false; HdmiCecMessage textViewOn = HdmiCecMessageBuilder.buildTextViewOn(ADDR_PLAYBACK_1, mTvLogicalAddress); assertThat(mHdmiCecLocalDeviceTv.dispatchMessage(textViewOn)).isEqualTo(Constants.HANDLED); mTestLooper.dispatchAll(); assertThat(mPowerManager.isInteractive()).isTrue(); assertThat(mWokenUp).isTrue(); } @Test public void tvSendStandbyOnSleep_Enabled() { mHdmiCecLocalDeviceTv.mService.getHdmiCecConfig().setIntValue( Loading Loading
services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +10 −7 Original line number Diff line number Diff line Loading @@ -654,14 +654,17 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { protected int handleTextViewOn(HdmiCecMessage message) { assertRunOnServiceThread(); // Note that <Text View On> (and <Image View On>) command won't be handled here in // most cases. A dedicated microcontroller should be in charge while Android system // is in sleep mode, and the command need not be passed up to this service. // The only situation where the command reaches this handler is that sleep mode is // implemented in such a way that Android system is not really put to standby mode // but only the display is set to blank. Then the command leads to the effect of // Note that if the device is in sleep mode, the <Text View On> (and <Image View On>) // command won't be handled here in most cases. A dedicated microcontroller should be in // charge while the Android system is in sleep mode, and the command doesn't need to be // passed up to this service. // The only situations where the command reaches this handler are // 1. if sleep mode is implemented in such a way that Android system is not really put to // standby mode but only the display is set to blank. Then the command leads to // turning on the display by the invocation of PowerManager.wakeUp(). if (mService.isPowerStandbyOrTransient() && getAutoWakeup()) { // 2. if the device is in dream mode, not sleep mode. Then this command leads to // waking up the device from dream mode by the invocation of PowerManager.wakeUp(). if (getAutoWakeup()) { mService.wakeUp(); } return Constants.HANDLED; Loading
services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class HdmiCecLocalDeviceTvTest { private ArrayList<HdmiCecLocalDevice> mLocalDevices = new ArrayList<>(); private int mTvPhysicalAddress; private int mTvLogicalAddress; private boolean mWokenUp; @Mock private AudioManager mAudioManager; Loading @@ -104,6 +105,11 @@ public class HdmiCecLocalDeviceTvTest { new HdmiControlService(InstrumentationRegistry.getTargetContext(), Collections.emptyList()) { @Override void wakeUp() { mWokenUp = true; super.wakeUp(); } @Override boolean isControlEnabled() { return true; } Loading Loading @@ -307,6 +313,22 @@ public class HdmiCecLocalDeviceTvTest { assertThat(mPowerManager.isInteractive()).isFalse(); } @Test public void handleTextViewOn_Dreaming() { mHdmiCecLocalDeviceTv.mService.getHdmiCecConfig().setIntValue( HdmiControlManager.CEC_SETTING_NAME_TV_WAKE_ON_ONE_TOUCH_PLAY, HdmiControlManager.TV_WAKE_ON_ONE_TOUCH_PLAY_ENABLED); mTestLooper.dispatchAll(); mPowerManager.setInteractive(true); mWokenUp = false; HdmiCecMessage textViewOn = HdmiCecMessageBuilder.buildTextViewOn(ADDR_PLAYBACK_1, mTvLogicalAddress); assertThat(mHdmiCecLocalDeviceTv.dispatchMessage(textViewOn)).isEqualTo(Constants.HANDLED); mTestLooper.dispatchAll(); assertThat(mPowerManager.isInteractive()).isTrue(); assertThat(mWokenUp).isTrue(); } @Test public void tvSendStandbyOnSleep_Enabled() { mHdmiCecLocalDeviceTv.mService.getHdmiCecConfig().setIntValue( Loading