Only set KeyEvent long press flag when repeat count equals 1.
This fixes a Gingerbread regression.
Bug: 3507021
Change-Id: Ia6030665b6a406332adc0ee0d8ee3cb735338c8e
diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp
index 421ad66..46baf9d 100644
--- a/libs/ui/InputDispatcher.cpp
+++ b/libs/ui/InputDispatcher.cpp
@@ -592,10 +592,6 @@
// mKeyRepeatState.lastKeyEntry in addition to the one we return.
entry->refCount += 1;
- if (entry->repeatCount == 1) {
- entry->flags |= AKEY_EVENT_FLAG_LONG_PRESS;
- }
-
mKeyRepeatState.nextRepeatTime = currentTime + keyRepeatDelay;
return entry;
}
@@ -645,6 +641,12 @@
resetKeyRepeatLocked();
}
+ if (entry->repeatCount == 1) {
+ entry->flags |= AKEY_EVENT_FLAG_LONG_PRESS;
+ } else {
+ entry->flags &= ~AKEY_EVENT_FLAG_LONG_PRESS;
+ }
+
entry->dispatchInProgress = true;
resetTargetsLocked();