summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/KeyInputQueue.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-09-28 13:25:46 -0700
committerDianne Hackborn <hackbod@google.com>2009-09-28 13:40:45 -0700
commit6af0d50a8edb101d9da1306b6d85abf5dd3f9a30 (patch)
tree0680cd7ce5f407446a1b5d50095deada73d2e508 /services/java/com/android/server/KeyInputQueue.java
parentaef439e6f825c0cb99a2ac08c8207f48b7a9fe10 (diff)
downloadframeworks_base-6af0d50a8edb101d9da1306b6d85abf5dd3f9a30.zip
frameworks_base-6af0d50a8edb101d9da1306b6d85abf5dd3f9a30.tar.gz
frameworks_base-6af0d50a8edb101d9da1306b6d85abf5dd3f9a30.tar.bz2
Fix issue #2149145: Safe Mode does not work on Sholes device
The APIs for checking whether keys are held down now also look at virtual keys. However it turns out there is less than a second between the time we start the input thread and check for safe mode, so there is not enough time to actually open all of the devices and get the data from them about the finger being down to determine if a virtual key is down. So now you can also hold DPAD center, trackball center, or s to enter safe mode. Also give some vibrator feedback. Change-Id: I55edce63bc0c375813bd3751766b8070beeb0153
Diffstat (limited to 'services/java/com/android/server/KeyInputQueue.java')
-rw-r--r--services/java/com/android/server/KeyInputQueue.java56
1 files changed, 52 insertions, 4 deletions
diff --git a/services/java/com/android/server/KeyInputQueue.java b/services/java/com/android/server/KeyInputQueue.java
index d9f4c9c..d7b8f57 100644
--- a/services/java/com/android/server/KeyInputQueue.java
+++ b/services/java/com/android/server/KeyInputQueue.java
@@ -337,6 +337,54 @@ public abstract class KeyInputQueue {
}
}
+ public int getScancodeState(int code) {
+ synchronized (mFirst) {
+ VirtualKey vk = mPressedVirtualKey;
+ if (vk != null) {
+ if (vk.scancode == code) {
+ return 2;
+ }
+ }
+ return nativeGetScancodeState(code);
+ }
+ }
+
+ public int getScancodeState(int deviceId, int code) {
+ synchronized (mFirst) {
+ VirtualKey vk = mPressedVirtualKey;
+ if (vk != null) {
+ if (vk.scancode == code) {
+ return 2;
+ }
+ }
+ return nativeGetScancodeState(deviceId, code);
+ }
+ }
+
+ public int getKeycodeState(int code) {
+ synchronized (mFirst) {
+ VirtualKey vk = mPressedVirtualKey;
+ if (vk != null) {
+ if (vk.lastKeycode == code) {
+ return 2;
+ }
+ }
+ return nativeGetKeycodeState(code);
+ }
+ }
+
+ public int getKeycodeState(int deviceId, int code) {
+ synchronized (mFirst) {
+ VirtualKey vk = mPressedVirtualKey;
+ if (vk != null) {
+ if (vk.lastKeycode == code) {
+ return 2;
+ }
+ }
+ return nativeGetKeycodeState(deviceId, code);
+ }
+ }
+
public static native String getDeviceName(int deviceId);
public static native int getDeviceClasses(int deviceId);
public static native void addExcludedDevice(String deviceName);
@@ -344,10 +392,10 @@ public abstract class KeyInputQueue {
InputDevice.AbsoluteInfo outInfo);
public static native int getSwitchState(int sw);
public static native int getSwitchState(int deviceId, int sw);
- public static native int getScancodeState(int sw);
- public static native int getScancodeState(int deviceId, int sw);
- public static native int getKeycodeState(int sw);
- public static native int getKeycodeState(int deviceId, int sw);
+ public static native int nativeGetScancodeState(int code);
+ public static native int nativeGetScancodeState(int deviceId, int code);
+ public static native int nativeGetKeycodeState(int code);
+ public static native int nativeGetKeycodeState(int deviceId, int code);
public static native int scancodeToKeycode(int deviceId, int scancode);
public static native boolean hasKeys(int[] keycodes, boolean[] keyExists);