Tapl Widgets: Don't use container width as gesture margin

The test used margin that was equal to the width of the container when
injecting a backward swipe. This means the swipe was injected at an x
value of 0 in the View's local coordinates. When injecting such events
into the system, the coordinates will undergo several transformations,
at which point floating point precision errors could accumulate. This
could result in the event being dispatched outside the boundary of the
view.

Change the injection margin so that the swipe is injected in the middle
of the View instead of at its edge.

Bug: 201777251
Bug: 207146693
Test: atest TaplTestsLauncher3
Change-Id: I4082c2845aef033a6fbe41070061866d6048e21d
This commit is contained in:
Prabir Pradhan
2021-11-24 08:54:25 -08:00
parent 260b90c7ad
commit 53ae5d85a6

View File

@@ -77,7 +77,8 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer {
mLauncher.scroll(
widgetsContainer,
Direction.UP,
new Rect(0, 0, mLauncher.getVisibleBounds(widgetsContainer).width(), 0),
new Rect(0, 0, mLauncher.getRightGestureMarginInContainer(widgetsContainer) + 1,
0),
FLING_STEPS, false);
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("flung back")) {
verifyActiveContainer();