Merge "Add IntDef annotations to fields"

This commit is contained in:
TreeHugger Robot
2020-11-03 14:12:18 +00:00
committed by Android (Google) Code Review
2 changed files with 73 additions and 5 deletions

View File

@@ -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;
@@ -2724,6 +2745,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.
*
@@ -2733,6 +2786,7 @@ public interface WindowManager extends ViewManager {
* @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController}
* instead.
*/
@SystemUiVisibilityFlags
@Deprecated
public int systemUiVisibility;
@@ -2741,6 +2795,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;
@@ -2754,7 +2809,6 @@ public interface WindowManager extends ViewManager {
@UnsupportedAppUsage
public boolean hasSystemUiListeners;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(
@@ -2920,6 +2974,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.
*
@@ -2928,6 +2995,7 @@ public interface WindowManager extends ViewManager {
* @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
* @hide
*/
@InputFeatureFlags
@UnsupportedAppUsage
public int inputFeatures;

View File

@@ -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"];