summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorYuncheol Heo <ycheo@google.com>2014-05-20 19:49:58 +0900
committerYuncheol Heo <ycheo@google.com>2014-05-20 19:49:58 +0900
commit03e8a834da8189b3a20023cee31e78a17a45b07b (patch)
treeb512eef8bcf463cf531ec80cdaa935b8419ab9f8 /services
parent47c6514eaa5f1b0af101108b3c1b599cefa14b23 (diff)
downloadframeworks_base-03e8a834da8189b3a20023cee31e78a17a45b07b.zip
frameworks_base-03e8a834da8189b3a20023cee31e78a17a45b07b.tar.gz
frameworks_base-03e8a834da8189b3a20023cee31e78a17a45b07b.tar.bz2
Fix the wrong conversion of byte to int.
Because 'byte' type is signed, we need a mask when converting it to 'int' type. Change-Id: I3a8fcb38c9d108c0280d66301e29144391807401
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/hdmi/NewDeviceAction.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/hdmi/NewDeviceAction.java b/services/core/java/com/android/server/hdmi/NewDeviceAction.java
index e0bc718..156bbbe 100644
--- a/services/core/java/com/android/server/hdmi/NewDeviceAction.java
+++ b/services/core/java/com/android/server/hdmi/NewDeviceAction.java
@@ -103,7 +103,7 @@ final class NewDeviceAction extends FeatureAction {
requestVendorId();
return true;
} else if (opcode == HdmiCec.MESSAGE_FEATURE_ABORT) {
- int requestOpcode = params[1];
+ int requestOpcode = params[1] & 0xff;
if (requestOpcode == HdmiCec.MESSAGE_SET_OSD_NAME) {
mState = STATE_WAITING_FOR_DEVICE_VENDOR_ID;
requestVendorId();
@@ -113,7 +113,8 @@ final class NewDeviceAction extends FeatureAction {
} else if (mState == STATE_WAITING_FOR_DEVICE_VENDOR_ID) {
if (opcode == HdmiCec.MESSAGE_DEVICE_VENDOR_ID) {
if (params.length == 3) {
- mVendorId = (params[0] << 16) + (params[1] << 8) + params[2];
+ mVendorId = ((params[0] & 0xff) << 16) + ((params[1] & 0xff) << 8)
+ + (params[2] & 0xff);
} else {
Slog.e(TAG, "Failed to get device vendor ID: ");
}
@@ -121,7 +122,7 @@ final class NewDeviceAction extends FeatureAction {
finish();
return true;
} else if (opcode == HdmiCec.MESSAGE_FEATURE_ABORT) {
- int requestOpcode = params[1];
+ int requestOpcode = params[1] & 0xff;
if (requestOpcode == HdmiCec.MESSAGE_DEVICE_VENDOR_ID) {
addDeviceInfo();
finish();