summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2018-11-02 01:46:43 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-11-02 01:46:43 +0000
commit12c631b5872e534ea2a1b287f4a61066ae2ae0ee (patch)
treef628f4422bb2c919f485e02ec45bd404aa6fb800
parent86458f019691a10e23aa7d06fcd0877af93d5cb1 (diff)
parent622bd3244d82bb982f4f8bf2e5b7d1d9c98860d3 (diff)
Merge "Allow injected events to specify repeatCount"
-rw-r--r--services/inputflinger/InputDispatcher.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/services/inputflinger/InputDispatcher.cpp b/services/inputflinger/InputDispatcher.cpp
index 2cad9861ab..2e984d9ca9 100644
--- a/services/inputflinger/InputDispatcher.cpp
+++ b/services/inputflinger/InputDispatcher.cpp
@@ -2545,6 +2545,9 @@ void InputDispatcher::notifyKey(const NotifyKeyArgs* args) {
uint32_t policyFlags = args->policyFlags;
int32_t flags = args->flags;
int32_t metaState = args->metaState;
+ // InputDispatcher tracks and generates key repeats on behalf of
+ // whatever notifies it, so repeatCount should always be set to 0
+ constexpr int32_t repeatCount = 0;
if ((policyFlags & POLICY_FLAG_VIRTUAL) || (flags & AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY)) {
policyFlags |= POLICY_FLAG_VIRTUAL;
flags |= AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY;
@@ -2560,7 +2563,7 @@ void InputDispatcher::notifyKey(const NotifyKeyArgs* args) {
KeyEvent event;
event.initialize(args->deviceId, args->source, args->displayId, args->action,
- flags, keyCode, args->scanCode, metaState, 0,
+ flags, keyCode, args->scanCode, metaState, repeatCount,
args->downTime, args->eventTime);
android::base::Timer t;
@@ -2585,7 +2588,6 @@ void InputDispatcher::notifyKey(const NotifyKeyArgs* args) {
mLock.lock();
}
- int32_t repeatCount = 0;
KeyEntry* newEntry = new KeyEntry(args->eventTime,
args->deviceId, args->source, args->displayId, policyFlags,
args->action, flags, keyCode, args->scanCode,
@@ -2756,7 +2758,7 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event,
accelerateMetaShortcuts(keyEvent.getDeviceId(), action,
/*byref*/ keyCode, /*byref*/ metaState);
keyEvent.initialize(keyEvent.getDeviceId(), keyEvent.getSource(), keyEvent.getDisplayId(),
- action, flags, keyCode, keyEvent.getScanCode(), metaState, 0,
+ action, flags, keyCode, keyEvent.getScanCode(), metaState, keyEvent.getRepeatCount(),
keyEvent.getDownTime(), keyEvent.getEventTime());
if (flags & AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY) {