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

Commit 1db29f89 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Remove raw coordinates VelocityTracker workaround

VelocityTracker uses raw coordinates starting in P, so it is no longer
necessary to adjust the MotionEvent to the screen coordinates in order
to get the correct velocities.

Bug: 72263561
Test: manual test - interaction with notification panel and quick
settings. Tried to fling it different ways (starting point, fling speed,
simple liftoff without flinging) and ensured that no unusual behaviour
is observed.

Change-Id: I19590ddeab1054a59b2671d6ef0ef7027509f863
parent 27906ac9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public class NoisyVelocityTracker implements VelocityTrackerInterface {
        if (mEventBuf.size() == MAX_EVENTS) {
            mEventBuf.remove();
        }
        mEventBuf.add(new MotionEventCopy(event.getX(), event.getY(), event.getEventTime()));
        mEventBuf.add(new MotionEventCopy(event.getRawX(), event.getRawY(), event.getEventTime()));
    }

    public void computeCurrentVelocity(int units) {
+0 −6
Original line number Diff line number Diff line
@@ -222,13 +222,7 @@ public abstract class PanelView extends FrameLayout {
    }

    private void trackMovement(MotionEvent event) {
        // Add movement to velocity tracker using raw screen X and Y coordinates instead
        // of window coordinates because the window frame may be moving at the same time.
        float deltaX = event.getRawX() - event.getX();
        float deltaY = event.getRawY() - event.getY();
        event.offsetLocation(deltaX, deltaY);
        if (mVelocityTracker != null) mVelocityTracker.addMovement(event);
        event.offsetLocation(-deltaX, -deltaY);
    }

    public void setTouchDisabled(boolean disabled) {