diff options
author | Jinsuk Kim <jinsukkim@google.com> | 2014-04-02 22:39:41 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-04-02 22:39:41 +0000 |
commit | b1dca1624dc8d853a52d1918c7672173e9b79836 (patch) | |
tree | 874b4057bd023272fbfb56cccc64419fff280cd4 /core | |
parent | 4932a355f1594990173e0d9cd1fa38b8491c4a29 (diff) | |
parent | 4e90fcd1907e0c1f1fa1dc991fbd7fda5e49a482 (diff) | |
download | frameworks_base-b1dca1624dc8d853a52d1918c7672173e9b79836.zip frameworks_base-b1dca1624dc8d853a52d1918c7672173e9b79836.tar.gz frameworks_base-b1dca1624dc8d853a52d1918c7672173e9b79836.tar.bz2 |
Merge "Maintain display power status for playback device" into klp-modular-dev
Diffstat (limited to 'core')
4 files changed, 20 insertions, 7 deletions
diff --git a/core/java/android/hardware/hdmi/HdmiCec.java b/core/java/android/hardware/hdmi/HdmiCec.java index 38d9de4..8578a32 100644 --- a/core/java/android/hardware/hdmi/HdmiCec.java +++ b/core/java/android/hardware/hdmi/HdmiCec.java @@ -160,6 +160,12 @@ public final class HdmiCec { public static final int MESSAGE_SET_EXTERNAL_TIMER = 0xA2; public static final int MESSAGE_ABORT = 0xFF; + public static final int POWER_STATUS_UNKNOWN = -1; + public static final int POWER_STATUS_ON = 0; + public static final int POWER_STATUS_STANDBY = 1; + public static final int POWER_TRANSIENT_TO_ON = 2; + public static final int POWER_TRANSIENT_TO_STANDBY = 3; + private static final int[] ADDRESS_TO_TYPE = { DEVICE_TV, // ADDR_TV DEVICE_RECORDER, // ADDR_RECORDER_1 diff --git a/core/java/android/hardware/hdmi/HdmiCecClient.java b/core/java/android/hardware/hdmi/HdmiCecClient.java index d7f4a72..1f382e6 100644 --- a/core/java/android/hardware/hdmi/HdmiCecClient.java +++ b/core/java/android/hardware/hdmi/HdmiCecClient.java @@ -110,16 +110,20 @@ public final class HdmiCecClient { } /** - * Send <GiveDevicePowerStatus> message. + * Returns true if the TV or attached display is powered on. + * <p> + * The result of this method is only meaningful on playback devices (where the device + * type is {@link HdmiCec#DEVICE_PLAYBACK}). + * </p> * - * @param address logical address of the device to send the message to, such as - * {@link HdmiCec#ADDR_TV}. + * @return true if TV is on; otherwise false. */ - public void sendGiveDevicePowerStatus(int address) { + public boolean isTvOn() { try { - mService.sendGiveDevicePowerStatus(mBinder, address); + return mService.isTvOn(mBinder); } catch (RemoteException e) { - Log.e(TAG, "sendGiveDevicePowerStatus threw exception ", e); + Log.e(TAG, "isTvOn threw exception ", e); } + return false; } } diff --git a/core/java/android/hardware/hdmi/HdmiCecManager.java b/core/java/android/hardware/hdmi/HdmiCecManager.java index 575785d..10b058c 100644 --- a/core/java/android/hardware/hdmi/HdmiCecManager.java +++ b/core/java/android/hardware/hdmi/HdmiCecManager.java @@ -45,6 +45,9 @@ public final class HdmiCecManager { * @return {@link HdmiCecClient} instance. {@code null} on failure. */ public HdmiCecClient getClient(int type, HdmiCecClient.Listener listener) { + if (mService == null) { + return null; + } try { IBinder b = mService.allocateLogicalDevice(type, getListenerWrapper(listener)); return HdmiCecClient.create(mService, b); diff --git a/core/java/android/hardware/hdmi/IHdmiCecService.aidl b/core/java/android/hardware/hdmi/IHdmiCecService.aidl index 6fefcf8..727f469 100644 --- a/core/java/android/hardware/hdmi/IHdmiCecService.aidl +++ b/core/java/android/hardware/hdmi/IHdmiCecService.aidl @@ -34,7 +34,7 @@ interface IHdmiCecService { void sendInactiveSource(IBinder b); void sendImageViewOn(IBinder b); void sendTextViewOn(IBinder b); - void sendGiveDevicePowerStatus(IBinder b, int address); + boolean isTvOn(IBinder b); void sendMessage(IBinder b, in HdmiCecMessage message); } |