diff --git a/quickstep/src/com/android/quickstep/inputconsumers/MotionEventsHandler.java b/quickstep/src/com/android/quickstep/inputconsumers/MotionEventsHandler.java
deleted file mode 100644
index 54edde6..0000000
--- a/quickstep/src/com/android/quickstep/inputconsumers/MotionEventsHandler.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.quickstep.inputconsumers;
-
-import static android.view.MotionEvent.AXIS_GESTURE_X_OFFSET;
-import static android.view.MotionEvent.AXIS_GESTURE_Y_OFFSET;
-import static android.view.MotionEvent.INVALID_POINTER_ID;
-
-import static com.android.launcher3.Utilities.getTrackpadMotionEventScale;
-import static com.android.launcher3.Utilities.isTrackpadMotionEvent;
-
-import android.content.Context;
-import android.graphics.PointF;
-import android.view.MotionEvent;
-
-import com.android.quickstep.util.NavBarPosition;
-
-/**
- * A motion event handler that can tracks the states of a gesture, whether it's from on-screen
- * touch or trackpad gesture.
- */
-public class MotionEventsHandler {
-
-    private final PointF mDownPos = new PointF();
-    private final PointF mLastPos = new PointF();
-    private final int mScale;
-
-    private int mActivePointerId = INVALID_POINTER_ID;
-
-    private float mCurrentTrackpadOffsetX = 0;
-    private float mCurrentTrackpadOffsetY = 0;
-
-    public MotionEventsHandler(Context context) {
-        mScale = getTrackpadMotionEventScale(context);
-    }
-
-    public int getActivePointerId() {
-        return mActivePointerId;
-    }
-
-    public void onActionDown(MotionEvent ev) {
-        mActivePointerId = ev.getPointerId(0);
-        if (isTrackpadMotionEvent(ev)) {
-            mCurrentTrackpadOffsetX = 0;
-            mCurrentTrackpadOffsetY = 0;
-        } else {
-            mDownPos.set(ev.getX(), ev.getY());
-            mLastPos.set(mDownPos);
-        }
-    }
-
-    public void onActionMove(MotionEvent ev) {
-        int pointerIndex = ev.findPointerIndex(mActivePointerId);
-        if (isTrackpadMotionEvent(ev)) {
-            mCurrentTrackpadOffsetX += ev.getAxisValue(AXIS_GESTURE_X_OFFSET, pointerIndex)
-                    * mScale;
-            mCurrentTrackpadOffsetY += ev.getAxisValue(AXIS_GESTURE_Y_OFFSET, pointerIndex)
-                    * mScale;
-        } else {
-            mLastPos.set(ev.getX(pointerIndex), ev.getY(pointerIndex));
-        }
-    }
-
-    public void onActionPointerUp(MotionEvent ev) {
-        int ptrIdx = ev.getActionIndex();
-        int ptrId = ev.getPointerId(ptrIdx);
-        if (ptrId == mActivePointerId && !isTrackpadMotionEvent(ev)) {
-            final int newPointerIdx = ptrIdx == 0 ? 1 : 0;
-            mDownPos.set(
-                    ev.getX(newPointerIdx) - (mLastPos.x - mDownPos.x),
-                    ev.getY(newPointerIdx) - (mLastPos.y - mDownPos.y));
-            mLastPos.set(ev.getX(newPointerIdx), ev.getY(newPointerIdx));
-            mActivePointerId = ev.getPointerId(newPointerIdx);
-        }
-    }
-
-    public float getDisplacement(MotionEvent ev, NavBarPosition mNavBarPosition) {
-        if (mNavBarPosition.isRightEdge()) {
-            if (isTrackpadMotionEvent(ev)) {
-                return mCurrentTrackpadOffsetX;
-            }
-            return ev.getX() - mDownPos.x;
-        } else if (mNavBarPosition.isLeftEdge()) {
-            if (isTrackpadMotionEvent(ev)) {
-                return -mCurrentTrackpadOffsetX;
-            }
-            return mDownPos.x - ev.getX();
-        } else {
-            if (isTrackpadMotionEvent(ev)) {
-                return mCurrentTrackpadOffsetY;
-            }
-            return ev.getY() - mDownPos.y;
-        }
-    }
-
-    public float getDisplacementX(MotionEvent ev) {
-        return isTrackpadMotionEvent(ev) ? mCurrentTrackpadOffsetX : mLastPos.x - mDownPos.x;
-    }
-
-    public float getDisplacementY(MotionEvent ev) {
-        return isTrackpadMotionEvent(ev) ? mCurrentTrackpadOffsetY : mLastPos.y - mDownPos.y;
-    }
-}
diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
index cd0d463..601533d 100644
--- a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
+++ b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
@@ -26,8 +26,6 @@
 import static com.android.launcher3.PagedView.ACTION_MOVE_ALLOW_EASY_FLING;
 import static com.android.launcher3.PagedView.DEBUG_FAILED_QUICKSWITCH;
 import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
-import static com.android.launcher3.Utilities.getXVelocity;
-import static com.android.launcher3.Utilities.getYVelocity;
 import static com.android.launcher3.Utilities.squaredHypot;
 import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
 import static com.android.launcher3.util.TraceHelper.FLAG_CHECK_FOR_RACE_CONDITIONS;
@@ -112,8 +110,9 @@
     private final FinishImmediatelyHandler mCleanupHandler = new FinishImmediatelyHandler();
 
     private final boolean mIsDeferredDownTarget;
-
-    private final MotionEventsHandler mMotionEventsHandler;
+    private final PointF mDownPos = new PointF();
+    private final PointF mLastPos = new PointF();
+    private int mActivePointerId = INVALID_POINTER_ID;
 
     // Distance after which we start dragging the window.
     private final float mTouchSlop;
@@ -154,7 +153,6 @@
         mVelocityTracker = VelocityTracker.obtain();
         mInputMonitorCompat = inputMonitorCompat;
         mInputEventReceiver = inputEventReceiver;
-        mMotionEventsHandler = new MotionEventsHandler(base);
 
         boolean continuingPreviousGesture = mTaskAnimationManager.isRecentsAnimationRunning();
         mIsDeferredDownTarget = !continuingPreviousGesture && isDeferredDownTarget;
@@ -224,7 +222,9 @@
 
                 Object traceToken = TraceHelper.INSTANCE.beginSection(DOWN_EVT,
                         FLAG_CHECK_FOR_RACE_CONDITIONS);
-                mMotionEventsHandler.onActionDown(ev);
+                mActivePointerId = ev.getPointerId(0);
+                mDownPos.set(ev.getX(), ev.getY());
+                mLastPos.set(mDownPos);
 
                 // Start the window animation on down to give more time for launcher to draw if the
                 // user didn't start the gesture over the back button
@@ -247,20 +247,27 @@
                 break;
             }
             case ACTION_POINTER_UP: {
-                mMotionEventsHandler.onActionPointerUp(ev);
+                int ptrIdx = ev.getActionIndex();
+                int ptrId = ev.getPointerId(ptrIdx);
+                if (ptrId == mActivePointerId) {
+                    final int newPointerIdx = ptrIdx == 0 ? 1 : 0;
+                    mDownPos.set(
+                            ev.getX(newPointerIdx) - (mLastPos.x - mDownPos.x),
+                            ev.getY(newPointerIdx) - (mLastPos.y - mDownPos.y));
+                    mLastPos.set(ev.getX(newPointerIdx), ev.getY(newPointerIdx));
+                    mActivePointerId = ev.getPointerId(newPointerIdx);
+                }
                 break;
             }
             case ACTION_MOVE: {
-                int pointerIndex = ev.findPointerIndex(mMotionEventsHandler.getActivePointerId());
+                int pointerIndex = ev.findPointerIndex(mActivePointerId);
                 if (pointerIndex == INVALID_POINTER_ID) {
                     break;
                 }
-
-                mMotionEventsHandler.onActionMove(ev);
-                final float displacement = mMotionEventsHandler.getDisplacement(ev,
-                        mNavBarPosition);
-                final float displacementX = mMotionEventsHandler.getDisplacementX(ev);
-                final float displacementY= mMotionEventsHandler.getDisplacementY(ev);
+                mLastPos.set(ev.getX(pointerIndex), ev.getY(pointerIndex));
+                float displacement = getDisplacement(ev);
+                float displacementX = mLastPos.x - mDownPos.x;
+                float displacementY = mLastPos.y - mDownPos.y;
 
                 if (!mPassedWindowMoveSlop) {
                     if (!mIsDeferredDownTarget) {
@@ -342,8 +349,8 @@
             case ACTION_CANCEL:
             case ACTION_UP: {
                 if (DEBUG_FAILED_QUICKSWITCH && !mPassedWindowMoveSlop) {
-                    final float displacementX = mMotionEventsHandler.getDisplacementX(ev);
-                    final float displacementY = mMotionEventsHandler.getDisplacementY(ev);
+                    float displacementX = mLastPos.x - mDownPos.x;
+                    float displacementY = mLastPos.y - mDownPos.y;
                     Log.d("Quickswitch", "mPassedWindowMoveSlop=false"
                             + " disp=" + squaredHypot(displacementX, displacementY)
                             + " slop=" + mSquaredTouchSlop);
@@ -400,19 +407,16 @@
                 mInteractionHandler.onGestureCancelled();
             } else {
                 mVelocityTracker.computeCurrentVelocity(PX_PER_MS);
-                int activePointerId = mMotionEventsHandler.getActivePointerId();
-                float velocityXPxPerMs = getXVelocity(mVelocityTracker, ev, activePointerId);
-                float velocityYPxPerMs = getYVelocity(mVelocityTracker, ev, activePointerId);
+                float velocityXPxPerMs = mVelocityTracker.getXVelocity(mActivePointerId);
+                float velocityYPxPerMs = mVelocityTracker.getYVelocity(mActivePointerId);
                 float velocityPxPerMs = mNavBarPosition.isRightEdge()
                         ? velocityXPxPerMs
                         : mNavBarPosition.isLeftEdge()
                                 ? -velocityXPxPerMs
                                 : velocityYPxPerMs;
-                mInteractionHandler.updateDisplacement(
-                        mMotionEventsHandler.getDisplacement(ev, mNavBarPosition)
-                                - mStartDisplacement);
-                mInteractionHandler.onGestureEnded(
-                        velocityPxPerMs, new PointF(velocityXPxPerMs, velocityYPxPerMs));
+                mInteractionHandler.updateDisplacement(getDisplacement(ev) - mStartDisplacement);
+                mInteractionHandler.onGestureEnded(velocityPxPerMs,
+                        new PointF(velocityXPxPerMs, velocityYPxPerMs));
             }
         } else {
             // Since we start touch tracking on DOWN, we may reach this state without actually
@@ -475,6 +479,16 @@
         }
     }
 
+    private float getDisplacement(MotionEvent ev) {
+        if (mNavBarPosition.isRightEdge()) {
+            return ev.getX() - mDownPos.x;
+        } else if (mNavBarPosition.isLeftEdge()) {
+            return mDownPos.x - ev.getX();
+        } else {
+            return ev.getY() - mDownPos.y;
+        }
+    }
+
     @Override
     public boolean allowInterceptByParent() {
         return !mPassedPilferInputSlop;
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index b66ed81..1354d21 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -62,7 +62,6 @@
 import android.util.Log;
 import android.util.TypedValue;
 import android.view.MotionEvent;
-import android.view.VelocityTracker;
 import android.view.View;
 import android.view.ViewConfiguration;
 import android.view.animation.Interpolator;
@@ -156,8 +155,6 @@
     public static boolean IS_RUNNING_IN_TEST_HARNESS =
                     ActivityManager.isRunningInTestHarness();
 
-    private static final int TRACKPAD_GESTURE_SCALE = 60;
-
     public static void enableRunningInTestHarnessForTests() {
         IS_RUNNING_IN_TEST_HARNESS = true;
     }
@@ -716,38 +713,6 @@
                 && (event.getSource() & SOURCE_TOUCHSCREEN) != SOURCE_TOUCHSCREEN;
     }
 
-    public static int getTrackpadMotionEventScale(Context context) {
-        return ViewConfiguration.get(context).getScaledTouchSlop() * TRACKPAD_GESTURE_SCALE;
-    }
-
-    public static float getXVelocity(VelocityTracker velocityTracker, MotionEvent event,
-            int pointerId) {
-        // Will be enabled after ag/20353570 is submitted
-//        if (isTrackpadMotionEvent(event)) {
-//            return velocityTracker.getAxisVelocity(AXIS_GESTURE_X_OFFSET, pointerId);
-//        } else {
-            return velocityTracker.getXVelocity(pointerId);
-//        }
-    }
-
-    public static float getXVelocity(VelocityTracker velocityTracker, MotionEvent event) {
-        return getXVelocity(velocityTracker, event, -1 /* ACTIVE_POINTER_ID */);
-    }
-
-    public static float getYVelocity(VelocityTracker velocityTracker, MotionEvent event,
-            int pointerId) {
-        // Will be enabled after ag/20353570 is submitted
-//        if (isTrackpadMotionEvent(event)) {
-//            return velocityTracker.getAxisVelocity(AXIS_GESTURE_Y_OFFSET, pointerId);
-//        } else {
-            return velocityTracker.getYVelocity(pointerId);
-//        }
-    }
-
-    public static float getYVelocity(VelocityTracker velocityTracker, MotionEvent event) {
-        return getYVelocity(velocityTracker, event, -1 /* ACTIVE_POINTER_ID */);
-    }
-
     /** Logs the Scale and Translate properties of a matrix. Ignores skew and perspective. */
     public static void logMatrix(String label, Matrix matrix) {
         float[] matrixValues = new float[9];
