diff options
author | Yuncheol Heo <ycheo@google.com> | 2014-05-23 20:10:19 +0900 |
---|---|---|
committer | Jungshik Jang <jayjang@google.com> | 2014-06-02 10:46:36 +0900 |
commit | 61ced38d61926bc28638d805436086db22b642c3 (patch) | |
tree | b8434fb8b44873e78895ea83931bef9f80a6c73a /core | |
parent | 47927f756a0f694358567cec845b53ab3fc980e9 (diff) | |
download | frameworks_base-61ced38d61926bc28638d805436086db22b642c3.zip frameworks_base-61ced38d61926bc28638d805436086db22b642c3.tar.gz frameworks_base-61ced38d61926bc28638d805436086db22b642c3.tar.bz2 |
DO NOT MERGE: Add the constants for the callback result of SendCecCommand().
- Move the send failure warning messages into HdmiCecController.sendCommand()
from each Actions.
- Stringfy with more detail messages for some opcodes.
Change-Id: Ib7ce24dd2a1f290e6c3a0b26738772ef1d4a9630
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/hardware/hdmi/HdmiCecMessage.java | 37 |
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); + } + } } |