Skip to content

Commit

Permalink
extra keys: avoid scheduled executor leak
Browse files Browse the repository at this point in the history
Under certain cases scheduled executor may leak causing repeatable input to
stuck.

Issue: #2156
  • Loading branch information
Leonid Pliushch committed Jul 11, 2021
1 parent 1b62f7c commit 0308d6a
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ public void reload(ExtraKeysInfo infos) {
case MotionEvent.ACTION_DOWN:
longPressCount = 0;
v.setBackgroundColor(BUTTON_PRESSED_COLOR);
if (scheduledExecutor != null) {
scheduledExecutor.shutdownNow();
scheduledExecutor = null;
}
if (Arrays.asList("UP", "DOWN", "LEFT", "RIGHT", "BKSP", "DEL").contains(buttonInfo.getKey())) {
// autorepeat
scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
Expand Down

0 comments on commit 0308d6a

Please sign in to comment.