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

Commit a6f19699 authored by Hyunyoung Song's avatar Hyunyoung Song Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE / add downX,Y location for all swipes/ add extra debugging info...

Merge "Fix NPE / add downX,Y location for all swipes/ add extra debugging info Bug: 122700646 Bug: 127840207" into ub-launcher3-qt-dev
parents 6b435c2a bf44bc34
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -17,8 +17,6 @@ package com.android.launcher3.uioverrides.touchcontrollers;


import static android.view.View.TRANSLATION_X;
import static android.view.View.TRANSLATION_X;


import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_BACK_BUTTON;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW;
@@ -47,7 +45,6 @@ import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.touch.SwipeDetector;
import com.android.launcher3.touch.SwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Command;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsView;
@@ -219,6 +216,7 @@ public class NavBarToHomeTouchController implements TouchController, SwipeDetect
    private void logStateChange(int startContainerType, int logAction) {
    private void logStateChange(int startContainerType, int logAction) {
        mLauncher.getUserEventDispatcher().logStateChangeAction(logAction,
        mLauncher.getUserEventDispatcher().logStateChangeAction(logAction,
                LauncherLogProto.Action.Direction.UP,
                LauncherLogProto.Action.Direction.UP,
                mSwipeDetector.getDownX(), mSwipeDetector.getDownY(),
                LauncherLogProto.ContainerType.NAVBAR,
                LauncherLogProto.ContainerType.NAVBAR,
                startContainerType,
                startContainerType,
                mEndState.containerType,
                mEndState.containerType,
+2 −1
Original line number Original line Diff line number Diff line
@@ -347,7 +347,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
                            : velocityY;
                            : velocityY;


            mInteractionHandler.updateDisplacement(getDisplacement(ev) - mStartDisplacement);
            mInteractionHandler.updateDisplacement(getDisplacement(ev) - mStartDisplacement);
            mInteractionHandler.onGestureEnded(velocity, new PointF(velocityX, velocityY));
            mInteractionHandler.onGestureEnded(velocity, new PointF(velocityX, velocityY),
                    mDownPos);
        } else {
        } else {
            // Since we start touch tracking on DOWN, we may reach this state without actually
            // Since we start touch tracking on DOWN, we may reach this state without actually
            // starting the gesture. In that case, just cleanup immediately.
            // starting the gesture. In that case, just cleanup immediately.
+5 −1
Original line number Original line Diff line number Diff line
@@ -253,6 +253,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
    private boolean mGestureStarted;
    private boolean mGestureStarted;
    private int mLogAction = Touch.SWIPE;
    private int mLogAction = Touch.SWIPE;
    private int mLogDirection = Direction.UP;
    private int mLogDirection = Direction.UP;
    private PointF mDownPos;


    private final RecentsAnimationWrapper mRecentsAnimationWrapper;
    private final RecentsAnimationWrapper mRecentsAnimationWrapper;


@@ -703,9 +704,10 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
    /**
    /**
     * @param endVelocity The velocity in the direction of the nav bar to the middle of the screen.
     * @param endVelocity The velocity in the direction of the nav bar to the middle of the screen.
     * @param velocity The x and y components of the velocity when the gesture ends.
     * @param velocity The x and y components of the velocity when the gesture ends.
     * @param downPos The x and y value of where the gesture started.
     */
     */
    @UiThread
    @UiThread
    public void onGestureEnded(float endVelocity, PointF velocity) {
    public void onGestureEnded(float endVelocity, PointF velocity, PointF downPos) {
        float flingThreshold = mContext.getResources()
        float flingThreshold = mContext.getResources()
                .getDimension(R.dimen.quickstep_fling_threshold_velocity);
                .getDimension(R.dimen.quickstep_fling_threshold_velocity);
        boolean isFling = mGestureStarted && Math.abs(endVelocity) > flingThreshold;
        boolean isFling = mGestureStarted && Math.abs(endVelocity) > flingThreshold;
@@ -718,6 +720,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
        } else {
        } else {
            mLogDirection = velocity.x < 0 ? Direction.LEFT : Direction.RIGHT;
            mLogDirection = velocity.x < 0 ? Direction.LEFT : Direction.RIGHT;
        }
        }
        mDownPos = downPos;
        handleNormalGestureEnd(endVelocity, isFling, velocity);
        handleNormalGestureEnd(endVelocity, isFling, velocity);
    }
    }


@@ -856,6 +859,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
                : mRecentsView.getNextPage();
                : mRecentsView.getNextPage();
        UserEventDispatcher.newInstance(mContext).logStateChangeAction(
        UserEventDispatcher.newInstance(mContext).logStateChangeAction(
                mLogAction, mLogDirection,
                mLogAction, mLogDirection,
                (int) mDownPos.x, (int) mDownPos.y,
                ContainerType.NAVBAR, ContainerType.APP,
                ContainerType.NAVBAR, ContainerType.APP,
                endTarget.containerType,
                endTarget.containerType,
                pageIndex);
                pageIndex);
+5 −5
Original line number Original line Diff line number Diff line
@@ -42,13 +42,13 @@ public class UserEventDispatcherExtension extends UserEventDispatcher {


    public UserEventDispatcherExtension(Context context) { }
    public UserEventDispatcherExtension(Context context) { }


    public void logStateChangeAction(int action, int dir, int srcChildTargetType,
    public void logStateChangeAction(int action, int dir, int downX, int downY,
                                     int srcParentContainerType, int dstContainerType,
                                     int srcChildTargetType, int srcParentContainerType,
                                     int pageIndex) {
                                     int dstContainerType, int pageIndex) {
        new MetricsLoggerCompat().visibility(MetricsLoggerCompat.OVERVIEW_ACTIVITY,
        new MetricsLoggerCompat().visibility(MetricsLoggerCompat.OVERVIEW_ACTIVITY,
                dstContainerType == LauncherLogProto.ContainerType.TASKSWITCHER);
                dstContainerType == LauncherLogProto.ContainerType.TASKSWITCHER);
        super.logStateChangeAction(action, dir, srcChildTargetType, srcParentContainerType,
        super.logStateChangeAction(action, dir, downX, downY, srcChildTargetType,
                dstContainerType, pageIndex);
                srcParentContainerType, dstContainerType, pageIndex);
    }
    }


    public void logActionTip(int actionType, int viewType) {
    public void logActionTip(int actionType, int viewType) {
+14 −4
Original line number Original line Diff line number Diff line
@@ -41,7 +41,6 @@ import java.lang.reflect.Modifier;
/**
/**
 * Helper methods for logging.
 * Helper methods for logging.
 */
 */
@Deprecated
public class LoggerUtils {
public class LoggerUtils {
    private static final ArrayMap<Class, SparseArray<String>> sNameCache = new ArrayMap<>();
    private static final ArrayMap<Class, SparseArray<String>> sNameCache = new ArrayMap<>();
    private static final String UNKNOWN = "UNKNOWN";
    private static final String UNKNOWN = "UNKNOWN";
@@ -77,10 +76,17 @@ public class LoggerUtils {
                if (action.touch == Action.Touch.SWIPE || action.touch == Action.Touch.FLING) {
                if (action.touch == Action.Touch.SWIPE || action.touch == Action.Touch.FLING) {
                    str += " direction=" + getFieldName(action.dir, Action.Direction.class);
                    str += " direction=" + getFieldName(action.dir, Action.Direction.class);
                }
                }
                return str;
                break;
            case Action.Type.COMMAND: return getFieldName(action.command, Action.Command.class);
            case Action.Type.COMMAND:
                str += getFieldName(action.command, Action.Command.class);
                break;
            default: return getFieldName(action.type, Action.Type.class);
            default: return getFieldName(action.type, Action.Type.class);
        }
        }
        if (action.touch == Action.Touch.SWIPE || action.touch == Action.Touch.FLING ||
                (action.command == Action.Command.BACK && action.dir != Action.Direction.NONE)) {
            str += " direction=" + getFieldName(action.dir, Action.Direction.class);
        }
        return str;
    }
    }


    public static String getTargetStr(Target t) {
    public static String getTargetStr(Target t) {
@@ -109,6 +115,10 @@ public class LoggerUtils {
                str += "UNKNOWN TARGET TYPE";
                str += "UNKNOWN TARGET TYPE";
        }
        }


        if (t.spanX != 1 || t.spanY != 1) {
            str += " span(" + t.spanX + "," + t.spanY + ")";
        }

        if (t.tipType != TipType.DEFAULT_NONE) {
        if (t.tipType != TipType.DEFAULT_NONE) {
            str += " " + getFieldName(t.tipType, TipType.class);
            str += " " + getFieldName(t.tipType, TipType.class);
        }
        }
Loading