diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2010-05-12 12:33:35 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2010-05-12 12:33:35 -0700 |
commit | 2a9ae01f74e7273ce0d1045754597ea78b88ba69 (patch) | |
tree | 0b916d365fd86f189f96ffc42174d02489a4cdef /services/java | |
parent | fb234bbe5e7cbae42b4fc8f4ab353ba561599db2 (diff) | |
parent | 133bfdfa4a89f40f15371e99904639ff5db7759a (diff) | |
download | frameworks_base-2a9ae01f74e7273ce0d1045754597ea78b88ba69.zip frameworks_base-2a9ae01f74e7273ce0d1045754597ea78b88ba69.tar.gz frameworks_base-2a9ae01f74e7273ce0d1045754597ea78b88ba69.tar.bz2 |
merge from open-source master
Change-Id: I24ecfac151c0ddc27237d711c95b8fe488d7931b
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/WindowManagerService.java | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 9a843a7..be5cc7b 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -6526,18 +6526,30 @@ public class WindowManagerService extends IWindowManager.Stub case RawInputEvent.CLASS_KEYBOARD: KeyEvent ke = (KeyEvent)ev.event; if (ke.isDown()) { - lastKey = ke; - downTime = curTime; - keyRepeatCount = 0; lastKeyTime = curTime; - nextKeyTime = lastKeyTime - + ViewConfiguration.getLongPressTimeout(); - if (DEBUG_INPUT) Slog.v( - TAG, "Received key down: first repeat @ " - + nextKeyTime); + if (lastKey != null && + ke.getKeyCode() == lastKey.getKeyCode()) { + keyRepeatCount++; + // Arbitrary long timeout to block + // repeating here since we know that + // the device driver takes care of it. + nextKeyTime = lastKeyTime + LONG_WAIT; + if (DEBUG_INPUT) Slog.v( + TAG, "Received repeated key down"); + } else { + downTime = curTime; + keyRepeatCount = 0; + nextKeyTime = lastKeyTime + + ViewConfiguration.getLongPressTimeout(); + if (DEBUG_INPUT) Slog.v( + TAG, "Received key down: first repeat @ " + + nextKeyTime); + } + lastKey = ke; } else { lastKey = null; downTime = 0; + keyRepeatCount = 0; // Arbitrary long timeout. lastKeyTime = curTime; nextKeyTime = curTime + LONG_WAIT; @@ -6545,7 +6557,12 @@ public class WindowManagerService extends IWindowManager.Stub TAG, "Received key up: ignore repeat @ " + nextKeyTime); } - dispatchKey((KeyEvent)ev.event, 0, 0); + if (keyRepeatCount > 0) { + dispatchKey(KeyEvent.changeTimeRepeat(ke, + ke.getEventTime(), keyRepeatCount), 0, 0); + } else { + dispatchKey(ke, 0, 0); + } mQueue.recycleEvent(ev); break; case RawInputEvent.CLASS_TOUCHSCREEN: |