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

Commit 991edb76 authored by Arthur Hung's avatar Arthur Hung Committed by Android (Google) Code Review
Browse files

Merge "Introduce SingleKeyGestureDetector to PhoneWindowManager" into sc-dev

parents 52e885a6 29f27e8d
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -102,9 +102,11 @@ public class KeyCombinationManager {
    }

    /**
     * Check if the key event could be triggered by combine key rule before dispatching to a window.
     * Check if the key event could be intercepted by combination key rule before it is dispatched
     * to a window.
     * Return true if any active rule could be triggered by the key event, otherwise false.
     */
    void interceptKey(KeyEvent event, boolean interactive) {
    boolean interceptKey(KeyEvent event, boolean interactive) {
        final boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
        final int keyCode = event.getKeyCode();
        final int count = mActiveRules.size();
@@ -117,9 +119,9 @@ public class KeyCombinationManager {
                    // exceed time from first key down.
                    forAllRules(mActiveRules, (rule)-> rule.cancel());
                    mActiveRules.clear();
                    return;
                    return false;
                } else if (count == 0) { // has some key down but no active rule exist.
                    return;
                    return false;
                }
            }

@@ -127,7 +129,7 @@ public class KeyCombinationManager {
                mDownTimes.put(keyCode, eventTime);
            } else {
                // ignore old key, maybe a repeat key.
                return;
                return false;
            }

            if (mDownTimes.size() == 1) {
@@ -141,7 +143,7 @@ public class KeyCombinationManager {
            } else {
                // Ignore if rule already triggered.
                if (mTriggeredRule != null) {
                    return;
                    return true;
                }

                // check if second key can trigger rule, or remove the non-match rule.
@@ -156,6 +158,7 @@ public class KeyCombinationManager {
                mActiveRules.clear();
                if (mTriggeredRule != null) {
                    mActiveRules.add(mTriggeredRule);
                    return true;
                }
            }
        } else {
@@ -168,6 +171,7 @@ public class KeyCombinationManager {
                }
            }
        }
        return false;
    }

    /**
+163 −186

File changed.

Preview size limit exceeded, changes collapsed.

+356 −0

File added.

Preview size limit exceeded, changes collapsed.

+152 −0

File added.

Preview size limit exceeded, changes collapsed.