From 9bb3ef2e78879e4ec02821fbdb07ba9f9e9521a1 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Wed, 17 Nov 2010 19:16:52 -0800 Subject: [PATCH] Fix stuck keys when released out of order. (DO NOT MERGE) Bug: 3208156 Change-Id: I14e4d54f4912de5e2fabcd8638120623aa2d16e0 --- libs/ui/InputReader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ui/InputReader.cpp b/libs/ui/InputReader.cpp index d1674390e..3197ab229 100644 --- a/libs/ui/InputReader.cpp +++ b/libs/ui/InputReader.cpp @@ -934,7 +934,7 @@ void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t keyCode, ssize_t keyDownIndex = findKeyDownLocked(scanCode); if (keyDownIndex >= 0) { // key repeat, be sure to use same keycode as before in case of rotation - keyCode = mLocked.keyDowns.top().keyCode; + keyCode = mLocked.keyDowns.itemAt(keyDownIndex).keyCode; } else { // key down mLocked.keyDowns.push(); @@ -949,7 +949,7 @@ void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t keyCode, ssize_t keyDownIndex = findKeyDownLocked(scanCode); if (keyDownIndex >= 0) { // key up, be sure to use same keycode as before in case of rotation - keyCode = mLocked.keyDowns.top().keyCode; + keyCode = mLocked.keyDowns.itemAt(keyDownIndex).keyCode; mLocked.keyDowns.removeAt(size_t(keyDownIndex)); } else { // key was not actually down