OSDN Git Service

Don't broadcast <Standby> message during shutdown when setting is disabled
authorDonghyun Cho <donghyun@google.com>
Fri, 1 Apr 2016 05:31:11 +0000 (14:31 +0900)
committerDonghyun Cho <donghyun@google.com>
Mon, 4 Apr 2016 05:17:03 +0000 (05:17 +0000)
When the system is shutting down or the screen is going to be off, <Standby>
message will be broadcasted if and only if the setting variable,
Settings.Global#HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED, is enabled. This change
will make the shutdown case to be checked with the setting properly, too.

Bug: 27781559
Change-Id: Ia6605d6b5627ab1ff67285d72846b618a09548bc

services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java

index a36e671..69c012e 100644 (file)
@@ -165,15 +165,13 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice {
     @ServiceThreadOnly
     protected void onStandby(boolean initiatedByCec, int standbyAction) {
         assertRunOnServiceThread();
-        if (!mService.isControlEnabled() || initiatedByCec) {
+        if (!mService.isControlEnabled() || initiatedByCec || !mAutoTvOff) {
             return;
         }
         switch (standbyAction) {
             case HdmiControlService.STANDBY_SCREEN_OFF:
-                if (mAutoTvOff) {
-                    mService.sendCecCommand(
-                            HdmiCecMessageBuilder.buildStandby(mAddress, Constants.ADDR_TV));
-                }
+                mService.sendCecCommand(
+                        HdmiCecMessageBuilder.buildStandby(mAddress, Constants.ADDR_TV));
                 break;
             case HdmiControlService.STANDBY_SHUTDOWN:
                 // ACTION_SHUTDOWN is taken as a signal to power off all the devices.