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

Commit c2c996d3 authored by Nathalie Le Clair's avatar Nathalie Le Clair Committed by Automerger Merge Worker
Browse files

Merge "Exit dream mode when receiving <Text View On>" into tm-dev am: 4e930672

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17071207

Change-Id: Ide18771ae956f2bffd36f032ef9ccd93b6f589ce
parents 9aa83a47 4e930672
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -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;
+22 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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;
                    }
@@ -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(