Loading libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/CommonAssertions.kt +16 −4 Original line number Diff line number Diff line Loading @@ -254,6 +254,16 @@ fun LayersTraceSubject.splitAppLayerBoundsSnapToDivider( } } /** * Checks that surfaces are still within the expected region after snapping to a snap point. * * @param component The component we are checking (should be one of the two split apps) * @param landscapePosLeft If [true], and device is in left/right split, app is on the left side of * the screen. Has no meaning if device is in top/bottom split. * @param portraitPosTop If [true], and device is in top/bottom split, app is on the top side of * the screen. Has no meaning if device is in left/right split. * @param rotation The rotation state of the display. */ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( component: IComponentMatcher, landscapePosLeft: Boolean, Loading @@ -268,10 +278,12 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( visibleRegion(component).isNotEmpty() visibleRegion(component) .coversAtMost( // TODO (b/403082705): Should use the new method for determining left/right split. if (displayBounds.width() > displayBounds.height()) { if (landscapePosLeft) { Region( 0, // TODO (b/403304310): Check if we're in an offscreen-enabled mode. -displayBounds.right, // the receding app can go offscreen 0, (dividerRegion.left + dividerRegion.right) / 2, displayBounds.bottom Loading @@ -280,7 +292,7 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( Region( (dividerRegion.left + dividerRegion.right) / 2, 0, displayBounds.right, displayBounds.right * 2, // the receding app can go offscreen displayBounds.bottom ) } Loading @@ -288,7 +300,7 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( if (portraitPosTop) { Region( 0, 0, -displayBounds.bottom, // the receding app can go offscreen displayBounds.right, (dividerRegion.top + dividerRegion.bottom) / 2 ) Loading @@ -297,7 +309,7 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( 0, (dividerRegion.top + dividerRegion.bottom) / 2, displayBounds.right, displayBounds.bottom displayBounds.bottom * 2 // the receding app can go offscreen ) } } Loading libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/SplitScreenUtils.kt +9 −3 Original line number Diff line number Diff line Loading @@ -310,12 +310,18 @@ object SplitScreenUtils { } } /** * Drags the divider, then releases, making it snap to a new snap point. */ fun dragDividerToResizeAndWait(device: UiDevice, wmHelper: WindowManagerStateHelper) { // Find the first display that is turned on (making the assumption that there is only one). val displayBounds = wmHelper.currentState.layerState.displays.firstOrNull { !it.isVirtual }?.layerStackSpace ?: error("Display not found") wmHelper.currentState.layerState.displays.firstOrNull { !it.isVirtual && it.isOn } ?.layerStackSpace ?: error("Display not found") val dividerBar = device.wait(Until.findObject(dividerBarSelector), TIMEOUT_MS) dividerBar.drag(Point(displayBounds.width() * 1 / 3, displayBounds.height() * 2 / 3), 200) // Drag to a point on the lower left of the screen -- this will cause the divider to snap // to the left- or bottom-side snap point, shrinking the "primary" test app. dividerBar.drag(Point(displayBounds.width() * 1 / 4, displayBounds.height() * 3 / 4), 200) wmHelper .StateSyncBuilder() Loading Loading
libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/CommonAssertions.kt +16 −4 Original line number Diff line number Diff line Loading @@ -254,6 +254,16 @@ fun LayersTraceSubject.splitAppLayerBoundsSnapToDivider( } } /** * Checks that surfaces are still within the expected region after snapping to a snap point. * * @param component The component we are checking (should be one of the two split apps) * @param landscapePosLeft If [true], and device is in left/right split, app is on the left side of * the screen. Has no meaning if device is in top/bottom split. * @param portraitPosTop If [true], and device is in top/bottom split, app is on the top side of * the screen. Has no meaning if device is in left/right split. * @param rotation The rotation state of the display. */ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( component: IComponentMatcher, landscapePosLeft: Boolean, Loading @@ -268,10 +278,12 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( visibleRegion(component).isNotEmpty() visibleRegion(component) .coversAtMost( // TODO (b/403082705): Should use the new method for determining left/right split. if (displayBounds.width() > displayBounds.height()) { if (landscapePosLeft) { Region( 0, // TODO (b/403304310): Check if we're in an offscreen-enabled mode. -displayBounds.right, // the receding app can go offscreen 0, (dividerRegion.left + dividerRegion.right) / 2, displayBounds.bottom Loading @@ -280,7 +292,7 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( Region( (dividerRegion.left + dividerRegion.right) / 2, 0, displayBounds.right, displayBounds.right * 2, // the receding app can go offscreen displayBounds.bottom ) } Loading @@ -288,7 +300,7 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( if (portraitPosTop) { Region( 0, 0, -displayBounds.bottom, // the receding app can go offscreen displayBounds.right, (dividerRegion.top + dividerRegion.bottom) / 2 ) Loading @@ -297,7 +309,7 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( 0, (dividerRegion.top + dividerRegion.bottom) / 2, displayBounds.right, displayBounds.bottom displayBounds.bottom * 2 // the receding app can go offscreen ) } } Loading
libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/SplitScreenUtils.kt +9 −3 Original line number Diff line number Diff line Loading @@ -310,12 +310,18 @@ object SplitScreenUtils { } } /** * Drags the divider, then releases, making it snap to a new snap point. */ fun dragDividerToResizeAndWait(device: UiDevice, wmHelper: WindowManagerStateHelper) { // Find the first display that is turned on (making the assumption that there is only one). val displayBounds = wmHelper.currentState.layerState.displays.firstOrNull { !it.isVirtual }?.layerStackSpace ?: error("Display not found") wmHelper.currentState.layerState.displays.firstOrNull { !it.isVirtual && it.isOn } ?.layerStackSpace ?: error("Display not found") val dividerBar = device.wait(Until.findObject(dividerBarSelector), TIMEOUT_MS) dividerBar.drag(Point(displayBounds.width() * 1 / 3, displayBounds.height() * 2 / 3), 200) // Drag to a point on the lower left of the screen -- this will cause the divider to snap // to the left- or bottom-side snap point, shrinking the "primary" test app. dividerBar.drag(Point(displayBounds.width() * 1 / 4, displayBounds.height() * 3 / 4), 200) wmHelper .StateSyncBuilder() Loading