summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityBackAnimation.kt21
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/back/CustomCrossActivityBackAnimation.kt16
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/back/DefaultCrossActivityBackAnimation.kt15
3 files changed, 39 insertions, 13 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityBackAnimation.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityBackAnimation.kt
index 71fc8c3a01ea..7c0837eaf2f2 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityBackAnimation.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityBackAnimation.kt
@@ -87,7 +87,7 @@ abstract class CrossActivityBackAnimation(
private var triggerBack = false
private var finishCallback: IRemoteAnimationFinishedCallback? = null
private val progressAnimator = BackProgressAnimator()
- private val displayBoundsMargin =
+ protected val displayBoundsMargin =
context.resources.getDimension(R.dimen.cross_task_back_vertical_margin)
private val gestureInterpolator = Interpolators.BACK_GESTURE
@@ -117,6 +117,12 @@ abstract class CrossActivityBackAnimation(
abstract val allowEnteringYShift: Boolean
/**
+ * Subclasses must set the [startClosingRect] and [targetClosingRect] to define the movement
+ * of the closingTarget during pre-commit phase.
+ */
+ abstract fun preparePreCommitClosingRectMovement(@BackEvent.SwipeEdge swipeEdge: Int)
+
+ /**
* Subclasses must set the [startEnteringRect] and [targetEnteringRect] to define the movement
* of the enteringTarget during pre-commit phase.
*/
@@ -170,18 +176,7 @@ abstract class CrossActivityBackAnimation(
// Offset start rectangle to align task bounds.
backAnimRect.offsetTo(0, 0)
- startClosingRect.set(backAnimRect)
-
- // scale closing target into the middle for rhs and to the right for lhs
- targetClosingRect.set(startClosingRect)
- targetClosingRect.scaleCentered(MAX_SCALE)
- if (backMotionEvent.swipeEdge != BackEvent.EDGE_RIGHT) {
- targetClosingRect.offset(
- startClosingRect.right - targetClosingRect.right - displayBoundsMargin,
- 0f
- )
- }
-
+ preparePreCommitClosingRectMovement(backMotionEvent.swipeEdge)
preparePreCommitEnteringRectMovement()
background.ensureBackground(
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/CustomCrossActivityBackAnimation.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/back/CustomCrossActivityBackAnimation.kt
index e6ec2b449616..ab359bdc18b5 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/CustomCrossActivityBackAnimation.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/CustomCrossActivityBackAnimation.kt
@@ -23,6 +23,7 @@ import android.view.Choreographer
import android.view.SurfaceControl
import android.view.animation.Animation
import android.view.animation.Transformation
+import android.window.BackEvent
import android.window.BackMotionEvent
import android.window.BackNavigationInfo
import com.android.internal.R
@@ -74,6 +75,21 @@ class CustomCrossActivityBackAnimation(
)
)
+ override fun preparePreCommitClosingRectMovement(swipeEdge: Int) {
+ startClosingRect.set(backAnimRect)
+
+ // scale closing target to the left for right-hand-swipe and to the right for
+ // left-hand-swipe
+ targetClosingRect.set(startClosingRect)
+ targetClosingRect.scaleCentered(MAX_SCALE)
+ val offset = if (swipeEdge != BackEvent.EDGE_RIGHT) {
+ startClosingRect.right - targetClosingRect.right - displayBoundsMargin
+ } else {
+ -targetClosingRect.left + displayBoundsMargin
+ }
+ targetClosingRect.offset(offset, 0f)
+ }
+
override fun preparePreCommitEnteringRectMovement() {
// No movement for the entering rect
startEnteringRect.set(startClosingRect)
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/DefaultCrossActivityBackAnimation.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/back/DefaultCrossActivityBackAnimation.kt
index d6c5349201b8..9f07e5b1854a 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/DefaultCrossActivityBackAnimation.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/DefaultCrossActivityBackAnimation.kt
@@ -18,6 +18,7 @@ package com.android.wm.shell.back
import android.content.Context
import android.view.Choreographer
import android.view.SurfaceControl
+import android.window.BackEvent
import com.android.wm.shell.R
import com.android.wm.shell.RootTaskDisplayAreaOrganizer
import com.android.wm.shell.animation.Interpolators
@@ -47,6 +48,20 @@ constructor(
context.resources.getDimension(R.dimen.cross_activity_back_entering_start_offset)
override val allowEnteringYShift = true
+ override fun preparePreCommitClosingRectMovement(swipeEdge: Int) {
+ startClosingRect.set(backAnimRect)
+
+ // scale closing target into the middle for rhs and to the right for lhs
+ targetClosingRect.set(startClosingRect)
+ targetClosingRect.scaleCentered(MAX_SCALE)
+ if (swipeEdge != BackEvent.EDGE_RIGHT) {
+ targetClosingRect.offset(
+ startClosingRect.right - targetClosingRect.right - displayBoundsMargin,
+ 0f
+ )
+ }
+ }
+
override fun preparePreCommitEnteringRectMovement() {
// the entering target starts 96dp to the left of the screen edge...
startEnteringRect.set(startClosingRect)