Only send <Standby> to TV on sleep when active source

Test: make, flash, let device go to sleep due to keycode_power and
energy saver mode, verify that <Standby> is only sent when mIsActiveSource is true.

Bug: 155228844
Change-Id: Ie62d60e8c4fa573aac6c08a4c1093d5f1a52d7f3
This commit is contained in:
Nathalie Le Clair
2020-05-20 13:46:30 +02:00
parent b0033693a8
commit fd434cbcd8

View File

@@ -163,12 +163,13 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
}
if (mIsActiveSource) {
mService.sendCecCommand(HdmiCecMessageBuilder.buildInactiveSource(
mAddress, mService.getPhysicalAddress()));
mAddress, mService.getPhysicalAddress()));
}
boolean wasActiveSource = mIsActiveSource;
// Invalidate the internal active source record when goes to standby
// This set will also update mIsActiveSource
mService.setActiveSource(Constants.ADDR_INVALID, Constants.INVALID_PHYSICAL_ADDRESS);
if (initiatedByCec || !mAutoTvOff) {
if (initiatedByCec || !mAutoTvOff || !wasActiveSource) {
return;
}
switch (standbyAction) {