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

Commit f09a552f authored by Phil Tunstall's avatar Phil Tunstall Committed by Bruno Martins
Browse files

Reimplement hardware keys custom rebinding

Fixups for ten @sam3000

This is a squash of the following commits:

Author: Phil Tunstall <ptunstall@gmail.com>
Date:   Fri Nov 14 09:44:49 2014 -0800

    Hardware key custom rebinding (1/2)

    Framework changes to allow rebinding of the actions performed on the
    following key press events: Home long-press, home double-tap, menu press,
    menu long-press, search press, search long-press, app-switch press and
    app-switch long-press.

    The available actions are: Nothing, open/close menu, recent apps
    switcher, search assistant, voice search, in-app search, device sleep,
    and launch camera.

    Change-Id: I72c0d220a09d79230bfa299e0521ed693e5c25f1

Author: Steve Kondik <steve@cyngn.com>
Date:   Tue Oct 18 23:38:28 2016 -0700

    wm: Add support for split screen button behavior

     * And make it the default for long-press recents like the navbar.

    Change-Id: I432c80a2c9b29b9a02d64e29d484f92623b0648a

Author: Bruno Martins <bgcngm@gmail.com>
Date:   Mon Dec 25 22:10:28 2017 +0000

    Forward-port hardware keys custom rebinding to O

     * Adapted to Lineage SDK as well as to the moved hardware keys
       configs and constants.

     * Converted variables that track user-customisable behavior for
       certain key events from int to Action in order to use the newly
       introduced SDK function helpers.

Change-Id: I2e2234e3d01d943e0cadd23898288f8a88936a47

Setting a custom menu key action will do both the custom action
and the default action at the same time. Comparing code with 14.1
we're missing the return here.

Change-Id: I2f188ec78fae5068ffa1a5c80a8afa5ee2f167b5
parent eb421618
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -989,6 +989,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback

        ButtonDispatcher homeButton = mNavigationBarView.getHomeButton();
        homeButton.setOnTouchListener(this::onHomeTouch);
        homeButton.setLongClickable(true);
        homeButton.setOnLongClickListener(this::onHomeLongClick);

        ButtonDispatcher accessibilityButton = mNavigationBarView.getAccessibilityButton();
@@ -1043,20 +1044,9 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback
                && ActivityManagerWrapper.getInstance().isScreenPinningActive()) {
            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_HOME_BUTTON_LONG_PRESS);
        mAssistManager.startAssist(args);
        mStatusBarLazy.get().awakenDreams();

        if (mNavigationBarView != null) {
            mNavigationBarView.abortCurrentGesture();
        }
        KeyButtonView keyButtonView = (KeyButtonView) v;
        keyButtonView.sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_LONG_PRESS);
        keyButtonView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
        return true;
    }

+285 −88

File changed.

Preview size limit exceeded, changes collapsed.