diff options
40 files changed, 382 insertions, 220 deletions
diff --git a/api/current.txt b/api/current.txt index cbea597ac42f..f2755c9f62d6 100644 --- a/api/current.txt +++ b/api/current.txt @@ -52867,7 +52867,7 @@ package android.view { method protected void dispatchSetPressed(boolean); method protected void dispatchSetSelected(boolean); method @CallSuper public void dispatchStartTemporaryDetach(); - method public void dispatchSystemUiVisibilityChanged(int); + method @Deprecated public void dispatchSystemUiVisibilityChanged(int); method public boolean dispatchTouchEvent(android.view.MotionEvent); method public boolean dispatchTrackballEvent(android.view.MotionEvent); method public boolean dispatchUnhandledMove(android.view.View, int); @@ -52877,7 +52877,7 @@ package android.view { method public void dispatchWindowInsetsAnimationPrepare(@NonNull android.view.WindowInsetsAnimationCallback.InsetsAnimation); method @NonNull public android.view.WindowInsets dispatchWindowInsetsAnimationProgress(@NonNull android.view.WindowInsets); method @NonNull public android.view.WindowInsetsAnimationCallback.AnimationBounds dispatchWindowInsetsAnimationStart(@NonNull android.view.WindowInsetsAnimationCallback.InsetsAnimation, @NonNull android.view.WindowInsetsAnimationCallback.AnimationBounds); - method public void dispatchWindowSystemUiVisiblityChanged(int); + method @Deprecated public void dispatchWindowSystemUiVisiblityChanged(int); method public void dispatchWindowVisibilityChanged(int); method @CallSuper public void draw(android.graphics.Canvas); method @CallSuper public void drawableHotspotChanged(float, float); @@ -53030,7 +53030,7 @@ package android.view { method protected int getSuggestedMinimumHeight(); method protected int getSuggestedMinimumWidth(); method @NonNull public java.util.List<android.graphics.Rect> getSystemGestureExclusionRects(); - method public int getSystemUiVisibility(); + method @Deprecated public int getSystemUiVisibility(); method @android.view.ViewDebug.ExportedProperty public Object getTag(); method public Object getTag(int); method @android.view.ViewDebug.ExportedProperty(category="text", mapping={@android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_INHERIT, to="INHERIT"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_GRAVITY, to="GRAVITY"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_TEXT_START, to="TEXT_START"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_TEXT_END, to="TEXT_END"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_CENTER, to="CENTER"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_VIEW_START, to="VIEW_START"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_VIEW_END, to="VIEW_END")}) public int getTextAlignment(); @@ -53058,7 +53058,7 @@ package android.view { method protected int getWindowAttachCount(); method public android.view.WindowId getWindowId(); method @Nullable public android.view.WindowInsetsController getWindowInsetsController(); - method public int getWindowSystemUiVisibility(); + method @Deprecated public int getWindowSystemUiVisibility(); method public android.os.IBinder getWindowToken(); method public int getWindowVisibility(); method public void getWindowVisibleDisplayFrame(android.graphics.Rect); @@ -53196,7 +53196,7 @@ package android.view { method @CallSuper public void onVisibilityAggregated(boolean); method protected void onVisibilityChanged(@NonNull android.view.View, int); method public void onWindowFocusChanged(boolean); - method public void onWindowSystemUiVisibilityChanged(int); + method @Deprecated public void onWindowSystemUiVisibilityChanged(int); method protected void onWindowVisibilityChanged(int); method protected boolean overScrollBy(int, int, int, int, int, int, int, int, boolean); method public boolean performAccessibilityAction(int, android.os.Bundle); @@ -53338,7 +53338,7 @@ package android.view { method public void setOnKeyListener(android.view.View.OnKeyListener); method public void setOnLongClickListener(@Nullable android.view.View.OnLongClickListener); method public void setOnScrollChangeListener(android.view.View.OnScrollChangeListener); - method public void setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener); + method @Deprecated public void setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener); method public void setOnTouchListener(android.view.View.OnTouchListener); method public void setOutlineAmbientShadowColor(@ColorInt int); method public void setOutlineProvider(android.view.ViewOutlineProvider); @@ -53375,7 +53375,7 @@ package android.view { method public void setStateDescription(@Nullable CharSequence); method public void setStateListAnimator(android.animation.StateListAnimator); method public void setSystemGestureExclusionRects(@NonNull java.util.List<android.graphics.Rect>); - method public void setSystemUiVisibility(int); + method @Deprecated public void setSystemUiVisibility(int); method public void setTag(Object); method public void setTag(int, Object); method public void setTextAlignment(int); @@ -53553,18 +53553,18 @@ package android.view { field public static final int SOUND_EFFECTS_ENABLED = 134217728; // 0x8000000 field @Deprecated public static final int STATUS_BAR_HIDDEN = 1; // 0x1 field @Deprecated public static final int STATUS_BAR_VISIBLE = 0; // 0x0 - field public static final int SYSTEM_UI_FLAG_FULLSCREEN = 4; // 0x4 - field public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 2; // 0x2 - field public static final int SYSTEM_UI_FLAG_IMMERSIVE = 2048; // 0x800 - field public static final int SYSTEM_UI_FLAG_IMMERSIVE_STICKY = 4096; // 0x1000 - field public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 1024; // 0x400 - field public static final int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 512; // 0x200 - field public static final int SYSTEM_UI_FLAG_LAYOUT_STABLE = 256; // 0x100 - field public static final int SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR = 16; // 0x10 - field public static final int SYSTEM_UI_FLAG_LIGHT_STATUS_BAR = 8192; // 0x2000 - field public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1 - field public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0 - field public static final int SYSTEM_UI_LAYOUT_FLAGS = 1536; // 0x600 + field @Deprecated public static final int SYSTEM_UI_FLAG_FULLSCREEN = 4; // 0x4 + field @Deprecated public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 2; // 0x2 + field @Deprecated public static final int SYSTEM_UI_FLAG_IMMERSIVE = 2048; // 0x800 + field @Deprecated public static final int SYSTEM_UI_FLAG_IMMERSIVE_STICKY = 4096; // 0x1000 + field @Deprecated public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 1024; // 0x400 + field @Deprecated public static final int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 512; // 0x200 + field @Deprecated public static final int SYSTEM_UI_FLAG_LAYOUT_STABLE = 256; // 0x100 + field @Deprecated public static final int SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR = 16; // 0x10 + field @Deprecated public static final int SYSTEM_UI_FLAG_LIGHT_STATUS_BAR = 8192; // 0x2000 + field @Deprecated public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1 + field @Deprecated public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0 + field @Deprecated public static final int SYSTEM_UI_LAYOUT_FLAGS = 1536; // 0x600 field public static final int TEXT_ALIGNMENT_CENTER = 4; // 0x4 field public static final int TEXT_ALIGNMENT_GRAVITY = 1; // 0x1 field public static final int TEXT_ALIGNMENT_INHERIT = 0; // 0x0 @@ -53688,8 +53688,8 @@ package android.view { method public void onScrollChange(android.view.View, int, int, int, int); } - public static interface View.OnSystemUiVisibilityChangeListener { - method public void onSystemUiVisibilityChange(int); + @Deprecated public static interface View.OnSystemUiVisibilityChangeListener { + method @Deprecated public void onSystemUiVisibilityChange(int); } public static interface View.OnTouchListener { @@ -54508,23 +54508,23 @@ package android.view { method @Deprecated @NonNull public android.view.WindowInsets consumeSystemWindowInsets(); method @Nullable public android.view.DisplayCutout getDisplayCutout(); method @NonNull public android.graphics.Insets getInsets(int); - method @NonNull public android.graphics.Insets getMandatorySystemGestureInsets(); - method @NonNull public android.graphics.Insets getMaxInsets(int) throws java.lang.IllegalArgumentException; - method public int getStableInsetBottom(); - method public int getStableInsetLeft(); - method public int getStableInsetRight(); - method public int getStableInsetTop(); - method @NonNull public android.graphics.Insets getStableInsets(); - method @NonNull public android.graphics.Insets getSystemGestureInsets(); - method public int getSystemWindowInsetBottom(); - method public int getSystemWindowInsetLeft(); - method public int getSystemWindowInsetRight(); - method public int getSystemWindowInsetTop(); - method @NonNull public android.graphics.Insets getSystemWindowInsets(); - method @NonNull public android.graphics.Insets getTappableElementInsets(); + method @NonNull public android.graphics.Insets getInsetsIgnoringVisibility(int); + method @Deprecated @NonNull public android.graphics.Insets getMandatorySystemGestureInsets(); + method @Deprecated public int getStableInsetBottom(); + method @Deprecated public int getStableInsetLeft(); + method @Deprecated public int getStableInsetRight(); + method @Deprecated public int getStableInsetTop(); + method @Deprecated @NonNull public android.graphics.Insets getStableInsets(); + method @Deprecated @NonNull public android.graphics.Insets getSystemGestureInsets(); + method @Deprecated public int getSystemWindowInsetBottom(); + method @Deprecated public int getSystemWindowInsetLeft(); + method @Deprecated public int getSystemWindowInsetRight(); + method @Deprecated public int getSystemWindowInsetTop(); + method @Deprecated @NonNull public android.graphics.Insets getSystemWindowInsets(); + method @Deprecated @NonNull public android.graphics.Insets getTappableElementInsets(); method public boolean hasInsets(); - method public boolean hasStableInsets(); - method public boolean hasSystemWindowInsets(); + method @Deprecated public boolean hasStableInsets(); + method @Deprecated public boolean hasSystemWindowInsets(); method @NonNull public android.view.WindowInsets inset(@IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0) int); method public boolean isConsumed(); method public boolean isRound(); @@ -54540,17 +54540,24 @@ package android.view { method @NonNull public android.view.WindowInsets build(); method @NonNull public android.view.WindowInsets.Builder setDisplayCutout(@Nullable android.view.DisplayCutout); method @NonNull public android.view.WindowInsets.Builder setInsets(int, @NonNull android.graphics.Insets); - method @NonNull public android.view.WindowInsets.Builder setMandatorySystemGestureInsets(@NonNull android.graphics.Insets); - method @NonNull public android.view.WindowInsets.Builder setMaxInsets(int, @NonNull android.graphics.Insets) throws java.lang.IllegalArgumentException; - method @NonNull public android.view.WindowInsets.Builder setStableInsets(@NonNull android.graphics.Insets); - method @NonNull public android.view.WindowInsets.Builder setSystemGestureInsets(@NonNull android.graphics.Insets); - method @NonNull public android.view.WindowInsets.Builder setSystemWindowInsets(@NonNull android.graphics.Insets); - method @NonNull public android.view.WindowInsets.Builder setTappableElementInsets(@NonNull android.graphics.Insets); + method @NonNull public android.view.WindowInsets.Builder setInsetsIgnoringVisibility(int, @NonNull android.graphics.Insets) throws java.lang.IllegalArgumentException; + method @Deprecated @NonNull public android.view.WindowInsets.Builder setMandatorySystemGestureInsets(@NonNull android.graphics.Insets); + method @Deprecated @NonNull public android.view.WindowInsets.Builder setStableInsets(@NonNull android.graphics.Insets); + method @Deprecated @NonNull public android.view.WindowInsets.Builder setSystemGestureInsets(@NonNull android.graphics.Insets); + method @Deprecated @NonNull public android.view.WindowInsets.Builder setSystemWindowInsets(@NonNull android.graphics.Insets); + method @Deprecated @NonNull public android.view.WindowInsets.Builder setTappableElementInsets(@NonNull android.graphics.Insets); method @NonNull public android.view.WindowInsets.Builder setVisible(int, boolean); } - public static final class WindowInsets.Type { + public static final class WindowInsets.Side { method public static int all(); + field public static final int BOTTOM = 8; // 0x8 + field public static final int LEFT = 1; // 0x1 + field public static final int RIGHT = 4; // 0x4 + field public static final int TOP = 2; // 0x2 + } + + public static final class WindowInsets.Type { method public static int captionBar(); method public static int ime(); method public static int mandatorySystemGestures(); @@ -54559,7 +54566,6 @@ package android.view { method public static int systemBars(); method public static int systemGestures(); method public static int tappableElement(); - method public static int windowDecor(); } public interface WindowInsetsAnimationCallback { @@ -54609,14 +54615,20 @@ package android.view { public interface WindowInsetsController { method public default void controlInputMethodAnimation(long, @Nullable android.view.animation.Interpolator, @NonNull android.view.WindowInsetsAnimationControlListener); + method public void controlWindowInsetsAnimation(int, long, @Nullable android.view.animation.Interpolator, @NonNull android.view.WindowInsetsAnimationControlListener); method public int getSystemBarsAppearance(); method public int getSystemBarsBehavior(); + method public void hide(int); method public default void hideInputMethod(); method public void setSystemBarsAppearance(int, int); method public void setSystemBarsBehavior(int); + method public void show(int); method public default void showInputMethod(); field public static final int APPEARANCE_LIGHT_NAVIGATION_BARS = 16; // 0x10 field public static final int APPEARANCE_LIGHT_STATUS_BARS = 8; // 0x8 + field public static final int BEHAVIOR_SHOW_BARS_BY_SWIPE = 1; // 0x1 + field public static final int BEHAVIOR_SHOW_BARS_BY_TOUCH = 0; // 0x0 + field public static final int BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE = 2; // 0x2 } public interface WindowManager extends android.view.ViewManager { @@ -54646,9 +54658,15 @@ package android.view { method public String debug(String); method public int describeContents(); method public int getColorMode(); + method public int getFitInsetsSides(); + method public int getFitInsetsTypes(); method public final CharSequence getTitle(); + method public boolean isFitInsetsIgnoringVisibility(); method public static boolean mayUseInputMethod(int); method public void setColorMode(int); + method public void setFitInsetsIgnoringVisibility(boolean); + method public void setFitInsetsSides(int); + method public void setFitInsetsTypes(int); method public final void setTitle(CharSequence); method public void writeToParcel(android.os.Parcel, int); field public static final int ALPHA_CHANGED = 128; // 0x80 @@ -54669,13 +54687,13 @@ package android.view { field @Deprecated public static final int FLAG_DISMISS_KEYGUARD = 4194304; // 0x400000 field @Deprecated public static final int FLAG_DITHER = 4096; // 0x1000 field public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = -2147483648; // 0x80000000 - field public static final int FLAG_FORCE_NOT_FULLSCREEN = 2048; // 0x800 - field public static final int FLAG_FULLSCREEN = 1024; // 0x400 + field @Deprecated public static final int FLAG_FORCE_NOT_FULLSCREEN = 2048; // 0x800 + field @Deprecated public static final int FLAG_FULLSCREEN = 1024; // 0x400 field public static final int FLAG_HARDWARE_ACCELERATED = 16777216; // 0x1000000 field public static final int FLAG_IGNORE_CHEEK_PRESSES = 32768; // 0x8000 field public static final int FLAG_KEEP_SCREEN_ON = 128; // 0x80 - field public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 1073741824; // 0x40000000 - field public static final int FLAG_LAYOUT_INSET_DECOR = 65536; // 0x10000 + field @Deprecated public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 1073741824; // 0x40000000 + field @Deprecated public static final int FLAG_LAYOUT_INSET_DECOR = 65536; // 0x10000 field @Deprecated public static final int FLAG_LAYOUT_IN_OVERSCAN = 33554432; // 0x2000000 field public static final int FLAG_LAYOUT_IN_SCREEN = 256; // 0x100 field public static final int FLAG_LAYOUT_NO_LIMITS = 512; // 0x200 @@ -54689,8 +54707,8 @@ package android.view { field @Deprecated public static final int FLAG_SHOW_WHEN_LOCKED = 524288; // 0x80000 field public static final int FLAG_SPLIT_TOUCH = 8388608; // 0x800000 field @Deprecated public static final int FLAG_TOUCHABLE_WHEN_WAKING = 64; // 0x40 - field public static final int FLAG_TRANSLUCENT_NAVIGATION = 134217728; // 0x8000000 - field public static final int FLAG_TRANSLUCENT_STATUS = 67108864; // 0x4000000 + field @Deprecated public static final int FLAG_TRANSLUCENT_NAVIGATION = 134217728; // 0x8000000 + field @Deprecated public static final int FLAG_TRANSLUCENT_STATUS = 67108864; // 0x4000000 field @Deprecated public static final int FLAG_TURN_SCREEN_ON = 2097152; // 0x200000 field public static final int FLAG_WATCH_OUTSIDE_TOUCH = 262144; // 0x40000 field public static final int FORMAT_CHANGED = 8; // 0x8 @@ -54716,7 +54734,7 @@ package android.view { field public static final int SCREEN_ORIENTATION_CHANGED = 1024; // 0x400 field public static final int SOFT_INPUT_ADJUST_NOTHING = 48; // 0x30 field public static final int SOFT_INPUT_ADJUST_PAN = 32; // 0x20 - field public static final int SOFT_INPUT_ADJUST_RESIZE = 16; // 0x10 + field @Deprecated public static final int SOFT_INPUT_ADJUST_RESIZE = 16; // 0x10 field public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0; // 0x0 field public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 256; // 0x100 field public static final int SOFT_INPUT_MASK_ADJUST = 240; // 0xf0 @@ -54773,7 +54791,7 @@ package android.view { field public float screenBrightness; field public int screenOrientation; field public int softInputMode; - field public int systemUiVisibility; + field @Deprecated public int systemUiVisibility; field public android.os.IBinder token; field @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION, to="BASE_APPLICATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION, to="APPLICATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING, to="APPLICATION_STARTING"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_DRAWN_APPLICATION, to="DRAWN_APPLICATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_PANEL, to="APPLICATION_PANEL"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA, to="APPLICATION_MEDIA"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL, to="APPLICATION_SUB_PANEL"), @android.view.ViewDebug.IntToString(from=0x3ed, to="APPLICATION_ABOVE_SUB_PANEL"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG, to="APPLICATION_ATTACHED_DIALOG"), @android.view.ViewDebug.IntToString(from=0x3ec, to="APPLICATION_MEDIA_OVERLAY"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR, to="STATUS_BAR"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR, to="SEARCH_BAR"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_PHONE, to="PHONE"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, to="SYSTEM_ALERT"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_TOAST, to="TOAST"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, to="SYSTEM_OVERLAY"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE, to="PRIORITY_PHONE"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG, to="SYSTEM_DIALOG"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG, to="KEYGUARD_DIALOG"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR, to="SYSTEM_ERROR"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD, to="INPUT_METHOD"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG, to="INPUT_METHOD_DIALOG"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_WALLPAPER, to="WALLPAPER"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, to="STATUS_BAR_PANEL"), @android.view.ViewDebug.IntToString(from=0x7df, to="SECURE_SYSTEM_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7e0, to="DRAG"), @android.view.ViewDebug.IntToString(from=0x7e1, to="STATUS_BAR_SUB_PANEL"), @android.view.ViewDebug.IntToString(from=0x7e2, to="POINTER"), @android.view.ViewDebug.IntToString(from=0x7e3, to="NAVIGATION_BAR"), @android.view.ViewDebug.IntToString(from=0x7e4, to="VOLUME_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7e5, to="BOOT_PROGRESS"), @android.view.ViewDebug.IntToString(from=0x7e6, to="INPUT_CONSUMER"), @android.view.ViewDebug.IntToString(from=0x7e7, to="DREAM"), @android.view.ViewDebug.IntToString(from=0x7e8, to="NAVIGATION_BAR_PANEL"), @android.view.ViewDebug.IntToString(from=0x7ea, to="DISPLAY_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7eb, to="MAGNIFICATION_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7f5, to="PRESENTATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION, to="PRIVATE_PRESENTATION"), @android.view.ViewDebug.IntToString(from=0x7ef, to="VOICE_INTERACTION"), @android.view.ViewDebug.IntToString(from=0x7f1, to="VOICE_INTERACTION_STARTING"), @android.view.ViewDebug.IntToString(from=0x7f2, to="DOCK_DIVIDER"), @android.view.ViewDebug.IntToString(from=0x7f3, to="QS_DIALOG"), @android.view.ViewDebug.IntToString(from=0x7f4, to="SCREENSHOT"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, to="APPLICATION_OVERLAY")}) public int type; field public float verticalMargin; diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index c5f0aab3daa9..92047dcad09e 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -1240,13 +1240,14 @@ public class InputMethodService extends AbstractInputMethodService { Context.LAYOUT_INFLATER_SERVICE); mWindow = new SoftInputWindow(this, "InputMethod", mTheme, null, null, mDispatcherState, WindowManager.LayoutParams.TYPE_INPUT_METHOD, Gravity.BOTTOM, false); - mWindow.getWindow().getAttributes().setFitWindowInsetsTypes(WindowInsets.Type.statusBars()); + mWindow.getWindow().getAttributes().setFitInsetsTypes(WindowInsets.Type.statusBars()); // IME layout should always be inset by navigation bar, no matter it's current visibility. mWindow.getWindow().getDecorView().setOnApplyWindowInsetsListener( (v, insets) -> v.onApplyWindowInsets( new WindowInsets.Builder(insets).setInsets( - navigationBars(), insets.getMaxInsets(navigationBars())) + navigationBars(), + insets.getInsetsIgnoringVisibility(navigationBars())) .build())); // For ColorView in DecorView to work, FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS needs to be set diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java index 5cb52ea0685e..36f2c6267622 100644 --- a/core/java/android/service/voice/VoiceInteractionSession.java +++ b/core/java/android/service/voice/VoiceInteractionSession.java @@ -1137,7 +1137,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall mWindow = new SoftInputWindow(mContext, "VoiceInteractionSession", mTheme, mCallbacks, this, mDispatcherState, WindowManager.LayoutParams.TYPE_VOICE_INTERACTION, Gravity.BOTTOM, true); - mWindow.getWindow().getAttributes().setFitWindowInsetsTypes(0 /* types */); + mWindow.getWindow().getAttributes().setFitInsetsTypes(0 /* types */); mWindow.getWindow().addFlags( WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index 91691436a87a..dd78c78654c3 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -869,7 +869,7 @@ public abstract class WallpaperService extends Service { // Add window mLayout.type = mIWallpaperEngine.mWindowType; mLayout.gravity = Gravity.START|Gravity.TOP; - mLayout.setFitWindowInsetsTypes(0 /* types */); + mLayout.setFitInsetsTypes(0 /* types */); mLayout.setTitle(WallpaperService.this.getClass().getName()); mLayout.windowAnimations = com.android.internal.R.style.Animation_Wallpaper; diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 7e6ef47b2484..0f2d2c21d28d 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -22,7 +22,6 @@ import static android.util.StatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__LO import static android.util.StatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__SINGLE_TAP; import static android.util.StatsLog.TOUCH_GESTURE_CLASSIFIED__CLASSIFICATION__UNKNOWN_CLASSIFICATION; import static android.view.ViewRootImpl.NEW_INSETS_MODE_FULL; -import static android.view.WindowInsetsAnimationCallback.DISPATCH_MODE_CONTINUE_ON_SUBTREE; import static android.view.WindowInsets.Type.ime; import static android.view.WindowInsets.Type.systemBars; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; @@ -116,9 +115,10 @@ import android.view.AccessibilityIterators.TextSegmentIterator; import android.view.AccessibilityIterators.WordTextSegmentIterator; import android.view.ContextMenu.ContextMenuInfo; import android.view.Window.OnContentApplyWindowInsetsListener; +import android.view.WindowInsets.Type; import android.view.WindowInsetsAnimationCallback.AnimationBounds; import android.view.WindowInsetsAnimationCallback.InsetsAnimation; -import android.view.WindowInsetsAnimationCallback.DispatchMode; +import android.view.WindowManager.LayoutParams; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEventSource; import android.view.accessibility.AccessibilityManager; @@ -3523,7 +3523,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * requested the system UI (status bar) to be visible (the default). * * @see #setSystemUiVisibility(int) + * @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController} + * instead. */ + @Deprecated public static final int SYSTEM_UI_FLAG_VISIBLE = 0; /** @@ -3536,7 +3539,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * <p>In low profile mode, the status bar and/or navigation icons may dim. * * @see #setSystemUiVisibility(int) + * @deprecated Low profile mode is deprecated. Hide the system bars instead if the application + * needs to be in a unobtrusive mode. Use {@link WindowInsetsController#hide(int)} with + * {@link Type#systemBars()}. */ + @Deprecated public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 0x00000001; /** @@ -3557,7 +3564,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * so that both elements reappear at the same time. * * @see #setSystemUiVisibility(int) + * @deprecated Use {@link WindowInsetsController#hide(int)} with {@link Type#navigationBars()} + * instead. */ + @Deprecated public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 0x00000002; /** @@ -3593,7 +3603,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * the book. * * @see #setSystemUiVisibility(int) + * @deprecated Use {@link WindowInsetsController#hide(int)} with {@link Type#statusBars()} + * instead. */ + @Deprecated public static final int SYSTEM_UI_FLAG_FULLSCREEN = 0x00000004; /** @@ -3627,7 +3640,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * overlay mode with {@link Window#FEATURE_ACTION_BAR_OVERLAY * Window.FEATURE_ACTION_BAR_OVERLAY}, this flag will also impact the * insets it adds to those given to the application. + * + * @deprecated Use {@link WindowInsets#getInsetsIgnoringVisibility(int)} instead to retrieve + * insets that don't change when system bars change visibility state. */ + @Deprecated public static final int SYSTEM_UI_FLAG_LAYOUT_STABLE = 0x00000100; /** @@ -3639,6 +3656,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * decorations when they are shown. You can perform layout of your inner * UI elements to account for the navigation system UI through the * {@link #fitSystemWindows(Rect)} method. + * + * @deprecated For floating windows, use {@link LayoutParams#setFitInsetsTypes(int)} with + * {@link Type#navigationBars()}. For non-floating windows that fill the screen, call + * {@link Window#setOnContentApplyWindowInsets} with {@code null} or a listener that doesn't + * fit the navigation bar on the window content level. */ public static final int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 0x00000200; @@ -3663,7 +3685,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @see WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT * @see WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES * @see WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER + * + * @deprecated For floating windows, use {@link LayoutParams#setFitInsetsTypes(int)} with + * {@link Type#statusBars()} ()}. For non-floating windows that fill the screen, call + * {@link Window#setOnContentApplyWindowInsets} with {@code null} or a listener that doesn't + * fit the status bar on the window content level. */ + @Deprecated public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 0x00000400; /** @@ -3673,7 +3701,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * user interaction. * <p>Since this flag is a modifier for {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}, it only * has an effect when used in combination with that flag.</p> + * + * @deprecated Use {@link WindowInsetsController#BEHAVIOR_SHOW_BARS_BY_SWIPE} instead. */ + @Deprecated public static final int SYSTEM_UI_FLAG_IMMERSIVE = 0x00000800; /** @@ -3691,7 +3722,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * </p><p>Since this flag is a modifier for {@link #SYSTEM_UI_FLAG_FULLSCREEN} and * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}, it only has an effect when used in combination * with one or both of those flags.</p> + * + * @deprecated Use {@link WindowInsetsController#BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE} instead. */ + @Deprecated public static final int SYSTEM_UI_FLAG_IMMERSIVE_STICKY = 0x00001000; /** @@ -3705,7 +3739,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * FLAG_TRANSLUCENT_STATUS}. * * @see android.R.attr#windowLightStatusBar + * @deprecated Use {@link WindowInsetsController#APPEARANCE_LIGHT_STATUS_BARS} instead. */ + @Deprecated public static final int SYSTEM_UI_FLAG_LIGHT_STATUS_BAR = 0x00002000; /** @@ -3731,7 +3767,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * FLAG_TRANSLUCENT_NAVIGATION}. * * @see android.R.attr#windowLightNavigationBar + * @deprecated Use {@link WindowInsetsController#APPEARANCE_LIGHT_NAVIGATION_BARS} instead. */ + @Deprecated public static final int SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR = 0x00000010; /** @@ -3959,7 +3997,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * Flags that can impact the layout in relation to system UI. + * + * @deprecated System UI layout flags are deprecated. */ + @Deprecated public static final int SYSTEM_UI_LAYOUT_FLAGS = SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; @@ -25785,7 +25826,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * {@link #SYSTEM_UI_FLAG_LAYOUT_STABLE}, {@link #SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}, * {@link #SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}, {@link #SYSTEM_UI_FLAG_IMMERSIVE}, * and {@link #SYSTEM_UI_FLAG_IMMERSIVE_STICKY}. + * + * @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController} + * instead. */ + @Deprecated public void setSystemUiVisibility(int visibility) { if (visibility != mSystemUiVisibility) { mSystemUiVisibility = visibility; @@ -25802,7 +25847,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * {@link #SYSTEM_UI_FLAG_LAYOUT_STABLE}, {@link #SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}, * {@link #SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}, {@link #SYSTEM_UI_FLAG_IMMERSIVE}, * and {@link #SYSTEM_UI_FLAG_IMMERSIVE_STICKY}. + * + * @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController} + * instead. */ + @Deprecated public int getSystemUiVisibility() { return mSystemUiVisibility; } @@ -25812,7 +25861,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * the entire window. This is the combination of the * {@link #setSystemUiVisibility(int)} values supplied by all of the * views in the window. + * + * @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController} + * instead. */ + @Deprecated public int getWindowSystemUiVisibility() { return mAttachInfo != null ? mAttachInfo.mSystemUiVisibility : 0; } @@ -25824,14 +25877,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * {@link #setOnSystemUiVisibilityChangeListener(OnSystemUiVisibilityChangeListener)} * in that this is only telling you about the local request of the window, * not the actual values applied by the system. + * + * @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController} + * instead. */ + @Deprecated public void onWindowSystemUiVisibilityChanged(int visible) { } /** * Dispatch callbacks to {@link #onWindowSystemUiVisibilityChanged(int)} down * the view hierarchy. + * + * @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController} + * instead. */ + @Deprecated public void dispatchWindowSystemUiVisiblityChanged(int visible) { onWindowSystemUiVisibilityChanged(visible); } @@ -25839,7 +25900,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * Set a listener to receive callbacks when the visibility of the system bar changes. * @param l The {@link OnSystemUiVisibilityChangeListener} to receive callbacks. + * + * @deprecated Use {@link WindowInsets#isVisible(int)} to find out about system bar visibilities + * by setting a {@link OnApplyWindowInsetsListener} on this view. */ + @Deprecated public void setOnSystemUiVisibilityChangeListener(OnSystemUiVisibilityChangeListener l) { getListenerInfo().mOnSystemUiVisibilityChangeListener = l; if (mParent != null && mAttachInfo != null && !mAttachInfo.mRecomputeGlobalAttributes) { @@ -25850,7 +25915,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * Dispatch callbacks to {@link #setOnSystemUiVisibilityChangeListener} down * the view hierarchy. + * + * @deprecated Use {@link WindowInsets#isVisible(int)} to find out about system bar visibilities + * by setting a {@link OnApplyWindowInsetsListener} on this view. */ + @Deprecated public void dispatchSystemUiVisibilityChanged(int visibility) { ListenerInfo li = mListenerInfo; if (li != null && li.mOnSystemUiVisibilityChangeListener != null) { @@ -28291,7 +28360,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * state, not what the application is requesting. * * @see View#setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener) + * + * @deprecated Use {@link WindowInsets#isVisible(int)} to find out about system bar visibilities + * by setting a {@link OnApplyWindowInsetsListener} on this view. */ + @Deprecated public interface OnSystemUiVisibilityChangeListener { /** * Called when the status bar changes visibility because of a call to diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 59d6d874dc97..4f03ca152850 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -1885,6 +1885,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } @Override + @Deprecated public void dispatchWindowSystemUiVisiblityChanged(int visible) { super.dispatchWindowSystemUiVisiblityChanged(visible); @@ -1897,6 +1898,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } @Override + @Deprecated public void dispatchSystemUiVisibilityChanged(int visible) { super.dispatchSystemUiVisibilityChanged(visible); diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index c6de831656ad..f5cfbec924ac 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -32,8 +32,6 @@ 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.WindowCallbacks.RESIZE_MODE_DOCKED_DIVIDER; import static android.view.WindowCallbacks.RESIZE_MODE_FREEFORM; -import static android.view.WindowInsets.Type.ime; -import static android.view.WindowInsets.Type.systemBars; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS; @@ -80,7 +78,6 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.FrameInfo; import android.graphics.HardwareRenderer.FrameDrawingCallback; -import android.graphics.Insets; import android.graphics.Matrix; import android.graphics.PixelFormat; import android.graphics.Point; @@ -1988,9 +1985,9 @@ public final class ViewRootImpl implements ViewParent, return; } - int types = inOutParams.getFitWindowInsetsTypes(); - int sides = inOutParams.getFitWindowInsetsSides(); - boolean ignoreVis = inOutParams.getFitIgnoreVisibility(); + int types = inOutParams.getFitInsetsTypes(); + int sides = inOutParams.getFitInsetsSides(); + boolean ignoreVis = inOutParams.isFitInsetsIgnoringVisibility(); if (((sysUiVis & SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) != 0 || (flags & FLAG_LAYOUT_IN_SCREEN) != 0) @@ -2007,9 +2004,9 @@ public final class ViewRootImpl implements ViewParent, && adjust == SOFT_INPUT_ADJUST_RESIZE) { types |= Type.ime(); } - inOutParams.setFitWindowInsetsTypes(types); - inOutParams.setFitWindowInsetsSides(sides); - inOutParams.setFitIgnoreVisibility(ignoreVis); + inOutParams.setFitInsetsTypes(types); + inOutParams.setFitInsetsSides(sides); + inOutParams.setFitInsetsIgnoringVisibility(ignoreVis); // The fitting of insets are not really controlled by the clients, so we remove the flag. inOutParams.privateFlags &= ~PRIVATE_FLAG_FIT_INSETS_CONTROLLED; diff --git a/core/java/android/view/WindowInsets.java b/core/java/android/view/WindowInsets.java index 0a2a45b44523..a6c311e1daa5 100644 --- a/core/java/android/view/WindowInsets.java +++ b/core/java/android/view/WindowInsets.java @@ -301,11 +301,14 @@ public final class WindowInsets { * </p> * * @return The system window insets + * @deprecated Use {@link #getInsets(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated @NonNull public Insets getSystemWindowInsets() { Insets result = mCompatIgnoreVisibility - ? getMaxInsets(mCompatInsetTypes & ~ime()) + ? getInsetsIgnoringVisibility(mCompatInsetTypes & ~ime()) : getInsets(mCompatInsetTypes); // We can't query max insets for IME, so we need to add it manually after. @@ -328,25 +331,26 @@ public final class WindowInsets { } /** - * Returns the maximum amount of insets a specific set of windows can cause, denoted by the - * {@code typeMask} bit mask of {@link InsetsType}s. + * Returns the insets a specific set of windows can cause, denoted by the + * {@code typeMask} bit mask of {@link InsetsType}s, regardless of whether that type is + * currently visible or not. * - * <p>The maximum insets represents the area of a a window that that <b>may</b> be partially + * <p>The insets represents the area of a a window that that <b>may</b> be partially * or fully obscured by the system window identified by {@code type}. This value does not - * change based on the visibility state of those elements. for example, if the status bar is - * normally shown, but temporarily hidden, the maximum inset will still provide the inset + * change based on the visibility state of those elements. For example, if the status bar is + * normally shown, but temporarily hidden, the inset returned here will still provide the inset * associated with the status bar being shown.</p> * * @param typeMask Bit mask of {@link InsetsType}s to query the insets for. * @return The insets. * - * @throws IllegalArgumentException If the caller tries to query {@link Type#ime()}. Maximum - * insets are not available for this type as the height of the + * @throws IllegalArgumentException If the caller tries to query {@link Type#ime()}. Insets are + * not available if the IME isn't visible as the height of the * IME is dynamic depending on the {@link EditorInfo} of the * currently focused view, as well as the UI state of the IME. */ @NonNull - public Insets getMaxInsets(@InsetsType int typeMask) throws IllegalArgumentException { + public Insets getInsetsIgnoringVisibility(@InsetsType int typeMask) { if ((typeMask & IME) != 0) { throw new IllegalArgumentException("Unable to query the maximum insets for IME"); } @@ -381,7 +385,10 @@ public final class WindowInsets { * </p> * * @return The left system window inset + * @deprecated Use {@link #getInsets(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated public int getSystemWindowInsetLeft() { return getSystemWindowInsets().left; } @@ -394,7 +401,10 @@ public final class WindowInsets { * </p> * * @return The top system window inset + * @deprecated Use {@link #getInsets(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated public int getSystemWindowInsetTop() { return getSystemWindowInsets().top; } @@ -407,7 +417,10 @@ public final class WindowInsets { * </p> * * @return The right system window inset + * @deprecated Use {@link #getInsets(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated public int getSystemWindowInsetRight() { return getSystemWindowInsets().right; } @@ -420,7 +433,10 @@ public final class WindowInsets { * </p> * * @return The bottom system window inset + * @deprecated Use {@link #getInsets(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated public int getSystemWindowInsetBottom() { return getSystemWindowInsets().bottom; } @@ -433,7 +449,10 @@ public final class WindowInsets { * </p> * * @return true if any of the system window inset values are nonzero + * @deprecated Use {@link #getInsets(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated public boolean hasSystemWindowInsets() { return !getSystemWindowInsets().equals(Insets.NONE); } @@ -594,7 +613,10 @@ public final class WindowInsets { * associated with the status bar being shown.</p> * * @return The stable insets + * @deprecated Use {@link #getInsetsIgnoringVisibility(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated @NonNull public Insets getStableInsets() { return getInsets(mTypeMaxInsetsMap, mCompatInsetTypes); @@ -610,7 +632,10 @@ public final class WindowInsets { * associated with the status bar being shown.</p> * * @return The top stable inset + * @deprecated Use {@link #getInsetsIgnoringVisibility(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated public int getStableInsetTop() { return getStableInsets().top; } @@ -625,7 +650,10 @@ public final class WindowInsets { * associated with the status bar being shown.</p> * * @return The left stable inset + * @deprecated Use {@link #getInsetsIgnoringVisibility(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated public int getStableInsetLeft() { return getStableInsets().left; } @@ -640,7 +668,10 @@ public final class WindowInsets { * associated with the status bar being shown.</p> * * @return The right stable inset + * @deprecated Use {@link #getInsetsIgnoringVisibility(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated public int getStableInsetRight() { return getStableInsets().right; } @@ -655,7 +686,10 @@ public final class WindowInsets { * associated with the status bar being shown.</p> * * @return The bottom stable inset + * @deprecated Use {@link #getInsetsIgnoringVisibility(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated public int getStableInsetBottom() { return getStableInsets().bottom; } @@ -670,7 +704,10 @@ public final class WindowInsets { * associated with the status bar being shown.</p> * * @return true if any of the stable inset values are nonzero + * @deprecated Use {@link #getInsetsIgnoringVisibility(int)} with {@link Type#systemBars()} + * instead. */ + @Deprecated public boolean hasStableInsets() { return !getStableInsets().equals(Insets.NONE); } @@ -706,7 +743,9 @@ public final class WindowInsets { * system window insets} by {@link #consumeSystemWindowInsets()}. * * @see #getMandatorySystemGestureInsets + * @deprecated Use {@link #getInsets(int)} with {@link Type#systemGestures()} instead. */ + @Deprecated @NonNull public Insets getSystemGestureInsets() { return getInsets(mTypeInsetsMap, SYSTEM_GESTURES); @@ -734,7 +773,9 @@ public final class WindowInsets { * system window insets} by {@link #consumeSystemWindowInsets()}. * * @see #getSystemGestureInsets + * @deprecated Use {@link #getInsets(int)} with {@link Type#mandatorySystemGestures()} instead. */ + @Deprecated @NonNull public Insets getMandatorySystemGestureInsets() { return getInsets(mTypeInsetsMap, MANDATORY_SYSTEM_GESTURES); @@ -760,7 +801,10 @@ public final class WindowInsets { * * <p>This inset is consumed together with the {@link #getSystemWindowInsets() * system window insets} by {@link #consumeSystemWindowInsets()}. + * + * @deprecated Use {@link #getInsets(int)} with {@link Type#tappableElement()} instead. */ + @Deprecated @NonNull public Insets getTappableElementInsets() { return getInsets(mTypeInsetsMap, TAPPABLE_ELEMENT); @@ -985,7 +1029,9 @@ public final class WindowInsets { * * @see #getSystemWindowInsets() * @return itself + * @deprecated Use {@link #setInsets(int, Insets)} with {@link Type#systemBars()}. */ + @Deprecated @NonNull public Builder setSystemWindowInsets(@NonNull Insets systemWindowInsets) { Preconditions.checkNotNull(systemWindowInsets); @@ -1003,7 +1049,9 @@ public final class WindowInsets { * * @see #getSystemGestureInsets() * @return itself + * @deprecated Use {@link #setInsets(int, Insets)} with {@link Type#systemGestures()}. */ + @Deprecated @NonNull public Builder setSystemGestureInsets(@NonNull Insets insets) { WindowInsets.setInsets(mTypeInsetsMap, SYSTEM_GESTURES, insets); @@ -1023,7 +1071,10 @@ public final class WindowInsets { * * @see #getMandatorySystemGestureInsets() * @return itself + * @deprecated Use {@link #setInsets(int, Insets)} with + * {@link Type#mandatorySystemGestures()}. */ + @Deprecated @NonNull public Builder setMandatorySystemGestureInsets(@NonNull Insets insets) { WindowInsets.setInsets(mTypeInsetsMap, MANDATORY_SYSTEM_GESTURES, insets); @@ -1038,7 +1089,9 @@ public final class WindowInsets { * * @see #getTappableElementInsets() * @return itself + * @deprecated Use {@link #setInsets(int, Insets)} with {@link Type#tappableElement()}. */ + @Deprecated @NonNull public Builder setTappableElementInsets(@NonNull Insets insets) { WindowInsets.setInsets(mTypeInsetsMap, TAPPABLE_ELEMENT, insets); @@ -1068,15 +1121,15 @@ public final class WindowInsets { } /** - * Sets the maximum amount of insets a specific window type in pixels. + * Sets the insets a specific window type in pixels, while ignoring its visibility state. * - * <p>The maximum insets represents the area of a a window that that <b>may</b> be partially - * or fully obscured by the system windows identified by {@code typeMask}. This value does - * not change based on the visibility state of those elements. for example, if the status - * bar is normally shown, but temporarily hidden, the maximum inset will still provide the + * <p>The insets represents the area of a a window that that <b>may</b> be partially + * or fully obscured by the system window identified by {@code type}. This value does not + * change based on the visibility state of those elements. For example, if the status bar is + * normally shown, but temporarily hidden, the inset returned here will still provide the * inset associated with the status bar being shown.</p> * - * @see #getMaxInsets(int) + * @see #getInsetsIgnoringVisibility(int) * * @param typeMask The bitmask of {@link InsetsType} to set the insets for. * @param insets The insets to set. @@ -1090,7 +1143,7 @@ public final class WindowInsets { * state of the IME. */ @NonNull - public Builder setMaxInsets(@InsetsType int typeMask, @NonNull Insets insets) + public Builder setInsetsIgnoringVisibility(@InsetsType int typeMask, @NonNull Insets insets) throws IllegalArgumentException{ if (typeMask == IME) { throw new IllegalArgumentException("Maximum inset not available for IME"); @@ -1134,7 +1187,10 @@ public final class WindowInsets { * * @see #getStableInsets() * @return itself + * @deprecated Use {@link #setInsetsIgnoringVisibility(int, Insets)} with + * {@link Type#systemBars()}. */ + @Deprecated @NonNull public Builder setStableInsets(@NonNull Insets stableInsets) { Preconditions.checkNotNull(stableInsets); @@ -1267,13 +1323,6 @@ public final class WindowInsets { } /** - * @return An insets type representing decor that is being app-controlled. - */ - public static @InsetsType int windowDecor() { - return WINDOW_DECOR; - } - - /** * Returns an insets type representing the system gesture insets. * * <p>The system gesture insets represent the area of a window where system gestures have @@ -1309,18 +1358,17 @@ public final class WindowInsets { } /** - * @return All system bars. Includes {@link #statusBars()} as well as + * @return All system bars. Includes {@link #statusBars()}, {@link #captionBar()} as well as * {@link #navigationBars()}, but not {@link #ime()}. */ public static @InsetsType int systemBars() { - return STATUS_BARS | NAVIGATION_BARS; + return STATUS_BARS | NAVIGATION_BARS | CAPTION_BAR; } /** * @return All inset types combined. * - * TODO: Figure out if this makes sense at all, mixing e.g {@link #systemGestures()} and - * {@link #ime()} does not seem very useful. + * @hide */ public static @InsetsType int all() { return 0xFFFFFFFF; @@ -1340,7 +1388,6 @@ public final class WindowInsets { /** * Class that defines different sides for insets. - * @hide pending unhide */ public static final class Side { diff --git a/core/java/android/view/WindowInsetsController.java b/core/java/android/view/WindowInsetsController.java index 3bb6cfbbd7f2..02323cfb4f00 100644 --- a/core/java/android/view/WindowInsetsController.java +++ b/core/java/android/view/WindowInsetsController.java @@ -82,7 +82,6 @@ public interface WindowInsetsController { * shown on any user interaction on the corresponding display if navigation bars are hidden by * {@link #hide(int)} or * {@link WindowInsetsAnimationController#setInsetsAndAlpha(Insets, float, float)}. - * @hide */ int BEHAVIOR_SHOW_BARS_BY_TOUCH = 0; @@ -93,7 +92,6 @@ public interface WindowInsetsController { * * <p>When system bars are hidden in this mode, they can be revealed with system gestures, such * as swiping from the edge of the screen where the bar is hidden from.</p> - * @hide */ int BEHAVIOR_SHOW_BARS_BY_SWIPE = 1; @@ -106,7 +104,6 @@ public interface WindowInsetsController { * gestures, such as swiping from the edge of the screen where the bar is hidden from. These * transient system bars will overlay app’s content, may have some degree of transparency, and * will automatically hide after a short timeout.</p> - * @hide */ int BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE = 2; @@ -129,7 +126,6 @@ public interface WindowInsetsController { * * @param types A bitmask of {@link InsetsType} specifying what windows the app * would like to make appear on screen. - * @hide */ void show(@InsetsType int types); @@ -142,7 +138,6 @@ public interface WindowInsetsController { * * @param types A bitmask of {@link InsetsType} specifying what windows the app * would like to make disappear. - * @hide */ void hide(@InsetsType int types); @@ -166,7 +161,6 @@ public interface WindowInsetsController { * @see InsetsAnimation#getInterpolatedFraction() * @see InsetsAnimation#getInterpolator() * @see InsetsAnimation#getDurationMillis() - * @hide */ void controlWindowInsetsAnimation(@InsetsType int types, long durationMillis, @Nullable Interpolator interpolator, diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index e768b0ffdd30..1333ffe272d3 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1245,11 +1245,9 @@ public interface WindowManager extends ViewManager { * the device's screen turned on and bright. */ public static final int FLAG_KEEP_SCREEN_ON = 0x00000080; - /** Window flag: place the window within the entire screen, ignoring - * decorations around the border (such as the status bar). The - * window must correctly position its contents to take the screen - * decoration into account. This flag is normally set for you - * by Window as described in {@link Window#setFlags}. + /** + * Window flag for attached windows: Place the window within the entire screen, ignoring + * any constraints from the parent window. * * <p>Note: on displays that have a {@link DisplayCutout}, the window may be placed * such that it avoids the {@link DisplayCutout} area if necessary according to the @@ -1279,11 +1277,21 @@ public interface WindowManager extends ViewManager { * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen}, * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p> + * + * @deprecated Use {@link WindowInsetsController#hide(int)} with {@link Type#statusBars()} + * instead. */ + @Deprecated public static final int FLAG_FULLSCREEN = 0x00000400; - /** Window flag: override {@link #FLAG_FULLSCREEN} and force the - * screen decorations (such as the status bar) to be shown. */ + /** + * Window flag: override {@link #FLAG_FULLSCREEN} and force the + * screen decorations (such as the status bar) to be shown. + * + * @deprecated This value became API "by accident", and shouldn't be used by 3rd party + * applications. + */ + @Deprecated public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800; /** Window flag: turn on dithering when compositing this window to @@ -1315,13 +1323,18 @@ public interface WindowManager extends ViewManager { * until the finger is released. */ public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000; - /** Window flag: a special option only for use in combination with + /** + * Window flag: a special option only for use in combination with * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the * screen your window may appear on top of or behind screen decorations * such as the status bar. By also including this flag, the window * manager will report the inset rectangle needed to ensure your * content is not covered by screen decorations. This flag is normally - * set for you by Window as described in {@link Window#setFlags}.*/ + * set for you by Window as described in {@link Window#setFlags} + * + * @deprecated Insets will always be delivered to your application. + */ + @Deprecated public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000; /** Window flag: When set, input method can't interact with the focusable window @@ -1507,7 +1520,11 @@ public interface WindowManager extends ViewManager { * * <p>Note: For devices that support * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag may be ignored. + * + * @deprecated Use {@link Window#setStatusBarColor(int)} with a half-translucent color + * instead. */ + @Deprecated public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000; /** @@ -1530,7 +1547,11 @@ public interface WindowManager extends ViewManager { * <p>Note: For devices that support * {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE} this flag can be disabled * by the car manufacturers. + * + * @deprecated Use {@link Window#setNavigationBarColor(int)} with a half-translucent color + * instead. */ + @Deprecated public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000; /** @@ -1560,7 +1581,11 @@ public interface WindowManager extends ViewManager { * overlap with the screen decorations of the parent window such as the navigation bar. By * including this flag, the window manager will layout the attached window within the decor * frame of the parent window such that it doesn't overlap with screen decorations. + * + * @deprecated Use {@link #setFitInsetsTypes(int)} to determine whether the attached + * window will overlap with system bars. */ + @Deprecated public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000; /** @@ -2089,7 +2114,11 @@ public interface WindowManager extends ViewManager { * layout parameter flags include {@link #FLAG_FULLSCREEN}, this * value for {@link #softInputMode} will be ignored; the window will * not resize, but will stay fullscreen. + * + * @deprecated Use {@link Window#setOnContentApplyWindowInsetsListener} instead with a + * listener that fits {@link Type#ime()} instead. */ + @Deprecated public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10; /** Adjustment option for {@link #softInputMode}: set to have a window @@ -2384,7 +2413,11 @@ public interface WindowManager extends ViewManager { * * @see View#STATUS_BAR_VISIBLE * @see View#STATUS_BAR_HIDDEN + * + * @deprecated SystemUiVisibility flags are deprecated. Use {@link WindowInsetsController} + * instead. */ + @Deprecated public int systemUiVisibility; /** @@ -2710,7 +2743,7 @@ public interface WindowManager extends ViewManager { equals = WINDOW_DECOR, name = "WINDOW_DECOR") }) - private @InsetsType int mFitWindowInsetsTypes = Type.systemBars(); + private @InsetsType int mFitInsetsTypes = Type.systemBars(); @ViewDebug.ExportedProperty(flagMapping = { @ViewDebug.FlagToString( @@ -2730,19 +2763,18 @@ public interface WindowManager extends ViewManager { equals = BOTTOM, name = "BOTTOM") }) - private @InsetsSide int mFitWindowInsetsSides = Side.all(); + private @InsetsSide int mFitInsetsSides = Side.all(); - private boolean mFitIgnoreVisibility = false; + private boolean mFitInsetsIgnoringVisibility = false; /** * Specifies types of insets that this window should avoid overlapping during layout. * * @param types which types of insets that this window should avoid. The initial value of * this object includes all system bars. - * @hide pending unhide */ - public void setFitWindowInsetsTypes(@InsetsType int types) { - mFitWindowInsetsTypes = types; + public void setFitInsetsTypes(@InsetsType int types) { + mFitInsetsTypes = types; privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED; } @@ -2751,10 +2783,9 @@ public interface WindowManager extends ViewManager { * * @param sides which sides that this window should avoid overlapping with the types * specified. The initial value of this object includes all sides. - * @hide pending unhide */ - public void setFitWindowInsetsSides(@InsetsSide int sides) { - mFitWindowInsetsSides = sides; + public void setFitInsetsSides(@InsetsSide int sides) { + mFitInsetsSides = sides; privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED; } @@ -2762,36 +2793,32 @@ public interface WindowManager extends ViewManager { * Specifies if this window should fit the window insets no matter they are visible or not. * * @param ignore if true, this window will fit the given types even if they are not visible. - * @hide pending unhide */ - public void setFitIgnoreVisibility(boolean ignore) { - mFitIgnoreVisibility = ignore; + public void setFitInsetsIgnoringVisibility(boolean ignore) { + mFitInsetsIgnoringVisibility = ignore; privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED; } /** * @return the insets types that this window is avoiding overlapping. - * @hide pending unhide */ - public @InsetsType int getFitWindowInsetsTypes() { - return mFitWindowInsetsTypes; + public @InsetsType int getFitInsetsTypes() { + return mFitInsetsTypes; } /** * @return the sides that this window is avoiding overlapping. - * @hide pending unhide */ - public @InsetsSide int getFitWindowInsetsSides() { - return mFitWindowInsetsSides; + public @InsetsSide int getFitInsetsSides() { + return mFitInsetsSides; } /** * @return {@code true} if this window fits the window insets no matter they are visible or * not. - * @hide pending unhide */ - public boolean getFitIgnoreVisibility() { - return mFitIgnoreVisibility; + public boolean isFitInsetsIgnoringVisibility() { + return mFitInsetsIgnoringVisibility; } public LayoutParams() { @@ -2957,9 +2984,9 @@ public interface WindowManager extends ViewManager { out.writeLong(hideTimeoutMilliseconds); out.writeInt(insetsFlags.appearance); out.writeInt(insetsFlags.behavior); - out.writeInt(mFitWindowInsetsTypes); - out.writeInt(mFitWindowInsetsSides); - out.writeBoolean(mFitIgnoreVisibility); + out.writeInt(mFitInsetsTypes); + out.writeInt(mFitInsetsSides); + out.writeBoolean(mFitInsetsIgnoringVisibility); out.writeBoolean(preferMinimalPostProcessing); } @@ -3018,9 +3045,9 @@ public interface WindowManager extends ViewManager { hideTimeoutMilliseconds = in.readLong(); insetsFlags.appearance = in.readInt(); insetsFlags.behavior = in.readInt(); - mFitWindowInsetsTypes = in.readInt(); - mFitWindowInsetsSides = in.readInt(); - mFitIgnoreVisibility = in.readBoolean(); + mFitInsetsTypes = in.readInt(); + mFitInsetsSides = in.readInt(); + mFitInsetsIgnoringVisibility = in.readBoolean(); preferMinimalPostProcessing = in.readBoolean(); } @@ -3267,18 +3294,18 @@ public interface WindowManager extends ViewManager { changes |= INSET_FLAGS_CHANGED; } - if (mFitWindowInsetsTypes != o.mFitWindowInsetsTypes) { - mFitWindowInsetsTypes = o.mFitWindowInsetsTypes; + if (mFitInsetsTypes != o.mFitInsetsTypes) { + mFitInsetsTypes = o.mFitInsetsTypes; changes |= LAYOUT_CHANGED; } - if (mFitWindowInsetsSides != o.mFitWindowInsetsSides) { - mFitWindowInsetsSides = o.mFitWindowInsetsSides; + if (mFitInsetsSides != o.mFitInsetsSides) { + mFitInsetsSides = o.mFitInsetsSides; changes |= LAYOUT_CHANGED; } - if (mFitIgnoreVisibility != o.mFitIgnoreVisibility) { - mFitIgnoreVisibility = o.mFitIgnoreVisibility; + if (mFitInsetsIgnoringVisibility != o.mFitInsetsIgnoringVisibility) { + mFitInsetsIgnoringVisibility = o.mFitInsetsIgnoringVisibility; changes |= LAYOUT_CHANGED; } @@ -3440,17 +3467,17 @@ public interface WindowManager extends ViewManager { sb.append(prefix).append(" bhv=").append(ViewDebug.flagsToString( InsetsFlags.class, "behavior", insetsFlags.behavior)); } - if (mFitWindowInsetsTypes != 0) { + if (mFitInsetsTypes != 0) { sb.append(System.lineSeparator()); sb.append(prefix).append(" fitTypes=").append(ViewDebug.flagsToString( - LayoutParams.class, "mFitWindowInsetsTypes", mFitWindowInsetsTypes)); + LayoutParams.class, "mFitInsetsTypes", mFitInsetsTypes)); } - if (mFitWindowInsetsSides != Side.all()) { + if (mFitInsetsSides != Side.all()) { sb.append(System.lineSeparator()); sb.append(prefix).append(" fitSides=").append(ViewDebug.flagsToString( - LayoutParams.class, "mFitWindowInsetsSides", mFitWindowInsetsSides)); + LayoutParams.class, "mFitInsetsSides", mFitInsetsSides)); } - if (mFitIgnoreVisibility) { + if (mFitInsetsIgnoringVisibility) { sb.append(System.lineSeparator()); sb.append(prefix).append(" fitIgnoreVis"); } @@ -3491,9 +3518,9 @@ public interface WindowManager extends ViewManager { proto.write(SUBTREE_SYSTEM_UI_VISIBILITY_FLAGS, subtreeSystemUiVisibility); proto.write(APPEARANCE, insetsFlags.appearance); proto.write(BEHAVIOR, insetsFlags.behavior); - proto.write(FIT_INSETS_TYPES, mFitWindowInsetsTypes); - proto.write(FIT_INSETS_SIDES, mFitWindowInsetsSides); - proto.write(FIT_IGNORE_VISIBILITY, mFitIgnoreVisibility); + proto.write(FIT_INSETS_TYPES, mFitInsetsTypes); + proto.write(FIT_INSETS_SIDES, mFitInsetsSides); + proto.write(FIT_IGNORE_VISIBILITY, mFitInsetsIgnoringVisibility); proto.end(token); } diff --git a/core/java/android/widget/Toast.java b/core/java/android/widget/Toast.java index 969bda9da5a0..42d7892eeffb 100644 --- a/core/java/android/widget/Toast.java +++ b/core/java/android/widget/Toast.java @@ -456,7 +456,7 @@ public class Toast { params.format = PixelFormat.TRANSLUCENT; params.windowAnimations = com.android.internal.R.style.Animation_Toast; params.type = WindowManager.LayoutParams.TYPE_TOAST; - params.setFitIgnoreVisibility(true); + params.setFitInsetsIgnoringVisibility(true); params.setTitle("Toast"); params.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index cb0a985e6f11..95558c31e671 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -2381,8 +2381,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { setFlags(0, flagsToUpdate); } else { setFlags(FLAG_LAYOUT_IN_SCREEN|FLAG_LAYOUT_INSET_DECOR, flagsToUpdate); - getAttributes().setFitWindowInsetsSides(0); - getAttributes().setFitWindowInsetsTypes(0); + getAttributes().setFitInsetsSides(0); + getAttributes().setFitInsetsTypes(0); } if (a.getBoolean(R.styleable.Window_windowNoTitle, false)) { diff --git a/core/tests/coretests/src/android/view/InsetsStateTest.java b/core/tests/coretests/src/android/view/InsetsStateTest.java index 9e4b1c55304f..20be8c22ccfc 100644 --- a/core/tests/coretests/src/android/view/InsetsStateTest.java +++ b/core/tests/coretests/src/android/view/InsetsStateTest.java @@ -94,7 +94,7 @@ public class InsetsStateTest { WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), false, false, DisplayCutout.NO_CUTOUT, null, null, SOFT_INPUT_ADJUST_RESIZE, 0, null); assertEquals(100, insets.getStableInsetBottom()); - assertEquals(Insets.of(0, 0, 0, 100), insets.getMaxInsets(Type.systemBars())); + assertEquals(Insets.of(0, 0, 0, 100), insets.getInsetsIgnoringVisibility(Type.systemBars())); assertEquals(Insets.of(0, 0, 0, 200), insets.getSystemWindowInsets()); assertEquals(Insets.of(0, 0, 0, 200), insets.getInsets(Type.all())); assertEquals(Insets.of(0, 0, 0, 100), insets.getInsets(Type.navigationBars())); diff --git a/core/tests/coretests/src/android/view/ViewRootImplTest.java b/core/tests/coretests/src/android/view/ViewRootImplTest.java index cf5d079ba688..df6ed8c3fe0d 100644 --- a/core/tests/coretests/src/android/view/ViewRootImplTest.java +++ b/core/tests/coretests/src/android/view/ViewRootImplTest.java @@ -109,7 +109,7 @@ public class ViewRootImplTest { attrs.systemUiVisibility = SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; ViewRootImpl.adjustLayoutParamsForCompatibility(attrs); - assertEquals(0, attrs.getFitWindowInsetsTypes() & Type.statusBars()); + assertEquals(0, attrs.getFitInsetsTypes() & Type.statusBars()); } @Test @@ -120,7 +120,7 @@ public class ViewRootImplTest { attrs.flags = FLAG_LAYOUT_IN_SCREEN; ViewRootImpl.adjustLayoutParamsForCompatibility(attrs); - assertEquals(0, attrs.getFitWindowInsetsTypes() & Type.statusBars()); + assertEquals(0, attrs.getFitInsetsTypes() & Type.statusBars()); } @Test @@ -131,7 +131,7 @@ public class ViewRootImplTest { attrs.systemUiVisibility = SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; ViewRootImpl.adjustLayoutParamsForCompatibility(attrs); - assertEquals(0, attrs.getFitWindowInsetsTypes() & Type.systemBars()); + assertEquals(0, attrs.getFitInsetsTypes() & Type.systemBars()); } @Test @@ -141,8 +141,8 @@ public class ViewRootImplTest { final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(TYPE_TOAST); ViewRootImpl.adjustLayoutParamsForCompatibility(attrs); - assertEquals(Type.systemBars(), attrs.getFitWindowInsetsTypes() & Type.systemBars()); - assertEquals(true, attrs.getFitIgnoreVisibility()); + assertEquals(Type.systemBars(), attrs.getFitInsetsTypes() & Type.systemBars()); + assertEquals(true, attrs.isFitInsetsIgnoringVisibility()); } @Test @@ -152,8 +152,8 @@ public class ViewRootImplTest { final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(TYPE_SYSTEM_ALERT); ViewRootImpl.adjustLayoutParamsForCompatibility(attrs); - assertEquals(Type.systemBars(), attrs.getFitWindowInsetsTypes() & Type.systemBars()); - assertEquals(true, attrs.getFitIgnoreVisibility()); + assertEquals(Type.systemBars(), attrs.getFitInsetsTypes() & Type.systemBars()); + assertEquals(true, attrs.isFitInsetsIgnoringVisibility()); } @Test @@ -165,14 +165,14 @@ public class ViewRootImplTest { final int sides = Side.TOP | Side.LEFT; final boolean fitMaxInsets = true; attrs.flags = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; - attrs.setFitWindowInsetsTypes(types); - attrs.setFitWindowInsetsSides(sides); - attrs.setFitIgnoreVisibility(fitMaxInsets); + attrs.setFitInsetsTypes(types); + attrs.setFitInsetsSides(sides); + attrs.setFitInsetsIgnoringVisibility(fitMaxInsets); ViewRootImpl.adjustLayoutParamsForCompatibility(attrs); - assertEquals(types, attrs.getFitWindowInsetsTypes()); - assertEquals(sides, attrs.getFitWindowInsetsSides()); - assertEquals(fitMaxInsets, attrs.getFitIgnoreVisibility()); + assertEquals(types, attrs.getFitInsetsTypes()); + assertEquals(sides, attrs.getFitInsetsSides()); + assertEquals(fitMaxInsets, attrs.isFitInsetsIgnoringVisibility()); } private static class ViewRootImplAccessor { diff --git a/packages/CarSystemUI/src/com/android/systemui/car/SystemUIPrimaryWindowController.java b/packages/CarSystemUI/src/com/android/systemui/car/SystemUIPrimaryWindowController.java index c7e14d677b04..3f55ac8ccace 100644 --- a/packages/CarSystemUI/src/com/android/systemui/car/SystemUIPrimaryWindowController.java +++ b/packages/CarSystemUI/src/com/android/systemui/car/SystemUIPrimaryWindowController.java @@ -113,7 +113,7 @@ public class SystemUIPrimaryWindowController implements PixelFormat.TRANSLUCENT); mLp.token = new Binder(); mLp.gravity = Gravity.TOP; - mLp.setFitWindowInsetsTypes(/* types= */ 0); + mLp.setFitInsetsTypes(/* types= */ 0); mLp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; mLp.setTitle("SystemUIPrimaryWindow"); mLp.packageName = mContext.getPackageName(); diff --git a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java index 78764dd19741..dc84935034bc 100644 --- a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java +++ b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java @@ -296,7 +296,7 @@ public class CarNavigationBar extends SystemUI implements CommandQueue.Callbacks leftlp.windowAnimations = 0; leftlp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_IS_SCREEN_DECOR; leftlp.gravity = Gravity.LEFT; - leftlp.setFitWindowInsetsTypes(0 /* types */); + leftlp.setFitInsetsTypes(0 /* types */); mWindowManager.addView(mLeftNavigationBarWindow, leftlp); } if (mRightNavigationBarWindow != null) { @@ -314,7 +314,7 @@ public class CarNavigationBar extends SystemUI implements CommandQueue.Callbacks rightlp.windowAnimations = 0; rightlp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_IS_SCREEN_DECOR; rightlp.gravity = Gravity.RIGHT; - rightlp.setFitWindowInsetsTypes(0 /* types */); + rightlp.setFitInsetsTypes(0 /* types */); mWindowManager.addView(mRightNavigationBarWindow, rightlp); } } diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarTrustAgentUnlockDialogHelper.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarTrustAgentUnlockDialogHelper.java index b2f8aad77dd4..07dbd667acf4 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarTrustAgentUnlockDialogHelper.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarTrustAgentUnlockDialogHelper.java @@ -249,7 +249,7 @@ class CarTrustAgentUnlockDialogHelper extends BroadcastReceiver{ | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, PixelFormat.TRANSLUCENT ); - attrs.setFitWindowInsetsTypes(0 /* types */); + attrs.setFitInsetsTypes(0 /* types */); return attrs; } diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java index 34baa2de567f..7dd3be4b2c11 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java @@ -368,8 +368,8 @@ public class UserGridRecyclerView extends RecyclerView { window.setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); - window.getAttributes().setFitWindowInsetsTypes( - window.getAttributes().getFitWindowInsetsTypes() & ~statusBars()); + window.getAttributes().setFitInsetsTypes( + window.getAttributes().getFitInsetsTypes() & ~statusBars()); } private void notifyUserSelected(UserRecord userRecord) { diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java index 139f04241982..571c4ae0e386 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java @@ -290,7 +290,7 @@ public class KeyguardDisplayManager { View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); - getWindow().getAttributes().setFitWindowInsetsTypes(0 /* types */); + getWindow().getAttributes().setFitInsetsTypes(0 /* types */); getWindow().setNavigationBarContrastEnforced(false); getWindow().setNavigationBarColor(Color.TRANSPARENT); diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java index db8b5831faf1..e66b9f21bd8c 100644 --- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java @@ -503,7 +503,7 @@ public class ScreenDecorations extends SystemUI implements Tunable { lp.gravity = Gravity.TOP | Gravity.LEFT; } lp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; - lp.setFitWindowInsetsTypes(0 /* types */); + lp.setFitInsetsTypes(0 /* types */); if (isLandscape(mRotation)) { lp.width = WRAP_CONTENT; lp.height = MATCH_PARENT; diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java index 659629b59b45..5532a0427e79 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java @@ -70,7 +70,7 @@ public class AssistDisclosure { | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, PixelFormat.TRANSLUCENT); lp.setTitle("AssistDisclosure"); - lp.setFitWindowInsetsTypes(0 /* types */); + lp.setFitInsetsTypes(0 /* types */); mWm.addView(mView, lp); mViewAdded = true; diff --git a/packages/SystemUI/src/com/android/systemui/assist/ui/DefaultUiController.java b/packages/SystemUI/src/com/android/systemui/assist/ui/DefaultUiController.java index eb615a0392fa..f201a6fb1137 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/ui/DefaultUiController.java +++ b/packages/SystemUI/src/com/android/systemui/assist/ui/DefaultUiController.java @@ -85,7 +85,7 @@ public class DefaultUiController implements AssistManager.UiController { PixelFormat.TRANSLUCENT); mLayoutParams.privateFlags = WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION; mLayoutParams.gravity = Gravity.BOTTOM; - mLayoutParams.setFitWindowInsetsTypes(0 /* types */); + mLayoutParams.setFitInsetsTypes(0 /* types */); mLayoutParams.setTitle("Assist"); mInvocationLightsView = (InvocationLightsView) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java index 89446adb0fd7..b8d32aec30e3 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java @@ -592,7 +592,7 @@ public class AuthContainerView extends LinearLayout lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; lp.setTitle("BiometricPrompt"); lp.token = windowToken; - lp.setFitWindowInsetsTypes(lp.getFitWindowInsetsTypes() & ~Type.statusBars()); + lp.setFitInsetsTypes(lp.getFitInsetsTypes() & ~Type.statusBars()); return lp; } } diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java index 40f98005aff4..83f6d45465b3 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java @@ -1577,7 +1577,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); - window.getAttributes().setFitWindowInsetsTypes(0 /* types */); + window.getAttributes().setFitInsetsTypes(0 /* types */); setTitle(R.string.global_actions); mPanelController = plugin; diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java index ffc9e5ac68e6..dd1856a93d2e 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java @@ -126,7 +126,7 @@ public class GlobalActionsImpl implements GlobalActions, CommandQueue.Callbacks, window.getAttributes().height = ViewGroup.LayoutParams.MATCH_PARENT; window.getAttributes().layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); - window.getAttributes().setFitWindowInsetsTypes(0 /* types */); + window.getAttributes().setFitInsetsTypes(0 /* types */); window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); window.addFlags( WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipDismissViewController.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipDismissViewController.java index 750cc607abe3..b7258117c48c 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipDismissViewController.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipDismissViewController.java @@ -109,7 +109,7 @@ public class PipDismissViewController { lp.setTitle("pip-dismiss-overlay"); lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; lp.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL; - lp.setFitWindowInsetsTypes(0 /* types */); + lp.setFitInsetsTypes(0 /* types */); mWindowManager.addView(mDismissView, lp); } mDismissView.animate().cancel(); diff --git a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java index 1d649eee4d57..fe84d81836e8 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java +++ b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java @@ -138,7 +138,7 @@ public class ScreenPinningRequest implements View.OnClickListener, lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; lp.setTitle("ScreenPinningConfirmation"); lp.gravity = Gravity.FILL; - lp.setFitWindowInsetsTypes(0 /* types */); + lp.setFitInsetsTypes(0 /* types */); return lp; } diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 50e9a51478ed..99a9dfeae1d6 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -240,7 +240,7 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset PixelFormat.TRANSLUCENT); mWindowLayoutParams.setTitle("ScreenshotAnimation"); mWindowLayoutParams.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; - mWindowLayoutParams.setFitWindowInsetsTypes(0 /* types */); + mWindowLayoutParams.setFitInsetsTypes(0 /* types */); mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); mDisplay = mWindowManager.getDefaultDisplay(); mDisplayMetrics = new DisplayMetrics(); diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshotLegacy.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshotLegacy.java index 16447fbdd4aa..a5baa7a49bd0 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshotLegacy.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshotLegacy.java @@ -156,7 +156,7 @@ public class GlobalScreenshotLegacy { PixelFormat.TRANSLUCENT); mWindowLayoutParams.setTitle("ScreenshotAnimation"); mWindowLayoutParams.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; - mWindowLayoutParams.setFitWindowInsetsTypes(0 /* types */); + mWindowLayoutParams.setFitInsetsTypes(0 /* types */); mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); mDisplay = mWindowManager.getDefaultDisplay(); mDisplayMetrics = new DisplayMetrics(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt index 9ab3dbc8ab93..4f27c0f04c3f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt @@ -295,7 +295,7 @@ class ChannelEditorDialogController @Inject constructor( format = PixelFormat.TRANSLUCENT title = ChannelEditorDialogController::class.java.simpleName gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL - fitWindowInsetsTypes = attributes.fitWindowInsetsTypes and statusBars().inv() + fitInsetsTypes = attributes.fitInsetsTypes and statusBars().inv() width = MATCH_PARENT height = WRAP_CONTENT } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java index ef581db0b053..6bd122d97dea 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java @@ -304,7 +304,7 @@ public class EdgeBackGestureHandler implements DisplayListener, layoutParams.setTitle(TAG + mContext.getDisplayId()); layoutParams.accessibilityTitle = mContext.getString(R.string.nav_bar_edge_panel); layoutParams.windowAnimations = 0; - layoutParams.setFitWindowInsetsTypes(0 /* types */); + layoutParams.setFitInsetsTypes(0 /* types */); return layoutParams; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java index 783e7adf2a8b..16b5a2389ec6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java @@ -84,7 +84,7 @@ public class FloatingRotationButton implements RotationButton { PixelFormat.TRANSLUCENT); lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; lp.setTitle("FloatingRotationButton"); - lp.setFitWindowInsetsTypes(0 /*types */); + lp.setFitInsetsTypes(0 /*types */); switch (mWindowManager.getDefaultDisplay().getRotation()) { case Surface.ROTATION_0: lp.gravity = Gravity.BOTTOM | Gravity.LEFT; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java index fe4879b0b071..3af80387778b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java @@ -175,7 +175,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable, PixelFormat.TRANSLUCENT); mLp.token = new Binder(); mLp.gravity = Gravity.TOP; - mLp.setFitWindowInsetsTypes(0 /* types */); + mLp.setFitInsetsTypes(0 /* types */); mLp.softInputMode = LayoutParams.SOFT_INPUT_ADJUST_RESIZE; mLp.setTitle("NotificationShade"); mLp.packageName = mContext.getPackageName(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowView.java index 6979554303b3..7650a3ab3a4e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowView.java @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.phone; +import static android.view.WindowInsets.Type.systemBars; + import android.annotation.ColorInt; import android.annotation.DrawableRes; import android.annotation.LayoutRes; @@ -81,7 +83,7 @@ public class NotificationShadeWindowView extends FrameLayout { @Override public WindowInsets onApplyWindowInsets(WindowInsets windowInsets) { - final Insets insets = windowInsets.getMaxInsets(WindowInsets.Type.systemBars()); + final Insets insets = windowInsets.getInsetsIgnoringVisibility(systemBars()); if (getFitsSystemWindows()) { boolean paddingChanged = insets.top != getPaddingTop() || insets.bottom != getPaddingBottom(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java index fb30bdec68b5..e448d0ac8649 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java @@ -107,6 +107,7 @@ public class StatusBarWindowController { PixelFormat.TRANSLUCENT); mLp.token = new Binder(); mLp.gravity = Gravity.TOP; + mLp.setFitInsetsTypes(0 /* types */); mLp.setTitle("StatusBar"); mLp.packageName = mContext.getPackageName(); mLp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java index 9655535dbecd..06105f532eb6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java @@ -106,8 +106,8 @@ public class SystemUIDialog extends AlertDialog { if (Dependency.get(KeyguardStateController.class).isShowing()) { final Window window = dialog.getWindow(); window.setType(LayoutParams.TYPE_STATUS_BAR_PANEL); - window.getAttributes().setFitWindowInsetsTypes( - window.getAttributes().getFitWindowInsetsTypes() & ~Type.statusBars()); + window.getAttributes().setFitInsetsTypes( + window.getAttributes().getFitInsetsTypes() & ~Type.statusBars()); } else { dialog.getWindow().setType(LayoutParams.TYPE_STATUS_BAR_SUB_PANEL); } @@ -118,8 +118,8 @@ public class SystemUIDialog extends AlertDialog { window.setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); - window.getAttributes().setFitWindowInsetsTypes( - window.getAttributes().getFitWindowInsetsTypes() & ~Type.statusBars()); + window.getAttributes().setFitInsetsTypes( + window.getAttributes().getFitInsetsTypes() & ~Type.statusBars()); return dialog; } diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index ec9049ee05ee..c3e7f62e4f31 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -4876,7 +4876,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mBootMsgDialog.getWindow().setDimAmount(1); WindowManager.LayoutParams lp = mBootMsgDialog.getWindow().getAttributes(); lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR; - lp.setFitWindowInsetsTypes(0 /* types */); + lp.setFitInsetsTypes(0 /* types */); mBootMsgDialog.getWindow().setAttributes(lp); mBootMsgDialog.setCancelable(false); mBootMsgDialog.show(); diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 31311bd36514..f8df883a3e1c 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -894,10 +894,10 @@ public class DisplayPolicy { if (attrs.isFullscreen() && win.mActivityRecord != null && win.mActivityRecord.fillsParent() && (win.mAttrs.privateFlags & PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS) != 0 - && attrs.getFitWindowInsetsTypes() != 0) { + && attrs.getFitInsetsTypes() != 0) { throw new RuntimeException("Illegal attributes: Main activity window that isn't" + " translucent trying to fit insets: " - + attrs.getFitWindowInsetsTypes() + + attrs.getFitInsetsTypes() + " attrs=" + attrs); } break; @@ -1260,7 +1260,7 @@ public class DisplayPolicy { if (layoutInScreenAndInsetDecor && !screenDecor) { if ((sysUiVis & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0 - || (attrs.getFitWindowInsetsTypes() & Type.navigationBars()) == 0) { + || (attrs.getFitInsetsTypes() & Type.navigationBars()) == 0) { outFrame.set(displayFrames.mUnrestricted); } else { outFrame.set(displayFrames.mRestricted); @@ -1876,15 +1876,15 @@ public class DisplayPolicy { sf.set(displayFrames.mStable); if (ViewRootImpl.sNewInsetsMode == NEW_INSETS_MODE_FULL) { - final @InsetsType int typesToFit = attrs.getFitWindowInsetsTypes(); - final @InsetsSide int sidesToFit = attrs.getFitWindowInsetsSides(); + final @InsetsType int typesToFit = attrs.getFitInsetsTypes(); + final @InsetsSide int sidesToFit = attrs.getFitInsetsSides(); final ArraySet<Integer> types = InsetsState.toInternalType(typesToFit); final Rect dfu = displayFrames.mUnrestricted; Insets insets = Insets.of(0, 0, 0, 0); for (int i = types.size() - 1; i >= 0; i--) { insets = Insets.max(insets, mDisplayContent.getInsetsPolicy() .getInsetsForDispatch(win).getSource(types.valueAt(i)) - .calculateInsets(dfu, attrs.getFitIgnoreVisibility())); + .calculateInsets(dfu, attrs.isFitInsetsIgnoringVisibility())); } final int left = (sidesToFit & Side.LEFT) != 0 ? insets.left : 0; final int top = (sidesToFit & Side.TOP) != 0 ? insets.top : 0; diff --git a/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java b/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java index bef1442c73c5..ef6f84703723 100644 --- a/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java +++ b/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java @@ -190,7 +190,7 @@ public class ImmersiveModeConfirmation { | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, PixelFormat.TRANSLUCENT); - lp.setFitWindowInsetsTypes(lp.getFitWindowInsetsTypes() & ~Type.statusBars()); + lp.setFitInsetsTypes(lp.getFitInsetsTypes() & ~Type.statusBars()); lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; lp.setTitle("ImmersiveModeConfirmation"); lp.windowAnimations = com.android.internal.R.style.Animation_ImmersiveModeConfirmation; diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java index a95f43f41a88..5ba676d1c544 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java @@ -140,7 +140,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { public void layoutWindowLw_fitStatusBars() { assumeTrue(ViewRootImpl.sNewInsetsMode == ViewRootImpl.NEW_INSETS_MODE_FULL); - mWindow.mAttrs.setFitWindowInsetsTypes(Type.statusBars()); + mWindow.mAttrs.setFitInsetsTypes(Type.statusBars()); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); @@ -158,7 +158,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { public void layoutWindowLw_fitNavigationBars() { assumeTrue(ViewRootImpl.sNewInsetsMode == ViewRootImpl.NEW_INSETS_MODE_FULL); - mWindow.mAttrs.setFitWindowInsetsTypes(Type.navigationBars()); + mWindow.mAttrs.setFitInsetsTypes(Type.navigationBars()); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); @@ -177,7 +177,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { assumeTrue(ViewRootImpl.sNewInsetsMode == ViewRootImpl.NEW_INSETS_MODE_FULL); mWindow.mAttrs.flags = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; - mWindow.mAttrs.setFitWindowInsetsTypes(Type.systemBars()); + mWindow.mAttrs.setFitInsetsTypes(Type.systemBars()); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); @@ -196,7 +196,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { assumeTrue(ViewRootImpl.sNewInsetsMode == ViewRootImpl.NEW_INSETS_MODE_FULL); mWindow.mAttrs.privateFlags = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS; - mWindow.mAttrs.setFitWindowInsetsTypes(Type.systemBars()); + mWindow.mAttrs.setFitInsetsTypes(Type.systemBars()); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); @@ -215,7 +215,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { assumeTrue(ViewRootImpl.sNewInsetsMode == ViewRootImpl.NEW_INSETS_MODE_FULL); mWindow.mAttrs.flags = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; - mWindow.mAttrs.setFitWindowInsetsTypes(Type.systemBars()); + mWindow.mAttrs.setFitInsetsTypes(Type.systemBars()); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); @@ -233,7 +233,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { public void layoutWindowLw_fitAllSides() { assumeTrue(ViewRootImpl.sNewInsetsMode == ViewRootImpl.NEW_INSETS_MODE_FULL); - mWindow.mAttrs.setFitWindowInsetsSides(Side.all()); + mWindow.mAttrs.setFitInsetsSides(Side.all()); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); @@ -251,7 +251,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { public void layoutWindowLw_fitTopOnly() { assumeTrue(ViewRootImpl.sNewInsetsMode == ViewRootImpl.NEW_INSETS_MODE_FULL); - mWindow.mAttrs.setFitWindowInsetsSides(Side.TOP); + mWindow.mAttrs.setFitInsetsSides(Side.TOP); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); @@ -273,7 +273,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { mDisplayContent.getInsetsPolicy().getInsetsForDispatch(mWindow); state.getSource(InsetsState.ITYPE_STATUS_BAR).setVisible(false); state.getSource(InsetsState.ITYPE_NAVIGATION_BAR).setVisible(false); - mWindow.mAttrs.setFitIgnoreVisibility(true); + mWindow.mAttrs.setFitInsetsIgnoringVisibility(true); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); @@ -295,7 +295,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { mDisplayContent.getInsetsPolicy().getInsetsForDispatch(mWindow); state.getSource(InsetsState.ITYPE_STATUS_BAR).setVisible(false); state.getSource(InsetsState.ITYPE_NAVIGATION_BAR).setVisible(false); - mWindow.mAttrs.setFitIgnoreVisibility(false); + mWindow.mAttrs.setFitInsetsIgnoringVisibility(false); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); @@ -372,7 +372,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { mWindow.mAttrs.flags = FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; mWindow.mAttrs.systemUiVisibility = SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; - mWindow.mAttrs.setFitWindowInsetsTypes(0 /* types */); + mWindow.mAttrs.setFitInsetsTypes(0 /* types */); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* uiMode */); @@ -429,8 +429,8 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { mWindow.mAttrs.flags = FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; mWindow.mAttrs.subtreeSystemUiVisibility |= SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; - mWindow.mAttrs.setFitWindowInsetsTypes( - mWindow.mAttrs.getFitWindowInsetsTypes() & ~Type.statusBars()); + mWindow.mAttrs.setFitInsetsTypes( + mWindow.mAttrs.getFitInsetsTypes() & ~Type.statusBars()); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); @@ -535,8 +535,8 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { mWindow.mAttrs.flags = FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; mWindow.mAttrs.subtreeSystemUiVisibility |= SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; - mWindow.mAttrs.setFitWindowInsetsTypes( - mWindow.mAttrs.getFitWindowInsetsTypes() & ~Type.statusBars()); + mWindow.mAttrs.setFitInsetsTypes( + mWindow.mAttrs.getFitInsetsTypes() & ~Type.statusBars()); addWindow(mWindow); mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); @@ -554,7 +554,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { addDisplayCutout(); mWindow.mAttrs.flags = FLAG_LAYOUT_IN_SCREEN; - mWindow.mAttrs.setFitWindowInsetsTypes(Type.systemBars() & ~Type.statusBars()); + mWindow.mAttrs.setFitInsetsTypes(Type.systemBars() & ~Type.statusBars()); mWindow.mAttrs.type = TYPE_APPLICATION_OVERLAY; mWindow.mAttrs.width = DISPLAY_WIDTH; mWindow.mAttrs.height = DISPLAY_HEIGHT; @@ -575,8 +575,8 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { mWindow.mAttrs.flags = FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; mWindow.mAttrs.subtreeSystemUiVisibility |= SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; - mWindow.mAttrs.setFitWindowInsetsTypes( - mWindow.mAttrs.getFitWindowInsetsTypes() & ~Type.statusBars()); + mWindow.mAttrs.setFitInsetsTypes( + mWindow.mAttrs.getFitInsetsTypes() & ~Type.statusBars()); mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; addWindow(mWindow); |