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

Commit 6219e8d0 authored by Vaibhav Devmurari's avatar Vaibhav Devmurari Committed by Android (Google) Code Review
Browse files

Merge changes from topics "remove_isKeyGestureSupported",...

Merge changes from topics "remove_isKeyGestureSupported", "vaibhav_isKeygestureSupported_refactor" into main

* changes:
  (3/n) Remove usage of isKeyGestureSupported() from KeyGestureController
  (2/n) Remove usage of isKeyGestureSupported() from KeyGestureController
parents 7863bf6b 5e3f68d1
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -28,15 +28,4 @@ interface IKeyGestureHandler {
     * to that gesture.
     */
    boolean handleKeyGesture(in AidlKeyGestureEvent event, in IBinder focusedToken);

    /**
     * Called to know if a particular gesture type is supported by the handler.
     *
     * TODO(b/358569822): Remove this call to reduce the binder calls to single call for
     *  handleKeyGesture. For this we need to remove dependency of multi-key gestures to identify if
     *  a key gesture is supported on first relevant key down.
     *  Also, for now we prioritize handlers in the system server process above external handlers to
     *  reduce IPC binder calls.
     */
    boolean isKeyGestureSupported(int gestureType);
}
+0 −7
Original line number Diff line number Diff line
@@ -1758,13 +1758,6 @@ public final class InputManager {
         */
        boolean handleKeyGestureEvent(@NonNull KeyGestureEvent event,
                @Nullable IBinder focusedToken);

        /**
         * Called to identify if a particular gesture is of interest to a handler.
         *
         * NOTE: If no active handler supports certain gestures, the gestures will not be captured.
         */
        boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType);
    }

    /** @hide */
+0 −17
Original line number Diff line number Diff line
@@ -1193,23 +1193,6 @@ public final class InputManagerGlobal {
            }
            return false;
        }

        @Override
        public boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType) {
            synchronized (mKeyGestureEventHandlerLock) {
                if (mKeyGestureEventHandlers == null) {
                    return false;
                }
                final int numHandlers = mKeyGestureEventHandlers.size();
                for (int i = 0; i < numHandlers; i++) {
                    KeyGestureEventHandler handler = mKeyGestureEventHandlers.get(i);
                    if (handler.isKeyGestureSupported(gestureType)) {
                        return true;
                    }
                }
            }
            return false;
        }
    }

    /**
+2 −4
Original line number Diff line number Diff line
@@ -108,7 +108,8 @@ public final class KeyGestureEvent {
    public static final int KEY_GESTURE_TYPE_ACCESSIBILITY_SHORTCUT_CHORD = 55;
    public static final int KEY_GESTURE_TYPE_RINGER_TOGGLE_CHORD = 56;
    public static final int KEY_GESTURE_TYPE_GLOBAL_ACTIONS = 57;
    public static final int KEY_GESTURE_TYPE_TV_ACCESSIBILITY_SHORTCUT_CHORD = 58;
    @Deprecated
    public static final int DEPRECATED_KEY_GESTURE_TYPE_TV_ACCESSIBILITY_SHORTCUT_CHORD = 58;
    public static final int KEY_GESTURE_TYPE_TV_TRIGGER_BUG_REPORT = 59;
    public static final int KEY_GESTURE_TYPE_ACCESSIBILITY_SHORTCUT = 60;
    public static final int KEY_GESTURE_TYPE_CLOSE_ALL_DIALOGS = 61;
@@ -200,7 +201,6 @@ public final class KeyGestureEvent {
            KEY_GESTURE_TYPE_ACCESSIBILITY_SHORTCUT_CHORD,
            KEY_GESTURE_TYPE_RINGER_TOGGLE_CHORD,
            KEY_GESTURE_TYPE_GLOBAL_ACTIONS,
            KEY_GESTURE_TYPE_TV_ACCESSIBILITY_SHORTCUT_CHORD,
            KEY_GESTURE_TYPE_TV_TRIGGER_BUG_REPORT,
            KEY_GESTURE_TYPE_ACCESSIBILITY_SHORTCUT,
            KEY_GESTURE_TYPE_CLOSE_ALL_DIALOGS,
@@ -777,8 +777,6 @@ public final class KeyGestureEvent {
                return "KEY_GESTURE_TYPE_RINGER_TOGGLE_CHORD";
            case KEY_GESTURE_TYPE_GLOBAL_ACTIONS:
                return "KEY_GESTURE_TYPE_GLOBAL_ACTIONS";
            case KEY_GESTURE_TYPE_TV_ACCESSIBILITY_SHORTCUT_CHORD:
                return "KEY_GESTURE_TYPE_TV_ACCESSIBILITY_SHORTCUT_CHORD";
            case KEY_GESTURE_TYPE_TV_TRIGGER_BUG_REPORT:
                return "KEY_GESTURE_TYPE_TV_TRIGGER_BUG_REPORT";
            case KEY_GESTURE_TYPE_ACCESSIBILITY_SHORTCUT:
+0 −14
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ class DesktopModeKeyGestureHandler(

    override fun handleKeyGestureEvent(event: KeyGestureEvent, focusedToken: IBinder?): Boolean {
        if (
            !isKeyGestureSupported(event.keyGestureType) ||
                !desktopTasksController.isPresent ||
                !desktopModeWindowDecorViewModel.isPresent
        ) {
@@ -136,19 +135,6 @@ class DesktopModeKeyGestureHandler(
        }
    }

    override fun isKeyGestureSupported(gestureType: Int): Boolean =
        when (gestureType) {
            KeyGestureEvent.KEY_GESTURE_TYPE_MOVE_TO_NEXT_DISPLAY ->
                enableMoveToNextDisplayShortcut()
            KeyGestureEvent.KEY_GESTURE_TYPE_SNAP_LEFT_FREEFORM_WINDOW,
            KeyGestureEvent.KEY_GESTURE_TYPE_SNAP_RIGHT_FREEFORM_WINDOW,
            KeyGestureEvent.KEY_GESTURE_TYPE_TOGGLE_MAXIMIZE_FREEFORM_WINDOW,
            KeyGestureEvent.KEY_GESTURE_TYPE_MINIMIZE_FREEFORM_WINDOW ->
                DesktopModeFlags.ENABLE_TASK_RESIZING_KEYBOARD_SHORTCUTS.isTrue &&
                    manageKeyGestures()
            else -> false
        }

    //  TODO: b/364154795 - wait for the completion of moveToNextDisplay transition, otherwise it
    //  will pick a wrong task when a user quickly perform other actions with keyboard shortcuts
    //  after moveToNextDisplay, and move this to FocusTransitionObserver class.
Loading