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

Commit f3b6aab0 authored by Nathalie Le Clair's avatar Nathalie Le Clair
Browse files

Exit dream mode on CEC wake message received

Bug: 183945838
Test: atest

Change-Id: I9eb97557296b2c6cb0529c8a1e28519fea942aa6
parent ac0134bc
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -258,18 +258,6 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
        return super.handleUserControlPressed(message);
    }

    @Override
    protected void wakeUpIfActiveSource() {
        if (!isActiveSource()) {
            return;
        }
        // Wake up the device if the power is in standby mode, or its screen is off -
        // which can happen if the device is holding a partial lock.
        if (mService.isPowerStandbyOrTransient() || !mService.getPowerManager().isScreenOn()) {
            mService.wakeUp();
        }
    }

    @ServiceThreadOnly
    @Constants.HandleMessageResult
    protected int handleSetMenuLanguage(HdmiCecMessage message) {
+1 −1
Original line number Diff line number Diff line
@@ -380,7 +380,7 @@ abstract class HdmiCecLocalDeviceSource extends HdmiCecLocalDevice {
        if (!isActiveSource()) {
            return;
        }
        // Wake up the device
        // Wake up the device. This will also exit dream mode.
        mService.wakeUp();
        return;
    }
+1 −0
Original line number Diff line number Diff line
@@ -3030,6 +3030,7 @@ public class HdmiControlService extends SystemService {
    @ServiceThreadOnly
    @VisibleForTesting
    protected void onStandby(final int standbyAction) {
        mWakeUpMessageReceived = false;
        assertRunOnServiceThread();
        mPowerStatusController.setPowerStatus(HdmiControlManager.POWER_STATUS_TRANSIENT_TO_STANDBY,
                false);
+21 −0
Original line number Diff line number Diff line
@@ -136,6 +136,11 @@ public class HdmiCecLocalDevicePlaybackTest {
                        return false;
                    }

                    @Override
                    boolean isPowerStandbyOrTransient() {
                        return false;
                    }

                    @Override
                    protected PowerManager getPowerManager() {
                        return new PowerManager(context, mIPowerManagerMock,
@@ -1291,6 +1296,22 @@ public class HdmiCecLocalDevicePlaybackTest {
        assertThat(mHdmiCecLocalDevicePlayback.isActiveSource()).isTrue();
    }

    @Test
    public void handleSetStreamPath_Dreaming() throws RemoteException {
        when(mIPowerManagerMock.isInteractive()).thenReturn(true);

        mWokenUp = false;

        HdmiCecMessage message =
                HdmiCecMessageBuilder.buildSetStreamPath(ADDR_TV,
                        mPlaybackPhysicalAddress);

        assertThat(mHdmiCecLocalDevicePlayback.handleSetStreamPath(message))
                .isEqualTo(Constants.HANDLED);
        mTestLooper.dispatchAll();
        assertThat(mWokenUp).isTrue();
    }

    @Test
    public void handleSetStreamPath_otherDevice_None() {
        mHdmiCecLocalDevicePlayback.mService.getHdmiCecConfig().setStringValue(