summaryrefslogtreecommitdiffstats
path: root/policy/src
diff options
context:
space:
mode:
authorEthan Chen <intervigil@gmail.com>2013-05-30 22:12:18 -0700
committerEthan Chen <intervigil@gmail.com>2013-06-06 10:45:32 -0700
commit45b6edf912e4b2379a3971c5b785b66bfe1ae9d9 (patch)
tree59ef73b303b1f542f086f919f1b1cb72c1f6eeb6 /policy/src
parent4ed6fd0c617d7642a2056fb99d18e5356f42b60a (diff)
downloadframeworks_base-45b6edf912e4b2379a3971c5b785b66bfe1ae9d9.zip
frameworks_base-45b6edf912e4b2379a3971c5b785b66bfe1ae9d9.tar.gz
frameworks_base-45b6edf912e4b2379a3971c5b785b66bfe1ae9d9.tar.bz2
Detect whether overflow button should be shown based on menu key state
Some devices may have hardware keys but not contain a hardware menu key. Hardware keys are also able to remapped. The overflow button detection logic currently does not take that into account. This change allows detects whether any key is capable of emitting the MENU_ACTION keystroke in order to determine whether the overflow button should be shown or not. Change-Id: I8699bd0242560314f8eadc54b187c69c992cf875
Diffstat (limited to 'policy/src')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindowManager.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index b7fa3ef..49b9059 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -374,6 +374,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
boolean mHasMenuKey;
boolean mHasAssistKey;
boolean mHasAppSwitchKey;
+ boolean mHasMenuKeyEnabled;
// The last window we were told about in focusChanged.
WindowState mFocusedWindow;
@@ -1334,6 +1335,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
boolean keyRebindingEnabled = Settings.System.getInt(resolver,
Settings.System.HARDWARE_KEY_REBINDING, 0) == 1;
+ mHasMenuKeyEnabled = false;
+
if (!keyRebindingEnabled) {
if (mHasHomeKey) {
if (mHasAppSwitchKey) {
@@ -1349,6 +1352,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
} else {
mLongPressOnMenuBehavior = KEY_ACTION_SEARCH;
}
+ mHasMenuKeyEnabled = true;
}
if (mHasAssistKey) {
mPressOnAssistBehavior = KEY_ACTION_SEARCH;
@@ -1367,6 +1371,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mLongPressOnHomeBehavior = Settings.System.getInt(resolver,
Settings.System.KEY_HOME_LONG_PRESS_ACTION, KEY_ACTION_APP_SWITCH);
}
+ mHasMenuKeyEnabled = (mLongPressOnHomeBehavior == KEY_ACTION_MENU);
}
if (mHasMenuKey) {
mPressOnMenuBehavior = Settings.System.getInt(resolver,
@@ -1378,18 +1383,24 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mLongPressOnMenuBehavior = Settings.System.getInt(resolver,
Settings.System.KEY_MENU_LONG_PRESS_ACTION, KEY_ACTION_SEARCH);
}
+ mHasMenuKeyEnabled |= (mPressOnMenuBehavior == KEY_ACTION_MENU) ||
+ (mLongPressOnMenuBehavior == KEY_ACTION_MENU);
}
if (mHasAssistKey) {
mPressOnAssistBehavior = Settings.System.getInt(resolver,
Settings.System.KEY_ASSIST_ACTION, KEY_ACTION_SEARCH);
mLongPressOnAssistBehavior = Settings.System.getInt(resolver,
Settings.System.KEY_ASSIST_LONG_PRESS_ACTION, KEY_ACTION_VOICE_SEARCH);
+ mHasMenuKeyEnabled |= (mPressOnAssistBehavior == KEY_ACTION_MENU) ||
+ (mLongPressOnAssistBehavior == KEY_ACTION_MENU);
}
if (mHasAppSwitchKey) {
mPressOnAppSwitchBehavior = Settings.System.getInt(resolver,
Settings.System.KEY_APP_SWITCH_ACTION, KEY_ACTION_APP_SWITCH);
mLongPressOnAppSwitchBehavior = Settings.System.getInt(resolver,
Settings.System.KEY_APP_SWITCH_LONG_PRESS_ACTION, KEY_ACTION_NOTHING);
+ mHasMenuKeyEnabled |= (mPressOnAppSwitchBehavior == KEY_ACTION_MENU) ||
+ (mLongPressOnAppSwitchBehavior == KEY_ACTION_MENU);
}
}
@@ -5177,6 +5188,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
@Override
+ public boolean hasMenuKeyEnabled() {
+ return mHasMenuKeyEnabled;
+ }
+
+ @Override
public void setLastInputMethodWindowLw(WindowState ime, WindowState target) {
mLastInputMethodWindow = ime;
mLastInputMethodTargetWindow = target;