Loading core/java/android/view/InsetsAnimationControlImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -480,9 +480,9 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro : inset != 0; if (outState != null && source != null) { outState.getOrCreateSource(source.getId(), source.getType()) outState.addSource(new InsetsSource(source) .setVisible(visible) .setFrame(mTmpFrame); .setFrame(mTmpFrame)); } // If the system is controlling the insets source, the leash can be null. Loading core/java/android/view/InsetsFrameProvider.java +22 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.graphics.Rect; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; import android.view.InsetsSource.Flags; import android.view.WindowInsets.Type.InsetsType; import java.util.Arrays; Loading Loading @@ -85,6 +86,13 @@ public class InsetsFrameProvider implements Parcelable { */ private Insets mInsetsSize = null; /** * Various behavioral options/flags. Default is none. * * @see Flags */ private @Flags int mFlags; /** * If null, the size set in insetsSize will be applied to all window types. If it contains * element of some types, the insets reported to the window with that types will be overridden. Loading Loading @@ -149,6 +157,15 @@ public class InsetsFrameProvider implements Parcelable { return mSource; } public InsetsFrameProvider setFlags(@Flags int flags, @Flags int mask) { mFlags = (mFlags & ~mask) | (flags & mask); return this; } public @Flags int getFlags() { return mFlags; } public InsetsFrameProvider setInsetsSize(Insets insetsSize) { mInsetsSize = insetsSize; return this; Loading Loading @@ -198,6 +215,7 @@ public class InsetsFrameProvider implements Parcelable { sb.append(", index=").append(mIndex); sb.append(", type=").append(WindowInsets.Type.toString(mType)); sb.append(", source=").append(sourceToString(mSource)); sb.append(", flags=[").append(InsetsSource.flagsToString(mFlags)).append("]"); if (mInsetsSize != null) { sb.append(", insetsSize=").append(mInsetsSize); } Loading Loading @@ -230,6 +248,7 @@ public class InsetsFrameProvider implements Parcelable { mIndex = in.readInt(); mType = in.readInt(); mSource = in.readInt(); mFlags = in.readInt(); mInsetsSize = in.readTypedObject(Insets.CREATOR); mInsetsSizeOverrides = in.createTypedArray(InsetsSizeOverride.CREATOR); mArbitraryRectangle = in.readTypedObject(Rect.CREATOR); Loading @@ -241,6 +260,7 @@ public class InsetsFrameProvider implements Parcelable { out.writeInt(mIndex); out.writeInt(mType); out.writeInt(mSource); out.writeInt(mFlags); out.writeTypedObject(mInsetsSize, flags); out.writeTypedArray(mInsetsSizeOverrides, flags); out.writeTypedObject(mArbitraryRectangle, flags); Loading @@ -260,7 +280,7 @@ public class InsetsFrameProvider implements Parcelable { } final InsetsFrameProvider other = (InsetsFrameProvider) o; return Objects.equals(mOwner, other.mOwner) && mIndex == other.mIndex && mType == other.mType && mSource == other.mSource && mType == other.mType && mSource == other.mSource && mFlags == other.mFlags && Objects.equals(mInsetsSize, other.mInsetsSize) && Arrays.equals(mInsetsSizeOverrides, other.mInsetsSizeOverrides) && Objects.equals(mArbitraryRectangle, other.mArbitraryRectangle); Loading @@ -268,7 +288,7 @@ public class InsetsFrameProvider implements Parcelable { @Override public int hashCode() { return Objects.hash(mOwner, mIndex, mType, mSource, mInsetsSize, return Objects.hash(mOwner, mIndex, mType, mSource, mFlags, mInsetsSize, Arrays.hashCode(mInsetsSizeOverrides), mArbitraryRectangle); } Loading core/java/android/view/InsetsSource.java +48 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.view.InsetsSourceProto.VISIBLE; import static android.view.InsetsSourceProto.VISIBLE_FRAME; import static android.view.WindowInsets.Type.ime; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; Loading @@ -33,7 +34,10 @@ import android.util.proto.ProtoOutputStream; import android.view.WindowInsets.Type.InsetsType; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Objects; import java.util.StringJoiner; /** * Represents the state of a single entity generating insets for clients. Loading @@ -44,6 +48,24 @@ public class InsetsSource implements Parcelable { /** The insets source ID of IME */ public static final int ID_IME = createId(null, 0, ime()); /** * Controls whether this source suppresses the scrim. If the scrim is ignored, the system won't * draw a semi-transparent scrim behind the system bar area even when the bar contrast is * enforced. * * @see android.R.styleable#Window_enforceStatusBarContrast * @see android.R.styleable#Window_enforceNavigationBarContrast */ public static final int FLAG_SUPPRESS_SCRIM = 1; @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, prefix = "FLAG_", value = { FLAG_SUPPRESS_SCRIM, }) public @interface Flags {} private @Flags int mFlags; /** * An unique integer to identify this source across processes. */ Loading Loading @@ -75,6 +97,7 @@ public class InsetsSource implements Parcelable { mVisibleFrame = other.mVisibleFrame != null ? new Rect(other.mVisibleFrame) : null; mFlags = other.mFlags; mInsetsRoundedCornerFrame = other.mInsetsRoundedCornerFrame; } Loading @@ -84,6 +107,7 @@ public class InsetsSource implements Parcelable { mVisibleFrame = other.mVisibleFrame != null ? new Rect(other.mVisibleFrame) : null; mFlags = other.mFlags; mInsetsRoundedCornerFrame = other.mInsetsRoundedCornerFrame; } Loading @@ -107,6 +131,11 @@ public class InsetsSource implements Parcelable { return this; } public InsetsSource setFlags(@Flags int flags) { mFlags = flags; return this; } public int getId() { return mId; } Loading @@ -127,6 +156,10 @@ public class InsetsSource implements Parcelable { return mVisible; } public @Flags int getFlags() { return mFlags; } boolean isUserControllable() { // If mVisibleFrame is null, it will be the same area as mFrame. return mVisibleFrame == null || !mVisibleFrame.isEmpty(); Loading Loading @@ -254,6 +287,14 @@ public class InsetsSource implements Parcelable { + WindowInsets.Type.indexOf(type); } public static String flagsToString(@Flags int flags) { final StringJoiner joiner = new StringJoiner(" "); if ((flags & FLAG_SUPPRESS_SCRIM) != 0) { joiner.add("SUPPRESS_SCRIM"); } return joiner.toString(); } /** * Export the state of {@link InsetsSource} into a protocol buffer output stream. * Loading @@ -280,6 +321,7 @@ public class InsetsSource implements Parcelable { pw.print(" visibleFrame="); pw.print(mVisibleFrame.toShortString()); } pw.print(" visible="); pw.print(mVisible); pw.print(" flags="); pw.print(flagsToString(mFlags)); pw.print(" insetsRoundedCornerFrame="); pw.print(mInsetsRoundedCornerFrame); pw.println(); } Loading @@ -302,6 +344,7 @@ public class InsetsSource implements Parcelable { if (mId != that.mId) return false; if (mType != that.mType) return false; if (mVisible != that.mVisible) return false; if (mFlags != that.mFlags) return false; if (excludeInvisibleImeFrames && !mVisible && mType == WindowInsets.Type.ime()) return true; if (!Objects.equals(mVisibleFrame, that.mVisibleFrame)) return false; if (mInsetsRoundedCornerFrame != that.mInsetsRoundedCornerFrame) return false; Loading @@ -310,7 +353,8 @@ public class InsetsSource implements Parcelable { @Override public int hashCode() { return Objects.hash(mId, mType, mFrame, mVisibleFrame, mVisible, mInsetsRoundedCornerFrame); return Objects.hash(mId, mType, mFrame, mVisibleFrame, mVisible, mFlags, mInsetsRoundedCornerFrame); } public InsetsSource(Parcel in) { Loading @@ -323,6 +367,7 @@ public class InsetsSource implements Parcelable { mVisibleFrame = null; } mVisible = in.readBoolean(); mFlags = in.readInt(); mInsetsRoundedCornerFrame = in.readBoolean(); } Loading @@ -343,6 +388,7 @@ public class InsetsSource implements Parcelable { dest.writeInt(0); } dest.writeBoolean(mVisible); dest.writeInt(mFlags); dest.writeBoolean(mInsetsRoundedCornerFrame); } Loading @@ -352,6 +398,7 @@ public class InsetsSource implements Parcelable { + " mType=" + WindowInsets.Type.toString(mType) + " mFrame=" + mFrame.toShortString() + " mVisible=" + mVisible + " mFlags=[" + flagsToString(mFlags) + "]" + (mInsetsRoundedCornerFrame ? " insetsRoundedCornerFrame" : "") + "}"; } Loading core/java/android/view/InsetsState.java +6 −1 Original line number Diff line number Diff line Loading @@ -143,9 +143,14 @@ public class InsetsState implements Parcelable { boolean[] typeVisibilityMap = new boolean[Type.SIZE]; final Rect relativeFrame = new Rect(frame); final Rect relativeFrameMax = new Rect(frame); @InsetsType int suppressScrimTypes = 0; for (int i = mSources.size() - 1; i >= 0; i--) { final InsetsSource source = mSources.valueAt(i); if ((source.getFlags() & InsetsSource.FLAG_SUPPRESS_SCRIM) != 0) { suppressScrimTypes |= source.getType(); } processSource(source, relativeFrame, false /* ignoreVisibility */, typeInsetsMap, idSideMap, typeVisibilityMap); Loading Loading @@ -177,7 +182,7 @@ public class InsetsState implements Parcelable { } return new WindowInsets(typeInsetsMap, typeMaxInsetsMap, typeVisibilityMap, isScreenRound, alwaysConsumeSystemBars, calculateRelativeCutout(frame), alwaysConsumeSystemBars, suppressScrimTypes, calculateRelativeCutout(frame), calculateRelativeRoundedCorners(frame), calculateRelativePrivacyIndicatorBounds(frame), calculateRelativeDisplayShape(frame), Loading core/java/android/view/WindowInsets.java +38 −14 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public final class WindowInsets { */ private final boolean mAlwaysConsumeSystemBars; private final @InsetsType int mSuppressScrimTypes; private final boolean mSystemWindowInsetsConsumed; private final boolean mStableInsetsConsumed; private final boolean mDisplayCutoutConsumed; Loading @@ -116,8 +117,8 @@ public final class WindowInsets { static { CONSUMED = new WindowInsets(createCompatTypeMap(null), createCompatTypeMap(null), createCompatVisibilityMap(createCompatTypeMap(null)), false, false, null, null, null, null, systemBars(), false); createCompatVisibilityMap(createCompatTypeMap(null)), false, false, 0, null, null, null, null, systemBars(), false); } /** Loading @@ -136,7 +137,8 @@ public final class WindowInsets { @Nullable Insets[] typeMaxInsetsMap, boolean[] typeVisibilityMap, boolean isRound, boolean alwaysConsumeSystemBars, DisplayCutout displayCutout, boolean alwaysConsumeSystemBars, @InsetsType int suppressScrimTypes, DisplayCutout displayCutout, RoundedCorners roundedCorners, PrivacyIndicatorBounds privacyIndicatorBounds, DisplayShape displayShape, Loading @@ -154,6 +156,7 @@ public final class WindowInsets { mTypeVisibilityMap = typeVisibilityMap; mIsRound = isRound; mAlwaysConsumeSystemBars = alwaysConsumeSystemBars; mSuppressScrimTypes = suppressScrimTypes; mCompatInsetsTypes = compatInsetsTypes; mCompatIgnoreVisibility = compatIgnoreVisibility; Loading @@ -175,7 +178,8 @@ public final class WindowInsets { this(src.mSystemWindowInsetsConsumed ? null : src.mTypeInsetsMap, src.mStableInsetsConsumed ? null : src.mTypeMaxInsetsMap, src.mTypeVisibilityMap, src.mIsRound, src.mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(src), src.mAlwaysConsumeSystemBars, src.mSuppressScrimTypes, displayCutoutCopyConstructorArgument(src), src.mRoundedCorners, src.mPrivacyIndicatorBounds, src.mDisplayShape, Loading Loading @@ -231,8 +235,8 @@ public final class WindowInsets { /** @hide */ @UnsupportedAppUsage public WindowInsets(Rect systemWindowInsets) { this(createCompatTypeMap(systemWindowInsets), null, new boolean[SIZE], false, false, null, null, null, null, systemBars(), false /* compatIgnoreVisibility */); this(createCompatTypeMap(systemWindowInsets), null, new boolean[SIZE], false, false, 0, null, null, null, null, systemBars(), false /* compatIgnoreVisibility */); } /** Loading Loading @@ -552,7 +556,7 @@ public final class WindowInsets { return new WindowInsets(mSystemWindowInsetsConsumed ? null : mTypeInsetsMap, mStableInsetsConsumed ? null : mTypeMaxInsetsMap, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, mIsRound, mAlwaysConsumeSystemBars, mSuppressScrimTypes, null /* displayCutout */, mRoundedCorners, mPrivacyIndicatorBounds, mDisplayShape, mCompatInsetsTypes, mCompatIgnoreVisibility); } Loading Loading @@ -603,7 +607,7 @@ public final class WindowInsets { public WindowInsets consumeSystemWindowInsets() { return new WindowInsets(null, null, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, mIsRound, mAlwaysConsumeSystemBars, mSuppressScrimTypes, // If the system window insets types contain displayCutout, we should also consume // it. (mCompatInsetsTypes & displayCutout()) != 0 Loading Loading @@ -895,6 +899,13 @@ public final class WindowInsets { return mAlwaysConsumeSystemBars; } /** * @hide */ public @InsetsType int getSuppressScrimTypes() { return mSuppressScrimTypes; } @Override public String toString() { StringBuilder result = new StringBuilder("WindowInsets{\n "); Loading @@ -919,7 +930,9 @@ public final class WindowInsets { result.append("\n "); result.append(mDisplayShape != null ? "displayShape=" + mDisplayShape : ""); result.append("\n "); result.append("compatInsetsTypes=" + mCompatInsetsTypes); result.append("suppressScrimTypes=" + Type.toString(mSuppressScrimTypes)); result.append("\n "); result.append("compatInsetsTypes=" + Type.toString(mCompatInsetsTypes)); result.append("\n "); result.append("compatIgnoreVisibility=" + mCompatIgnoreVisibility); result.append("\n "); Loading Loading @@ -1014,7 +1027,7 @@ public final class WindowInsets { ? null : insetInsets(mTypeMaxInsetsMap, left, top, right, bottom), mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, mIsRound, mAlwaysConsumeSystemBars, mSuppressScrimTypes, mDisplayCutoutConsumed ? null : mDisplayCutout == null Loading @@ -1038,6 +1051,7 @@ public final class WindowInsets { return mIsRound == that.mIsRound && mAlwaysConsumeSystemBars == that.mAlwaysConsumeSystemBars && mSuppressScrimTypes == that.mSuppressScrimTypes && mSystemWindowInsetsConsumed == that.mSystemWindowInsetsConsumed && mStableInsetsConsumed == that.mStableInsetsConsumed && mDisplayCutoutConsumed == that.mDisplayCutoutConsumed Loading @@ -1054,8 +1068,9 @@ public final class WindowInsets { public int hashCode() { return Objects.hash(Arrays.hashCode(mTypeInsetsMap), Arrays.hashCode(mTypeMaxInsetsMap), Arrays.hashCode(mTypeVisibilityMap), mIsRound, mDisplayCutout, mRoundedCorners, mAlwaysConsumeSystemBars, mSystemWindowInsetsConsumed, mStableInsetsConsumed, mDisplayCutoutConsumed, mPrivacyIndicatorBounds, mDisplayShape); mAlwaysConsumeSystemBars, mSuppressScrimTypes, mSystemWindowInsetsConsumed, mStableInsetsConsumed, mDisplayCutoutConsumed, mPrivacyIndicatorBounds, mDisplayShape); } Loading Loading @@ -1120,6 +1135,7 @@ public final class WindowInsets { private boolean mIsRound; private boolean mAlwaysConsumeSystemBars; private @InsetsType int mSuppressScrimTypes; private PrivacyIndicatorBounds mPrivacyIndicatorBounds = new PrivacyIndicatorBounds(); Loading Loading @@ -1147,6 +1163,7 @@ public final class WindowInsets { mRoundedCorners = insets.mRoundedCorners; mIsRound = insets.mIsRound; mAlwaysConsumeSystemBars = insets.mAlwaysConsumeSystemBars; mSuppressScrimTypes = insets.mSuppressScrimTypes; mPrivacyIndicatorBounds = insets.mPrivacyIndicatorBounds; mDisplayShape = insets.mDisplayShape; } Loading Loading @@ -1420,6 +1437,13 @@ public final class WindowInsets { return this; } /** @hide */ @NonNull public Builder setSuppressScrimTypes(@InsetsType int suppressScrimTypes) { mSuppressScrimTypes = suppressScrimTypes; return this; } /** * Builds a {@link WindowInsets} instance. * Loading @@ -1429,8 +1453,8 @@ public final class WindowInsets { public WindowInsets build() { return new WindowInsets(mSystemInsetsConsumed ? null : mTypeInsetsMap, mStableInsetsConsumed ? null : mTypeMaxInsetsMap, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, mDisplayCutout, mRoundedCorners, mPrivacyIndicatorBounds, mDisplayShape, systemBars(), mIsRound, mAlwaysConsumeSystemBars, mSuppressScrimTypes, mDisplayCutout, mRoundedCorners, mPrivacyIndicatorBounds, mDisplayShape, systemBars(), false /* compatIgnoreVisibility */); } } Loading Loading
core/java/android/view/InsetsAnimationControlImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -480,9 +480,9 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro : inset != 0; if (outState != null && source != null) { outState.getOrCreateSource(source.getId(), source.getType()) outState.addSource(new InsetsSource(source) .setVisible(visible) .setFrame(mTmpFrame); .setFrame(mTmpFrame)); } // If the system is controlling the insets source, the leash can be null. Loading
core/java/android/view/InsetsFrameProvider.java +22 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.graphics.Rect; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; import android.view.InsetsSource.Flags; import android.view.WindowInsets.Type.InsetsType; import java.util.Arrays; Loading Loading @@ -85,6 +86,13 @@ public class InsetsFrameProvider implements Parcelable { */ private Insets mInsetsSize = null; /** * Various behavioral options/flags. Default is none. * * @see Flags */ private @Flags int mFlags; /** * If null, the size set in insetsSize will be applied to all window types. If it contains * element of some types, the insets reported to the window with that types will be overridden. Loading Loading @@ -149,6 +157,15 @@ public class InsetsFrameProvider implements Parcelable { return mSource; } public InsetsFrameProvider setFlags(@Flags int flags, @Flags int mask) { mFlags = (mFlags & ~mask) | (flags & mask); return this; } public @Flags int getFlags() { return mFlags; } public InsetsFrameProvider setInsetsSize(Insets insetsSize) { mInsetsSize = insetsSize; return this; Loading Loading @@ -198,6 +215,7 @@ public class InsetsFrameProvider implements Parcelable { sb.append(", index=").append(mIndex); sb.append(", type=").append(WindowInsets.Type.toString(mType)); sb.append(", source=").append(sourceToString(mSource)); sb.append(", flags=[").append(InsetsSource.flagsToString(mFlags)).append("]"); if (mInsetsSize != null) { sb.append(", insetsSize=").append(mInsetsSize); } Loading Loading @@ -230,6 +248,7 @@ public class InsetsFrameProvider implements Parcelable { mIndex = in.readInt(); mType = in.readInt(); mSource = in.readInt(); mFlags = in.readInt(); mInsetsSize = in.readTypedObject(Insets.CREATOR); mInsetsSizeOverrides = in.createTypedArray(InsetsSizeOverride.CREATOR); mArbitraryRectangle = in.readTypedObject(Rect.CREATOR); Loading @@ -241,6 +260,7 @@ public class InsetsFrameProvider implements Parcelable { out.writeInt(mIndex); out.writeInt(mType); out.writeInt(mSource); out.writeInt(mFlags); out.writeTypedObject(mInsetsSize, flags); out.writeTypedArray(mInsetsSizeOverrides, flags); out.writeTypedObject(mArbitraryRectangle, flags); Loading @@ -260,7 +280,7 @@ public class InsetsFrameProvider implements Parcelable { } final InsetsFrameProvider other = (InsetsFrameProvider) o; return Objects.equals(mOwner, other.mOwner) && mIndex == other.mIndex && mType == other.mType && mSource == other.mSource && mType == other.mType && mSource == other.mSource && mFlags == other.mFlags && Objects.equals(mInsetsSize, other.mInsetsSize) && Arrays.equals(mInsetsSizeOverrides, other.mInsetsSizeOverrides) && Objects.equals(mArbitraryRectangle, other.mArbitraryRectangle); Loading @@ -268,7 +288,7 @@ public class InsetsFrameProvider implements Parcelable { @Override public int hashCode() { return Objects.hash(mOwner, mIndex, mType, mSource, mInsetsSize, return Objects.hash(mOwner, mIndex, mType, mSource, mFlags, mInsetsSize, Arrays.hashCode(mInsetsSizeOverrides), mArbitraryRectangle); } Loading
core/java/android/view/InsetsSource.java +48 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.view.InsetsSourceProto.VISIBLE; import static android.view.InsetsSourceProto.VISIBLE_FRAME; import static android.view.WindowInsets.Type.ime; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; Loading @@ -33,7 +34,10 @@ import android.util.proto.ProtoOutputStream; import android.view.WindowInsets.Type.InsetsType; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Objects; import java.util.StringJoiner; /** * Represents the state of a single entity generating insets for clients. Loading @@ -44,6 +48,24 @@ public class InsetsSource implements Parcelable { /** The insets source ID of IME */ public static final int ID_IME = createId(null, 0, ime()); /** * Controls whether this source suppresses the scrim. If the scrim is ignored, the system won't * draw a semi-transparent scrim behind the system bar area even when the bar contrast is * enforced. * * @see android.R.styleable#Window_enforceStatusBarContrast * @see android.R.styleable#Window_enforceNavigationBarContrast */ public static final int FLAG_SUPPRESS_SCRIM = 1; @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, prefix = "FLAG_", value = { FLAG_SUPPRESS_SCRIM, }) public @interface Flags {} private @Flags int mFlags; /** * An unique integer to identify this source across processes. */ Loading Loading @@ -75,6 +97,7 @@ public class InsetsSource implements Parcelable { mVisibleFrame = other.mVisibleFrame != null ? new Rect(other.mVisibleFrame) : null; mFlags = other.mFlags; mInsetsRoundedCornerFrame = other.mInsetsRoundedCornerFrame; } Loading @@ -84,6 +107,7 @@ public class InsetsSource implements Parcelable { mVisibleFrame = other.mVisibleFrame != null ? new Rect(other.mVisibleFrame) : null; mFlags = other.mFlags; mInsetsRoundedCornerFrame = other.mInsetsRoundedCornerFrame; } Loading @@ -107,6 +131,11 @@ public class InsetsSource implements Parcelable { return this; } public InsetsSource setFlags(@Flags int flags) { mFlags = flags; return this; } public int getId() { return mId; } Loading @@ -127,6 +156,10 @@ public class InsetsSource implements Parcelable { return mVisible; } public @Flags int getFlags() { return mFlags; } boolean isUserControllable() { // If mVisibleFrame is null, it will be the same area as mFrame. return mVisibleFrame == null || !mVisibleFrame.isEmpty(); Loading Loading @@ -254,6 +287,14 @@ public class InsetsSource implements Parcelable { + WindowInsets.Type.indexOf(type); } public static String flagsToString(@Flags int flags) { final StringJoiner joiner = new StringJoiner(" "); if ((flags & FLAG_SUPPRESS_SCRIM) != 0) { joiner.add("SUPPRESS_SCRIM"); } return joiner.toString(); } /** * Export the state of {@link InsetsSource} into a protocol buffer output stream. * Loading @@ -280,6 +321,7 @@ public class InsetsSource implements Parcelable { pw.print(" visibleFrame="); pw.print(mVisibleFrame.toShortString()); } pw.print(" visible="); pw.print(mVisible); pw.print(" flags="); pw.print(flagsToString(mFlags)); pw.print(" insetsRoundedCornerFrame="); pw.print(mInsetsRoundedCornerFrame); pw.println(); } Loading @@ -302,6 +344,7 @@ public class InsetsSource implements Parcelable { if (mId != that.mId) return false; if (mType != that.mType) return false; if (mVisible != that.mVisible) return false; if (mFlags != that.mFlags) return false; if (excludeInvisibleImeFrames && !mVisible && mType == WindowInsets.Type.ime()) return true; if (!Objects.equals(mVisibleFrame, that.mVisibleFrame)) return false; if (mInsetsRoundedCornerFrame != that.mInsetsRoundedCornerFrame) return false; Loading @@ -310,7 +353,8 @@ public class InsetsSource implements Parcelable { @Override public int hashCode() { return Objects.hash(mId, mType, mFrame, mVisibleFrame, mVisible, mInsetsRoundedCornerFrame); return Objects.hash(mId, mType, mFrame, mVisibleFrame, mVisible, mFlags, mInsetsRoundedCornerFrame); } public InsetsSource(Parcel in) { Loading @@ -323,6 +367,7 @@ public class InsetsSource implements Parcelable { mVisibleFrame = null; } mVisible = in.readBoolean(); mFlags = in.readInt(); mInsetsRoundedCornerFrame = in.readBoolean(); } Loading @@ -343,6 +388,7 @@ public class InsetsSource implements Parcelable { dest.writeInt(0); } dest.writeBoolean(mVisible); dest.writeInt(mFlags); dest.writeBoolean(mInsetsRoundedCornerFrame); } Loading @@ -352,6 +398,7 @@ public class InsetsSource implements Parcelable { + " mType=" + WindowInsets.Type.toString(mType) + " mFrame=" + mFrame.toShortString() + " mVisible=" + mVisible + " mFlags=[" + flagsToString(mFlags) + "]" + (mInsetsRoundedCornerFrame ? " insetsRoundedCornerFrame" : "") + "}"; } Loading
core/java/android/view/InsetsState.java +6 −1 Original line number Diff line number Diff line Loading @@ -143,9 +143,14 @@ public class InsetsState implements Parcelable { boolean[] typeVisibilityMap = new boolean[Type.SIZE]; final Rect relativeFrame = new Rect(frame); final Rect relativeFrameMax = new Rect(frame); @InsetsType int suppressScrimTypes = 0; for (int i = mSources.size() - 1; i >= 0; i--) { final InsetsSource source = mSources.valueAt(i); if ((source.getFlags() & InsetsSource.FLAG_SUPPRESS_SCRIM) != 0) { suppressScrimTypes |= source.getType(); } processSource(source, relativeFrame, false /* ignoreVisibility */, typeInsetsMap, idSideMap, typeVisibilityMap); Loading Loading @@ -177,7 +182,7 @@ public class InsetsState implements Parcelable { } return new WindowInsets(typeInsetsMap, typeMaxInsetsMap, typeVisibilityMap, isScreenRound, alwaysConsumeSystemBars, calculateRelativeCutout(frame), alwaysConsumeSystemBars, suppressScrimTypes, calculateRelativeCutout(frame), calculateRelativeRoundedCorners(frame), calculateRelativePrivacyIndicatorBounds(frame), calculateRelativeDisplayShape(frame), Loading
core/java/android/view/WindowInsets.java +38 −14 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public final class WindowInsets { */ private final boolean mAlwaysConsumeSystemBars; private final @InsetsType int mSuppressScrimTypes; private final boolean mSystemWindowInsetsConsumed; private final boolean mStableInsetsConsumed; private final boolean mDisplayCutoutConsumed; Loading @@ -116,8 +117,8 @@ public final class WindowInsets { static { CONSUMED = new WindowInsets(createCompatTypeMap(null), createCompatTypeMap(null), createCompatVisibilityMap(createCompatTypeMap(null)), false, false, null, null, null, null, systemBars(), false); createCompatVisibilityMap(createCompatTypeMap(null)), false, false, 0, null, null, null, null, systemBars(), false); } /** Loading @@ -136,7 +137,8 @@ public final class WindowInsets { @Nullable Insets[] typeMaxInsetsMap, boolean[] typeVisibilityMap, boolean isRound, boolean alwaysConsumeSystemBars, DisplayCutout displayCutout, boolean alwaysConsumeSystemBars, @InsetsType int suppressScrimTypes, DisplayCutout displayCutout, RoundedCorners roundedCorners, PrivacyIndicatorBounds privacyIndicatorBounds, DisplayShape displayShape, Loading @@ -154,6 +156,7 @@ public final class WindowInsets { mTypeVisibilityMap = typeVisibilityMap; mIsRound = isRound; mAlwaysConsumeSystemBars = alwaysConsumeSystemBars; mSuppressScrimTypes = suppressScrimTypes; mCompatInsetsTypes = compatInsetsTypes; mCompatIgnoreVisibility = compatIgnoreVisibility; Loading @@ -175,7 +178,8 @@ public final class WindowInsets { this(src.mSystemWindowInsetsConsumed ? null : src.mTypeInsetsMap, src.mStableInsetsConsumed ? null : src.mTypeMaxInsetsMap, src.mTypeVisibilityMap, src.mIsRound, src.mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(src), src.mAlwaysConsumeSystemBars, src.mSuppressScrimTypes, displayCutoutCopyConstructorArgument(src), src.mRoundedCorners, src.mPrivacyIndicatorBounds, src.mDisplayShape, Loading Loading @@ -231,8 +235,8 @@ public final class WindowInsets { /** @hide */ @UnsupportedAppUsage public WindowInsets(Rect systemWindowInsets) { this(createCompatTypeMap(systemWindowInsets), null, new boolean[SIZE], false, false, null, null, null, null, systemBars(), false /* compatIgnoreVisibility */); this(createCompatTypeMap(systemWindowInsets), null, new boolean[SIZE], false, false, 0, null, null, null, null, systemBars(), false /* compatIgnoreVisibility */); } /** Loading Loading @@ -552,7 +556,7 @@ public final class WindowInsets { return new WindowInsets(mSystemWindowInsetsConsumed ? null : mTypeInsetsMap, mStableInsetsConsumed ? null : mTypeMaxInsetsMap, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, mIsRound, mAlwaysConsumeSystemBars, mSuppressScrimTypes, null /* displayCutout */, mRoundedCorners, mPrivacyIndicatorBounds, mDisplayShape, mCompatInsetsTypes, mCompatIgnoreVisibility); } Loading Loading @@ -603,7 +607,7 @@ public final class WindowInsets { public WindowInsets consumeSystemWindowInsets() { return new WindowInsets(null, null, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, mIsRound, mAlwaysConsumeSystemBars, mSuppressScrimTypes, // If the system window insets types contain displayCutout, we should also consume // it. (mCompatInsetsTypes & displayCutout()) != 0 Loading Loading @@ -895,6 +899,13 @@ public final class WindowInsets { return mAlwaysConsumeSystemBars; } /** * @hide */ public @InsetsType int getSuppressScrimTypes() { return mSuppressScrimTypes; } @Override public String toString() { StringBuilder result = new StringBuilder("WindowInsets{\n "); Loading @@ -919,7 +930,9 @@ public final class WindowInsets { result.append("\n "); result.append(mDisplayShape != null ? "displayShape=" + mDisplayShape : ""); result.append("\n "); result.append("compatInsetsTypes=" + mCompatInsetsTypes); result.append("suppressScrimTypes=" + Type.toString(mSuppressScrimTypes)); result.append("\n "); result.append("compatInsetsTypes=" + Type.toString(mCompatInsetsTypes)); result.append("\n "); result.append("compatIgnoreVisibility=" + mCompatIgnoreVisibility); result.append("\n "); Loading Loading @@ -1014,7 +1027,7 @@ public final class WindowInsets { ? null : insetInsets(mTypeMaxInsetsMap, left, top, right, bottom), mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, mIsRound, mAlwaysConsumeSystemBars, mSuppressScrimTypes, mDisplayCutoutConsumed ? null : mDisplayCutout == null Loading @@ -1038,6 +1051,7 @@ public final class WindowInsets { return mIsRound == that.mIsRound && mAlwaysConsumeSystemBars == that.mAlwaysConsumeSystemBars && mSuppressScrimTypes == that.mSuppressScrimTypes && mSystemWindowInsetsConsumed == that.mSystemWindowInsetsConsumed && mStableInsetsConsumed == that.mStableInsetsConsumed && mDisplayCutoutConsumed == that.mDisplayCutoutConsumed Loading @@ -1054,8 +1068,9 @@ public final class WindowInsets { public int hashCode() { return Objects.hash(Arrays.hashCode(mTypeInsetsMap), Arrays.hashCode(mTypeMaxInsetsMap), Arrays.hashCode(mTypeVisibilityMap), mIsRound, mDisplayCutout, mRoundedCorners, mAlwaysConsumeSystemBars, mSystemWindowInsetsConsumed, mStableInsetsConsumed, mDisplayCutoutConsumed, mPrivacyIndicatorBounds, mDisplayShape); mAlwaysConsumeSystemBars, mSuppressScrimTypes, mSystemWindowInsetsConsumed, mStableInsetsConsumed, mDisplayCutoutConsumed, mPrivacyIndicatorBounds, mDisplayShape); } Loading Loading @@ -1120,6 +1135,7 @@ public final class WindowInsets { private boolean mIsRound; private boolean mAlwaysConsumeSystemBars; private @InsetsType int mSuppressScrimTypes; private PrivacyIndicatorBounds mPrivacyIndicatorBounds = new PrivacyIndicatorBounds(); Loading Loading @@ -1147,6 +1163,7 @@ public final class WindowInsets { mRoundedCorners = insets.mRoundedCorners; mIsRound = insets.mIsRound; mAlwaysConsumeSystemBars = insets.mAlwaysConsumeSystemBars; mSuppressScrimTypes = insets.mSuppressScrimTypes; mPrivacyIndicatorBounds = insets.mPrivacyIndicatorBounds; mDisplayShape = insets.mDisplayShape; } Loading Loading @@ -1420,6 +1437,13 @@ public final class WindowInsets { return this; } /** @hide */ @NonNull public Builder setSuppressScrimTypes(@InsetsType int suppressScrimTypes) { mSuppressScrimTypes = suppressScrimTypes; return this; } /** * Builds a {@link WindowInsets} instance. * Loading @@ -1429,8 +1453,8 @@ public final class WindowInsets { public WindowInsets build() { return new WindowInsets(mSystemInsetsConsumed ? null : mTypeInsetsMap, mStableInsetsConsumed ? null : mTypeMaxInsetsMap, mTypeVisibilityMap, mIsRound, mAlwaysConsumeSystemBars, mDisplayCutout, mRoundedCorners, mPrivacyIndicatorBounds, mDisplayShape, systemBars(), mIsRound, mAlwaysConsumeSystemBars, mSuppressScrimTypes, mDisplayCutout, mRoundedCorners, mPrivacyIndicatorBounds, mDisplayShape, systemBars(), false /* compatIgnoreVisibility */); } } Loading