Merge "Remove Type.statusBars from compatInsetsTypes if FLAG_FULLSCREEN" into rvc-dev am: 0b237bb06f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12157384 Change-Id: Ie7bbdf01416680dac708e47347d86718aa22336c
This commit is contained in:
@@ -308,7 +308,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
|
|||||||
false /* isScreenRound */,
|
false /* isScreenRound */,
|
||||||
false /* alwaysConsumeSystemBars */, null /* displayCutout */,
|
false /* alwaysConsumeSystemBars */, null /* displayCutout */,
|
||||||
LayoutParams.SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode*/,
|
LayoutParams.SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode*/,
|
||||||
0 /* legacySystemUiFlags */, typeSideMap)
|
0 /* legacyWindowFlags */, 0 /* legacySystemUiFlags */, typeSideMap)
|
||||||
.getInsets(mTypes);
|
.getInsets(mTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -501,6 +501,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
|||||||
private PendingControlRequest mPendingImeControlRequest;
|
private PendingControlRequest mPendingImeControlRequest;
|
||||||
|
|
||||||
private int mLastLegacySoftInputMode;
|
private int mLastLegacySoftInputMode;
|
||||||
|
private int mLastLegacyWindowFlags;
|
||||||
private int mLastLegacySystemUiFlags;
|
private int mLastLegacySystemUiFlags;
|
||||||
private DisplayCutout mLastDisplayCutout;
|
private DisplayCutout mLastDisplayCutout;
|
||||||
private boolean mStartingAnimation;
|
private boolean mStartingAnimation;
|
||||||
@@ -569,8 +570,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
|||||||
|
|
||||||
WindowInsets insets = state.calculateInsets(mFrame, mState /* ignoringVisibilityState*/,
|
WindowInsets insets = state.calculateInsets(mFrame, mState /* ignoringVisibilityState*/,
|
||||||
mLastInsets.isRound(), mLastInsets.shouldAlwaysConsumeSystemBars(),
|
mLastInsets.isRound(), mLastInsets.shouldAlwaysConsumeSystemBars(),
|
||||||
mLastDisplayCutout, mLastLegacySoftInputMode, mLastLegacySystemUiFlags,
|
mLastDisplayCutout, mLastLegacySoftInputMode, mLastLegacyWindowFlags,
|
||||||
null /* typeSideMap */);
|
mLastLegacySystemUiFlags, null /* typeSideMap */);
|
||||||
mHost.dispatchWindowInsetsAnimationProgress(insets, mUnmodifiableTmpRunningAnims);
|
mHost.dispatchWindowInsetsAnimationProgress(insets, mUnmodifiableTmpRunningAnims);
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
for (WindowInsetsAnimation anim : mUnmodifiableTmpRunningAnims) {
|
for (WindowInsetsAnimation anim : mUnmodifiableTmpRunningAnims) {
|
||||||
@@ -706,13 +707,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public WindowInsets calculateInsets(boolean isScreenRound,
|
public WindowInsets calculateInsets(boolean isScreenRound,
|
||||||
boolean alwaysConsumeSystemBars, DisplayCutout cutout,
|
boolean alwaysConsumeSystemBars, DisplayCutout cutout,
|
||||||
int legacySoftInputMode, int legacySystemUiFlags) {
|
int legacySoftInputMode, int legacyWindowFlags, int legacySystemUiFlags) {
|
||||||
mLastLegacySoftInputMode = legacySoftInputMode;
|
mLastLegacySoftInputMode = legacySoftInputMode;
|
||||||
|
mLastLegacyWindowFlags = legacyWindowFlags;
|
||||||
mLastLegacySystemUiFlags = legacySystemUiFlags;
|
mLastLegacySystemUiFlags = legacySystemUiFlags;
|
||||||
mLastDisplayCutout = cutout;
|
mLastDisplayCutout = cutout;
|
||||||
mLastInsets = mState.calculateInsets(mFrame, null /* ignoringVisibilityState*/,
|
mLastInsets = mState.calculateInsets(mFrame, null /* ignoringVisibilityState*/,
|
||||||
isScreenRound, alwaysConsumeSystemBars, cutout,
|
isScreenRound, alwaysConsumeSystemBars, cutout,
|
||||||
legacySoftInputMode, legacySystemUiFlags,
|
legacySoftInputMode, legacyWindowFlags, legacySystemUiFlags,
|
||||||
null /* typeSideMap */);
|
null /* typeSideMap */);
|
||||||
return mLastInsets;
|
return mLastInsets;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,14 @@ import static android.view.ViewRootImpl.NEW_INSETS_MODE_IME;
|
|||||||
import static android.view.ViewRootImpl.NEW_INSETS_MODE_NONE;
|
import static android.view.ViewRootImpl.NEW_INSETS_MODE_NONE;
|
||||||
import static android.view.ViewRootImpl.sNewInsetsMode;
|
import static android.view.ViewRootImpl.sNewInsetsMode;
|
||||||
import static android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES;
|
import static android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES;
|
||||||
import static android.view.WindowInsets.Type.SIZE;
|
|
||||||
import static android.view.WindowInsets.Type.SYSTEM_GESTURES;
|
import static android.view.WindowInsets.Type.SYSTEM_GESTURES;
|
||||||
import static android.view.WindowInsets.Type.displayCutout;
|
import static android.view.WindowInsets.Type.displayCutout;
|
||||||
import static android.view.WindowInsets.Type.ime;
|
import static android.view.WindowInsets.Type.ime;
|
||||||
import static android.view.WindowInsets.Type.indexOf;
|
import static android.view.WindowInsets.Type.indexOf;
|
||||||
import static android.view.WindowInsets.Type.isVisibleInsetsType;
|
import static android.view.WindowInsets.Type.isVisibleInsetsType;
|
||||||
|
import static android.view.WindowInsets.Type.statusBars;
|
||||||
import static android.view.WindowInsets.Type.systemBars;
|
import static android.view.WindowInsets.Type.systemBars;
|
||||||
|
import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
|
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
|
||||||
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
|
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
|
||||||
|
|
||||||
@@ -38,7 +39,6 @@ import android.graphics.Insets;
|
|||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.util.ArrayMap;
|
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
import android.util.SparseIntArray;
|
import android.util.SparseIntArray;
|
||||||
import android.view.WindowInsets.Type;
|
import android.view.WindowInsets.Type;
|
||||||
@@ -171,7 +171,7 @@ public class InsetsState implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public WindowInsets calculateInsets(Rect frame, @Nullable InsetsState ignoringVisibilityState,
|
public WindowInsets calculateInsets(Rect frame, @Nullable InsetsState ignoringVisibilityState,
|
||||||
boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout,
|
boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout,
|
||||||
int legacySoftInputMode, int legacySystemUiFlags,
|
int legacySoftInputMode, int legacyWindowFlags, int legacySystemUiFlags,
|
||||||
@Nullable @InternalInsetsSide SparseIntArray typeSideMap) {
|
@Nullable @InternalInsetsSide SparseIntArray typeSideMap) {
|
||||||
Insets[] typeInsetsMap = new Insets[Type.SIZE];
|
Insets[] typeInsetsMap = new Insets[Type.SIZE];
|
||||||
Insets[] typeMaxInsetsMap = new Insets[Type.SIZE];
|
Insets[] typeMaxInsetsMap = new Insets[Type.SIZE];
|
||||||
@@ -218,10 +218,17 @@ public class InsetsState implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final int softInputAdjustMode = legacySoftInputMode & SOFT_INPUT_MASK_ADJUST;
|
final int softInputAdjustMode = legacySoftInputMode & SOFT_INPUT_MASK_ADJUST;
|
||||||
|
|
||||||
|
@InsetsType int compatInsetsTypes = systemBars() | displayCutout();
|
||||||
|
if (softInputAdjustMode == SOFT_INPUT_ADJUST_RESIZE) {
|
||||||
|
compatInsetsTypes |= ime();
|
||||||
|
}
|
||||||
|
if ((legacyWindowFlags & FLAG_FULLSCREEN) != 0) {
|
||||||
|
compatInsetsTypes &= ~statusBars();
|
||||||
|
}
|
||||||
|
|
||||||
return new WindowInsets(typeInsetsMap, typeMaxInsetsMap, typeVisibilityMap, isScreenRound,
|
return new WindowInsets(typeInsetsMap, typeMaxInsetsMap, typeVisibilityMap, isScreenRound,
|
||||||
alwaysConsumeSystemBars, cutout, softInputAdjustMode == SOFT_INPUT_ADJUST_RESIZE
|
alwaysConsumeSystemBars, cutout, compatInsetsTypes,
|
||||||
? systemBars() | displayCutout() | ime()
|
|
||||||
: systemBars() | displayCutout(),
|
|
||||||
sNewInsetsMode == NEW_INSETS_MODE_FULL
|
sNewInsetsMode == NEW_INSETS_MODE_FULL
|
||||||
&& (legacySystemUiFlags & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0);
|
&& (legacySystemUiFlags & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2265,7 +2265,8 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
mLastWindowInsets = mInsetsController.calculateInsets(
|
mLastWindowInsets = mInsetsController.calculateInsets(
|
||||||
mContext.getResources().getConfiguration().isScreenRound(),
|
mContext.getResources().getConfiguration().isScreenRound(),
|
||||||
mAttachInfo.mAlwaysConsumeSystemBars, mPendingDisplayCutout.get(),
|
mAttachInfo.mAlwaysConsumeSystemBars, mPendingDisplayCutout.get(),
|
||||||
mWindowAttributes.softInputMode, (mWindowAttributes.systemUiVisibility
|
mWindowAttributes.softInputMode, mWindowAttributes.flags,
|
||||||
|
(mWindowAttributes.systemUiVisibility
|
||||||
| mWindowAttributes.subtreeSystemUiVisibility));
|
| mWindowAttributes.subtreeSystemUiVisibility));
|
||||||
|
|
||||||
Rect visibleInsets = mInsetsController.calculateVisibleInsets(
|
Rect visibleInsets = mInsetsController.calculateVisibleInsets(
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package android.view;
|
package android.view;
|
||||||
|
|
||||||
import static android.view.WindowInsets.Type.CAPTION_BAR;
|
|
||||||
import static android.view.WindowInsets.Type.DISPLAY_CUTOUT;
|
import static android.view.WindowInsets.Type.DISPLAY_CUTOUT;
|
||||||
import static android.view.WindowInsets.Type.FIRST;
|
import static android.view.WindowInsets.Type.FIRST;
|
||||||
import static android.view.WindowInsets.Type.IME;
|
import static android.view.WindowInsets.Type.IME;
|
||||||
@@ -95,7 +94,7 @@ public final class WindowInsets {
|
|||||||
private final boolean mStableInsetsConsumed;
|
private final boolean mStableInsetsConsumed;
|
||||||
private final boolean mDisplayCutoutConsumed;
|
private final boolean mDisplayCutoutConsumed;
|
||||||
|
|
||||||
private final int mCompatInsetTypes;
|
private final int mCompatInsetsTypes;
|
||||||
private final boolean mCompatIgnoreVisibility;
|
private final boolean mCompatIgnoreVisibility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -150,8 +149,8 @@ public final class WindowInsets {
|
|||||||
@Nullable Insets[] typeMaxInsetsMap,
|
@Nullable Insets[] typeMaxInsetsMap,
|
||||||
boolean[] typeVisibilityMap,
|
boolean[] typeVisibilityMap,
|
||||||
boolean isRound,
|
boolean isRound,
|
||||||
boolean alwaysConsumeSystemBars, DisplayCutout displayCutout, int compatInsetTypes,
|
boolean alwaysConsumeSystemBars, DisplayCutout displayCutout,
|
||||||
boolean compatIgnoreVisibility) {
|
@InsetsType int compatInsetsTypes, boolean compatIgnoreVisibility) {
|
||||||
mSystemWindowInsetsConsumed = typeInsetsMap == null;
|
mSystemWindowInsetsConsumed = typeInsetsMap == null;
|
||||||
mTypeInsetsMap = mSystemWindowInsetsConsumed
|
mTypeInsetsMap = mSystemWindowInsetsConsumed
|
||||||
? new Insets[SIZE]
|
? new Insets[SIZE]
|
||||||
@@ -165,7 +164,7 @@ public final class WindowInsets {
|
|||||||
mTypeVisibilityMap = typeVisibilityMap;
|
mTypeVisibilityMap = typeVisibilityMap;
|
||||||
mIsRound = isRound;
|
mIsRound = isRound;
|
||||||
mAlwaysConsumeSystemBars = alwaysConsumeSystemBars;
|
mAlwaysConsumeSystemBars = alwaysConsumeSystemBars;
|
||||||
mCompatInsetTypes = compatInsetTypes;
|
mCompatInsetsTypes = compatInsetsTypes;
|
||||||
mCompatIgnoreVisibility = compatIgnoreVisibility;
|
mCompatIgnoreVisibility = compatIgnoreVisibility;
|
||||||
|
|
||||||
mDisplayCutoutConsumed = displayCutout == null;
|
mDisplayCutoutConsumed = displayCutout == null;
|
||||||
@@ -183,7 +182,7 @@ public final class WindowInsets {
|
|||||||
src.mStableInsetsConsumed ? null : src.mTypeMaxInsetsMap,
|
src.mStableInsetsConsumed ? null : src.mTypeMaxInsetsMap,
|
||||||
src.mTypeVisibilityMap, src.mIsRound,
|
src.mTypeVisibilityMap, src.mIsRound,
|
||||||
src.mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(src),
|
src.mAlwaysConsumeSystemBars, displayCutoutCopyConstructorArgument(src),
|
||||||
src.mCompatInsetTypes,
|
src.mCompatInsetsTypes,
|
||||||
src.mCompatIgnoreVisibility);
|
src.mCompatIgnoreVisibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,11 +309,11 @@ public final class WindowInsets {
|
|||||||
@NonNull
|
@NonNull
|
||||||
public Insets getSystemWindowInsets() {
|
public Insets getSystemWindowInsets() {
|
||||||
Insets result = mCompatIgnoreVisibility
|
Insets result = mCompatIgnoreVisibility
|
||||||
? getInsetsIgnoringVisibility(mCompatInsetTypes & ~ime())
|
? getInsetsIgnoringVisibility(mCompatInsetsTypes & ~ime())
|
||||||
: getInsets(mCompatInsetTypes);
|
: getInsets(mCompatInsetsTypes);
|
||||||
|
|
||||||
// We can't query max insets for IME, so we need to add it manually after.
|
// We can't query max insets for IME, so we need to add it manually after.
|
||||||
if ((mCompatInsetTypes & ime()) != 0 && mCompatIgnoreVisibility) {
|
if ((mCompatInsetsTypes & ime()) != 0 && mCompatIgnoreVisibility) {
|
||||||
result = Insets.max(result, getInsets(ime()));
|
result = Insets.max(result, getInsets(ime()));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -503,7 +502,7 @@ public final class WindowInsets {
|
|||||||
mTypeVisibilityMap,
|
mTypeVisibilityMap,
|
||||||
mIsRound, mAlwaysConsumeSystemBars,
|
mIsRound, mAlwaysConsumeSystemBars,
|
||||||
null /* displayCutout */,
|
null /* displayCutout */,
|
||||||
mCompatInsetTypes, mCompatIgnoreVisibility);
|
mCompatInsetsTypes, mCompatIgnoreVisibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -554,7 +553,7 @@ public final class WindowInsets {
|
|||||||
mTypeVisibilityMap,
|
mTypeVisibilityMap,
|
||||||
mIsRound, mAlwaysConsumeSystemBars,
|
mIsRound, mAlwaysConsumeSystemBars,
|
||||||
displayCutoutCopyConstructorArgument(this),
|
displayCutoutCopyConstructorArgument(this),
|
||||||
mCompatInsetTypes, mCompatIgnoreVisibility);
|
mCompatInsetsTypes, mCompatIgnoreVisibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(b/119190588): replace @code with @link below
|
// TODO(b/119190588): replace @code with @link below
|
||||||
@@ -627,7 +626,7 @@ public final class WindowInsets {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
@NonNull
|
@NonNull
|
||||||
public Insets getStableInsets() {
|
public Insets getStableInsets() {
|
||||||
return getInsets(mTypeMaxInsetsMap, mCompatInsetTypes);
|
return getInsets(mTypeMaxInsetsMap, mCompatInsetsTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -939,7 +938,7 @@ public final class WindowInsets {
|
|||||||
: mDisplayCutout == null
|
: mDisplayCutout == null
|
||||||
? DisplayCutout.NO_CUTOUT
|
? DisplayCutout.NO_CUTOUT
|
||||||
: mDisplayCutout.inset(left, top, right, bottom),
|
: mDisplayCutout.inset(left, top, right, bottom),
|
||||||
mCompatInsetTypes, mCompatIgnoreVisibility);
|
mCompatInsetsTypes, mCompatIgnoreVisibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ public final class WindowManagerImpl implements WindowManager {
|
|||||||
if (ViewRootImpl.sNewInsetsMode == NEW_INSETS_MODE_FULL) {
|
if (ViewRootImpl.sNewInsetsMode == NEW_INSETS_MODE_FULL) {
|
||||||
return insetsState.calculateInsets(bounds, null /* ignoringVisibilityState*/,
|
return insetsState.calculateInsets(bounds, null /* ignoringVisibilityState*/,
|
||||||
isScreenRound, alwaysConsumeSystemBars, displayCutout.get(),
|
isScreenRound, alwaysConsumeSystemBars, displayCutout.get(),
|
||||||
SOFT_INPUT_ADJUST_NOTHING,
|
SOFT_INPUT_ADJUST_NOTHING, attrs.flags,
|
||||||
SYSTEM_UI_FLAG_VISIBLE, null /* typeSideMap */);
|
SYSTEM_UI_FLAG_VISIBLE, null /* typeSideMap */);
|
||||||
} else {
|
} else {
|
||||||
return new WindowInsets.Builder()
|
return new WindowInsets.Builder()
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class ImeInsetsSourceConsumerTest {
|
|||||||
false,
|
false,
|
||||||
new DisplayCutout(
|
new DisplayCutout(
|
||||||
Insets.of(10, 10, 10, 10), rect, rect, rect, rect),
|
Insets.of(10, 10, 10, 10), rect, rect, rect, rect),
|
||||||
SOFT_INPUT_ADJUST_RESIZE, 0);
|
SOFT_INPUT_ADJUST_RESIZE, 0, 0);
|
||||||
mImeConsumer = (ImeInsetsSourceConsumer) mController.getSourceConsumer(ITYPE_IME);
|
mImeConsumer = (ImeInsetsSourceConsumer) mController.getSourceConsumer(ITYPE_IME);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ public class InsetsControllerTest {
|
|||||||
false,
|
false,
|
||||||
new DisplayCutout(
|
new DisplayCutout(
|
||||||
Insets.of(10, 10, 10, 10), rect, rect, rect, rect),
|
Insets.of(10, 10, 10, 10), rect, rect, rect, rect),
|
||||||
SOFT_INPUT_ADJUST_RESIZE, 0);
|
SOFT_INPUT_ADJUST_RESIZE, 0, 0);
|
||||||
mController.onFrameChanged(new Rect(0, 0, 100, 100));
|
mController.onFrameChanged(new Rect(0, 0, 100, 100));
|
||||||
});
|
});
|
||||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
|
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
|||||||
import static android.view.WindowInsets.Type.ime;
|
import static android.view.WindowInsets.Type.ime;
|
||||||
import static android.view.WindowInsets.Type.navigationBars;
|
import static android.view.WindowInsets.Type.navigationBars;
|
||||||
import static android.view.WindowInsets.Type.statusBars;
|
import static android.view.WindowInsets.Type.statusBars;
|
||||||
|
import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
|
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
|
||||||
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
|
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
|
||||||
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
|
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
|
||||||
@@ -77,7 +78,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_IME).setVisible(true);
|
mState.getSource(ITYPE_IME).setVisible(true);
|
||||||
SparseIntArray typeSideMap = new SparseIntArray();
|
SparseIntArray typeSideMap = new SparseIntArray();
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, typeSideMap);
|
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, 0, typeSideMap);
|
||||||
assertEquals(Insets.of(0, 100, 0, 100), insets.getSystemWindowInsets());
|
assertEquals(Insets.of(0, 100, 0, 100), insets.getSystemWindowInsets());
|
||||||
assertEquals(Insets.of(0, 100, 0, 100), insets.getInsets(Type.all()));
|
assertEquals(Insets.of(0, 100, 0, 100), insets.getInsets(Type.all()));
|
||||||
assertEquals(ISIDE_TOP, typeSideMap.get(ITYPE_STATUS_BAR));
|
assertEquals(ISIDE_TOP, typeSideMap.get(ITYPE_STATUS_BAR));
|
||||||
@@ -96,7 +97,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 100, 100, 300));
|
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 100, 100, 300));
|
||||||
mState.getSource(ITYPE_IME).setVisible(true);
|
mState.getSource(ITYPE_IME).setVisible(true);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, null);
|
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, 0, null);
|
||||||
assertEquals(100, insets.getStableInsetBottom());
|
assertEquals(100, insets.getStableInsetBottom());
|
||||||
assertEquals(Insets.of(0, 0, 0, 100), insets.getInsetsIgnoringVisibility(Type.systemBars()));
|
assertEquals(Insets.of(0, 0, 0, 100), insets.getInsetsIgnoringVisibility(Type.systemBars()));
|
||||||
assertEquals(Insets.of(0, 0, 0, 200), insets.getSystemWindowInsets());
|
assertEquals(Insets.of(0, 0, 0, 200), insets.getSystemWindowInsets());
|
||||||
@@ -115,7 +116,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_NAVIGATION_BAR).setFrame(new Rect(80, 0, 100, 300));
|
mState.getSource(ITYPE_NAVIGATION_BAR).setFrame(new Rect(80, 0, 100, 300));
|
||||||
mState.getSource(ITYPE_NAVIGATION_BAR).setVisible(true);
|
mState.getSource(ITYPE_NAVIGATION_BAR).setVisible(true);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, 0, 0, null);
|
false, DisplayCutout.NO_CUTOUT, 0, 0, 0, null);
|
||||||
assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets());
|
assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets());
|
||||||
assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars()));
|
assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars()));
|
||||||
assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars()));
|
assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars()));
|
||||||
@@ -131,7 +132,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 200, 100, 300));
|
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 200, 100, 300));
|
||||||
mState.getSource(ITYPE_IME).setVisible(true);
|
mState.getSource(ITYPE_IME).setVisible(true);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, 0, null);
|
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, 0, 0, null);
|
||||||
assertEquals(0, insets.getSystemWindowInsetBottom());
|
assertEquals(0, insets.getSystemWindowInsetBottom());
|
||||||
assertEquals(100, insets.getInsets(ime()).bottom);
|
assertEquals(100, insets.getInsets(ime()).bottom);
|
||||||
assertTrue(insets.isVisible(ime()));
|
assertTrue(insets.isVisible(ime()));
|
||||||
@@ -147,11 +148,28 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 200, 100, 300));
|
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 200, 100, 300));
|
||||||
mState.getSource(ITYPE_IME).setVisible(true);
|
mState.getSource(ITYPE_IME).setVisible(true);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING,
|
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, 0,
|
||||||
SYSTEM_UI_FLAG_LAYOUT_STABLE, null);
|
SYSTEM_UI_FLAG_LAYOUT_STABLE, null);
|
||||||
assertEquals(100, insets.getSystemWindowInsetTop());
|
assertEquals(100, insets.getSystemWindowInsetTop());
|
||||||
insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false,
|
insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false,
|
||||||
DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING,
|
DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, 0,
|
||||||
|
0 /* legacySystemUiFlags */, null);
|
||||||
|
assertEquals(0, insets.getSystemWindowInsetTop());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCalculateInsets_systemUiFlagLayoutStable_windowFlagFullscreen() {
|
||||||
|
try (final InsetsModeSession session =
|
||||||
|
new InsetsModeSession(ViewRootImpl.NEW_INSETS_MODE_FULL)) {
|
||||||
|
mState.getSource(ITYPE_STATUS_BAR).setFrame(new Rect(0, 0, 100, 100));
|
||||||
|
mState.getSource(ITYPE_STATUS_BAR).setVisible(false);
|
||||||
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
|
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, FLAG_FULLSCREEN,
|
||||||
|
SYSTEM_UI_FLAG_LAYOUT_STABLE, null);
|
||||||
|
assertEquals(0, insets.getSystemWindowInsetTop());
|
||||||
|
insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false,
|
||||||
|
DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, 0,
|
||||||
0 /* legacySystemUiFlags */, null);
|
0 /* legacySystemUiFlags */, null);
|
||||||
assertEquals(0, insets.getSystemWindowInsetTop());
|
assertEquals(0, insets.getSystemWindowInsetTop());
|
||||||
}
|
}
|
||||||
@@ -195,7 +213,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_EXTRA_NAVIGATION_BAR).setFrame(new Rect(80, 0, 100, 300));
|
mState.getSource(ITYPE_EXTRA_NAVIGATION_BAR).setFrame(new Rect(80, 0, 100, 300));
|
||||||
mState.getSource(ITYPE_EXTRA_NAVIGATION_BAR).setVisible(true);
|
mState.getSource(ITYPE_EXTRA_NAVIGATION_BAR).setVisible(true);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, 0, 0, null);
|
false, DisplayCutout.NO_CUTOUT, 0, 0, 0, null);
|
||||||
assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets());
|
assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets());
|
||||||
assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars()));
|
assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars()));
|
||||||
assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars()));
|
assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars()));
|
||||||
@@ -211,7 +229,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_NAVIGATION_BAR).setFrame(new Rect(80, 0, 100, 300));
|
mState.getSource(ITYPE_NAVIGATION_BAR).setFrame(new Rect(80, 0, 100, 300));
|
||||||
mState.getSource(ITYPE_NAVIGATION_BAR).setVisible(true);
|
mState.getSource(ITYPE_NAVIGATION_BAR).setVisible(true);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, 0, 0, null);
|
false, DisplayCutout.NO_CUTOUT, 0, 0, 0, null);
|
||||||
assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets());
|
assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets());
|
||||||
assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars()));
|
assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars()));
|
||||||
assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars()));
|
assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars()));
|
||||||
@@ -226,7 +244,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_IME).setVisible(true);
|
mState.getSource(ITYPE_IME).setVisible(true);
|
||||||
mState.removeSource(ITYPE_IME);
|
mState.removeSource(ITYPE_IME);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false,
|
||||||
DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, null);
|
DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, 0, null);
|
||||||
assertEquals(0, insets.getSystemWindowInsetBottom());
|
assertEquals(0, insets.getSystemWindowInsetBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -615,8 +615,9 @@ class TaskSnapshotController {
|
|||||||
static Rect getSystemBarInsets(Rect frame, InsetsState state) {
|
static Rect getSystemBarInsets(Rect frame, InsetsState state) {
|
||||||
return state.calculateInsets(frame, null /* ignoringVisibilityState */,
|
return state.calculateInsets(frame, null /* ignoringVisibilityState */,
|
||||||
false /* isScreenRound */, false /* alwaysConsumeSystemBars */,
|
false /* isScreenRound */, false /* alwaysConsumeSystemBars */,
|
||||||
null /* displayCutout */, 0 /* legacySoftInputMode */, 0 /* legacySystemUiFlags */,
|
null /* displayCutout */, 0 /* legacySoftInputMode */, 0 /* legacyWindowFlags */,
|
||||||
null /* typeSideMap */).getInsets(WindowInsets.Type.systemBars()).toRect();
|
0 /* legacySystemUiFlags */, null /* typeSideMap */).getInsets(
|
||||||
|
WindowInsets.Type.systemBars()).toRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump(PrintWriter pw, String prefix) {
|
void dump(PrintWriter pw, String prefix) {
|
||||||
|
|||||||
Reference in New Issue
Block a user