diff options
author | Dongil Seo <seo@google.com> | 2014-08-26 19:41:39 +0900 |
---|---|---|
committer | Dongil Seo <seo@google.com> | 2014-08-27 10:21:20 +0900 |
commit | b64c2ba05bf64bb8015444fdcd706fa3238cb96c (patch) | |
tree | 0c08420b3254b726784c48d9ba7b3f75d41205ea /services/core/java/com/android/server/hdmi | |
parent | b79a70ab7177386ec1c3a2c83fe2ded4cf040fb9 (diff) | |
download | frameworks_base-b64c2ba05bf64bb8015444fdcd706fa3238cb96c.zip frameworks_base-b64c2ba05bf64bb8015444fdcd706fa3238cb96c.tar.gz frameworks_base-b64c2ba05bf64bb8015444fdcd706fa3238cb96c.tar.bz2 |
Fix a bug that the HdmiCecLocalDeviceTv sends <User Control Released> message for unsupported keys
Bug: 17170954
Change-Id: I0ad624eb3a1301b24865228164d8dd5a97452329
Diffstat (limited to 'services/core/java/com/android/server/hdmi')
-rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiCecKeycode.java | 8 | ||||
-rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java b/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java index aed5dcc..61c9424 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java @@ -394,4 +394,12 @@ final class HdmiCecKeycode { } return false; } + + /** + * Returns {@code true} if given Android keycode is supported, otherwise {@code false}. + */ + static boolean isSupportedKeycode(int androidKeycode) { + return HdmiCecKeycode.androidKeyToCecKey(androidKeycode) + != HdmiCecKeycode.UNSUPPORTED_KEYCODE; + } } diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java index 935714c..ae10633 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java @@ -343,6 +343,10 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { @ServiceThreadOnly protected void sendKeyEvent(int keyCode, boolean isPressed) { assertRunOnServiceThread(); + if (!HdmiCecKeycode.isSupportedKeycode(keyCode)) { + Slog.w(TAG, "Unsupported key: " + keyCode); + return; + } List<SendKeyAction> action = getActions(SendKeyAction.class); if (!action.isEmpty()) { action.get(0).processKeyEvent(keyCode, isPressed); |