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

Commit 571becc8 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Steve Kondik
Browse files

wm: Make the default menu longpress action configurable at build time

Do the same we do for home. For CDD validation, we need to switch
the menu and home longpress action, since Home must map to Google Now.

Change-Id: Iacfedf711d43f6637023c87c00e6c6b8b8a437dc
parent 7695fad9
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1520,4 +1520,16 @@
    <string-array name="config_auto_perf_activities" translatable="false">
    </string-array>

    <!-- Control the behavior when the user long presses the menu button.
            0 - Nothing
            1 - Menu key
            2 - Recent apps view in SystemUI
            3 - Launch assist intent
            4 - Voice Search
            5 - In-app Search
         This needs to match the constants in
         policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
    -->
    <integer name="config_longPressOnMenuBehavior">3</integer>

</resources>
+1 −0
Original line number Diff line number Diff line
@@ -1397,6 +1397,7 @@
  <java-symbol type="integer" name="config_lidNavigationAccessibility" />
  <java-symbol type="integer" name="config_lidOpenRotation" />
  <java-symbol type="integer" name="config_longPressOnHomeBehavior" />
  <java-symbol type="integer" name="config_longPressOnMenuBehavior" />
  <java-symbol type="layout" name="global_actions_item" />
  <java-symbol type="layout" name="global_actions_silent_mode" />
  <java-symbol type="layout" name="recent_apps_dialog" />
+9 −3
Original line number Diff line number Diff line
@@ -1365,9 +1365,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {

        // Initialize all assignments to sane defaults.
        mPressOnMenuBehavior = KEY_ACTION_MENU;
        if (!hasMenu || hasAssist) {
            mLongPressOnMenuBehavior = KEY_ACTION_NOTHING;
        } else {

        mLongPressOnMenuBehavior = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_longPressOnMenuBehavior);

        if (mLongPressOnMenuBehavior == KEY_ACTION_NOTHING &&
                (hasMenu && !hasAssist)) {
            mLongPressOnMenuBehavior = KEY_ACTION_SEARCH;
        }
        mPressOnAssistBehavior = KEY_ACTION_SEARCH;
@@ -2661,9 +2664,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    if (mMenuPressed) {
                        mMenuPressed = false;
                        cancelPreloadRecentApps();
                        performKeyAction(mPressOnMenuBehavior);
                    } else if (mLongPressOnMenuBehavior != KEY_ACTION_NOTHING) {
                        return -1;
                    }
                } else if (mLongPressOnMenuBehavior != KEY_ACTION_NOTHING) {
                    return -1;
                }
            }
        } else if (keyCode == KeyEvent.KEYCODE_SEARCH) {