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

Commit 4af9ce06 authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix bug 5202226 - Leave menu button visible for no-button phones if targetSdk < ICS"

parents 234144b5 82349c54
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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>
+1 −0
Original line number Diff line number Diff line
@@ -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>
+9 −2
Original line number Diff line number Diff line
@@ -2512,8 +2512,15 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
        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);
        }