Bug 758427 - Ignore KeyEvents with keyCodes greater than getMaxKeyCode(), such as Gingerbread Galaxy Note's bogus stylus events. r=blassey
authorChris Peterson <cpeterson@mozilla.com>
Thu, 28 Jun 2012 11:03:53 -0700
changeset 97874 d70b14d6df3391de9ddfa43f07718aa989c03386
parent 97873 b912941bed45a65375dc5a1427a78c4a01200fb2
child 97875 4d766f24e6a48af42457099ff927add96247c7f4
push id23007
push useremorley@mozilla.com
push dateFri, 29 Jun 2012 07:42:23 +0000
treeherdermozilla-central@4a8e0d5fc954 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs758427
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 758427 - Ignore KeyEvents with keyCodes greater than getMaxKeyCode(), such as Gingerbread Galaxy Note's bogus stylus events. r=blassey
mobile/android/base/GeckoInputConnection.java
--- a/mobile/android/base/GeckoInputConnection.java
+++ b/mobile/android/base/GeckoInputConnection.java
@@ -871,16 +871,19 @@ public class GeckoInputConnection
     }
 
     private boolean processKeyDown(int keyCode, KeyEvent event, boolean isPreIme) {
         if (DEBUG) {
             Log.d(LOGTAG, "IME: processKeyDown(keyCode=" + keyCode + ", event=" + event + ", "
                           + isPreIme + ")");
         }
 
+        if (keyCode > KeyEvent.getMaxKeyCode())
+            return false;
+
         clampSelection();
 
         switch (keyCode) {
             case KeyEvent.KEYCODE_MENU:
             case KeyEvent.KEYCODE_BACK:
             case KeyEvent.KEYCODE_VOLUME_UP:
             case KeyEvent.KEYCODE_VOLUME_DOWN:
             case KeyEvent.KEYCODE_SEARCH:
@@ -930,16 +933,19 @@ public class GeckoInputConnection
     }
 
     private boolean processKeyUp(int keyCode, KeyEvent event, boolean isPreIme) {
         if (DEBUG) {
             Log.d(LOGTAG, "IME: processKeyUp(keyCode=" + keyCode + ", event=" + event + ", "
                           + isPreIme + ")");
         }
 
+        if (keyCode > KeyEvent.getMaxKeyCode())
+            return false;
+
         switch (keyCode) {
             case KeyEvent.KEYCODE_BACK:
             case KeyEvent.KEYCODE_SEARCH:
             case KeyEvent.KEYCODE_MENU:
                 return false;
             default:
                 break;
         }