Loading core/java/android/view/InsetsAnimationControlImpl.java +2 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,8 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll return state.calculateInsets(frame, false /* isScreenRound */, false /* alwaysConsumeSystemBars */, null /* displayCutout */, null /* legacyContentInsets */, null /* legacyStableInsets */, LayoutParams.SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode*/, typeSideMap) LayoutParams.SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode*/, 0 /* legacySystemUiFlags */, typeSideMap) .getInsets(mTypes); } Loading core/java/android/view/InsetsController.java +5 −3 Original line number Diff line number Diff line Loading @@ -246,6 +246,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private int mPendingTypesToShow; private int mLastLegacySoftInputMode; private int mLastLegacySystemUiFlags; private boolean mStartingAnimation; private SyncRtSurfaceTransactionApplier mApplier; Loading Loading @@ -274,7 +275,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation WindowInsets insets = state.calculateInsets(mFrame, mLastInsets.isRound(), mLastInsets.shouldAlwaysConsumeSystemBars(), mLastInsets.getDisplayCutout(), mLastLegacyContentInsets, mLastLegacyStableInsets, mLastLegacySoftInputMode, null /* typeSideMap */); mLastLegacySystemUiFlags, null /* typeSideMap */); mViewRoot.mView.dispatchWindowInsetsAnimationProgress(insets); for (int i = mTmpFinishedControls.size() - 1; i >= 0; i--) { Loading Loading @@ -317,12 +318,13 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation @VisibleForTesting public WindowInsets calculateInsets(boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout, Rect legacyContentInsets, Rect legacyStableInsets, int legacySoftInputMode) { Rect legacyStableInsets, int legacySoftInputMode, int legacySystemUiFlags) { mLastLegacyContentInsets.set(legacyContentInsets); mLastLegacyStableInsets.set(legacyStableInsets); mLastLegacySoftInputMode = legacySoftInputMode; mLastLegacySystemUiFlags = legacySystemUiFlags; mLastInsets = mState.calculateInsets(mFrame, isScreenRound, alwaysConsumeSystemBars, cutout, legacyContentInsets, legacyStableInsets, legacySoftInputMode, legacyContentInsets, legacyStableInsets, legacySoftInputMode, legacySystemUiFlags, null /* typeSideMap */); return mLastInsets; } Loading core/java/android/view/InsetsState.java +6 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE; import static android.view.ViewRootImpl.NEW_INSETS_MODE_FULL; import static android.view.ViewRootImpl.NEW_INSETS_MODE_IME; import static android.view.ViewRootImpl.NEW_INSETS_MODE_NONE; Loading Loading @@ -143,7 +144,8 @@ public class InsetsState implements Parcelable { public WindowInsets calculateInsets(Rect frame, boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout, @Nullable Rect legacyContentInsets, @Nullable Rect legacyStableInsets, int legacySoftInputMode, @Nullable @InternalInsetsSide SparseIntArray typeSideMap) { int legacySoftInputMode, int legacySystemUiFlags, @Nullable @InternalInsetsSide SparseIntArray typeSideMap) { Insets[] typeInsetsMap = new Insets[Type.SIZE]; Insets[] typeMaxInsetsMap = new Insets[Type.SIZE]; boolean[] typeVisibilityMap = new boolean[SIZE]; Loading Loading @@ -186,7 +188,9 @@ public class InsetsState implements Parcelable { return new WindowInsets(typeInsetsMap, typeMaxInsetsMap, typeVisibilityMap, isScreenRound, alwaysConsumeSystemBars, cutout, softInputAdjustMode == SOFT_INPUT_ADJUST_RESIZE ? systemBars() | ime() : systemBars()); : systemBars(), sNewInsetsMode == NEW_INSETS_MODE_FULL && (legacySystemUiFlags & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0); } public Rect calculateVisibleInsets(Rect frame, Rect legacyVisibleInsets, Loading core/java/android/view/ViewRootImpl.java +3 −1 Original line number Diff line number Diff line Loading @@ -2082,7 +2082,9 @@ public final class ViewRootImpl implements ViewParent, mLastWindowInsets = mInsetsController.calculateInsets( mContext.getResources().getConfiguration().isScreenRound(), mAttachInfo.mAlwaysConsumeSystemBars, displayCutout, contentInsets, stableInsets, mWindowAttributes.softInputMode); contentInsets, stableInsets, mWindowAttributes.softInputMode, (mWindowAttributes.systemUiVisibility | mWindowAttributes.subtreeSystemUiVisibility)); } return mLastWindowInsets; } Loading core/java/android/view/WindowInsets.java +28 −15 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static android.view.WindowInsets.Type.STATUS_BARS; import static android.view.WindowInsets.Type.SYSTEM_GESTURES; import static android.view.WindowInsets.Type.TAPPABLE_ELEMENT; import static android.view.WindowInsets.Type.all; import static android.view.WindowInsets.Type.ime; import static android.view.WindowInsets.Type.indexOf; import static android.view.WindowInsets.Type.systemBars; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING; Loading @@ -46,6 +47,7 @@ import android.view.WindowManager.LayoutParams.SoftInputModeFlags; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethod; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.Preconditions; import java.lang.annotation.Retention; Loading Loading @@ -91,6 +93,7 @@ public final class WindowInsets { private final boolean mDisplayCutoutConsumed; private final int mCompatInsetTypes; private final boolean mCompatIgnoreVisibility; /** * Since new insets may be added in the future that existing apps couldn't Loading @@ -117,7 +120,8 @@ public final class WindowInsets { boolean isRound, boolean alwaysConsumeSystemBars, DisplayCutout displayCutout) { this(createCompatTypeMap(systemWindowInsetsRect), createCompatTypeMap(stableInsetsRect), createCompatVisibilityMap(createCompatTypeMap(systemWindowInsetsRect)), isRound, alwaysConsumeSystemBars, displayCutout, systemBars()); isRound, alwaysConsumeSystemBars, displayCutout, systemBars(), false /* compatIgnoreVisibility */); } /** Loading @@ -136,7 +140,8 @@ public final class WindowInsets { @Nullable Insets[] typeMaxInsetsMap, boolean[] typeVisibilityMap, boolean isRound, boolean alwaysConsumeSystemBars, DisplayCutout displayCutout, int compatInsetTypes) { boolean alwaysConsumeSystemBars, DisplayCutout displayCutout, int compatInsetTypes, boolean compatIgnoreVisibility) { mSystemWindowInsetsConsumed = typeInsetsMap == null; mTypeInsetsMap = mSystemWindowInsetsConsumed ? new Insets[SIZE] Loading @@ -151,6 +156,7 @@ public final class WindowInsets { mIsRound = isRound; mAlwaysConsumeSystemBars = alwaysConsumeSystemBars; mCompatInsetTypes = compatInsetTypes; mCompatIgnoreVisibility = compatIgnoreVisibility; mDisplayCutoutConsumed = displayCutout == null; mDisplayCutout = (mDisplayCutoutConsumed || displayCutout.isEmpty()) Loading @@ -167,7 +173,8 @@ public final class WindowInsets { src.mStableInsetsConsumed ? null : src.mTypeMaxInsetsMap, src.mTypeVisibilityMap, src.mIsRound, src.mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(src), src.mCompatInsetTypes); src.mCompatInsetTypes, src.mCompatIgnoreVisibility); } private static DisplayCutout displayCutoutCopyConstructorArgument(WindowInsets w) { Loading Loading @@ -219,7 +226,7 @@ public final class WindowInsets { @UnsupportedAppUsage public WindowInsets(Rect systemWindowInsets) { this(createCompatTypeMap(systemWindowInsets), null, new boolean[SIZE], false, false, null, systemBars()); systemBars(), false /* compatIgnoreVisibility */); } /** Loading @@ -239,7 +246,8 @@ public final class WindowInsets { /** * @hide */ static void assignCompatInsets(Insets[] typeInsetsMap, Rect insets) { @VisibleForTesting public static void assignCompatInsets(Insets[] typeInsetsMap, Rect insets) { typeInsetsMap[indexOf(STATUS_BARS)] = Insets.of(0, insets.top, 0, 0); typeInsetsMap[indexOf(NAVIGATION_BARS)] = Insets.of(insets.left, 0, insets.right, insets.bottom); Loading Loading @@ -288,7 +296,15 @@ public final class WindowInsets { */ @NonNull public Insets getSystemWindowInsets() { return getInsets(mTypeInsetsMap, mCompatInsetTypes); Insets result = mCompatIgnoreVisibility ? getMaxInsets(mCompatInsetTypes & ~ime()) : getInsets(mCompatInsetTypes); // We can't query max insets for IME, so we need to add it manually after. if ((mCompatInsetTypes & ime()) != 0 && mCompatIgnoreVisibility) { result = Insets.max(result, getInsets(ime())); } return result; } /** Loading Loading @@ -448,7 +464,7 @@ public final class WindowInsets { mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, null /* displayCutout */, mCompatInsetTypes); mCompatInsetTypes, mCompatIgnoreVisibility); } Loading Loading @@ -491,11 +507,11 @@ public final class WindowInsets { */ @NonNull public WindowInsets consumeSystemWindowInsets() { return new WindowInsets(null, mStableInsetsConsumed ? null : mTypeMaxInsetsMap, return new WindowInsets(null, null, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(this), mCompatInsetTypes); mCompatInsetTypes, mCompatIgnoreVisibility); } // TODO(b/119190588): replace @code with @link below Loading Loading @@ -741,10 +757,7 @@ public final class WindowInsets { */ @NonNull public WindowInsets consumeStableInsets() { return new WindowInsets(mSystemWindowInsetsConsumed ? null : mTypeInsetsMap, null, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(this), mCompatInsetTypes); return consumeSystemWindowInsets(); } /** Loading Loading @@ -829,7 +842,7 @@ public final class WindowInsets { : mDisplayCutout == null ? DisplayCutout.NO_CUTOUT : mDisplayCutout.inset(left, top, right, bottom), mCompatInsetTypes); mCompatInsetTypes, mCompatIgnoreVisibility); } @Override Loading Loading @@ -1147,7 +1160,7 @@ public final class WindowInsets { return new WindowInsets(mSystemInsetsConsumed ? null : mTypeInsetsMap, mStableInsetsConsumed ? null : mTypeMaxInsetsMap, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, mDisplayCutout, systemBars()); systemBars(), false /* compatIgnoreVisibility */); } } Loading Loading
core/java/android/view/InsetsAnimationControlImpl.java +2 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,8 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll return state.calculateInsets(frame, false /* isScreenRound */, false /* alwaysConsumeSystemBars */, null /* displayCutout */, null /* legacyContentInsets */, null /* legacyStableInsets */, LayoutParams.SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode*/, typeSideMap) LayoutParams.SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode*/, 0 /* legacySystemUiFlags */, typeSideMap) .getInsets(mTypes); } Loading
core/java/android/view/InsetsController.java +5 −3 Original line number Diff line number Diff line Loading @@ -246,6 +246,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private int mPendingTypesToShow; private int mLastLegacySoftInputMode; private int mLastLegacySystemUiFlags; private boolean mStartingAnimation; private SyncRtSurfaceTransactionApplier mApplier; Loading Loading @@ -274,7 +275,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation WindowInsets insets = state.calculateInsets(mFrame, mLastInsets.isRound(), mLastInsets.shouldAlwaysConsumeSystemBars(), mLastInsets.getDisplayCutout(), mLastLegacyContentInsets, mLastLegacyStableInsets, mLastLegacySoftInputMode, null /* typeSideMap */); mLastLegacySystemUiFlags, null /* typeSideMap */); mViewRoot.mView.dispatchWindowInsetsAnimationProgress(insets); for (int i = mTmpFinishedControls.size() - 1; i >= 0; i--) { Loading Loading @@ -317,12 +318,13 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation @VisibleForTesting public WindowInsets calculateInsets(boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout, Rect legacyContentInsets, Rect legacyStableInsets, int legacySoftInputMode) { Rect legacyStableInsets, int legacySoftInputMode, int legacySystemUiFlags) { mLastLegacyContentInsets.set(legacyContentInsets); mLastLegacyStableInsets.set(legacyStableInsets); mLastLegacySoftInputMode = legacySoftInputMode; mLastLegacySystemUiFlags = legacySystemUiFlags; mLastInsets = mState.calculateInsets(mFrame, isScreenRound, alwaysConsumeSystemBars, cutout, legacyContentInsets, legacyStableInsets, legacySoftInputMode, legacyContentInsets, legacyStableInsets, legacySoftInputMode, legacySystemUiFlags, null /* typeSideMap */); return mLastInsets; } Loading
core/java/android/view/InsetsState.java +6 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE; import static android.view.ViewRootImpl.NEW_INSETS_MODE_FULL; import static android.view.ViewRootImpl.NEW_INSETS_MODE_IME; import static android.view.ViewRootImpl.NEW_INSETS_MODE_NONE; Loading Loading @@ -143,7 +144,8 @@ public class InsetsState implements Parcelable { public WindowInsets calculateInsets(Rect frame, boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout, @Nullable Rect legacyContentInsets, @Nullable Rect legacyStableInsets, int legacySoftInputMode, @Nullable @InternalInsetsSide SparseIntArray typeSideMap) { int legacySoftInputMode, int legacySystemUiFlags, @Nullable @InternalInsetsSide SparseIntArray typeSideMap) { Insets[] typeInsetsMap = new Insets[Type.SIZE]; Insets[] typeMaxInsetsMap = new Insets[Type.SIZE]; boolean[] typeVisibilityMap = new boolean[SIZE]; Loading Loading @@ -186,7 +188,9 @@ public class InsetsState implements Parcelable { return new WindowInsets(typeInsetsMap, typeMaxInsetsMap, typeVisibilityMap, isScreenRound, alwaysConsumeSystemBars, cutout, softInputAdjustMode == SOFT_INPUT_ADJUST_RESIZE ? systemBars() | ime() : systemBars()); : systemBars(), sNewInsetsMode == NEW_INSETS_MODE_FULL && (legacySystemUiFlags & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0); } public Rect calculateVisibleInsets(Rect frame, Rect legacyVisibleInsets, Loading
core/java/android/view/ViewRootImpl.java +3 −1 Original line number Diff line number Diff line Loading @@ -2082,7 +2082,9 @@ public final class ViewRootImpl implements ViewParent, mLastWindowInsets = mInsetsController.calculateInsets( mContext.getResources().getConfiguration().isScreenRound(), mAttachInfo.mAlwaysConsumeSystemBars, displayCutout, contentInsets, stableInsets, mWindowAttributes.softInputMode); contentInsets, stableInsets, mWindowAttributes.softInputMode, (mWindowAttributes.systemUiVisibility | mWindowAttributes.subtreeSystemUiVisibility)); } return mLastWindowInsets; } Loading
core/java/android/view/WindowInsets.java +28 −15 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static android.view.WindowInsets.Type.STATUS_BARS; import static android.view.WindowInsets.Type.SYSTEM_GESTURES; import static android.view.WindowInsets.Type.TAPPABLE_ELEMENT; import static android.view.WindowInsets.Type.all; import static android.view.WindowInsets.Type.ime; import static android.view.WindowInsets.Type.indexOf; import static android.view.WindowInsets.Type.systemBars; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING; Loading @@ -46,6 +47,7 @@ import android.view.WindowManager.LayoutParams.SoftInputModeFlags; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethod; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.Preconditions; import java.lang.annotation.Retention; Loading Loading @@ -91,6 +93,7 @@ public final class WindowInsets { private final boolean mDisplayCutoutConsumed; private final int mCompatInsetTypes; private final boolean mCompatIgnoreVisibility; /** * Since new insets may be added in the future that existing apps couldn't Loading @@ -117,7 +120,8 @@ public final class WindowInsets { boolean isRound, boolean alwaysConsumeSystemBars, DisplayCutout displayCutout) { this(createCompatTypeMap(systemWindowInsetsRect), createCompatTypeMap(stableInsetsRect), createCompatVisibilityMap(createCompatTypeMap(systemWindowInsetsRect)), isRound, alwaysConsumeSystemBars, displayCutout, systemBars()); isRound, alwaysConsumeSystemBars, displayCutout, systemBars(), false /* compatIgnoreVisibility */); } /** Loading @@ -136,7 +140,8 @@ public final class WindowInsets { @Nullable Insets[] typeMaxInsetsMap, boolean[] typeVisibilityMap, boolean isRound, boolean alwaysConsumeSystemBars, DisplayCutout displayCutout, int compatInsetTypes) { boolean alwaysConsumeSystemBars, DisplayCutout displayCutout, int compatInsetTypes, boolean compatIgnoreVisibility) { mSystemWindowInsetsConsumed = typeInsetsMap == null; mTypeInsetsMap = mSystemWindowInsetsConsumed ? new Insets[SIZE] Loading @@ -151,6 +156,7 @@ public final class WindowInsets { mIsRound = isRound; mAlwaysConsumeSystemBars = alwaysConsumeSystemBars; mCompatInsetTypes = compatInsetTypes; mCompatIgnoreVisibility = compatIgnoreVisibility; mDisplayCutoutConsumed = displayCutout == null; mDisplayCutout = (mDisplayCutoutConsumed || displayCutout.isEmpty()) Loading @@ -167,7 +173,8 @@ public final class WindowInsets { src.mStableInsetsConsumed ? null : src.mTypeMaxInsetsMap, src.mTypeVisibilityMap, src.mIsRound, src.mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(src), src.mCompatInsetTypes); src.mCompatInsetTypes, src.mCompatIgnoreVisibility); } private static DisplayCutout displayCutoutCopyConstructorArgument(WindowInsets w) { Loading Loading @@ -219,7 +226,7 @@ public final class WindowInsets { @UnsupportedAppUsage public WindowInsets(Rect systemWindowInsets) { this(createCompatTypeMap(systemWindowInsets), null, new boolean[SIZE], false, false, null, systemBars()); systemBars(), false /* compatIgnoreVisibility */); } /** Loading @@ -239,7 +246,8 @@ public final class WindowInsets { /** * @hide */ static void assignCompatInsets(Insets[] typeInsetsMap, Rect insets) { @VisibleForTesting public static void assignCompatInsets(Insets[] typeInsetsMap, Rect insets) { typeInsetsMap[indexOf(STATUS_BARS)] = Insets.of(0, insets.top, 0, 0); typeInsetsMap[indexOf(NAVIGATION_BARS)] = Insets.of(insets.left, 0, insets.right, insets.bottom); Loading Loading @@ -288,7 +296,15 @@ public final class WindowInsets { */ @NonNull public Insets getSystemWindowInsets() { return getInsets(mTypeInsetsMap, mCompatInsetTypes); Insets result = mCompatIgnoreVisibility ? getMaxInsets(mCompatInsetTypes & ~ime()) : getInsets(mCompatInsetTypes); // We can't query max insets for IME, so we need to add it manually after. if ((mCompatInsetTypes & ime()) != 0 && mCompatIgnoreVisibility) { result = Insets.max(result, getInsets(ime())); } return result; } /** Loading Loading @@ -448,7 +464,7 @@ public final class WindowInsets { mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, null /* displayCutout */, mCompatInsetTypes); mCompatInsetTypes, mCompatIgnoreVisibility); } Loading Loading @@ -491,11 +507,11 @@ public final class WindowInsets { */ @NonNull public WindowInsets consumeSystemWindowInsets() { return new WindowInsets(null, mStableInsetsConsumed ? null : mTypeMaxInsetsMap, return new WindowInsets(null, null, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(this), mCompatInsetTypes); mCompatInsetTypes, mCompatIgnoreVisibility); } // TODO(b/119190588): replace @code with @link below Loading Loading @@ -741,10 +757,7 @@ public final class WindowInsets { */ @NonNull public WindowInsets consumeStableInsets() { return new WindowInsets(mSystemWindowInsetsConsumed ? null : mTypeInsetsMap, null, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(this), mCompatInsetTypes); return consumeSystemWindowInsets(); } /** Loading Loading @@ -829,7 +842,7 @@ public final class WindowInsets { : mDisplayCutout == null ? DisplayCutout.NO_CUTOUT : mDisplayCutout.inset(left, top, right, bottom), mCompatInsetTypes); mCompatInsetTypes, mCompatIgnoreVisibility); } @Override Loading Loading @@ -1147,7 +1160,7 @@ public final class WindowInsets { return new WindowInsets(mSystemInsetsConsumed ? null : mTypeInsetsMap, mStableInsetsConsumed ? null : mTypeMaxInsetsMap, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, mDisplayCutout, systemBars()); systemBars(), false /* compatIgnoreVisibility */); } } Loading