Fix issue #2249821: Unable to start passion in safe mode

Holding down the trackball now works.

Also fix a little API check warning from Intent.

Change-Id: Icb1f901535cb521917bf7f847a93c4ff7861d20e
diff --git a/services/java/com/android/server/KeyInputQueue.java b/services/java/com/android/server/KeyInputQueue.java
index a885df8..1bb897b 100644
--- a/services/java/com/android/server/KeyInputQueue.java
+++ b/services/java/com/android/server/KeyInputQueue.java
@@ -371,6 +371,40 @@
         }
     }
     
+    public int getTrackballScancodeState(int code) {
+        synchronized (mFirst) {
+            final int N = mDevices.size();
+            for (int i=0; i<N; i++) {
+                InputDevice dev = mDevices.valueAt(i);
+                if ((dev.classes&RawInputEvent.CLASS_TRACKBALL) != 0) {
+                    int res = nativeGetScancodeState(dev.id, code);
+                    if (res > 0) {
+                        return res;
+                    }
+                }
+            }
+        }
+        
+        return 0;
+    }
+    
+    public int getDPadScancodeState(int code) {
+        synchronized (mFirst) {
+            final int N = mDevices.size();
+            for (int i=0; i<N; i++) {
+                InputDevice dev = mDevices.valueAt(i);
+                if ((dev.classes&RawInputEvent.CLASS_DPAD) != 0) {
+                    int res = nativeGetScancodeState(dev.id, code);
+                    if (res > 0) {
+                        return res;
+                    }
+                }
+            }
+        }
+        
+        return 0;
+    }
+    
     public int getKeycodeState(int code) {
         synchronized (mFirst) {
             VirtualKey vk = mPressedVirtualKey;
@@ -395,6 +429,40 @@
         }
     }
     
+    public int getTrackballKeycodeState(int code) {
+        synchronized (mFirst) {
+            final int N = mDevices.size();
+            for (int i=0; i<N; i++) {
+                InputDevice dev = mDevices.valueAt(i);
+                if ((dev.classes&RawInputEvent.CLASS_TRACKBALL) != 0) {
+                    int res = nativeGetKeycodeState(dev.id, code);
+                    if (res > 0) {
+                        return res;
+                    }
+                }
+            }
+        }
+        
+        return 0;
+    }
+    
+    public int getDPadKeycodeState(int code) {
+        synchronized (mFirst) {
+            final int N = mDevices.size();
+            for (int i=0; i<N; i++) {
+                InputDevice dev = mDevices.valueAt(i);
+                if ((dev.classes&RawInputEvent.CLASS_DPAD) != 0) {
+                    int res = nativeGetKeycodeState(dev.id, code);
+                    if (res > 0) {
+                        return res;
+                    }
+                }
+            }
+        }
+        
+        return 0;
+    }
+    
     public static native String getDeviceName(int deviceId);
     public static native int getDeviceClasses(int deviceId);
     public static native void addExcludedDevice(String deviceName);