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

Unverified Commit 3ecd6e45 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 avatarCosmin Tanislav <demonsingur@gmail.com>
Co-authored-by: default avatarDanesh Mondegarian <daneshm90@gmail.com>
Co-authored-by: default avatarDhina17 <dhinalogu@gmail.com>
Co-authored-by: default avatarkyasu <kyasu.dev@gmail.com>
Co-authored-by: default avatarLuK1337 <priv.luk@gmail.com>
Co-authored-by: default avatarPranav Vashi <neobuddy89@gmail.com>
Co-authored-by: default avatarSteve Kondik <steve@cyngn.com>
Co-authored-by: default avatarHazouPH <jgrharbers@gmail.com>
Co-authored-by: default avatarNick Reuter <nreuter85@gmail.com>
Change-Id: I8e8af90ac8fc7e96f73f2c68056de533d9157fa6
parent ce09de65
Loading
Loading
Loading
Loading
+0 −12
Original line number Original line Diff line number Diff line
@@ -143,18 +143,6 @@ public class PhoneFallbackEventHandler implements FallbackEventHandler {
                    dispatcher.startTracking(event, this);
                    dispatcher.startTracking(event, this);
                } else if (event.isLongPress() && dispatcher.isTracking(event)) {
                } else if (event.isLongPress() && dispatcher.isTracking(event)) {
                    dispatcher.performedLongPress(event);
                    dispatcher.performedLongPress(event);
                    if (isUserSetupComplete()) {
                        mView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
                        // Broadcast an intent that the Camera button was longpressed
                        Intent intent = new Intent(Intent.ACTION_CAMERA_BUTTON, null);
                        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
                        intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
                        mContext.sendOrderedBroadcastAsUser(intent, UserHandle.CURRENT_OR_SELF,
                                null, null, null, 0, null, null);
                    } else {
                        Log.i(TAG, "Not dispatching CAMERA long press because user "
                                + "setup is in progress.");
                    }
                }
                }
                return true;
                return true;
            }
            }
+3 −22
Original line number Original line Diff line number Diff line
@@ -1488,28 +1488,9 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
        if (!mView.isRecentsButtonVisible() && mScreenPinningActive) {
        if (!mView.isRecentsButtonVisible() && mScreenPinningActive) {
            return onLongPressBackHome(v);
            return onLongPressBackHome(v);
        }
        }
        if (shouldDisableNavbarGestures()) {
        KeyButtonView keyButtonView = (KeyButtonView) v;
            return false;
        keyButtonView.sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_LONG_PRESS);
        }
        keyButtonView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
        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();
        return true;
        return true;
    }
    }


+3 −2
Original line number Original line Diff line number Diff line
@@ -875,8 +875,9 @@ final class KeyGestureController {
                }
                }
                break;
                break;
            case KeyEvent.KEYCODE_ASSIST:
            case KeyEvent.KEYCODE_ASSIST:
                Slog.wtf(TAG, "KEYCODE_ASSIST should be handled in interceptKeyBeforeQueueing");
            case KeyEvent.KEYCODE_MENU:
                return true;
                // Let policy handle it in PhoneWindowManager.interceptKeyBeforeQueueing
                return false;
            case KeyEvent.KEYCODE_VOICE_ASSIST:
            case KeyEvent.KEYCODE_VOICE_ASSIST:
                Slog.wtf(TAG, "KEYCODE_VOICE_ASSIST should be handled in"
                Slog.wtf(TAG, "KEYCODE_VOICE_ASSIST should be handled in"
                        + " interceptKeyBeforeQueueing");
                        + " interceptKeyBeforeQueueing");
+468 −153

File changed.

Preview size limit exceeded, changes collapsed.