From 195d31c54d6d64a34323191bdc0aaa8cb52cf711 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 15 Nov 2019 16:53:00 -0800 Subject: Removing remnants of menu key Bug: 131763491 Test: Everything compiles Change-Id: I43207f4835b295123d6eb2a9a06c90cd5ed29174 --- core/java/android/view/Window.java | 10 ---- core/java/android/view/WindowManager.java | 56 ---------------------- .../com/android/internal/policy/PhoneWindow.java | 12 ----- core/proto/android/view/windowlayoutparams.proto | 7 --- core/res/res/values-sw600dp/bools.xml | 1 - core/res/res/values/bools.xml | 1 - core/res/res/values/symbols.xml | 1 - .../android/server/policy/WindowManagerPolicy.java | 8 ---- .../java/com/android/server/wm/DisplayContent.java | 34 ------------- .../java/com/android/server/wm/WindowState.java | 6 --- 10 files changed, 136 deletions(-) diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index c699cdca4d00..d79abc207bfd 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -1167,16 +1167,6 @@ public abstract class Window { dispatchWindowAttributesChanged(attrs); } - /** - * {@hide} - */ - @UnsupportedAppUsage - protected void setNeedsMenuKey(int value) { - final WindowManager.LayoutParams attrs = getAttributes(); - attrs.needsMenuKey = value; - dispatchWindowAttributesChanged(attrs); - } - /** * {@hide} */ diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index c62e69cc5ed1..de04103c2ec0 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -29,7 +29,6 @@ import static android.view.WindowLayoutParamsProto.HAS_SYSTEM_UI_LISTENERS; import static android.view.WindowLayoutParamsProto.HEIGHT; import static android.view.WindowLayoutParamsProto.HORIZONTAL_MARGIN; import static android.view.WindowLayoutParamsProto.INPUT_FEATURE_FLAGS; -import static android.view.WindowLayoutParamsProto.NEEDS_MENU_KEY; import static android.view.WindowLayoutParamsProto.PREFERRED_REFRESH_RATE; import static android.view.WindowLayoutParamsProto.PRIVATE_FLAGS; import static android.view.WindowLayoutParamsProto.ROTATION_ANIMATION; @@ -1936,48 +1935,6 @@ public interface WindowManager extends ViewManager { @TestApi public int privateFlags; - /** - * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it - * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu - * key. For this case, we should look at windows behind it to determine the appropriate - * value. - * - * @hide - */ - public static final int NEEDS_MENU_UNSET = 0; - - /** - * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a - * menu key. - * - * @hide - */ - @UnsupportedAppUsage - public static final int NEEDS_MENU_SET_TRUE = 1; - - /** - * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't - * needs a menu key. - * - * @hide - */ - @UnsupportedAppUsage - public static final int NEEDS_MENU_SET_FALSE = 2; - - /** - * State variable for a window belonging to an activity that responds to - * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a - * physical button this variable is ignored, but on devices where the Menu key is drawn in - * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}. - * - * (Note that Action Bars, when available, are the preferred way to offer additional - * functions otherwise accessed via an options menu.) - * - * {@hide} - */ - @UnsupportedAppUsage - public int needsMenuKey = NEEDS_MENU_UNSET; - /** * Given a particular set of window manager flags, determine whether * such a window may be a target for an input method when it has @@ -2776,7 +2733,6 @@ public interface WindowManager extends ViewManager { out.writeInt(surfaceInsets.bottom); out.writeInt(hasManualSurfaceInsets ? 1 : 0); out.writeInt(preservePreviousSurfaceInsets ? 1 : 0); - out.writeInt(needsMenuKey); out.writeLong(accessibilityIdOfAnchor); TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags); out.writeInt(mColorMode); @@ -2834,7 +2790,6 @@ public interface WindowManager extends ViewManager { surfaceInsets.bottom = in.readInt(); hasManualSurfaceInsets = in.readInt() != 0; preservePreviousSurfaceInsets = in.readInt() != 0; - needsMenuKey = in.readInt(); accessibilityIdOfAnchor = in.readLong(); accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); mColorMode = in.readInt(); @@ -2876,8 +2831,6 @@ public interface WindowManager extends ViewManager { /** {@hide} */ public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21; /** {@hide} */ - public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22; - /** {@hide} */ public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23; /** {@hide} */ public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24; @@ -3051,11 +3004,6 @@ public interface WindowManager extends ViewManager { changes |= SURFACE_INSETS_CHANGED; } - if (needsMenuKey != o.needsMenuKey) { - needsMenuKey = o.needsMenuKey; - changes |= NEEDS_MENU_KEY_CHANGED; - } - if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) { accessibilityIdOfAnchor = o.accessibilityIdOfAnchor; changes |= ACCESSIBILITY_ANCHOR_CHANGED; @@ -3209,9 +3157,6 @@ public interface WindowManager extends ViewManager { sb.append(" (!preservePreviousSurfaceInsets)"); } } - if (needsMenuKey == NEEDS_MENU_SET_TRUE) { - sb.append(" needsMenuKey"); - } if (mColorMode != COLOR_MODE_DEFAULT) { sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode)); } @@ -3273,7 +3218,6 @@ public interface WindowManager extends ViewManager { proto.write(HAS_SYSTEM_UI_LISTENERS, hasSystemUiListeners); proto.write(INPUT_FEATURE_FLAGS, inputFeatures); proto.write(USER_ACTIVITY_TIMEOUT, userActivityTimeout); - proto.write(NEEDS_MENU_KEY, needsMenuKey); proto.write(COLOR_MODE, mColorMode); proto.write(FLAGS, flags); proto.write(PRIVATE_FLAGS, privateFlags); diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 227ef28cd129..05fa727cb8af 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -22,7 +22,6 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR; -import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN; import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH; @@ -2423,19 +2422,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { 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 targetPreL = targetSdk < android.os.Build.VERSION_CODES.LOLLIPOP; final boolean targetPreQ = targetSdk < Build.VERSION_CODES.Q; - final boolean targetHcNeedsOptions = context.getResources().getBoolean( - R.bool.target_honeycomb_needs_options_menu); - final boolean noActionBar = !hasFeature(FEATURE_ACTION_BAR) || hasFeature(FEATURE_NO_TITLE); - - if (targetPreHoneycomb || (targetPreIcs && targetHcNeedsOptions && noActionBar)) { - setNeedsMenuKey(WindowManager.LayoutParams.NEEDS_MENU_SET_TRUE); - } else { - setNeedsMenuKey(WindowManager.LayoutParams.NEEDS_MENU_SET_FALSE); - } if (!mForcedStatusBarColor) { mStatusBarColor = a.getColor(R.styleable.Window_statusBarColor, 0xFF000000); diff --git a/core/proto/android/view/windowlayoutparams.proto b/core/proto/android/view/windowlayoutparams.proto index 93a9fe2e5848..e7c282751d6a 100644 --- a/core/proto/android/view/windowlayoutparams.proto +++ b/core/proto/android/view/windowlayoutparams.proto @@ -56,13 +56,6 @@ message WindowLayoutParamsProto { optional uint32 input_feature_flags = 19; optional int64 user_activity_timeout = 20; - enum NeedsMenuState { - NEEDS_MENU_UNSET = 0; - NEEDS_MENU_SET_TRUE = 1; - NEEDS_MENU_SET_FALSE = 2; - } - optional NeedsMenuState needs_menu_key = 22; - optional DisplayProto.ColorMode color_mode = 23; optional uint32 flags = 24; optional uint32 private_flags = 26; diff --git a/core/res/res/values-sw600dp/bools.xml b/core/res/res/values-sw600dp/bools.xml index 00f45c1512a2..b3397179b5c8 100644 --- a/core/res/res/values-sw600dp/bools.xml +++ b/core/res/res/values-sw600dp/bools.xml @@ -15,7 +15,6 @@ --> - false true false false diff --git a/core/res/res/values/bools.xml b/core/res/res/values/bools.xml index b49fe49c087b..29f9f6c2d736 100644 --- a/core/res/res/values/bools.xml +++ b/core/res/res/values/bools.xml @@ -23,7 +23,6 @@ false true true - true