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

Commit 0ab1d0d8 authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Log the input type for back gesture" into udc-qpr-dev

parents 3ccd3b15 ae249ad2
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -264,6 +264,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
    private boolean mGestureBlockingActivityRunning;
    private boolean mIsNewBackAffordanceEnabled;
    private boolean mIsTrackpadGestureFeaturesEnabled;
    private boolean mIsTrackpadThreeFingerSwipe;
    private boolean mIsButtonForcedVisible;

    private InputMonitor mInputMonitor;
@@ -986,18 +987,21 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
                (int) mEndPoint.x, (int) mEndPoint.y,
                mEdgeWidthLeft + mLeftInset,
                mDisplaySize.x - (mEdgeWidthRight + mRightInset),
                mUseMLModel ? mMLResults : -2, logPackageName);
                mUseMLModel ? mMLResults : -2, logPackageName,
                mIsTrackpadThreeFingerSwipe ? SysUiStatsLog.BACK_GESTURE__INPUT_TYPE__TRACKPAD
                        : SysUiStatsLog.BACK_GESTURE__INPUT_TYPE__TOUCH);
    }

    private void onMotionEvent(MotionEvent ev) {
        int action = ev.getActionMasked();
        boolean isTrackpadThreeFingerSwipe = isTrackpadThreeFingerSwipe(
                mIsTrackpadGestureFeaturesEnabled, ev);
        if (action == MotionEvent.ACTION_DOWN) {
            if (DEBUG_MISSING_GESTURE) {
                Log.d(DEBUG_MISSING_GESTURE_TAG, "Start gesture: " + ev);
            }

            mIsTrackpadThreeFingerSwipe = isTrackpadThreeFingerSwipe(
                    mIsTrackpadGestureFeaturesEnabled, ev);

            // ACTION_UP or ACTION_CANCEL is not guaranteed to be called before a new
            // ACTION_DOWN, in that case we should just reuse the old instance.
            mVelocityTracker.clear();
@@ -1005,7 +1009,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
            // Verify if this is in within the touch region and we aren't in immersive mode, and
            // either the bouncer is showing or the notification panel is hidden
            mInputEventReceiver.setBatchingEnabled(false);
            if (isTrackpadThreeFingerSwipe) {
            if (mIsTrackpadThreeFingerSwipe) {
                // Since trackpad gestures don't have zones, this will be determined later by the
                // direction of the gesture. {@code mIsOnLeftEdge} is set to false to begin with.
                mDeferSetIsOnLeftEdge = true;
@@ -1021,11 +1025,11 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
                    && !mGestureBlockingActivityRunning
                    && !QuickStepContract.isBackGestureDisabled(mSysUiFlags)
                    && !isTrackpadScroll(mIsTrackpadGestureFeaturesEnabled, ev);
            if (isTrackpadThreeFingerSwipe) {
            if (mIsTrackpadThreeFingerSwipe) {
                // Trackpad back gestures don't have zones, so we don't need to check if the down
                // event is within insets.
                mAllowGesture = isBackAllowedCommon && isValidTrackpadBackGesture(
                        isTrackpadThreeFingerSwipe);
                        true /* isTrackpadEvent */);
            } else {
                mAllowGesture = isBackAllowedCommon && !mUsingThreeButtonNav && isWithinInsets
                    && isWithinTouchRegion((int) ev.getX(), (int) ev.getY())
@@ -1036,7 +1040,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
                mEdgeBackPlugin.onMotionEvent(ev);
                dispatchToBackAnimation(ev);
            }
            if (mLogGesture || isTrackpadThreeFingerSwipe) {
            if (mLogGesture || mIsTrackpadThreeFingerSwipe) {
                mDownPoint.set(ev.getX(), ev.getY());
                mEndPoint.set(-1, -1);
                mThresholdCrossed = false;
@@ -1050,7 +1054,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
                    "Gesture [%d [%s],alw=%B, t3fs=%B, left=%B, defLeft=%B, backAlw=%B, disbld=%B,"
                            + " qsDisbld=%b, blkdAct=%B, pip=%B,"
                            + " disp=%s, wl=%d, il=%d, wr=%d, ir=%d, excl=%s]",
                    curTime, curTimeStr, mAllowGesture, isTrackpadThreeFingerSwipe,
                    curTime, curTimeStr, mAllowGesture, mIsTrackpadThreeFingerSwipe,
                    mIsOnLeftEdge, mDeferSetIsOnLeftEdge, mIsBackGestureAllowed,
                    QuickStepContract.isBackGestureDisabled(mSysUiFlags), mDisabledForQuickstep,
                    mGestureBlockingActivityRunning, mIsInPip, mDisplaySize,
@@ -1059,7 +1063,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
            if (!mThresholdCrossed) {
                mEndPoint.x = (int) ev.getX();
                mEndPoint.y = (int) ev.getY();
                if (action == MotionEvent.ACTION_POINTER_DOWN && !isTrackpadThreeFingerSwipe) {
                if (action == MotionEvent.ACTION_POINTER_DOWN && !mIsTrackpadThreeFingerSwipe) {
                    if (mAllowGesture) {
                        logGesture(SysUiStatsLog.BACK_GESTURE__TYPE__INCOMPLETE_MULTI_TOUCH);
                        if (DEBUG_MISSING_GESTURE) {
@@ -1071,7 +1075,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
                    mLogGesture = false;
                    return;
                } else if (action == MotionEvent.ACTION_MOVE) {
                    if (isTrackpadThreeFingerSwipe && mDeferSetIsOnLeftEdge) {
                    if (mIsTrackpadThreeFingerSwipe && mDeferSetIsOnLeftEdge) {
                        // mIsOnLeftEdge is determined by the relative position between the down
                        // and the current motion event for trackpad gestures instead of zoning.
                        mIsOnLeftEdge = mEndPoint.x > mDownPoint.x;