Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d93df51 authored by vadimt's avatar vadimt
Browse files

Switching flinging gestures injection to model time

This is a right thing to do in any case.

Change-Id: I34eeecac6d9eb13130eb1015f9a9a5e2a32974ec
parent ddf64806
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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() {
+6 −6
Original line number Diff line number Diff line
@@ -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();
        }
    }
+16 −0
Original line number Diff line number Diff line
@@ -820,6 +820,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;