summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJinsuk Kim <jinsukkim@google.com>2014-04-03 01:41:13 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-04-03 01:41:13 +0000
commitc9cb91388b268608c8b7f588dca8417f2661f0ed (patch)
tree349c248467f8c1e7be24d9b41197bb66ea46a845 /core
parenta7d9b93756c8b1e61a721fe14d941ee7ab975513 (diff)
parent4c963841db60ed59fd59a6fba79f8e3e6ec7f349 (diff)
downloadframeworks_base-c9cb91388b268608c8b7f588dca8417f2661f0ed.zip
frameworks_base-c9cb91388b268608c8b7f588dca8417f2661f0ed.tar.gz
frameworks_base-c9cb91388b268608c8b7f588dca8417f2661f0ed.tar.bz2
am 4c963841: am b1dca162: Merge "Maintain display power status for playback device" into klp-modular-dev
* commit '4c963841db60ed59fd59a6fba79f8e3e6ec7f349': Maintain display power status for playback device
Diffstat (limited to 'core')
-rw-r--r--core/java/android/hardware/hdmi/HdmiCec.java6
-rw-r--r--core/java/android/hardware/hdmi/HdmiCecClient.java16
-rw-r--r--core/java/android/hardware/hdmi/HdmiCecManager.java3
-rw-r--r--core/java/android/hardware/hdmi/IHdmiCecService.aidl2
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 &lt;GiveDevicePowerStatus&gt; 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);
}