am 4af9ce06: Merge "Fix bug 5202226 - Leave menu button visible for no-button phones if targetSdk < ICS"
* commit '4af9ce060d71cb2774731dcc48f844ef9b7145d5':
Fix bug 5202226 - Leave menu button visible for no-button phones if targetSdk < ICS
diff --git a/core/res/res/values-sw600dp/bools.xml b/core/res/res/values-sw600dp/bools.xml
index a453ac1..2097049 100644
--- a/core/res/res/values-sw600dp/bools.xml
+++ b/core/res/res/values-sw600dp/bools.xml
@@ -18,4 +18,5 @@
<bool name="preferences_prefer_dual_pane">true</bool>
<bool name="show_ongoing_ime_switcher">false</bool>
<bool name="action_bar_expanded_action_views_exclusive">false</bool>
+ <bool name="target_honeycomb_needs_options_menu">false</bool>
</resources>
diff --git a/core/res/res/values/bools.xml b/core/res/res/values/bools.xml
index 6e4db5e..87a98e2 100644
--- a/core/res/res/values/bools.xml
+++ b/core/res/res/values/bools.xml
@@ -20,4 +20,5 @@
<bool name="preferences_prefer_dual_pane">false</bool>
<bool name="show_ongoing_ime_switcher">true</bool>
<bool name="action_bar_expanded_action_views_exclusive">true</bool>
+ <bool name="target_honeycomb_needs_options_menu">true</bool>
</resources>
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 431a6bb..e2d6c5f 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -2512,8 +2512,15 @@
a.getValue(com.android.internal.R.styleable.Window_windowMinWidthMajor, mMinWidthMajor);
a.getValue(com.android.internal.R.styleable.Window_windowMinWidthMinor, mMinWidthMinor);
- if (getContext().getApplicationInfo().targetSdkVersion
- < android.os.Build.VERSION_CODES.HONEYCOMB) {
+ final Context context = getContext();
+ final int targetSdk = context.getApplicationInfo().targetSdkVersion;
+ final boolean targetPreHoneycomb = targetSdk < android.os.Build.VERSION_CODES.HONEYCOMB;
+ final boolean targetPreIcs = targetSdk < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH;
+ final boolean targetHcNeedsOptions = context.getResources().getBoolean(
+ com.android.internal.R.bool.target_honeycomb_needs_options_menu);
+ final boolean noActionBar = !hasFeature(FEATURE_ACTION_BAR) || hasFeature(FEATURE_NO_TITLE);
+
+ if (targetPreHoneycomb || (targetPreIcs && targetHcNeedsOptions && noActionBar)) {
addFlags(WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY);
}