From 61791075f4422cfef00fda325d6ae07293dd262f Mon Sep 17 00:00:00 2001 From: Jinsuk Kim Date: Mon, 7 Apr 2014 13:39:17 +0900 Subject: Delegate HdmiCecService method impl to HdmiCecDevice subclass Most of the methods in the interface IHdmiCecService should be implemented based on the device type. This CL makes a change such that the HdmiCecDevice just has stub methods that should be overriden by subclasses. Other changes: - Fixed a bug of not sending its physical address in its message body. Also the command should have been sent to TV only rather than broadcast. - Put back sendGiveDevicePowerStatus interface method. It allows the client to keep track of the other device(like TV) power status more closely. Devices goes through the status from standby -> transient to on -> on but the CEC spec doesn't require that they broacast it actively. The restored method can be used to let the playback device to get up-to-date power status of TV/display when it is booting up. This method should work the same across all the device types. So it was implemented in the service, not delegated to HdmiCecDevice. - Send when a new logical device is registered, which is required by CEC spec: "it should report the association between its logical and physical address by broadcasting Change-Id: Iac1d2cf5783d947f2dcd6965a54670fbdb8e6a63 --- core/java/android/hardware/hdmi/HdmiCecClient.java | 18 ++++++++++++++++-- core/java/android/hardware/hdmi/IHdmiCecService.aidl | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/java/android/hardware/hdmi/HdmiCecClient.java b/core/java/android/hardware/hdmi/HdmiCecClient.java index 1f382e6..cd86cd8 100644 --- a/core/java/android/hardware/hdmi/HdmiCecClient.java +++ b/core/java/android/hardware/hdmi/HdmiCecClient.java @@ -88,7 +88,7 @@ public final class HdmiCecClient { } /** - * Send <TextViewOn> message. + * Send <Text View On> message. */ public void sendTextViewOn() { try { @@ -99,7 +99,7 @@ public final class HdmiCecClient { } /** - * Send <ImageViewOn> message. + * Send <Image View On> message. */ public void sendImageViewOn() { try { @@ -110,6 +110,20 @@ public final class HdmiCecClient { } /** + * Send <Give Device Power Status> message. + * + * @param address logical address of the device to send the message to, such as + * {@link HdmiCec#ADDR_TV}. + */ + public void sendGiveDevicePowerStatus(int address) { + try { + mService.sendGiveDevicePowerStatus(mBinder, address); + } catch (RemoteException e) { + Log.e(TAG, "sendGiveDevicePowerStatus threw exception ", e); + } + } + + /** * Returns true if the TV or attached display is powered on. *

* The result of this method is only meaningful on playback devices (where the device diff --git a/core/java/android/hardware/hdmi/IHdmiCecService.aidl b/core/java/android/hardware/hdmi/IHdmiCecService.aidl index b5df131..ecdd345 100644 --- a/core/java/android/hardware/hdmi/IHdmiCecService.aidl +++ b/core/java/android/hardware/hdmi/IHdmiCecService.aidl @@ -33,6 +33,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); } -- cgit v1.1