diff --git a/quickstep/src/com/android/quickstep/GestureState.java b/quickstep/src/com/android/quickstep/GestureState.java index 38bf1fd6d8..703db078c1 100644 --- a/quickstep/src/com/android/quickstep/GestureState.java +++ b/quickstep/src/com/android/quickstep/GestureState.java @@ -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); } diff --git a/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java b/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java index 693ef100b6..d2d123324a 100644 --- a/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java +++ b/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java @@ -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: diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 2e393bc70f..38e5acbf94 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -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 taskGroups) { if (mPendingAnimation != null) { mPendingAnimation.addEndListener(success -> applyLoadPlan(taskGroups)); diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 73be5beb2c..68c54c7667 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -259,8 +259,13 @@ public abstract class PagedView 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 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 extends ViewGrou int finalPos = mOrientationHandler.getPrimaryValue(mScroller.getFinalX(), mScroller.getFinalY()); if (newPos == finalPos && mEdgeGlowLeft.isFinished() && mEdgeGlowRight.isFinished()) { - mScroller.abortAnimation(); + abortScrollerAnimation(false); } invalidate();