summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJungshik Jang <jayjang@google.com>2014-06-02 04:34:02 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-06-02 04:34:02 +0000
commit5a0d97b1c208bf0fca18a721c55f687dc6f294d7 (patch)
treedb6570b32e6aa84cc5f54cfb4c6b90a4dacd7f11 /core
parent3a551cb536db28cfc73c181b185d1a275827a956 (diff)
parent61ced38d61926bc28638d805436086db22b642c3 (diff)
downloadframeworks_base-5a0d97b1c208bf0fca18a721c55f687dc6f294d7.zip
frameworks_base-5a0d97b1c208bf0fca18a721c55f687dc6f294d7.tar.gz
frameworks_base-5a0d97b1c208bf0fca18a721c55f687dc6f294d7.tar.bz2
Merge "DO NOT MERGE: Add the constants for the callback result of SendCecCommand()." into lmp-preview-dev
Diffstat (limited to 'core')
-rw-r--r--core/java/android/hardware/hdmi/HdmiCecMessage.java37
1 files changed, 34 insertions, 3 deletions
diff --git a/core/java/android/hardware/hdmi/HdmiCecMessage.java b/core/java/android/hardware/hdmi/HdmiCecMessage.java
index ddaf870..a8aa376 100644
--- a/core/java/android/hardware/hdmi/HdmiCecMessage.java
+++ b/core/java/android/hardware/hdmi/HdmiCecMessage.java
@@ -123,6 +123,7 @@ public final class HdmiCecMessage implements Parcelable {
* @param p HdmiCecMessage object to read the Rating from
* @return a new HdmiCecMessage created from the data in the parcel
*/
+ @Override
public HdmiCecMessage createFromParcel(Parcel p) {
int source = p.readInt();
int destination = p.readInt();
@@ -131,6 +132,7 @@ public final class HdmiCecMessage implements Parcelable {
p.readByteArray(params);
return new HdmiCecMessage(source, destination, opcode, params);
}
+ @Override
public HdmiCecMessage[] newArray(int size) {
return new HdmiCecMessage[size];
}
@@ -139,11 +141,40 @@ public final class HdmiCecMessage implements Parcelable {
@Override
public String toString() {
StringBuffer s = new StringBuffer();
- s.append(String.format("src: %d dst: %d op: %2X params: ", mSource, mDestination, mOpcode));
- for (byte data : mParams) {
- s.append(String.format("%02X ", data));
+ s.append(String.format("<%s> src: %d, dst: %d",
+ opcodeToString(mOpcode), mSource, mDestination));
+ if (mParams.length > 0) {
+ s.append(", params:");
+ for (byte data : mParams) {
+ s.append(String.format(" %02X", data));
+ }
}
return s.toString();
}
+
+ private static String opcodeToString(int opcode) {
+ switch (opcode) {
+ case HdmiCec.MESSAGE_FEATURE_ABORT:
+ return "Feature Abort";
+ case HdmiCec.MESSAGE_CEC_VERSION:
+ return "CEC Version";
+ case HdmiCec.MESSAGE_REQUEST_ARC_INITIATION:
+ return "Request ARC Initiation";
+ case HdmiCec.MESSAGE_REQUEST_ARC_TERMINATION:
+ return "Request ARC Termination";
+ case HdmiCec.MESSAGE_REPORT_ARC_INITIATED:
+ return "Report ARC Initiated";
+ case HdmiCec.MESSAGE_REPORT_ARC_TERMINATED:
+ return "Report ARC Terminated";
+ case HdmiCec.MESSAGE_TEXT_VIEW_ON:
+ return "Text View On";
+ case HdmiCec.MESSAGE_ACTIVE_SOURCE:
+ return "Active Source";
+ case HdmiCec.MESSAGE_GIVE_DEVICE_POWER_STATUS:
+ return "Give Device Power Status";
+ default:
+ return String.format("Opcode: %02X", opcode);
+ }
+ }
}