Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51eda6a6 authored by Massimo Carli's avatar Massimo Carli
Browse files

[25/n] Handle animation for transparent activities

In case of transparent activities, the first opaque below needs
to be collected. In this case all the activities will need to be
animated in the LetterboxAnimationHandler

Flag: com.android.window.flags.app_compat_refactoring
Fix: 406181296
Test: atest WmTests:WindowContainerTransactionTests

Change-Id: Iff7d0c0b20a853c1d0273b52ca01459765586f83
parent 13a6bfe7
Loading
Loading
Loading
Loading
+18 −15
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.animation.RectEvaluator
import android.animation.ValueAnimator
import android.graphics.Rect
import android.os.IBinder
import android.view.SurfaceControl
import android.view.SurfaceControl.Transaction
import android.window.TransitionInfo
import android.window.TransitionRequestInfo
@@ -104,7 +103,6 @@ class LetterboxAnimationHandler @Inject constructor(
                taskBounds,
                startBounds
            )
            val leash: SurfaceControl = change.leash
            val tx: Transaction = transactionSupplier.get()
            animExecutor.execute {
                boundsAnimator?.cancel()
@@ -137,8 +135,10 @@ class LetterboxAnimationHandler @Inject constructor(
            boundsAnimator?.addUpdateListener { animation ->
                val rect =
                    animation.getAnimatedValue() as Rect

                for (c in info.changes) {
                    tx.setPosition(
                    leash,
                        c.leash,
                        rect.left.toFloat(),
                        rect.top.toFloat()
                    ).apply {
@@ -150,8 +150,11 @@ class LetterboxAnimationHandler @Inject constructor(
                        )
                    }.apply()
                }
            }
            animExecutor.execute {
                tx.show(leash).apply()
                for (c in info.changes) {
                    tx.show(c.leash).apply()
                }
                boundsAnimator?.start()
            }
            return true
+8 −2
Original line number Diff line number Diff line
@@ -1196,11 +1196,17 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                if (currentTask != null) {
                    final ActivityRecord top = currentTask.topRunningActivity();
                    if (top != null) {
                        final ActivityRecord topOpaqueActivity = top.mAppCompatController
                                .getTransparentPolicy().getFirstOpaqueActivity().orElse(top);
                        if (chain.mTransition != null) {
                            chain.mTransition.collect(top);
                            // We also add the topOpaqueActivity if top is transparent.
                            if (top != topOpaqueActivity) {
                                chain.mTransition.collect(topOpaqueActivity);
                            }
                        top.mAppCompatController.getReachabilityPolicy().handleDoubleTap(doubleTapX,
                                doubleTapY);
                        }
                        topOpaqueActivity.mAppCompatController.getReachabilityPolicy()
                                .handleDoubleTap(doubleTapX, doubleTapY);
                    }
                }
                effects |= TRANSACT_EFFECTS_CLIENT_CONFIG;