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

Commit 57326ba6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Exit dream mode on CEC wake message received" into sc-dev am: a31ca4d9

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

Change-Id: I18399e29cd107a22c9fd16a581732630d0c135a5
parents d1b0a86a a31ca4d9
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -262,18 +262,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,
@@ -1334,6 +1339,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(