summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/provider/Settings.java70
-rw-r--r--core/java/android/view/ViewConfiguration.java17
2 files changed, 86 insertions, 1 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index db2598f..9f66bc7 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2896,6 +2896,76 @@ public final class Settings {
public static final String LOCKSCREEN_VIBRATE_ENABLED = "lockscreen.vibrate_enabled";
/**
+ * Whether to enable custom rebindings of the actions performed on
+ * certain key press events.
+ * @hide
+ */
+ public static final String HARDWARE_KEY_REBINDING = "hardware_key_rebinding";
+
+ /**
+ * Action to perform when the home key is long-pressed. (Default is 2)
+ * 0 - Nothing
+ * 1 - Menu
+ * 2 - App-switch
+ * 3 - Search
+ * 4 - Voice search
+ * 5 - In-app search
+ * @hide
+ */
+ public static final String KEY_HOME_LONG_PRESS_ACTION = "key_home_long_press_action";
+
+ /**
+ * Action to perform when the menu key is pressed. (Default is 1)
+ * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
+ * @hide
+ */
+ public static final String KEY_MENU_ACTION = "key_menu_action";
+
+ /**
+ * Action to perform when the menu key is long-pressed.
+ * (Default is 0 on devices with a search key, 3 on devices without)
+ * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
+ * @hide
+ */
+ public static final String KEY_MENU_LONG_PRESS_ACTION = "key_menu_long_press_action";
+
+ /**
+ * Action to perform when the assistant (search) key is pressed. (Default is 3)
+ * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
+ * @hide
+ */
+ public static final String KEY_ASSIST_ACTION = "key_assist_action";
+
+ /**
+ * Action to perform when the assistant (search) key is long-pressed. (Default is 4)
+ * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
+ * @hide
+ */
+ public static final String KEY_ASSIST_LONG_PRESS_ACTION = "key_assist_long_press_action";
+
+ /**
+ * Action to perform when the app switch key is pressed. (Default is 2)
+ * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
+ * @hide
+ */
+ public static final String KEY_APP_SWITCH_ACTION = "key_app_switch_action";
+
+ /**
+ * Action to perform when the app switch key is long-pressed. (Default is 0)
+ * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
+ * @hide
+ */
+ public static final String KEY_APP_SWITCH_LONG_PRESS_ACTION = "key_app_switch_long_press_action";
+
+ /**
+ * Control the display of the action overflow button within app UI.
+ * 0 = use system default
+ * 1 = force on
+ * @hide
+ */
+ public static final String UI_FORCE_OVERFLOW_BUTTON = "ui_force_overflow_button";
+
+ /**
* Settings to backup. This is here so that it's in the same place as the settings
* keys and easy to update.
*
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 499075e..73295a2 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -223,6 +223,8 @@ public class ViewConfiguration {
private boolean sHasPermanentMenuKey;
private boolean sHasPermanentMenuKeySet;
+ private Context mContext;
+
static final SparseArray<ViewConfiguration> sConfigurations =
new SparseArray<ViewConfiguration>(2);
@@ -270,6 +272,8 @@ public class ViewConfiguration {
sizeAndDensity = density;
}
+ mContext = context;
+
mEdgeSlop = (int) (sizeAndDensity * EDGE_SLOP + 0.5f);
mFadingEdgeLength = (int) (sizeAndDensity * FADING_EDGE_LENGTH + 0.5f);
mMinimumFlingVelocity = (int) (density * MINIMUM_FLING_VELOCITY + 0.5f);
@@ -678,7 +682,18 @@ public class ViewConfiguration {
* @return true if a permanent menu key is present, false otherwise.
*/
public boolean hasPermanentMenuKey() {
- return sHasPermanentMenuKey;
+ // The action overflow button within app UI can
+ // be controlled with a system setting
+ int showOverflowButton = Settings.System.getInt(
+ mContext.getContentResolver(),
+ Settings.System.UI_FORCE_OVERFLOW_BUTTON, 0);
+ if (showOverflowButton == 1) {
+ // Force overflow button on by reporting that
+ // the device has no permanent menu key
+ return false;
+ } else {
+ return sHasPermanentMenuKey;
+ }
}
/**