Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d41d0385 authored by Miranda Kephart's avatar Miranda Kephart
Browse files

Don't send long-press event if KEYCODE_UNKNOWN

Gates sending a long-press event on the keycode not being unknown.
This brings the behavior into line with the other times events are
sent from KeyButtonView and fixes a bug where long-pressing the
recents button in 3-button mode broke screenshots. When this
happens we send an ACTION_DOWN event, but no ACTION_UP event,
which prevents the key combination manager from correctly
recognizing keychords.

Bug: 181178545
Test: manual; repro = long-press the recents button in 3-button
mode, then attempt to take a screenshot with power+vol_down.

Change-Id: I26d232067befc3aca04c74e4ef8f4ad4ac629934
parent 40b4495f
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -127,8 +127,10 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
                    performLongClick();
                    performLongClick();
                    mLongClicked = true;
                    mLongClicked = true;
                } else {
                } else {
                    if (mCode != KEYCODE_UNKNOWN) {
                        sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_LONG_PRESS);
                        sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_LONG_PRESS);
                        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
                        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
                    }
                    mLongClicked = true;
                    mLongClicked = true;
                }
                }
            }
            }