From 40f6f9b28a5ff8c83deff654844a6e485721d35a Mon Sep 17 00:00:00 2001 From: Johannes Gallmann Date: Tue, 19 Nov 2024 14:59:14 +0000 Subject: [PATCH] Polish back-to-home animation for 3-button-nav Move window to the screen center when the animation is driven by a long press on the back button in 3-button-nav. Bug: 373544911 Test: Manual, i.e. verify that app is center scaled Flag: com.android.window.flags.predictive_back_three_button_nav Change-Id: I8bacb923e3c81d99ddc1a8900bcc7423c8276c55 --- .../quickstep/LauncherBackAnimationController.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java index 6719ab74dc..1418671068 100644 --- a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java +++ b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java @@ -384,10 +384,11 @@ public class LauncherBackAnimationController { // Move the window along the Y axis. float top = (screenHeight - height) * 0.5f + deltaY; // Move the window along the X axis. - float left = event.getSwipeEdge() == BackEvent.EDGE_RIGHT - ? progress * mWindowScaleMarginX - : screenWidth - progress * mWindowScaleMarginX - width; - + float left = switch (event.getSwipeEdge()) { + case BackEvent.EDGE_RIGHT -> progress * mWindowScaleMarginX; + case BackEvent.EDGE_LEFT -> screenWidth - progress * mWindowScaleMarginX - width; + default -> (screenWidth - width) / 2; + }; mCurrentRect.set(left, top, left + width, top + height); float cornerRadius = Utilities.mapRange( progress, mWindowScaleStartCornerRadius, mWindowScaleEndCornerRadius);