diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 9106a8fc15..cca41efaef 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -272,7 +272,7 @@ public abstract class AbsSwipeUpHandler, private AnimatorControllerWithResistance mLauncherTransitionController; private boolean mHasEndedLauncherTransition; - private AnimationFactory mAnimationFactory = (t) -> { }; + private AnimationFactory mAnimationFactory = (t, s) -> { }; private boolean mWasLauncherAlreadyVisible; @@ -501,7 +501,9 @@ public abstract class AbsSwipeUpHandler, Runnable initAnimFactory = () -> { mAnimationFactory = mActivityInterface.prepareRecentsUI(mDeviceState, mWasLauncherAlreadyVisible, this::onAnimatorPlaybackControllerCreated); - maybeUpdateRecentsAttachedState(false /* animate */); + maybeUpdateRecentsAttachedState( + false /* animate */, + new ActiveGestureLog.CompoundString("on Launcher start (animate=false)")); if (mGestureState.getEndTarget() != null) { // Update the end target in case the gesture ended before we init. mAnimationFactory.setEndTarget(mGestureState.getEndTarget()); @@ -606,7 +608,8 @@ public abstract class AbsSwipeUpHandler, } private void initializeLauncherAnimationController() { - buildAnimationController(); + buildAnimationController(new ActiveGestureLog.CompoundString( + "initializing launcher animation controller")); Object traceToken = TraceHelper.INSTANCE.beginSection("logToggleRecents", TraceHelper.FLAG_IGNORE_BINDERS); @@ -625,7 +628,11 @@ public abstract class AbsSwipeUpHandler, @Override public void onMotionPauseDetected() { mHasMotionEverBeenPaused = true; - maybeUpdateRecentsAttachedState(true/* animate */, true/* moveFocusedTask */); + maybeUpdateRecentsAttachedState( + true/* animate */, + true/* moveFocusedTask */, + new ActiveGestureLog.CompoundString( + "motion pause detected (animate=true)")); performHapticFeedback(); } @@ -636,12 +643,13 @@ public abstract class AbsSwipeUpHandler, }; } - private void maybeUpdateRecentsAttachedState() { - maybeUpdateRecentsAttachedState(true /* animate */); + private void maybeUpdateRecentsAttachedState(ActiveGestureLog.CompoundString reason) { + maybeUpdateRecentsAttachedState(true /* animate */, reason.append(" (animate=true)")); } - private void maybeUpdateRecentsAttachedState(boolean animate) { - maybeUpdateRecentsAttachedState(animate, false /* moveFocusedTask */); + private void maybeUpdateRecentsAttachedState( + boolean animate, ActiveGestureLog.CompoundString reason) { + maybeUpdateRecentsAttachedState(animate, false /* moveFocusedTask */, reason); } /** @@ -653,7 +661,8 @@ public abstract class AbsSwipeUpHandler, * @param animate whether to animate when attaching RecentsView * @param moveFocusedTask whether to move focused task to front when attaching */ - private void maybeUpdateRecentsAttachedState(boolean animate, boolean moveFocusedTask) { + private void maybeUpdateRecentsAttachedState( + boolean animate, boolean moveFocusedTask, ActiveGestureLog.CompoundString reason) { if (!mDeviceState.isFullyGesturalNavMode() || mRecentsView == null) { return; } @@ -663,14 +672,25 @@ public abstract class AbsSwipeUpHandler, final boolean recentsAttachedToAppWindow; if (mGestureState.getEndTarget() != null) { recentsAttachedToAppWindow = mGestureState.getEndTarget().recentsAttachedToAppWindow; + reason.append("; gesture state end target != null (attached=") + .append(Boolean.toString(recentsAttachedToAppWindow)) + .append(")"); } else if (mContinuingLastGesture && mRecentsView.getRunningTaskIndex() != mRecentsView.getNextPage()) { recentsAttachedToAppWindow = true; + reason.append("; continuing last gesture (attached=true)"); } else if (runningTaskTarget != null && isNotInRecents(runningTaskTarget)) { // The window is going away so make sure recents is always visible in this case. recentsAttachedToAppWindow = true; + reason.append("; make sure recents is always visible (attached=true)"); } else { recentsAttachedToAppWindow = mHasMotionEverBeenPaused || mIsLikelyToStartNewTask; + reason.append(mHasMotionEverBeenPaused + ? "; motion has been paused" + : "; gesture is likely to start a new task") + .append(" (attached=") + .append(Boolean.toString(recentsAttachedToAppWindow)) + .append(")"); } if (moveFocusedTask && !mAnimationFactory.hasRecentsEverAttachedToAppWindow() && recentsAttachedToAppWindow) { @@ -678,7 +698,8 @@ public abstract class AbsSwipeUpHandler, // TaskView jumping to new position as we move the tasks. mRecentsView.moveFocusedTaskToFront(); } - mAnimationFactory.setRecentsAttachedToAppWindow(recentsAttachedToAppWindow, animate); + mAnimationFactory.setRecentsAttachedToAppWindow( + recentsAttachedToAppWindow, animate, reason); // Reapply window transform throughout the attach animation, as the animation affects how // much the window is bound by overscroll (vs moving freely). @@ -698,22 +719,29 @@ public abstract class AbsSwipeUpHandler, } public void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask) { - setIsLikelyToStartNewTask(isLikelyToStartNewTask, true /* animate */); + setIsLikelyToStartNewTask( + isLikelyToStartNewTask, + true /* animate */, + new ActiveGestureLog.CompoundString( + "setting gesture likely to start (animate=true)")); } - private void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask, boolean animate) { + private void setIsLikelyToStartNewTask( + boolean isLikelyToStartNewTask, + boolean animate, + ActiveGestureLog.CompoundString reason) { if (mIsLikelyToStartNewTask != isLikelyToStartNewTask) { mIsLikelyToStartNewTask = isLikelyToStartNewTask; - maybeUpdateRecentsAttachedState(animate); + maybeUpdateRecentsAttachedState(animate, reason); } } - private void buildAnimationController() { + private void buildAnimationController(ActiveGestureLog.CompoundString reason) { if (!canCreateNewOrUpdateExistingLauncherTransitionController()) { return; } initTransitionEndpoints(mActivity.getDeviceProfile()); - mAnimationFactory.createActivityInterface(mTransitionDragLength); + mAnimationFactory.createActivityInterface(mTransitionDragLength, reason); } /** @@ -728,7 +756,7 @@ public abstract class AbsSwipeUpHandler, @Override public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) { WindowInsets result = view.onApplyWindowInsets(windowInsets); - buildAnimationController(); + buildAnimationController(new ActiveGestureLog.CompoundString("applying window insets")); // Reapply the current shift to ensure it takes new insets into account, e.g. when long // pressing to stash taskbar without moving the finger. updateFinalShift(); @@ -900,7 +928,10 @@ public abstract class AbsSwipeUpHandler, }); } notifyGestureStartedAsync(); - setIsLikelyToStartNewTask(isLikelyToStartNewTask, false /* animate */); + setIsLikelyToStartNewTask( + isLikelyToStartNewTask, + false /* animate */, + new ActiveGestureLog.CompoundString("on gesture started (animate=false)")); mStateCallback.setStateOnUiThread(STATE_GESTURE_STARTED); mGestureStarted = true; SystemUiProxy.INSTANCE.get(mContext).notifySwipeUpGestureStarted(); @@ -982,7 +1013,8 @@ public abstract class AbsSwipeUpHandler, private void onSettledOnEndTarget() { // Fast-finish the attaching animation if it's still running. - maybeUpdateRecentsAttachedState(false); + maybeUpdateRecentsAttachedState(false, new ActiveGestureLog.CompoundString( + "on settled on end target (animate=false)")); final GestureEndTarget endTarget = mGestureState.getEndTarget(); // Wait until the given View (if supplied) draws before resuming the last task. View postResumeLastTask = mActivityInterface.onSettledOnEndTarget(endTarget); @@ -1288,7 +1320,8 @@ public abstract class AbsSwipeUpHandler, @UiThread private void animateToProgressInternal(float start, float end, long duration, Interpolator interpolator, GestureEndTarget target, PointF velocityPxPerMs) { - maybeUpdateRecentsAttachedState(); + maybeUpdateRecentsAttachedState(new ActiveGestureLog.CompoundString( + "animate to progress internal")); // If we are transitioning to launcher, then listen for the activity to be restarted while // the transition is in progress @@ -1607,7 +1640,9 @@ public abstract class AbsSwipeUpHandler, mRecentsView.post(mRecentsView::resetTaskVisuals); } // Make sure recents is in its final state - maybeUpdateRecentsAttachedState(false); + maybeUpdateRecentsAttachedState( + false, new ActiveGestureLog.CompoundString( + "setting up window animation (animate=false)")); mActivityInterface.onSwipeUpToHomeComplete(mDeviceState); } }); diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 226b173ecd..a343c2d965 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -57,6 +57,7 @@ import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.NavigationMode; import com.android.launcher3.views.ScrimView; +import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.views.RecentsView; @@ -393,14 +394,16 @@ public abstract class BaseActivityInterface