Merge "Revert "Remove DepartingAnimationTarget from BackMotionEvent(2/2)"" into main
diff --git a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java
index 2ff42cd..783ec2c 100644
--- a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java
+++ b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java
@@ -220,7 +220,7 @@
mHandler.post(() -> {
LauncherBackAnimationController controller = mControllerRef.get();
if (controller != null) {
- controller.initBackMotion(backEvent);
+ controller.startBack(backEvent);
mProgressAnimator.onBackStarted(backEvent, event -> {
float backProgress = event.getProgress();
controller.mBackProgress =
@@ -270,7 +270,6 @@
}
}
controller.mAnimationFinishedCallback = finishedCallback;
- controller.startBack();
}
@Override
@@ -295,32 +294,34 @@
mBackCallback = null;
}
- private void initBackMotion(BackMotionEvent backEvent) {
+ private void startBack(BackMotionEvent backEvent) {
// in case we're still animating an onBackCancelled event, let's remove the finish-
// callback from the progress animator to prevent calling finishAnimation() before
// restarting a new animation
- // Side note: initBackMotion is never called during the post-commit phase if the back
- // gesture was committed (not cancelled). BackAnimationController prevents that. Therefore
- // we don't have to handle that case.
+ // Side note: startBack is never called during the post-commit phase if the back gesture
+ // was committed (not cancelled). BackAnimationController prevents that. Therefore we
+ // don't have to handle that case.
mProgressAnimator.removeOnBackCancelledFinishCallback();
mBackInProgress = true;
- mInitialTouchPos.set(backEvent.getTouchX(), backEvent.getTouchY());
- }
- private void startBack() {
- if (mBackTarget == null) {
+ RemoteAnimationTarget appTarget = backEvent.getDepartingAnimationTarget();
+
+ if (appTarget == null || appTarget.leash == null || !appTarget.leash.isValid()) {
return;
}
mTransaction
- .show(mBackTarget.leash)
+ .show(appTarget.leash)
.setAnimationTransaction();
- mStartRect.set(mBackTarget.windowConfiguration.getMaxBounds());
+ mBackTarget = appTarget;
+ mInitialTouchPos.set(backEvent.getTouchX(), backEvent.getTouchY());
+
+ mStartRect.set(appTarget.windowConfiguration.getMaxBounds());
// inset bottom in case of taskbar being present
if (!predictiveBackThreeButtonNav() || mLauncher.getDeviceProfile().isTaskbarPresent
|| DisplayController.getNavigationMode(mLauncher) == NavigationMode.NO_BUTTON) {
- mStartRect.inset(0, 0, 0, mBackTarget.contentInsets.bottom);
+ mStartRect.inset(0, 0, 0, appTarget.contentInsets.bottom);
}
mLauncherTargetView = mQuickstepTransitionManager.findLauncherView(