diff options
author | Jinsuk Kim <jinsukkim@google.com> | 2014-04-02 22:43:52 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-04-02 22:43:52 +0000 |
commit | 4c963841db60ed59fd59a6fba79f8e3e6ec7f349 (patch) | |
tree | 27c9518c0633da33b51243c727e2102367038e67 /core | |
parent | 3399ec317d8a318ca384036bc6fecf4656f1f118 (diff) | |
parent | b1dca1624dc8d853a52d1918c7672173e9b79836 (diff) | |
download | frameworks_base-4c963841db60ed59fd59a6fba79f8e3e6ec7f349.zip frameworks_base-4c963841db60ed59fd59a6fba79f8e3e6ec7f349.tar.gz frameworks_base-4c963841db60ed59fd59a6fba79f8e3e6ec7f349.tar.bz2 |
am b1dca162: Merge "Maintain display power status for playback device" into klp-modular-dev
* commit 'b1dca1624dc8d853a52d1918c7672173e9b79836':
Maintain display power status for playback device
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); } |