Merge "Switching flinging gestures injection to model time" into ub-launcher3-qt-r1-dev

This commit is contained in:
TreeHugger Robot 2019-07-12 18:12:59 +00:00 committed by Android (Google) Code Review
commit acc2b33574
3 changed files with 24 additions and 6 deletions

View File

@ -47,6 +47,7 @@ import android.view.animation.Interpolator;
import android.widget.ScrollView;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.pageindicators.PageIndicator;
import com.android.launcher3.touch.OverScroll;
@ -367,6 +368,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
*/
protected void onPageEndTransition() {
mWasInOverscroll = false;
AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext());
}
protected int getUnboundedScrollX() {

View File

@ -16,6 +16,8 @@
package com.android.launcher3.tapl;
import android.graphics.Rect;
import androidx.annotation.NonNull;
import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.Direction;
@ -49,9 +51,8 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
mLauncher.addContextLayer("want to fling forward in overview")) {
LauncherInstrumentation.log("Overview.flingForward before fling");
final UiObject2 overview = verifyActiveContainer();
overview.setGestureMargins(mLauncher.getEdgeSensitivityWidth(), 0, 0, 0);
overview.fling(Direction.LEFT, (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
mLauncher.waitForIdle();
mLauncher.scroll(overview, Direction.LEFT, 1,
new Rect(mLauncher.getEdgeSensitivityWidth(), 0, 0, 0), 20);
verifyActiveContainer();
}
}
@ -86,9 +87,8 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
mLauncher.addContextLayer("want to fling backward in overview")) {
LauncherInstrumentation.log("Overview.flingBackward before fling");
final UiObject2 overview = verifyActiveContainer();
overview.setGestureMargins(0, 0, mLauncher.getEdgeSensitivityWidth(), 0);
overview.fling(Direction.RIGHT, (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
mLauncher.waitForIdle();
mLauncher.scroll(overview, Direction.RIGHT, 1,
new Rect(0, 0, mLauncher.getEdgeSensitivityWidth(), 0), 20);
verifyActiveContainer();
}
}

View File

@ -834,6 +834,22 @@ public final class LauncherInstrumentation {
endY = (int) (vertCenter - halfGestureHeight);
}
break;
case LEFT: {
startY = endY = rect.centerY();
final int horizCenter = rect.centerX();
final float halfGestureWidth = rect.width() * percent / 2.0f;
startX = (int) (horizCenter - halfGestureWidth);
endX = (int) (horizCenter + halfGestureWidth);
}
break;
case RIGHT: {
startY = endY = rect.centerY();
final int horizCenter = rect.centerX();
final float halfGestureWidth = rect.width() * percent / 2.0f;
startX = (int) (horizCenter + halfGestureWidth);
endX = (int) (horizCenter - halfGestureWidth);
}
break;
default:
fail("Unsupported direction");
return;