Merge "Fix WindowMagnificationControllerTest failure on foldable targets" into sc-v2-dev am: 7aedd37457

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15624358

Change-Id: I0c94a925a8acd814e3136bb5568f3ece1e5221ed
This commit is contained in:
Ryan Lin
2021-08-20 04:19:57 +00:00
committed by Automerger Merge Worker

View File

@@ -188,6 +188,7 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
public void deleteWindowMagnification_enableAtTheBottom_overlapFlagIsFalse() { public void deleteWindowMagnification_enableAtTheBottom_overlapFlagIsFalse() {
final WindowManager wm = mContext.getSystemService(WindowManager.class); final WindowManager wm = mContext.getSystemService(WindowManager.class);
final Rect bounds = wm.getCurrentWindowMetrics().getBounds(); final Rect bounds = wm.getCurrentWindowMetrics().getBounds();
setSystemGestureInsets();
mInstrumentation.runOnMainSync(() -> { mInstrumentation.runOnMainSync(() -> {
mWindowMagnificationController.enableWindowMagnification(Float.NaN, Float.NaN, mWindowMagnificationController.enableWindowMagnification(Float.NaN, Float.NaN,
@@ -463,10 +464,7 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
@Test @Test
public void moveWindowMagnificationToTheBottom_enabledWithGestureInset_overlapFlagIsTrue() { public void moveWindowMagnificationToTheBottom_enabledWithGestureInset_overlapFlagIsTrue() {
final Rect bounds = mWindowManager.getCurrentWindowMetrics().getBounds(); final Rect bounds = mWindowManager.getCurrentWindowMetrics().getBounds();
final WindowInsets testInsets = new WindowInsets.Builder() setSystemGestureInsets();
.setInsets(systemGestures(), Insets.of(0, 0, 0, 10))
.build();
mWindowManager.setWindowInsets(testInsets);
mInstrumentation.runOnMainSync(() -> { mInstrumentation.runOnMainSync(() -> {
mWindowMagnificationController.enableWindowMagnification(Float.NaN, Float.NaN, mWindowMagnificationController.enableWindowMagnification(Float.NaN, Float.NaN,
Float.NaN); Float.NaN);
@@ -492,4 +490,11 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
private boolean hasMagnificationOverlapFlag() { private boolean hasMagnificationOverlapFlag() {
return (mSysUiState.getFlags() & SYSUI_STATE_MAGNIFICATION_OVERLAP) != 0; return (mSysUiState.getFlags() & SYSUI_STATE_MAGNIFICATION_OVERLAP) != 0;
} }
private void setSystemGestureInsets() {
final WindowInsets testInsets = new WindowInsets.Builder()
.setInsets(systemGestures(), Insets.of(0, 0, 0, 10))
.build();
mWindowManager.setWindowInsets(testInsets);
}
} }