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

Commit 6a62e55d authored by Michael Wright's avatar Michael Wright
Browse files

Use META_LEFT to launch the ASSIST behavior.

Also, claim any key combo'd with META_LEFT for the system.

Change-Id: I29892e31ed40f04d1dd3cf173551237ffb3702ca
parent 70dbeaca
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -446,6 +446,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mSearchKeyShortcutPending;
    boolean mConsumeSearchKeyUp;
    boolean mAssistKeyLongPressed;
    boolean mPendingMetaAction;

    // support for activating the lock screen while the screen is on
    boolean mAllowLockscreenWhenOn;
@@ -2088,6 +2089,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            }
        }

        // Cancel any pending meta actions if we see any other keys being pressed between the down
        // of the meta key and its corresponding up.
        if (mPendingMetaAction && keyCode != KeyEvent.KEYCODE_META_LEFT) {
            mPendingMetaAction = false;
        }

        // First we always handle the home key here, so applications
        // can never break it, although if keyguard is on, we do let
        // it handle it, because that gives us the correct 5 second
@@ -2282,6 +2289,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT_OR_SELF);
            }
            return -1;
        } else if (keyCode == KeyEvent.KEYCODE_META_LEFT) {
            if (down) {
                mPendingMetaAction = true;
            } else if (mPendingMetaAction) {
                mPendingMetaAction = false;
                launchAssistAction();
            }
            return -1;
        }

        // Shortcuts are invoked through Search+key, so intercept those here
@@ -2391,6 +2406,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            return -1;
        }

        // Reserve all the META modifier combos for system behavior
        if ((metaState & KeyEvent.META_META_LEFT_ON) != 0) {
            return -1;
        }

        // Let the application handle the key.
        return 0;
    }