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

Commit 08a915c0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add some gesture logging to track down quickscrub launch issue" into ub-launcher3-master

parents 9f2e997b 665bc46d
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
     * Updates the UI to indicate quick interaction.
     */
    void onQuickInteractionStart(T activity, @Nullable RunningTaskInfo taskInfo,
            boolean activityVisible);
            boolean activityVisible, TouchInteractionLog touchInteractionLog);

    float getTranslationYForQuickScrub(TransformedRect targetRect, DeviceProfile dp,
            Context context);
@@ -153,13 +153,14 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {

        @Override
        public void onQuickInteractionStart(Launcher activity, RunningTaskInfo taskInfo,
                boolean activityVisible) {
                boolean activityVisible, TouchInteractionLog touchInteractionLog) {
            LauncherState fromState = activity.getStateManager().getState();
            activity.getStateManager().goToState(FAST_OVERVIEW, activityVisible);

            QuickScrubController controller = activity.<RecentsView>getOverviewPanel()
                    .getQuickScrubController();
            controller.onQuickScrubStart(activityVisible && !fromState.overviewUi, this);
            controller.onQuickScrubStart(activityVisible && !fromState.overviewUi, this,
                    touchInteractionLog);

            if (!activityVisible) {
                // For the duration of the gesture, lock the screen orientation to ensure that we
@@ -425,14 +426,14 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {

        @Override
        public void onQuickInteractionStart(RecentsActivity activity, RunningTaskInfo taskInfo,
                boolean activityVisible) {
                boolean activityVisible, TouchInteractionLog touchInteractionLog) {
            QuickScrubController controller = activity.<RecentsView>getOverviewPanel()
                    .getQuickScrubController();

            // TODO: match user is as well
            boolean startingFromHome = !activityVisible &&
                    (taskInfo == null || Objects.equals(taskInfo.topActivity, mHomeComponent));
            controller.onQuickScrubStart(startingFromHome, this);
            controller.onQuickScrubStart(startingFromHome, this, touchInteractionLog);
            if (activityVisible) {
                mUiHandler.postDelayed(controller::onFinishedTransitionToQuickScrub,
                        OVERVIEW_TRANSITION_MS);
+2 −2
Original line number Diff line number Diff line
@@ -49,8 +49,8 @@ public class DeferredTouchConsumer implements TouchConsumer {
    }

    @Override
    public void updateTouchTracking(int interactionType) {
        mTarget.updateTouchTracking(interactionType);
    public void onQuickScrubStart() {
        mTarget.onQuickScrubStart();
    }

    @Override
+2 −2
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ public class MotionEventQueue {
                if (event.getActionMasked() == ACTION_VIRTUAL) {
                    switch (event.getAction()) {
                        case ACTION_QUICK_SCRUB_START:
                            mConsumer.updateTouchTracking(INTERACTION_QUICK_SCRUB);
                            mConsumer.onQuickScrubStart();
                            break;
                        case ACTION_QUICK_SCRUB_PROGRESS:
                            mConsumer.onQuickScrubProgress(event.getX());
@@ -162,7 +162,7 @@ public class MotionEventQueue {
                            break;
                        case ACTION_SHOW_OVERVIEW_FROM_ALT_TAB:
                            mConsumer.onShowOverviewFromAltTab();
                            mConsumer.updateTouchTracking(INTERACTION_QUICK_SCRUB);
                            mConsumer.onQuickScrubStart();
                            break;
                        case ACTION_QUICK_STEP:
                            mConsumer.onQuickStep(event);
+22 −10
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
    private final Choreographer mBackgroundThreadChoreographer;
    private final OverviewCallbacks mOverviewCallbacks;
    private final TaskOverlayFactory mTaskOverlayFactory;
    private final TouchInteractionLog mTouchInteractionLog;

    private final boolean mIsDeferredDownTarget;
    private final PointF mDownPos = new PointF();
@@ -100,7 +101,8 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
            RecentsModel recentsModel, Intent homeIntent, ActivityControlHelper activityControl,
            MainThreadExecutor mainThreadExecutor, Choreographer backgroundThreadChoreographer,
            @HitTarget int downHitTarget, OverviewCallbacks overviewCallbacks,
            TaskOverlayFactory taskOverlayFactory, VelocityTracker velocityTracker) {
            TaskOverlayFactory taskOverlayFactory, VelocityTracker velocityTracker,
            TouchInteractionLog touchInteractionLog) {
        super(base);

        mRunningTask = runningTaskInfo;
@@ -113,6 +115,8 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
        mIsDeferredDownTarget = activityControl.deferStartingActivity(downHitTarget);
        mOverviewCallbacks = overviewCallbacks;
        mTaskOverlayFactory = taskOverlayFactory;
        mTouchInteractionLog = touchInteractionLog;
        mTouchInteractionLog.setTouchConsumer(this);
    }

    @Override
@@ -125,6 +129,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
        if (mVelocityTracker == null) {
            return;
        }
        mTouchInteractionLog.addMotionEvent(ev);
        switch (ev.getActionMasked()) {
            case ACTION_DOWN: {
                TraceHelper.beginSection("TouchInt");
@@ -215,10 +220,13 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
    }

    private void startTouchTrackingForWindowAnimation(long touchTimeMs) {
        mTouchInteractionLog.startRecentsAnimation();

        // Create the shared handler
        RecentsAnimationState animationState = new RecentsAnimationState();
        final WindowTransformSwipeHandler handler = new WindowTransformSwipeHandler(
                animationState.id, mRunningTask, this, touchTimeMs, mActivityControlHelper);
                animationState.id, mRunningTask, this, touchTimeMs, mActivityControlHelper,
                mTouchInteractionLog);

        // Preload the plan
        mRecentsModel.loadTasks(mRunningTask.id, null);
@@ -315,7 +323,13 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
    }

    @Override
    public void updateTouchTracking(int interactionType) {
    public Choreographer getIntrimChoreographer(MotionEventQueue queue) {
        mEventQueue = queue;
        return mBackgroundThreadChoreographer;
    }

    @Override
    public void onQuickScrubStart() {
        if (!mPassedInitialSlop && mIsDeferredDownTarget && mInteractionHandler == null) {
            // If we deferred starting the window animation on touch down, then
            // start tracking now
@@ -323,20 +337,16 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
            mPassedInitialSlop = true;
        }

        mTouchInteractionLog.startQuickScrub();
        if (mInteractionHandler != null) {
            mInteractionHandler.updateInteractionType(interactionType);
            mInteractionHandler.onQuickScrubStart();
        }
        notifyGestureStarted();
    }

    @Override
    public Choreographer getIntrimChoreographer(MotionEventQueue queue) {
        mEventQueue = queue;
        return mBackgroundThreadChoreographer;
    }

    @Override
    public void onQuickScrubEnd() {
        mTouchInteractionLog.endQuickScrub("onQuickScrubEnd");
        if (mInteractionHandler != null) {
            mInteractionHandler.onQuickScrubEnd();
        }
@@ -344,6 +354,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC

    @Override
    public void onQuickScrubProgress(float progress) {
        mTouchInteractionLog.setQuickScrubProgress(progress);
        if (mInteractionHandler != null) {
            mInteractionHandler.onQuickScrubProgress(progress);
        }
@@ -351,6 +362,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC

    @Override
    public void onQuickStep(MotionEvent ev) {
        mTouchInteractionLog.startQuickStep();
        if (mIsDeferredDownTarget) {
            // Deferred gesture, start the animation and gesture tracking once we pass the actual
            // touch slop
+6 −1
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ public class QuickScrubController implements OnAlarmListener {
    private boolean mFinishedTransitionToQuickScrub;
    private Runnable mOnFinishedTransitionToQuickScrubRunnable;
    private ActivityControlHelper mActivityControlHelper;
    private TouchInteractionLog mTouchInteractionLog;

    public QuickScrubController(BaseActivity activity, RecentsView recentsView) {
        mActivity = activity;
@@ -79,13 +80,15 @@ public class QuickScrubController implements OnAlarmListener {
        }
    }

    public void onQuickScrubStart(boolean startingFromHome, ActivityControlHelper controlHelper) {
    public void onQuickScrubStart(boolean startingFromHome, ActivityControlHelper controlHelper,
            TouchInteractionLog touchInteractionLog) {
        prepareQuickScrub(TAG);
        mInQuickScrub = true;
        mStartedFromHome = startingFromHome;
        mQuickScrubSection = 0;
        mFinishedTransitionToQuickScrub = false;
        mActivityControlHelper = controlHelper;
        mTouchInteractionLog = touchInteractionLog;

        snapToNextTaskIfAvailable();
        mActivity.getUserEventDispatcher().resetActionDurationMillis();
@@ -101,7 +104,9 @@ public class QuickScrubController implements OnAlarmListener {
            TaskView taskView = mRecentsView.getTaskViewAt(page);
            if (taskView != null) {
                mWaitingForTaskLaunch = true;
                mTouchInteractionLog.launchTaskStart();
                taskView.launchTask(true, (result) -> {
                    mTouchInteractionLog.launchTaskEnd(result);
                    if (!result) {
                        taskView.notifyTaskLaunchFailed(TAG);
                        breakOutOfQuickScrub();
Loading