Merge "Revert^2 "Launch split tasks at beginning of animation instead of the end"" into 24D1-dev

This commit is contained in:
Vinit Nayak authored and Android (Google) Code Review committed 2024-04-26 18:18:56 +00:00
commit 4dfda85f2a
3 files changed
+26 -20

No files matched your search

@@ -217,11 +217,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
} }
mTaskbarLauncherStateController.updateStateForFlag(FLAG_VISIBLE, isVisible); mTaskbarLauncherStateController.updateStateForFlag(FLAG_VISIBLE, isVisible);
// TODO(b/308851855): Skip animation for launching split from home, will refine later if (fromInit) {
boolean skipAnimForSplit = enableSplitContextually() &&
mLauncher.areBothSplitAppsConfirmed() &&
mLauncher.getStateManager().getState() == LauncherState.NORMAL;
if (skipAnimForSplit || fromInit) {
duration = 0; duration = 0;
} }
return mTaskbarLauncherStateController.applyState(duration, startAnimation); return mTaskbarLauncherStateController.applyState(duration, startAnimation);
@@ -928,11 +928,30 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
} }
} }
if (splitRoot1 != null) {
// Set the highest level split root alpha; we could technically use the parent of
// either splitRoot1 or splitRoot2
val parentToken = splitRoot1.parent
var rootLayer: Change? = null
if (parentToken != null) {
rootLayer = transitionInfo.getChange(parentToken)
}
if (rootLayer != null && rootLayer.leash != null) {
openingTargets.add(rootLayer.leash)
}
}
val animTransaction = Transaction() val animTransaction = Transaction()
val animator = ValueAnimator.ofFloat(0f, 1f) val animator = ValueAnimator.ofFloat(0f, 1f)
animator.setDuration(QuickstepTransitionManager.SPLIT_LAUNCH_DURATION.toLong()) animator.setDuration(QuickstepTransitionManager.SPLIT_LAUNCH_DURATION.toLong())
animator.addUpdateListener { valueAnimator: ValueAnimator -> animator.addUpdateListener { valueAnimator: ValueAnimator ->
val progress = valueAnimator.animatedFraction val progress =
Interpolators.clampToProgress(
Interpolators.LINEAR,
valueAnimator.animatedFraction,
0.8f,
1f
)
for (leash in openingTargets) { for (leash in openingTargets) {
animTransaction.setAlpha(leash, progress) animTransaction.setAlpha(leash, progress)
} }
@@ -954,19 +973,6 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
} }
) )
if (splitRoot1 != null) {
// Set the highest level split root alpha; we could technically use the parent of
// either splitRoot1 or splitRoot2
val parentToken = splitRoot1.parent
var rootLayer: Change? = null
if (parentToken != null) {
rootLayer = transitionInfo.getChange(parentToken)
}
if (rootLayer != null && rootLayer.leash != null) {
t.setAlpha(rootLayer.leash, 1f)
}
}
t.apply() t.apply()
animator.start() animator.start()
} }
@@ -176,6 +176,11 @@ public class SplitToWorkspaceController {
pendingAnimation.addListener(new AnimatorListenerAdapter() { pendingAnimation.addListener(new AnimatorListenerAdapter() {
private boolean mIsCancelled = false; private boolean mIsCancelled = false;
@Override
public void onAnimationStart(Animator animation) {
mController.launchSplitTasks(aBoolean -> cleanUp());
}
@Override @Override
public void onAnimationCancel(Animator animation) { public void onAnimationCancel(Animator animation) {
mIsCancelled = true; mIsCancelled = true;
@@ -185,7 +190,6 @@ public class SplitToWorkspaceController {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
if (!mIsCancelled) { if (!mIsCancelled) {
mController.launchSplitTasks(aBoolean -> cleanUp());
InteractionJankMonitorWrapper.end(Cuj.CUJ_SPLIT_SCREEN_ENTER); InteractionJankMonitorWrapper.end(Cuj.CUJ_SPLIT_SCREEN_ENTER);
} }
} }