From 29ba533edf1fc306a00688121c96b7c616a1db03 Mon Sep 17 00:00:00 2001 From: Ioana Stefan Date: Wed, 28 Oct 2020 15:59:29 +0000 Subject: [PATCH] Add IntDef annotations to fields Added IntDef annotations to fields that missed them in WindowManager LayoutParams: input_feature_flags, system_ui_visibility_flags and subtree_system_ui_visibility_flags. Bug: 160129453 Test: Run 'mp :framework-minus-apex-intdefs' and check if mapping files are properly generated Change-Id: I66d6dcbff3b41175827c84c9fda68be92877925a --- core/java/android/view/WindowManager.java | 70 ++++++++++++++++++- .../android/view/windowlayoutparams.proto | 8 +-- 2 files changed, 73 insertions(+), 5 deletions(-) diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index f85489871730f..44fbfac07b399 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -17,6 +17,27 @@ package android.view; import static android.content.pm.ActivityInfo.COLOR_MODE_DEFAULT; +import static android.view.View.STATUS_BAR_DISABLE_BACK; +import static android.view.View.STATUS_BAR_DISABLE_CLOCK; +import static android.view.View.STATUS_BAR_DISABLE_EXPAND; +import static android.view.View.STATUS_BAR_DISABLE_HOME; +import static android.view.View.STATUS_BAR_DISABLE_NOTIFICATION_ALERTS; +import static android.view.View.STATUS_BAR_DISABLE_NOTIFICATION_ICONS; +import static android.view.View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER; +import static android.view.View.STATUS_BAR_DISABLE_RECENT; +import static android.view.View.STATUS_BAR_DISABLE_SEARCH; +import static android.view.View.STATUS_BAR_DISABLE_SYSTEM_INFO; +import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN; +import static android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; +import static android.view.View.SYSTEM_UI_FLAG_IMMERSIVE; +import static android.view.View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; +import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; +import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; +import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE; +import static android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; +import static android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; +import static android.view.View.SYSTEM_UI_FLAG_LOW_PROFILE; +import static android.view.View.SYSTEM_UI_FLAG_VISIBLE; import static android.view.WindowInsets.Side.BOTTOM; import static android.view.WindowInsets.Side.LEFT; import static android.view.WindowInsets.Side.RIGHT; @@ -2708,6 +2729,38 @@ public interface WindowManager extends ViewManager { */ public int preferredDisplayModeId; + /** + * An internal annotation for flags that can be specified to {@link #systemUiVisibility} + * and {@link #subtreeSystemUiVisibility}. + * + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(flag = true, prefix = { "" }, value = { + SYSTEM_UI_FLAG_VISIBLE, + SYSTEM_UI_FLAG_LOW_PROFILE, + SYSTEM_UI_FLAG_HIDE_NAVIGATION, + SYSTEM_UI_FLAG_FULLSCREEN, + SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR, + SYSTEM_UI_FLAG_LAYOUT_STABLE, + SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, + SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, + SYSTEM_UI_FLAG_IMMERSIVE, + SYSTEM_UI_FLAG_IMMERSIVE_STICKY, + SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, + STATUS_BAR_DISABLE_EXPAND, + STATUS_BAR_DISABLE_NOTIFICATION_ICONS, + STATUS_BAR_DISABLE_NOTIFICATION_ALERTS, + STATUS_BAR_DISABLE_NOTIFICATION_TICKER, + STATUS_BAR_DISABLE_SYSTEM_INFO, + STATUS_BAR_DISABLE_HOME, + STATUS_BAR_DISABLE_BACK, + STATUS_BAR_DISABLE_CLOCK, + STATUS_BAR_DISABLE_RECENT, + STATUS_BAR_DISABLE_SEARCH, + }) + public @interface SystemUiVisibilityFlags {} + /** * Control the visibility of the status bar. * @@ -2717,6 +2770,7 @@ public interface WindowManager extends ViewManager { * @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController} * instead. */ + @SystemUiVisibilityFlags @Deprecated public int systemUiVisibility; @@ -2725,6 +2779,7 @@ public interface WindowManager extends ViewManager { * The ui visibility as requested by the views in this hierarchy. * the combined value should be systemUiVisibility | subtreeSystemUiVisibility. */ + @SystemUiVisibilityFlags @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public int subtreeSystemUiVisibility; @@ -2738,7 +2793,6 @@ public interface WindowManager extends ViewManager { @UnsupportedAppUsage public boolean hasSystemUiListeners; - /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef( @@ -2904,6 +2958,19 @@ public interface WindowManager extends ViewManager { @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004; + /** + * An internal annotation for flags that can be specified to {@link #inputFeatures}. + * + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(flag = true, prefix = { "INPUT_FEATURE_" }, value = { + INPUT_FEATURE_DISABLE_POINTER_GESTURES, + INPUT_FEATURE_NO_INPUT_CHANNEL, + INPUT_FEATURE_DISABLE_USER_ACTIVITY, + }) + public @interface InputFeatureFlags {} + /** * Control special features of the input subsystem. * @@ -2912,6 +2979,7 @@ public interface WindowManager extends ViewManager { * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY * @hide */ + @InputFeatureFlags @UnsupportedAppUsage public int inputFeatures; diff --git a/core/proto/android/view/windowlayoutparams.proto b/core/proto/android/view/windowlayoutparams.proto index 64e6da852529b..4bb56f8acfa4d 100644 --- a/core/proto/android/view/windowlayoutparams.proto +++ b/core/proto/android/view/windowlayoutparams.proto @@ -35,7 +35,7 @@ message WindowLayoutParamsProto { optional int32 height = 5; optional float horizontal_margin = 6; optional float vertical_margin = 7; - optional int32 gravity = 8; // TODO (b/160129453): Add IntDef + optional int32 gravity = 8; optional int32 soft_input_mode = 9 [(.android.typedef) = "android.view.WindowManager.LayoutParams.SoftInputModeFlags"]; optional .android.graphics.PixelFormatProto.Format format = 10; optional int32 window_animations = 11; @@ -54,14 +54,14 @@ message WindowLayoutParamsProto { optional float preferred_refresh_rate = 16; optional int32 preferred_display_mode_id = 17; optional bool has_system_ui_listeners = 18; - optional uint32 input_feature_flags = 19; // TODO (b/160129453): Add IntDef + optional uint32 input_feature_flags = 19 [(.android.typedef) = "android.view.WindowManager.LayoutParams.InputFeatureFlags"]; optional int64 user_activity_timeout = 20; optional DisplayProto.ColorMode color_mode = 23; optional uint32 flags = 24 [(.android.typedef) = "android.view.WindowManager.LayoutParams.Flags"]; optional uint32 private_flags = 26 [(.android.typedef) = "android.view.WindowManager.LayoutParams.PrivateFlags"]; - optional uint32 system_ui_visibility_flags = 27; // TODO (b/160129453): Add IntDef - optional uint32 subtree_system_ui_visibility_flags = 28; // TODO (b/160129453): Add IntDef + optional uint32 system_ui_visibility_flags = 27 [(.android.typedef) = "android.view.WindowManager.LayoutParams.SystemUiVisibilityFlags"]; + optional uint32 subtree_system_ui_visibility_flags = 28 [(.android.typedef) = "android.view.WindowManager.LayoutParams.SystemUiVisibilityFlags"]; optional uint32 appearance = 29 [(.android.typedef) = "android.view.WindowInsetsController.Appearance"]; optional uint32 behavior = 30 [(.android.typedef) = "android.view.WindowInsetsController.Behavior"]; optional uint32 fit_insets_types = 31 [(.android.typedef) = "android.view.WindowInsets.Type.InsetsType"];