am 2a9ae01f
: merge from open-source master
Merge commit '2a9ae01f74e7273ce0d1045754597ea78b88ba69' into kraken * commit '2a9ae01f74e7273ce0d1045754597ea78b88ba69': Corrected repeat count for key repeat in input device.
This commit is contained in:
committed by
Android Git Automerger
commit
63ece47fec
@ -6530,18 +6530,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;
|
||||
@ -6549,7 +6561,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:
|
||||
|
Reference in New Issue
Block a user