Exit dream mode on CEC wake message received

Bug: 183945838
Test: atest

Change-Id: I9eb97557296b2c6cb0529c8a1e28519fea942aa6
This commit is contained in:
Nathalie Le Clair
2021-05-04 13:46:52 +02:00
parent ac0134bc53
commit f3b6aab045
4 changed files with 23 additions and 13 deletions

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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(