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

Commit 61b63547 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

wm: Simplify menu action decision paths

Since the action is performed directly from the handler, remove all
fallback paths and "if not default action" checks; these are superfluous,
and can send the wrong events to apps implementing their own input handlers.

Change-Id: Iaafe9c7a1ab0ab75ae93f1c8a6e1efb6c7a616cb
parent b68ccb0b
Loading
Loading
Loading
Loading
+8 −23
Original line number Diff line number Diff line
@@ -2623,7 +2623,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    if (mEnableShiftMenuBugReports && (metaState & chordBug) == chordBug) {
                        Intent intent = new Intent(Intent.ACTION_BUG_REPORT);
                        mContext.sendOrderedBroadcast(intent, null);
                        return -1;
                    } else if (SHOW_PROCESSES_ON_ALT_MENU &&
                            (metaState & KeyEvent.META_ALT_ON) == KeyEvent.META_ALT_ON) {
                        Intent service = new Intent();
@@ -2638,8 +2637,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                        }
                        Settings.System.putInt(
                                res, Settings.System.SHOW_PROCESSES, shown ? 0 : 1);
                        return -1;
                    }
                    return -1;
                } else if (longPress) {
                    if (mLongPressOnMenuBehavior != KEY_ACTION_NOTHING) {
                        if (mLongPressOnMenuBehavior != KEY_ACTION_APP_SWITCH) {
@@ -2653,7 +2652,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    }
                }
            }
            if (mPressOnMenuBehavior != KEY_ACTION_MENU) {
            if (!down && mMenuPressed) {
                mMenuPressed = false;
                if (mPressOnMenuBehavior != KEY_ACTION_APP_SWITCH) {
@@ -2664,19 +2662,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                }
            }
            return -1;
            } else {
                if (!down) {
                    if (mMenuPressed) {
                        mMenuPressed = false;
                        cancelPreloadRecentApps();
                        performKeyAction(mPressOnMenuBehavior);
                    } else if (mLongPressOnMenuBehavior != KEY_ACTION_NOTHING) {
                        return -1;
                    }
                } else {
                    return -1;
                }
            }
        } else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
            if (down) {
                if (repeatCount == 0) {