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

Commit fcb43caf authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add error detection for aborting the recents scrolling during...

Merge "Add error detection for aborting the recents scrolling during transition to home" into tm-qpr-dev am: 839297e2 am: d6757697

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/19873684



Change-Id: I4e7fba7f2c510893d744317eedad78934e9b7a3c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents fb77b34d d6757697
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.SET_END_TARGET;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.SET_END_TARGET_HOME;

import android.annotation.Nullable;
import android.annotation.TargetApi;
@@ -330,6 +331,16 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
        ActiveGestureLog.INSTANCE.addLog(
                /* event= */ "setEndTarget " + mEndTarget,
                /* gestureEvent= */ SET_END_TARGET);
        switch (mEndTarget) {
            case HOME:
                ActiveGestureLog.INSTANCE.trackEvent(SET_END_TARGET_HOME);
                break;
            case RECENTS:
            case NEW_TASK:
            case LAST_TASK:
            default:
                // No-Op
        }
        if (isAtomic) {
            mStateCallback.setState(STATE_END_TARGET_ANIMATION_FINISHED);
        }
+15 −3
Original line number Diff line number Diff line
@@ -33,9 +33,10 @@ public class ActiveGestureErrorDetector {
     * Enums associated to gesture navigation events.
     */
    public enum GestureEvent {
        MOTION_DOWN, MOTION_UP, SET_END_TARGET, ON_SETTLED_ON_END_TARGET, START_RECENTS_ANIMATION,
        FINISH_RECENTS_ANIMATION, CANCEL_RECENTS_ANIMATION, SET_ON_PAGE_TRANSITION_END_CALLBACK,
        CANCEL_CURRENT_ANIMATION, CLEANUP_SCREENSHOT,
        MOTION_DOWN, MOTION_UP, SET_END_TARGET, SET_END_TARGET_HOME, ON_SETTLED_ON_END_TARGET,
        START_RECENTS_ANIMATION, FINISH_RECENTS_ANIMATION, CANCEL_RECENTS_ANIMATION,
        SET_ON_PAGE_TRANSITION_END_CALLBACK, CANCEL_CURRENT_ANIMATION, CLEANUP_SCREENSHOT,
        SCROLLER_ANIMATION_ABORTED,

        /**
         * These GestureEvents are specifically associated to state flags that get set in
@@ -123,6 +124,16 @@ public class ActiveGestureErrorDetector {
                                        + "being set.",
                                writer);
                        break;
                    case SCROLLER_ANIMATION_ABORTED:
                        errorDetected |= printErrorIfTrue(
                                encounteredEvents.contains(GestureEvent.SET_END_TARGET_HOME)
                                        && !encounteredEvents.contains(
                                                GestureEvent.ON_SETTLED_ON_END_TARGET),
                                /* errorMessage= */ prefix + "\t\trecents view scroller animation "
                                        + "aborted after setting end target HOME, but before"
                                        + " settling on end target.",
                                writer);
                        break;
                    case STATE_GESTURE_COMPLETED:
                        errorDetected |= printErrorIfTrue(
                                !encounteredEvents.contains(GestureEvent.MOTION_UP),
@@ -173,6 +184,7 @@ public class ActiveGestureErrorDetector {
                        break;
                    case MOTION_DOWN:
                    case SET_END_TARGET:
                    case SET_END_TARGET_HOME:
                    case START_RECENTS_ANIMATION:
                    case SET_ON_PAGE_TRANSITION_END_CALLBACK:
                    case CANCEL_CURRENT_ANIMATION:
+10 −0
Original line number Diff line number Diff line
@@ -165,6 +165,8 @@ import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.TaskViewUtils;
import com.android.quickstep.TopTaskTracker;
import com.android.quickstep.ViewUtils;
import com.android.quickstep.util.ActiveGestureErrorDetector;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.RecentsOrientedState;
@@ -1236,6 +1238,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    @Override
    protected void onPageEndTransition() {
        super.onPageEndTransition();
        ActiveGestureLog.INSTANCE.addLog(
                "onPageEndTransition: current page index updated", mCurrentPage);
        if (isClearAllHidden() && !mActivity.getDeviceProfile().isTablet) {
            mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, false);
        }
@@ -1426,6 +1430,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        updateGridProperties();
    }

    @Override
    protected void onScrollerAnimationAborted() {
        ActiveGestureLog.INSTANCE.addLog("scroller animation aborted",
                ActiveGestureErrorDetector.GestureEvent.SCROLLER_ANIMATION_ABORTED);
    }

    protected void applyLoadPlan(ArrayList<GroupTask> taskGroups) {
        if (mPendingAnimation != null) {
            mPendingAnimation.addEndListener(success -> applyLoadPlan(taskGroups));
+8 −3
Original line number Diff line number Diff line
@@ -259,8 +259,13 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
        abortScrollerAnimation(true);
    }

    protected void onScrollerAnimationAborted() {
        // No-Op
    }

    private void abortScrollerAnimation(boolean resetNextPage) {
        mScroller.abortAnimation();
        onScrollerAnimationAborted();
        // We need to clean up the next page here to avoid computeScrollHelper from
        // updating current page on the pass.
        if (resetNextPage) {
@@ -555,11 +560,11 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
            if (mAllowOverScroll) {
                if (newPos < mMinScroll && oldPos >= mMinScroll) {
                    mEdgeGlowLeft.onAbsorb((int) mScroller.getCurrVelocity());
                    mScroller.abortAnimation();
                    abortScrollerAnimation(false);
                    onEdgeAbsorbingScroll();
                } else if (newPos > mMaxScroll && oldPos <= mMaxScroll) {
                    mEdgeGlowRight.onAbsorb((int) mScroller.getCurrVelocity());
                    mScroller.abortAnimation();
                    abortScrollerAnimation(false);
                    onEdgeAbsorbingScroll();
                }
            }
@@ -569,7 +574,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
            int finalPos = mOrientationHandler.getPrimaryValue(mScroller.getFinalX(),
                    mScroller.getFinalY());
            if (newPos == finalPos && mEdgeGlowLeft.isFinished() && mEdgeGlowRight.isFinished()) {
                mScroller.abortAnimation();
                abortScrollerAnimation(false);
            }

            invalidate();