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

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

Merge "Revert "Introduce SingleKeyGestureDetector to PhoneWindowManager"" into sc-dev

parents 399d1407 14904f3b
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -102,11 +102,9 @@ public class KeyCombinationManager {
    }

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

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

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

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

    /**
+186 −163

File changed.

Preview size limit exceeded, changes collapsed.

+0 −356

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −152

File deleted.

Preview size limit exceeded, changes collapsed.