Loading core/java/android/view/InsetsFrameProvider.java +151 −71 Original line number Diff line number Diff line Loading @@ -18,10 +18,14 @@ package android.view; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT; import android.annotation.IntRange; import android.annotation.NonNull; import android.graphics.Insets; import android.graphics.Rect; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; import android.view.WindowInsets.Type.InsetsType; import java.util.Arrays; import java.util.Objects; Loading Loading @@ -62,19 +66,18 @@ public class InsetsFrameProvider implements Parcelable { private static final int HAS_INSETS_SIZE = 1; private static final int HAS_INSETS_SIZE_OVERRIDE = 2; private static Rect sTmpRect = new Rect(); private static Rect sTmpRect2 = new Rect(); private static final Rect sTmpRect = new Rect(); private static final Rect sTmpRect2 = new Rect(); /** * The type of insets to provide. */ public @InsetsState.InternalInsetsType int type; private final IBinder mOwner; private final int mIndex; private final @InsetsType int mType; /** * The source of frame. By default, all adjustment will be based on the window frame, it * can be set to window bounds or display bounds instead. */ public int source = SOURCE_FRAME; private int mSource = SOURCE_FRAME; /** * The provided insets size based on the source frame. The result will be used as the insets Loading @@ -85,13 +88,13 @@ public class InsetsFrameProvider implements Parcelable { * (0, 0, 0, 50) instead, the insets frame will be a frame starting from the bottom side of the * source frame with height of 50, i.e., (0, 150) - (100, 200). */ public Insets insetsSize = null; private Insets mInsetsSize = null; /** * 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. */ public InsetsSizeOverride[] insetsSizeOverrides = null; private InsetsSizeOverride[] mInsetsSizeOverrides = null; /** * This field, if set, is indicating the insets needs to be at least the given size inside the Loading @@ -103,22 +106,80 @@ public class InsetsFrameProvider implements Parcelable { * * Be cautious, this will not be in effect for the window types whose insets size is overridden. */ public Insets minimalInsetsSizeInDisplayCutoutSafe = null; private Insets mMinimalInsetsSizeInDisplayCutoutSafe = null; /** * Creates an InsetsFrameProvider which describes what frame an insets source should have. * * @param owner the owner of this provider. We might have multiple sources with the same type on * a display, this is used to identify them. * @param index the index of this provider. An owner might provide multiple sources with the * same type, this is used to identify them. * The value must be in a range of [0, 2047]. * @param type the {@link InsetsType}. * @see InsetsSource#createId(Object, int, int) */ public InsetsFrameProvider(IBinder owner, @IntRange(from = 0, to = 2047) int index, @InsetsType int type) { if (index < 0 || index >= 2048) { throw new IllegalArgumentException(); } // This throws IllegalArgumentException if the type is not valid. WindowInsets.Type.indexOf(type); mOwner = owner; mIndex = index; mType = type; } public IBinder getOwner() { return mOwner; } public int getIndex() { return mIndex; } public int getType() { return mType; } public InsetsFrameProvider setSource(int source) { mSource = source; return this; } public int getSource() { return mSource; } public InsetsFrameProvider setInsetsSize(Insets insetsSize) { mInsetsSize = insetsSize; return this; } public InsetsFrameProvider(int type) { this(type, SOURCE_FRAME, null, null); public Insets getInsetsSize() { return mInsetsSize; } public InsetsFrameProvider(int type, Insets insetsSize) { this(type, SOURCE_FRAME, insetsSize, null); public InsetsFrameProvider setInsetsSizeOverrides(InsetsSizeOverride[] insetsSizeOverrides) { mInsetsSizeOverrides = insetsSizeOverrides; return this; } public InsetsFrameProvider(int type, int source, Insets insetsSize, InsetsSizeOverride[] insetsSizeOverride) { this.type = type; this.source = source; this.insetsSize = insetsSize; this.insetsSizeOverrides = insetsSizeOverride; public InsetsSizeOverride[] getInsetsSizeOverrides() { return mInsetsSizeOverrides; } public InsetsFrameProvider setMinimalInsetsSizeInDisplayCutoutSafe( Insets minimalInsetsSizeInDisplayCutoutSafe) { mMinimalInsetsSizeInDisplayCutoutSafe = minimalInsetsSizeInDisplayCutoutSafe; return this; } public Insets getMinimalInsetsSizeInDisplayCutoutSafe() { return mMinimalInsetsSizeInDisplayCutoutSafe; } @Override Loading @@ -128,61 +189,71 @@ public class InsetsFrameProvider implements Parcelable { @Override public String toString() { StringBuilder sb = new StringBuilder(32); sb.append("InsetsFrameProvider: {"); sb.append("type=").append(InsetsState.typeToString(type)); sb.append(", source="); final StringBuilder sb = new StringBuilder("InsetsFrameProvider: {"); sb.append("owner=").append(mOwner); sb.append(", index=").append(mIndex); sb.append(", type=").append(WindowInsets.Type.toString(mType)); sb.append(", source=").append(sourceToString(mSource)); if (mInsetsSize != null) { sb.append(", insetsSize=").append(mInsetsSize); } if (mInsetsSizeOverrides != null) { sb.append(", insetsSizeOverrides=").append(Arrays.toString(mInsetsSizeOverrides)); } sb.append("}"); return sb.toString(); } private static String sourceToString(int source) { switch (source) { case SOURCE_DISPLAY: sb.append("SOURCE_DISPLAY"); break; return "DISPLAY"; case SOURCE_CONTAINER_BOUNDS: sb.append("SOURCE_CONTAINER_BOUNDS Bounds"); break; return "CONTAINER_BOUNDS"; case SOURCE_FRAME: sb.append("SOURCE_FRAME"); break; return "FRAME"; } if (insetsSize != null) { sb.append(", insetsSize=").append(insetsSize); } if (insetsSizeOverrides != null) { sb.append(", insetsSizeOverrides=").append(Arrays.toString(insetsSizeOverrides)); } sb.append("}"); return sb.toString(); return "UNDEFINED"; } public InsetsFrameProvider(Parcel in) { mOwner = in.readStrongBinder(); mIndex = in.readInt(); mType = in.readInt(); int insetsSizeModified = in.readInt(); type = in.readInt(); source = in.readInt(); mSource = in.readInt(); if ((insetsSizeModified & HAS_INSETS_SIZE) != 0) { insetsSize = Insets.CREATOR.createFromParcel(in); mInsetsSize = Insets.CREATOR.createFromParcel(in); } if ((insetsSizeModified & HAS_INSETS_SIZE_OVERRIDE) != 0) { insetsSizeOverrides = in.createTypedArray(InsetsSizeOverride.CREATOR); mInsetsSizeOverrides = in.createTypedArray(InsetsSizeOverride.CREATOR); } } @Override public void writeToParcel(Parcel out, int flags) { out.writeStrongBinder(mOwner); out.writeInt(mIndex); out.writeInt(mType); int insetsSizeModified = 0; if (insetsSize != null) { if (mInsetsSize != null) { insetsSizeModified |= HAS_INSETS_SIZE; } if (insetsSizeOverrides != null) { if (mInsetsSizeOverrides != null) { insetsSizeModified |= HAS_INSETS_SIZE_OVERRIDE; } out.writeInt(insetsSizeModified); out.writeInt(type); out.writeInt(source); if (insetsSize != null) { insetsSize.writeToParcel(out, flags); out.writeInt(mSource); if (mInsetsSize != null) { mInsetsSize.writeToParcel(out, flags); } if (mInsetsSizeOverrides != null) { out.writeTypedArray(mInsetsSizeOverrides, flags); } if (insetsSizeOverrides != null) { out.writeTypedArray(insetsSizeOverrides, flags); } public boolean idEquals(InsetsFrameProvider o) { return Objects.equals(mOwner, o.mOwner) && mIndex == o.mIndex && mType == o.mType; } @Override Loading @@ -193,19 +264,21 @@ public class InsetsFrameProvider implements Parcelable { if (o == null || getClass() != o.getClass()) { return false; } InsetsFrameProvider other = (InsetsFrameProvider) o; return type == other.type && source == other.source && Objects.equals(insetsSize, other.insetsSize) && Arrays.equals(insetsSizeOverrides, other.insetsSizeOverrides); final InsetsFrameProvider other = (InsetsFrameProvider) o; return Objects.equals(mOwner, other.mOwner) && mIndex == other.mIndex && mType == other.mType && mSource == other.mSource && Objects.equals(mInsetsSize, other.mInsetsSize) && Arrays.equals(mInsetsSizeOverrides, other.mInsetsSizeOverrides); } @Override public int hashCode() { return Objects.hash(type, source, insetsSize, Arrays.hashCode(insetsSizeOverrides)); return Objects.hash(mOwner, mIndex, mType, mSource, mInsetsSize, Arrays.hashCode(mInsetsSizeOverrides)); } public static final @android.annotation.NonNull Parcelable.Creator<InsetsFrameProvider> CREATOR = new Parcelable.Creator<InsetsFrameProvider>() { public static final @NonNull Parcelable.Creator<InsetsFrameProvider> CREATOR = new Parcelable.Creator<>() { @Override public InsetsFrameProvider createFromParcel(Parcel in) { return new InsetsFrameProvider(in); Loading Loading @@ -282,21 +355,28 @@ public class InsetsFrameProvider implements Parcelable { * directly for that window type. */ public static class InsetsSizeOverride implements Parcelable { public final int windowType; public Insets insetsSize; private final int mWindowType; private final Insets mInsetsSize; protected InsetsSizeOverride(Parcel in) { windowType = in.readInt(); insetsSize = in.readParcelable(null, Insets.class); mWindowType = in.readInt(); mInsetsSize = in.readParcelable(null, Insets.class); } public InsetsSizeOverride(int windowType, Insets insetsSize) { mWindowType = windowType; mInsetsSize = insetsSize; } public int getWindowType() { return mWindowType; } public InsetsSizeOverride(int type, Insets size) { windowType = type; insetsSize = size; public Insets getInsetsSize() { return mInsetsSize; } public static final Creator<InsetsSizeOverride> CREATOR = new Creator<InsetsSizeOverride>() { public static final Creator<InsetsSizeOverride> CREATOR = new Creator<>() { @Override public InsetsSizeOverride createFromParcel(Parcel in) { return new InsetsSizeOverride(in); Loading @@ -315,8 +395,8 @@ public class InsetsFrameProvider implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { out.writeInt(windowType); out.writeParcelable(insetsSize, flags); out.writeInt(mWindowType); out.writeParcelable(mInsetsSize, flags); } @Override Loading @@ -324,15 +404,15 @@ public class InsetsFrameProvider implements Parcelable { StringBuilder sb = new StringBuilder(32); sb.append("TypedInsetsSize: {"); sb.append("windowType=").append(ViewDebug.intToString( WindowManager.LayoutParams.class, "type", windowType)); sb.append(", insetsSize=").append(insetsSize); WindowManager.LayoutParams.class, "type", mWindowType)); sb.append(", insetsSize=").append(mInsetsSize); sb.append("}"); return sb.toString(); } @Override public int hashCode() { return Objects.hash(windowType, insetsSize); return Objects.hash(mWindowType, mInsetsSize); } } } Loading core/java/android/view/InsetsState.java +0 −35 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ import android.graphics.Insets; import android.graphics.Rect; import android.os.Parcel; import android.os.Parcelable; import android.util.ArraySet; import android.util.SparseArray; import android.util.SparseIntArray; import android.util.proto.ProtoOutputStream; Loading Loading @@ -707,40 +706,6 @@ public class InsetsState implements Parcelable { && !WindowConfiguration.inMultiWindowMode(windowingMode); } public static @InternalInsetsType ArraySet<Integer> toInternalType(@InsetsType int types) { final ArraySet<Integer> result = new ArraySet<>(); if ((types & Type.STATUS_BARS) != 0) { result.add(ITYPE_STATUS_BAR); result.add(ITYPE_CLIMATE_BAR); } if ((types & Type.NAVIGATION_BARS) != 0) { result.add(ITYPE_NAVIGATION_BAR); result.add(ITYPE_EXTRA_NAVIGATION_BAR); } if ((types & Type.SYSTEM_OVERLAYS) != 0) { result.add(ITYPE_LEFT_GENERIC_OVERLAY); result.add(ITYPE_TOP_GENERIC_OVERLAY); result.add(ITYPE_RIGHT_GENERIC_OVERLAY); result.add(ITYPE_BOTTOM_GENERIC_OVERLAY); } if ((types & Type.CAPTION_BAR) != 0) { result.add(ITYPE_CAPTION_BAR); } if ((types & Type.SYSTEM_GESTURES) != 0) { result.add(ITYPE_LEFT_GESTURES); result.add(ITYPE_TOP_GESTURES); result.add(ITYPE_RIGHT_GESTURES); result.add(ITYPE_BOTTOM_GESTURES); } if ((types & Type.MANDATORY_SYSTEM_GESTURES) != 0) { result.add(ITYPE_LEFT_MANDATORY_GESTURES); result.add(ITYPE_TOP_MANDATORY_GESTURES); result.add(ITYPE_RIGHT_MANDATORY_GESTURES); result.add(ITYPE_BOTTOM_MANDATORY_GESTURES); } return result; } /** * Converting a internal type to the public type. * @param type internal insets type, {@code InternalInsetsType}. Loading packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +20 −28 Original line number Diff line number Diff line Loading @@ -25,11 +25,6 @@ import static android.app.StatusBarManager.WindowType; import static android.app.StatusBarManager.WindowVisibleState; import static android.app.StatusBarManager.windowStateToString; import static android.app.WindowConfiguration.ROTATION_UNDEFINED; import static android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES; import static android.view.InsetsState.ITYPE_BOTTOM_TAPPABLE_ELEMENT; import static android.view.InsetsState.ITYPE_LEFT_GESTURES; import static android.view.InsetsState.ITYPE_NAVIGATION_BAR; import static android.view.InsetsState.ITYPE_RIGHT_GESTURES; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION; Loading Loading @@ -292,6 +287,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements private final DeadZone mDeadZone; private boolean mImeVisible; private final Rect mSamplingBounds = new Rect(); private final Binder mInsetsSourceOwner = new Binder(); /** * When quickswitching between apps of different orientations, we draw a secondary home handle Loading Loading @@ -1709,28 +1705,21 @@ public class NavigationBar extends ViewController<NavigationBarView> implements } private InsetsFrameProvider[] getInsetsFrameProvider(int insetsHeight, Context userContext) { final InsetsFrameProvider navBarProvider; final InsetsFrameProvider navBarProvider = new InsetsFrameProvider(mInsetsSourceOwner, 0, WindowInsets.Type.navigationBars()) .setInsetsSizeOverrides(new InsetsFrameProvider.InsetsSizeOverride[] { new InsetsFrameProvider.InsetsSizeOverride( TYPE_INPUT_METHOD, null)}); if (insetsHeight != -1 && !mIsButtonForceVisible) { navBarProvider = new InsetsFrameProvider( ITYPE_NAVIGATION_BAR, Insets.of(0, 0, 0, insetsHeight)); // Use window frame for IME. navBarProvider.insetsSizeOverrides = new InsetsFrameProvider.InsetsSizeOverride[] { new InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, null) }; } else { navBarProvider = new InsetsFrameProvider(ITYPE_NAVIGATION_BAR); navBarProvider.insetsSizeOverrides = new InsetsFrameProvider.InsetsSizeOverride[]{ new InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, null) }; navBarProvider.setInsetsSize(Insets.of(0, 0, 0, insetsHeight)); } final InsetsFrameProvider tappableElementProvider = new InsetsFrameProvider( mInsetsSourceOwner, 0, WindowInsets.Type.tappableElement()); final boolean navBarTapThrough = userContext.getResources().getBoolean( com.android.internal.R.bool.config_navBarTapThrough); final InsetsFrameProvider bottomTappableProvider; if (navBarTapThrough) { bottomTappableProvider = new InsetsFrameProvider(ITYPE_BOTTOM_TAPPABLE_ELEMENT, Insets.of(0, 0, 0, 0)); } else { bottomTappableProvider = new InsetsFrameProvider(ITYPE_BOTTOM_TAPPABLE_ELEMENT); tappableElementProvider.setInsetsSize(Insets.NONE); } final DisplayCutout cutout = userContext.getDisplay().getCutout(); Loading @@ -1745,13 +1734,16 @@ public class NavigationBar extends ViewController<NavigationBarView> implements ? mEdgeBackGestureHandler.getEdgeWidthRight() + safeInsetsRight : 0; return new InsetsFrameProvider[] { navBarProvider, tappableElementProvider, new InsetsFrameProvider( ITYPE_BOTTOM_MANDATORY_GESTURES, Insets.of(0, 0, 0, gestureHeight)), new InsetsFrameProvider(ITYPE_LEFT_GESTURES, InsetsFrameProvider.SOURCE_DISPLAY, Insets.of(gestureInsetsLeft, 0, 0, 0), null), new InsetsFrameProvider(ITYPE_RIGHT_GESTURES, InsetsFrameProvider.SOURCE_DISPLAY, Insets.of(0, 0, gestureInsetsRight, 0), null), bottomTappableProvider mInsetsSourceOwner, 0, WindowInsets.Type.mandatorySystemGestures()) .setInsetsSize(Insets.of(0, 0, 0, gestureHeight)), new InsetsFrameProvider(mInsetsSourceOwner, 0, WindowInsets.Type.systemGestures()) .setSource(InsetsFrameProvider.SOURCE_DISPLAY) .setInsetsSize(Insets.of(gestureInsetsLeft, 0, 0, 0)), new InsetsFrameProvider(mInsetsSourceOwner, 1, WindowInsets.Type.systemGestures()) .setSource(InsetsFrameProvider.SOURCE_DISPLAY) .setInsetsSize(Insets.of(0, 0, gestureInsetsRight, 0)) }; } Loading packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java +9 −8 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ package com.android.systemui.statusbar.window; import static android.view.InsetsState.ITYPE_STATUS_BAR; import static android.view.InsetsState.ITYPE_TOP_MANDATORY_GESTURES; import static android.view.InsetsState.ITYPE_TOP_TAPPABLE_ELEMENT; import static android.view.WindowInsets.Type.mandatorySystemGestures; import static android.view.WindowInsets.Type.statusBars; import static android.view.WindowInsets.Type.tappableElement; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR; Loading Loading @@ -85,6 +85,7 @@ public class StatusBarWindowController { private final ViewGroup mLaunchAnimationContainer; private WindowManager.LayoutParams mLp; private final WindowManager.LayoutParams mLpChanged; private final Binder mInsetsSourceOwner = new Binder(); @Inject public StatusBarWindowController( Loading Loading @@ -231,16 +232,16 @@ public class StatusBarWindowController { lp.packageName = mContext.getPackageName(); lp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; final InsetsFrameProvider gestureInsetsProvider = new InsetsFrameProvider(ITYPE_TOP_MANDATORY_GESTURES); new InsetsFrameProvider(mInsetsSourceOwner, 0, mandatorySystemGestures()); final int safeTouchRegionHeight = mContext.getResources().getDimensionPixelSize( com.android.internal.R.dimen.display_cutout_touchable_region_size); if (safeTouchRegionHeight > 0) { gestureInsetsProvider.minimalInsetsSizeInDisplayCutoutSafe = Insets.of(0, safeTouchRegionHeight, 0, 0); gestureInsetsProvider.setMinimalInsetsSizeInDisplayCutoutSafe( Insets.of(0, safeTouchRegionHeight, 0, 0)); } lp.providedInsets = new InsetsFrameProvider[] { new InsetsFrameProvider(ITYPE_STATUS_BAR), new InsetsFrameProvider(ITYPE_TOP_TAPPABLE_ELEMENT), new InsetsFrameProvider(mInsetsSourceOwner, 0, statusBars()), new InsetsFrameProvider(mInsetsSourceOwner, 0, tappableElement()), gestureInsetsProvider }; return lp; Loading services/core/java/com/android/server/wm/DisplayPolicy.java +13 −43 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
core/java/android/view/InsetsFrameProvider.java +151 −71 Original line number Diff line number Diff line Loading @@ -18,10 +18,14 @@ package android.view; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT; import android.annotation.IntRange; import android.annotation.NonNull; import android.graphics.Insets; import android.graphics.Rect; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; import android.view.WindowInsets.Type.InsetsType; import java.util.Arrays; import java.util.Objects; Loading Loading @@ -62,19 +66,18 @@ public class InsetsFrameProvider implements Parcelable { private static final int HAS_INSETS_SIZE = 1; private static final int HAS_INSETS_SIZE_OVERRIDE = 2; private static Rect sTmpRect = new Rect(); private static Rect sTmpRect2 = new Rect(); private static final Rect sTmpRect = new Rect(); private static final Rect sTmpRect2 = new Rect(); /** * The type of insets to provide. */ public @InsetsState.InternalInsetsType int type; private final IBinder mOwner; private final int mIndex; private final @InsetsType int mType; /** * The source of frame. By default, all adjustment will be based on the window frame, it * can be set to window bounds or display bounds instead. */ public int source = SOURCE_FRAME; private int mSource = SOURCE_FRAME; /** * The provided insets size based on the source frame. The result will be used as the insets Loading @@ -85,13 +88,13 @@ public class InsetsFrameProvider implements Parcelable { * (0, 0, 0, 50) instead, the insets frame will be a frame starting from the bottom side of the * source frame with height of 50, i.e., (0, 150) - (100, 200). */ public Insets insetsSize = null; private Insets mInsetsSize = null; /** * 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. */ public InsetsSizeOverride[] insetsSizeOverrides = null; private InsetsSizeOverride[] mInsetsSizeOverrides = null; /** * This field, if set, is indicating the insets needs to be at least the given size inside the Loading @@ -103,22 +106,80 @@ public class InsetsFrameProvider implements Parcelable { * * Be cautious, this will not be in effect for the window types whose insets size is overridden. */ public Insets minimalInsetsSizeInDisplayCutoutSafe = null; private Insets mMinimalInsetsSizeInDisplayCutoutSafe = null; /** * Creates an InsetsFrameProvider which describes what frame an insets source should have. * * @param owner the owner of this provider. We might have multiple sources with the same type on * a display, this is used to identify them. * @param index the index of this provider. An owner might provide multiple sources with the * same type, this is used to identify them. * The value must be in a range of [0, 2047]. * @param type the {@link InsetsType}. * @see InsetsSource#createId(Object, int, int) */ public InsetsFrameProvider(IBinder owner, @IntRange(from = 0, to = 2047) int index, @InsetsType int type) { if (index < 0 || index >= 2048) { throw new IllegalArgumentException(); } // This throws IllegalArgumentException if the type is not valid. WindowInsets.Type.indexOf(type); mOwner = owner; mIndex = index; mType = type; } public IBinder getOwner() { return mOwner; } public int getIndex() { return mIndex; } public int getType() { return mType; } public InsetsFrameProvider setSource(int source) { mSource = source; return this; } public int getSource() { return mSource; } public InsetsFrameProvider setInsetsSize(Insets insetsSize) { mInsetsSize = insetsSize; return this; } public InsetsFrameProvider(int type) { this(type, SOURCE_FRAME, null, null); public Insets getInsetsSize() { return mInsetsSize; } public InsetsFrameProvider(int type, Insets insetsSize) { this(type, SOURCE_FRAME, insetsSize, null); public InsetsFrameProvider setInsetsSizeOverrides(InsetsSizeOverride[] insetsSizeOverrides) { mInsetsSizeOverrides = insetsSizeOverrides; return this; } public InsetsFrameProvider(int type, int source, Insets insetsSize, InsetsSizeOverride[] insetsSizeOverride) { this.type = type; this.source = source; this.insetsSize = insetsSize; this.insetsSizeOverrides = insetsSizeOverride; public InsetsSizeOverride[] getInsetsSizeOverrides() { return mInsetsSizeOverrides; } public InsetsFrameProvider setMinimalInsetsSizeInDisplayCutoutSafe( Insets minimalInsetsSizeInDisplayCutoutSafe) { mMinimalInsetsSizeInDisplayCutoutSafe = minimalInsetsSizeInDisplayCutoutSafe; return this; } public Insets getMinimalInsetsSizeInDisplayCutoutSafe() { return mMinimalInsetsSizeInDisplayCutoutSafe; } @Override Loading @@ -128,61 +189,71 @@ public class InsetsFrameProvider implements Parcelable { @Override public String toString() { StringBuilder sb = new StringBuilder(32); sb.append("InsetsFrameProvider: {"); sb.append("type=").append(InsetsState.typeToString(type)); sb.append(", source="); final StringBuilder sb = new StringBuilder("InsetsFrameProvider: {"); sb.append("owner=").append(mOwner); sb.append(", index=").append(mIndex); sb.append(", type=").append(WindowInsets.Type.toString(mType)); sb.append(", source=").append(sourceToString(mSource)); if (mInsetsSize != null) { sb.append(", insetsSize=").append(mInsetsSize); } if (mInsetsSizeOverrides != null) { sb.append(", insetsSizeOverrides=").append(Arrays.toString(mInsetsSizeOverrides)); } sb.append("}"); return sb.toString(); } private static String sourceToString(int source) { switch (source) { case SOURCE_DISPLAY: sb.append("SOURCE_DISPLAY"); break; return "DISPLAY"; case SOURCE_CONTAINER_BOUNDS: sb.append("SOURCE_CONTAINER_BOUNDS Bounds"); break; return "CONTAINER_BOUNDS"; case SOURCE_FRAME: sb.append("SOURCE_FRAME"); break; return "FRAME"; } if (insetsSize != null) { sb.append(", insetsSize=").append(insetsSize); } if (insetsSizeOverrides != null) { sb.append(", insetsSizeOverrides=").append(Arrays.toString(insetsSizeOverrides)); } sb.append("}"); return sb.toString(); return "UNDEFINED"; } public InsetsFrameProvider(Parcel in) { mOwner = in.readStrongBinder(); mIndex = in.readInt(); mType = in.readInt(); int insetsSizeModified = in.readInt(); type = in.readInt(); source = in.readInt(); mSource = in.readInt(); if ((insetsSizeModified & HAS_INSETS_SIZE) != 0) { insetsSize = Insets.CREATOR.createFromParcel(in); mInsetsSize = Insets.CREATOR.createFromParcel(in); } if ((insetsSizeModified & HAS_INSETS_SIZE_OVERRIDE) != 0) { insetsSizeOverrides = in.createTypedArray(InsetsSizeOverride.CREATOR); mInsetsSizeOverrides = in.createTypedArray(InsetsSizeOverride.CREATOR); } } @Override public void writeToParcel(Parcel out, int flags) { out.writeStrongBinder(mOwner); out.writeInt(mIndex); out.writeInt(mType); int insetsSizeModified = 0; if (insetsSize != null) { if (mInsetsSize != null) { insetsSizeModified |= HAS_INSETS_SIZE; } if (insetsSizeOverrides != null) { if (mInsetsSizeOverrides != null) { insetsSizeModified |= HAS_INSETS_SIZE_OVERRIDE; } out.writeInt(insetsSizeModified); out.writeInt(type); out.writeInt(source); if (insetsSize != null) { insetsSize.writeToParcel(out, flags); out.writeInt(mSource); if (mInsetsSize != null) { mInsetsSize.writeToParcel(out, flags); } if (mInsetsSizeOverrides != null) { out.writeTypedArray(mInsetsSizeOverrides, flags); } if (insetsSizeOverrides != null) { out.writeTypedArray(insetsSizeOverrides, flags); } public boolean idEquals(InsetsFrameProvider o) { return Objects.equals(mOwner, o.mOwner) && mIndex == o.mIndex && mType == o.mType; } @Override Loading @@ -193,19 +264,21 @@ public class InsetsFrameProvider implements Parcelable { if (o == null || getClass() != o.getClass()) { return false; } InsetsFrameProvider other = (InsetsFrameProvider) o; return type == other.type && source == other.source && Objects.equals(insetsSize, other.insetsSize) && Arrays.equals(insetsSizeOverrides, other.insetsSizeOverrides); final InsetsFrameProvider other = (InsetsFrameProvider) o; return Objects.equals(mOwner, other.mOwner) && mIndex == other.mIndex && mType == other.mType && mSource == other.mSource && Objects.equals(mInsetsSize, other.mInsetsSize) && Arrays.equals(mInsetsSizeOverrides, other.mInsetsSizeOverrides); } @Override public int hashCode() { return Objects.hash(type, source, insetsSize, Arrays.hashCode(insetsSizeOverrides)); return Objects.hash(mOwner, mIndex, mType, mSource, mInsetsSize, Arrays.hashCode(mInsetsSizeOverrides)); } public static final @android.annotation.NonNull Parcelable.Creator<InsetsFrameProvider> CREATOR = new Parcelable.Creator<InsetsFrameProvider>() { public static final @NonNull Parcelable.Creator<InsetsFrameProvider> CREATOR = new Parcelable.Creator<>() { @Override public InsetsFrameProvider createFromParcel(Parcel in) { return new InsetsFrameProvider(in); Loading Loading @@ -282,21 +355,28 @@ public class InsetsFrameProvider implements Parcelable { * directly for that window type. */ public static class InsetsSizeOverride implements Parcelable { public final int windowType; public Insets insetsSize; private final int mWindowType; private final Insets mInsetsSize; protected InsetsSizeOverride(Parcel in) { windowType = in.readInt(); insetsSize = in.readParcelable(null, Insets.class); mWindowType = in.readInt(); mInsetsSize = in.readParcelable(null, Insets.class); } public InsetsSizeOverride(int windowType, Insets insetsSize) { mWindowType = windowType; mInsetsSize = insetsSize; } public int getWindowType() { return mWindowType; } public InsetsSizeOverride(int type, Insets size) { windowType = type; insetsSize = size; public Insets getInsetsSize() { return mInsetsSize; } public static final Creator<InsetsSizeOverride> CREATOR = new Creator<InsetsSizeOverride>() { public static final Creator<InsetsSizeOverride> CREATOR = new Creator<>() { @Override public InsetsSizeOverride createFromParcel(Parcel in) { return new InsetsSizeOverride(in); Loading @@ -315,8 +395,8 @@ public class InsetsFrameProvider implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { out.writeInt(windowType); out.writeParcelable(insetsSize, flags); out.writeInt(mWindowType); out.writeParcelable(mInsetsSize, flags); } @Override Loading @@ -324,15 +404,15 @@ public class InsetsFrameProvider implements Parcelable { StringBuilder sb = new StringBuilder(32); sb.append("TypedInsetsSize: {"); sb.append("windowType=").append(ViewDebug.intToString( WindowManager.LayoutParams.class, "type", windowType)); sb.append(", insetsSize=").append(insetsSize); WindowManager.LayoutParams.class, "type", mWindowType)); sb.append(", insetsSize=").append(mInsetsSize); sb.append("}"); return sb.toString(); } @Override public int hashCode() { return Objects.hash(windowType, insetsSize); return Objects.hash(mWindowType, mInsetsSize); } } } Loading
core/java/android/view/InsetsState.java +0 −35 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ import android.graphics.Insets; import android.graphics.Rect; import android.os.Parcel; import android.os.Parcelable; import android.util.ArraySet; import android.util.SparseArray; import android.util.SparseIntArray; import android.util.proto.ProtoOutputStream; Loading Loading @@ -707,40 +706,6 @@ public class InsetsState implements Parcelable { && !WindowConfiguration.inMultiWindowMode(windowingMode); } public static @InternalInsetsType ArraySet<Integer> toInternalType(@InsetsType int types) { final ArraySet<Integer> result = new ArraySet<>(); if ((types & Type.STATUS_BARS) != 0) { result.add(ITYPE_STATUS_BAR); result.add(ITYPE_CLIMATE_BAR); } if ((types & Type.NAVIGATION_BARS) != 0) { result.add(ITYPE_NAVIGATION_BAR); result.add(ITYPE_EXTRA_NAVIGATION_BAR); } if ((types & Type.SYSTEM_OVERLAYS) != 0) { result.add(ITYPE_LEFT_GENERIC_OVERLAY); result.add(ITYPE_TOP_GENERIC_OVERLAY); result.add(ITYPE_RIGHT_GENERIC_OVERLAY); result.add(ITYPE_BOTTOM_GENERIC_OVERLAY); } if ((types & Type.CAPTION_BAR) != 0) { result.add(ITYPE_CAPTION_BAR); } if ((types & Type.SYSTEM_GESTURES) != 0) { result.add(ITYPE_LEFT_GESTURES); result.add(ITYPE_TOP_GESTURES); result.add(ITYPE_RIGHT_GESTURES); result.add(ITYPE_BOTTOM_GESTURES); } if ((types & Type.MANDATORY_SYSTEM_GESTURES) != 0) { result.add(ITYPE_LEFT_MANDATORY_GESTURES); result.add(ITYPE_TOP_MANDATORY_GESTURES); result.add(ITYPE_RIGHT_MANDATORY_GESTURES); result.add(ITYPE_BOTTOM_MANDATORY_GESTURES); } return result; } /** * Converting a internal type to the public type. * @param type internal insets type, {@code InternalInsetsType}. Loading
packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +20 −28 Original line number Diff line number Diff line Loading @@ -25,11 +25,6 @@ import static android.app.StatusBarManager.WindowType; import static android.app.StatusBarManager.WindowVisibleState; import static android.app.StatusBarManager.windowStateToString; import static android.app.WindowConfiguration.ROTATION_UNDEFINED; import static android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES; import static android.view.InsetsState.ITYPE_BOTTOM_TAPPABLE_ELEMENT; import static android.view.InsetsState.ITYPE_LEFT_GESTURES; import static android.view.InsetsState.ITYPE_NAVIGATION_BAR; import static android.view.InsetsState.ITYPE_RIGHT_GESTURES; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION; Loading Loading @@ -292,6 +287,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements private final DeadZone mDeadZone; private boolean mImeVisible; private final Rect mSamplingBounds = new Rect(); private final Binder mInsetsSourceOwner = new Binder(); /** * When quickswitching between apps of different orientations, we draw a secondary home handle Loading Loading @@ -1709,28 +1705,21 @@ public class NavigationBar extends ViewController<NavigationBarView> implements } private InsetsFrameProvider[] getInsetsFrameProvider(int insetsHeight, Context userContext) { final InsetsFrameProvider navBarProvider; final InsetsFrameProvider navBarProvider = new InsetsFrameProvider(mInsetsSourceOwner, 0, WindowInsets.Type.navigationBars()) .setInsetsSizeOverrides(new InsetsFrameProvider.InsetsSizeOverride[] { new InsetsFrameProvider.InsetsSizeOverride( TYPE_INPUT_METHOD, null)}); if (insetsHeight != -1 && !mIsButtonForceVisible) { navBarProvider = new InsetsFrameProvider( ITYPE_NAVIGATION_BAR, Insets.of(0, 0, 0, insetsHeight)); // Use window frame for IME. navBarProvider.insetsSizeOverrides = new InsetsFrameProvider.InsetsSizeOverride[] { new InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, null) }; } else { navBarProvider = new InsetsFrameProvider(ITYPE_NAVIGATION_BAR); navBarProvider.insetsSizeOverrides = new InsetsFrameProvider.InsetsSizeOverride[]{ new InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, null) }; navBarProvider.setInsetsSize(Insets.of(0, 0, 0, insetsHeight)); } final InsetsFrameProvider tappableElementProvider = new InsetsFrameProvider( mInsetsSourceOwner, 0, WindowInsets.Type.tappableElement()); final boolean navBarTapThrough = userContext.getResources().getBoolean( com.android.internal.R.bool.config_navBarTapThrough); final InsetsFrameProvider bottomTappableProvider; if (navBarTapThrough) { bottomTappableProvider = new InsetsFrameProvider(ITYPE_BOTTOM_TAPPABLE_ELEMENT, Insets.of(0, 0, 0, 0)); } else { bottomTappableProvider = new InsetsFrameProvider(ITYPE_BOTTOM_TAPPABLE_ELEMENT); tappableElementProvider.setInsetsSize(Insets.NONE); } final DisplayCutout cutout = userContext.getDisplay().getCutout(); Loading @@ -1745,13 +1734,16 @@ public class NavigationBar extends ViewController<NavigationBarView> implements ? mEdgeBackGestureHandler.getEdgeWidthRight() + safeInsetsRight : 0; return new InsetsFrameProvider[] { navBarProvider, tappableElementProvider, new InsetsFrameProvider( ITYPE_BOTTOM_MANDATORY_GESTURES, Insets.of(0, 0, 0, gestureHeight)), new InsetsFrameProvider(ITYPE_LEFT_GESTURES, InsetsFrameProvider.SOURCE_DISPLAY, Insets.of(gestureInsetsLeft, 0, 0, 0), null), new InsetsFrameProvider(ITYPE_RIGHT_GESTURES, InsetsFrameProvider.SOURCE_DISPLAY, Insets.of(0, 0, gestureInsetsRight, 0), null), bottomTappableProvider mInsetsSourceOwner, 0, WindowInsets.Type.mandatorySystemGestures()) .setInsetsSize(Insets.of(0, 0, 0, gestureHeight)), new InsetsFrameProvider(mInsetsSourceOwner, 0, WindowInsets.Type.systemGestures()) .setSource(InsetsFrameProvider.SOURCE_DISPLAY) .setInsetsSize(Insets.of(gestureInsetsLeft, 0, 0, 0)), new InsetsFrameProvider(mInsetsSourceOwner, 1, WindowInsets.Type.systemGestures()) .setSource(InsetsFrameProvider.SOURCE_DISPLAY) .setInsetsSize(Insets.of(0, 0, gestureInsetsRight, 0)) }; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java +9 −8 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ package com.android.systemui.statusbar.window; import static android.view.InsetsState.ITYPE_STATUS_BAR; import static android.view.InsetsState.ITYPE_TOP_MANDATORY_GESTURES; import static android.view.InsetsState.ITYPE_TOP_TAPPABLE_ELEMENT; import static android.view.WindowInsets.Type.mandatorySystemGestures; import static android.view.WindowInsets.Type.statusBars; import static android.view.WindowInsets.Type.tappableElement; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR; Loading Loading @@ -85,6 +85,7 @@ public class StatusBarWindowController { private final ViewGroup mLaunchAnimationContainer; private WindowManager.LayoutParams mLp; private final WindowManager.LayoutParams mLpChanged; private final Binder mInsetsSourceOwner = new Binder(); @Inject public StatusBarWindowController( Loading Loading @@ -231,16 +232,16 @@ public class StatusBarWindowController { lp.packageName = mContext.getPackageName(); lp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; final InsetsFrameProvider gestureInsetsProvider = new InsetsFrameProvider(ITYPE_TOP_MANDATORY_GESTURES); new InsetsFrameProvider(mInsetsSourceOwner, 0, mandatorySystemGestures()); final int safeTouchRegionHeight = mContext.getResources().getDimensionPixelSize( com.android.internal.R.dimen.display_cutout_touchable_region_size); if (safeTouchRegionHeight > 0) { gestureInsetsProvider.minimalInsetsSizeInDisplayCutoutSafe = Insets.of(0, safeTouchRegionHeight, 0, 0); gestureInsetsProvider.setMinimalInsetsSizeInDisplayCutoutSafe( Insets.of(0, safeTouchRegionHeight, 0, 0)); } lp.providedInsets = new InsetsFrameProvider[] { new InsetsFrameProvider(ITYPE_STATUS_BAR), new InsetsFrameProvider(ITYPE_TOP_TAPPABLE_ELEMENT), new InsetsFrameProvider(mInsetsSourceOwner, 0, statusBars()), new InsetsFrameProvider(mInsetsSourceOwner, 0, tappableElement()), gestureInsetsProvider }; return lp; Loading
services/core/java/com/android/server/wm/DisplayPolicy.java +13 −43 File changed.Preview size limit exceeded, changes collapsed. Show changes