Merge "Completely remove ITYPEs" into udc-dev

This commit is contained in:
Tiger Huang
2023-03-28 15:30:09 +00:00
committed by Android (Google) Code Review
3 changed files with 5 additions and 57 deletions

View File

@@ -63,37 +63,6 @@ import java.util.StringJoiner;
*/
public class InsetsState implements Parcelable {
/**
* Internal representation of inset source types. This is different from the public API in
* {@link WindowInsets.Type} as one type from the public API might indicate multiple windows
* at the same time.
*/
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = "ITYPE", value = {
ITYPE_CAPTION_BAR,
ITYPE_LEFT_TAPPABLE_ELEMENT,
ITYPE_TOP_TAPPABLE_ELEMENT,
ITYPE_RIGHT_TAPPABLE_ELEMENT,
ITYPE_BOTTOM_TAPPABLE_ELEMENT,
ITYPE_LEFT_GENERIC_OVERLAY,
ITYPE_TOP_GENERIC_OVERLAY,
ITYPE_RIGHT_GENERIC_OVERLAY,
ITYPE_BOTTOM_GENERIC_OVERLAY
})
public @interface InternalInsetsType {}
public static final int ITYPE_CAPTION_BAR = 0;
public static final int ITYPE_LEFT_TAPPABLE_ELEMENT = 1;
public static final int ITYPE_TOP_TAPPABLE_ELEMENT = 2;
public static final int ITYPE_RIGHT_TAPPABLE_ELEMENT = 3;
public static final int ITYPE_BOTTOM_TAPPABLE_ELEMENT = 4;
public static final int ITYPE_LEFT_GENERIC_OVERLAY = 5;
public static final int ITYPE_TOP_GENERIC_OVERLAY = 6;
public static final int ITYPE_RIGHT_GENERIC_OVERLAY = 7;
public static final int ITYPE_BOTTOM_GENERIC_OVERLAY = 8;
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = "ISIDE", value = {
ISIDE_LEFT,
@@ -677,30 +646,6 @@ public class InsetsState implements Parcelable {
&& !WindowConfiguration.inMultiWindowMode(windowingMode);
}
/**
* Converting a internal type to the public type.
* @param type internal insets type, {@code InternalInsetsType}.
* @return public insets type, {@code Type.InsetsType}.
*/
public static @Type.InsetsType int toPublicType(@InternalInsetsType int type) {
switch (type) {
case ITYPE_LEFT_GENERIC_OVERLAY:
case ITYPE_TOP_GENERIC_OVERLAY:
case ITYPE_RIGHT_GENERIC_OVERLAY:
case ITYPE_BOTTOM_GENERIC_OVERLAY:
return Type.SYSTEM_OVERLAYS;
case ITYPE_CAPTION_BAR:
return Type.CAPTION_BAR;
case ITYPE_LEFT_TAPPABLE_ELEMENT:
case ITYPE_TOP_TAPPABLE_ELEMENT:
case ITYPE_RIGHT_TAPPABLE_ELEMENT:
case ITYPE_BOTTOM_TAPPABLE_ELEMENT:
return Type.TAPPABLE_ELEMENT;
default:
throw new IllegalArgumentException("Unknown type: " + type);
}
}
public void dump(String prefix, PrintWriter pw) {
final String newPrefix = prefix + " ";
pw.println(prefix + "InsetsState");

View File

@@ -334,7 +334,11 @@ class InsetsPolicy {
// remove caption insets from floating windows.
// TODO(b/254128050): Remove this workaround after we find a way to update window frames
// and caption insets frames simultaneously.
state.removeSource(InsetsState.ITYPE_CAPTION_BAR);
for (int i = state.sourceSize() - 1; i >= 0; i--) {
if (state.sourceAt(i).getType() == Type.captionBar()) {
state.removeSourceAt(i);
}
}
}
final SparseArray<WindowContainerInsetsSourceProvider> providers =

View File

@@ -202,7 +202,6 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
// Exclude comparing IME insets because currently the simulated layout only focuses on the
// insets from status bar and navigation bar.
realInsetsState.removeSource(InsetsSource.ID_IME);
realInsetsState.removeSource(InsetsState.ITYPE_CAPTION_BAR);
assertEquals(new ToStringComparatorWrapper<>(realInsetsState),
new ToStringComparatorWrapper<>(simulatedInsetsState));