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

Unverified Commit dd0c904b authored by Phil Tunstall's avatar Phil Tunstall Committed by Michael Bestas
Browse files

fw/b: Implement hardware keys custom rebinding



Co-authored-by: default avatarArne Coucheron <arco68@gmail.com>
Co-authored-by: default avatarBruno Martins <bgcngm@gmail.com>
Co-authored-by: default avatarDanesh Mondegarian <daneshm90@gmail.com>
Co-authored-by: default avatarDhina17 <dhinalogu@gmail.com>
Co-authored-by: default avatarSteve Kondik <steve@cyngn.com>
Change-Id: I8e8af90ac8fc7e96f73f2c68056de533d9157fa6
parent deb0acd3
Loading
Loading
Loading
Loading
+3 −22
Original line number Diff line number Diff line
@@ -1441,28 +1441,9 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
        if (!mView.isRecentsButtonVisible() && mScreenPinningActive) {
            return onLongPressBackHome(v);
        }
        if (shouldDisableNavbarGestures()) {
            return false;
        }
        mMetricsLogger.action(MetricsEvent.ACTION_ASSIST_LONG_PRESS);
        mUiEventLogger.log(NavBarActionEvent.NAVBAR_ASSIST_LONGPRESS);
        Bundle args = new Bundle();
        args.putInt(
                AssistManager.INVOCATION_TYPE_KEY,
                AssistManager.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS);
        // If Launcher has requested to override long press home, add a delay for the ripple.
        // TODO(b/304146255): Remove this delay once we can exclude 3-button nav from screenshot.
        boolean delayAssistInvocation = mAssistManagerLazy.get().shouldOverrideAssist(
                AssistManager.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS);
        // In practice, I think v should always be a KeyButtonView, but just being safe.
        if (delayAssistInvocation && v instanceof KeyButtonView) {
            ((KeyButtonView) v).setOnRippleInvisibleRunnable(
                    () -> mAssistManagerLazy.get().startAssist(args));
        } else {
            mAssistManagerLazy.get().startAssist(args);
        }
        mCentralSurfacesOptionalLazy.get().ifPresent(CentralSurfaces::awakenDreams);
        mView.abortCurrentGesture();
        KeyButtonView keyButtonView = (KeyButtonView) v;
        keyButtonView.sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_LONG_PRESS);
        keyButtonView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
        return true;
    }

+306 −115

File changed.

Preview size limit exceeded, changes collapsed.