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

Commit 87a08338 authored by Pranav Vashi's avatar Pranav Vashi Committed by Bruno Martins
Browse files

KeyGestureController: Fix broken actions for Assist key press and long press

Issue:
Assist button press action and assist button long press action not working.

Log:
E KeyGestureController: KEYCODE_ASSIST should be handled in interceptKeyBeforeQueueing

Analysis:
InputManager routes this key to KeyGestureController first.
KeyGestureController then consumes it and logs the WTF, so it never reaches PhoneWindowManager.

Flag useKeyGestureEventHandler is true (where?).

Solution:
Do not consume in KeyGestureController, let policy handle it in PhoneWindowManager.
Pipe functions in interceptSystemKeysAndShortcutsNew.

Bonus: Seems this would be also broken for KEYCODE_MENU. Let's add same hotfix.

Fixes: https://github.com/crdroidandroid/issue_tracker/issues/777
Change-Id: I8ecccc5e83ad963faf45719a186d69b7cdcaa90f
parent 5c721029
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -842,8 +842,9 @@ final class KeyGestureController {
                }
                return true;
            case KeyEvent.KEYCODE_ASSIST:
                Slog.wtf(TAG, "KEYCODE_ASSIST should be handled in interceptKeyBeforeQueueing");
                return true;
            case KeyEvent.KEYCODE_MENU:
                // Let policy handle it in PhoneWindowManager.interceptKeyBeforeQueueing
                return false;
            case KeyEvent.KEYCODE_VOICE_ASSIST:
                Slog.wtf(TAG, "KEYCODE_VOICE_ASSIST should be handled in"
                        + " interceptKeyBeforeQueueing");
+3 −0
Original line number Diff line number Diff line
@@ -4634,6 +4634,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        final int metaState = event.getMetaState();

        switch (keyCode) {
            case KeyEvent.KEYCODE_ASSIST:
            case KeyEvent.KEYCODE_MENU:
                return interceptSystemKeysAndShortcutsOld(focusedToken, event);
            case KeyEvent.KEYCODE_HOME:
                return handleHomeShortcuts(focusedToken, event);
            case KeyEvent.KEYCODE_VOLUME_UP: