Revert "Add debug logs to help identify when setRecentsAttachedToAppWindow will not animate properly."

This reverts commit a0be92c830.

Reason for revert: Bug fixed and logs are too verbose

Test: ran launcher and checked logs
Fixes: 244593270
Change-Id: Ia67ba96b0b2146308f9cad1df884144edf2ab186
This commit is contained in:
Schneider Victor-tulias
2022-11-18 18:43:37 +00:00
parent bddda819d2
commit e04a878709
2 changed files with 25 additions and 85 deletions
@@ -287,7 +287,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
private AnimatorControllerWithResistance mLauncherTransitionController;
private boolean mHasEndedLauncherTransition;
private AnimationFactory mAnimationFactory = (t, s) -> { };
private AnimationFactory mAnimationFactory = (t) -> { };
private boolean mWasLauncherAlreadyVisible;
@@ -531,9 +531,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
Runnable initAnimFactory = () -> {
mAnimationFactory = mActivityInterface.prepareRecentsUI(mDeviceState,
mWasLauncherAlreadyVisible, this::onAnimatorPlaybackControllerCreated);
maybeUpdateRecentsAttachedState(
false /* animate */,
new ActiveGestureLog.CompoundString("on Launcher start (animate=false)"));
maybeUpdateRecentsAttachedState(false /* animate */);
if (mGestureState.getEndTarget() != null) {
// Update the end target in case the gesture ended before we init.
mAnimationFactory.setEndTarget(mGestureState.getEndTarget());
@@ -638,8 +636,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
}
private void initializeLauncherAnimationController() {
buildAnimationController(new ActiveGestureLog.CompoundString(
"initializing launcher animation controller"));
buildAnimationController();
Object traceToken = TraceHelper.INSTANCE.beginSection("logToggleRecents",
TraceHelper.FLAG_IGNORE_BINDERS);
@@ -658,11 +655,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
@Override
public void onMotionPauseDetected() {
mHasMotionEverBeenPaused = true;
maybeUpdateRecentsAttachedState(
true/* animate */,
true/* moveFocusedTask */,
new ActiveGestureLog.CompoundString(
"motion pause detected (animate=true)"));
maybeUpdateRecentsAttachedState(true/* animate */, true/* moveFocusedTask */);
Optional.ofNullable(mActivityInterface.getTaskbarController())
.ifPresent(TaskbarUIController::startTranslationSpring);
performHapticFeedback();
@@ -675,13 +668,12 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
};
}
private void maybeUpdateRecentsAttachedState(ActiveGestureLog.CompoundString reason) {
maybeUpdateRecentsAttachedState(true /* animate */, reason.append(" (animate=true)"));
private void maybeUpdateRecentsAttachedState() {
maybeUpdateRecentsAttachedState(true /* animate */);
}
private void maybeUpdateRecentsAttachedState(
boolean animate, ActiveGestureLog.CompoundString reason) {
maybeUpdateRecentsAttachedState(animate, false /* moveFocusedTask */, reason);
private void maybeUpdateRecentsAttachedState(boolean animate) {
maybeUpdateRecentsAttachedState(animate, false /* moveFocusedTask */);
}
/**
@@ -693,8 +685,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
* @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, ActiveGestureLog.CompoundString reason) {
private void maybeUpdateRecentsAttachedState(boolean animate, boolean moveFocusedTask) {
if (!mDeviceState.isFullyGesturalNavMode() || mRecentsView == null) {
return;
}
@@ -704,25 +695,14 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
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) {
@@ -730,8 +710,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
// TaskView jumping to new position as we move the tasks.
mRecentsView.moveFocusedTaskToFront();
}
mAnimationFactory.setRecentsAttachedToAppWindow(
recentsAttachedToAppWindow, animate, reason);
mAnimationFactory.setRecentsAttachedToAppWindow(recentsAttachedToAppWindow, animate);
// Reapply window transform throughout the attach animation, as the animation affects how
// much the window is bound by overscroll (vs moving freely).
@@ -751,29 +730,22 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
}
public void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask) {
setIsLikelyToStartNewTask(
isLikelyToStartNewTask,
true /* animate */,
new ActiveGestureLog.CompoundString(
"setting gesture likely to start (animate=true)"));
setIsLikelyToStartNewTask(isLikelyToStartNewTask, true /* animate */);
}
private void setIsLikelyToStartNewTask(
boolean isLikelyToStartNewTask,
boolean animate,
ActiveGestureLog.CompoundString reason) {
private void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask, boolean animate) {
if (mIsLikelyToStartNewTask != isLikelyToStartNewTask) {
mIsLikelyToStartNewTask = isLikelyToStartNewTask;
maybeUpdateRecentsAttachedState(animate, reason);
maybeUpdateRecentsAttachedState(animate);
}
}
private void buildAnimationController(ActiveGestureLog.CompoundString reason) {
private void buildAnimationController() {
if (!canCreateNewOrUpdateExistingLauncherTransitionController()) {
return;
}
initTransitionEndpoints(mActivity.getDeviceProfile());
mAnimationFactory.createActivityInterface(mTransitionDragLength, reason);
mAnimationFactory.createActivityInterface(mTransitionDragLength);
}
/**
@@ -788,7 +760,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
@Override
public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
WindowInsets result = view.onApplyWindowInsets(windowInsets);
buildAnimationController(new ActiveGestureLog.CompoundString("applying window insets"));
buildAnimationController();
// 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();
@@ -962,10 +934,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
});
}
notifyGestureStartedAsync();
setIsLikelyToStartNewTask(
isLikelyToStartNewTask,
false /* animate */,
new ActiveGestureLog.CompoundString("on gesture started (animate=false)"));
setIsLikelyToStartNewTask(isLikelyToStartNewTask, false /* animate */);
mStateCallback.setStateOnUiThread(STATE_GESTURE_STARTED);
mGestureStarted = true;
}
@@ -1046,8 +1015,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
private void onSettledOnEndTarget() {
// Fast-finish the attaching animation if it's still running.
maybeUpdateRecentsAttachedState(false, new ActiveGestureLog.CompoundString(
"on settled on end target (animate=false)"));
maybeUpdateRecentsAttachedState(false);
final GestureEndTarget endTarget = mGestureState.getEndTarget();
// Wait until the given View (if supplied) draws before resuming the last task.
View postResumeLastTask = mActivityInterface.onSettledOnEndTarget(endTarget);
@@ -1357,8 +1325,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
@UiThread
private void animateToProgressInternal(float start, float end, long duration,
Interpolator interpolator, GestureEndTarget target, PointF velocityPxPerMs) {
maybeUpdateRecentsAttachedState(new ActiveGestureLog.CompoundString(
"animate to progress internal"));
maybeUpdateRecentsAttachedState();
// If we are transitioning to launcher, then listen for the activity to be restarted while
// the transition is in progress
@@ -1677,9 +1644,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
mRecentsView.post(mRecentsView::resetTaskVisuals);
}
// Make sure recents is in its final state
maybeUpdateRecentsAttachedState(
false, new ActiveGestureLog.CompoundString(
"setting up window animation (animate=false)"));
maybeUpdateRecentsAttachedState(false);
mActivityInterface.onSwipeUpToHomeComplete(mDeviceState);
}
});