summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt34
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/animation/ActivityLaunchAnimatorTest.kt3
2 files changed, 30 insertions, 7 deletions
diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt
index a95ab5565ab9..288b842d947a 100644
--- a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt
+++ b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt
@@ -25,6 +25,7 @@ import android.graphics.Path
import android.graphics.Rect
import android.graphics.RectF
import android.os.Build
+import android.os.Handler
import android.os.Looper
import android.os.RemoteException
import android.util.Log
@@ -58,7 +59,14 @@ class ActivityLaunchAnimator(
/** The animator used when animating a Dialog into an app. */
// TODO(b/218989950): Remove this animator and instead set the duration of the dim fade out to
// TIMINGS.contentBeforeFadeOutDuration.
- private val dialogToAppAnimator: LaunchAnimator = DEFAULT_DIALOG_TO_APP_ANIMATOR
+ private val dialogToAppAnimator: LaunchAnimator = DEFAULT_DIALOG_TO_APP_ANIMATOR,
+
+ /**
+ * Whether we should disable the WindowManager timeout. This should be set to true in tests
+ * only.
+ */
+ // TODO(b/301385865): Remove this flag.
+ private val disableWmTimeout: Boolean = false,
) {
companion object {
/** The timings when animating a View into an app. */
@@ -252,7 +260,7 @@ class ActivityLaunchAnimator(
Log.d(
TAG,
"Calling controller.onIntentStarted(willAnimate=$willAnimate) " +
- "[controller=$this]"
+ "[controller=$this]"
)
}
this.onIntentStarted(willAnimate)
@@ -432,7 +440,8 @@ class ActivityLaunchAnimator(
internal val delegate: AnimationDelegate
init {
- delegate = AnimationDelegate(controller, callback, listener, launchAnimator)
+ delegate =
+ AnimationDelegate(controller, callback, listener, launchAnimator, disableWmTimeout)
}
@BinderThread
@@ -462,13 +471,26 @@ class ActivityLaunchAnimator(
/** Listener for animation lifecycle events. */
private val listener: Listener? = null,
/** The animator to use to animate the window launch. */
- private val launchAnimator: LaunchAnimator = DEFAULT_LAUNCH_ANIMATOR
+ private val launchAnimator: LaunchAnimator = DEFAULT_LAUNCH_ANIMATOR,
+
+ /**
+ * Whether we should disable the WindowManager timeout. This should be set to true in tests
+ * only.
+ */
+ // TODO(b/301385865): Remove this flag.
+ disableWmTimeout: Boolean = false,
) : RemoteAnimationDelegate<IRemoteAnimationFinishedCallback> {
private val launchContainer = controller.launchContainer
private val context = launchContainer.context
private val transactionApplierView =
controller.openingWindowSyncView ?: controller.launchContainer
private val transactionApplier = SyncRtSurfaceTransactionApplier(transactionApplierView)
+ private val timeoutHandler =
+ if (!disableWmTimeout) {
+ Handler(Looper.getMainLooper())
+ } else {
+ null
+ }
private val matrix = Matrix()
private val invertMatrix = Matrix()
@@ -488,11 +510,11 @@ class ActivityLaunchAnimator(
@UiThread
internal fun postTimeout() {
- launchContainer.postDelayed(onTimeout, LAUNCH_TIMEOUT)
+ timeoutHandler?.postDelayed(onTimeout, LAUNCH_TIMEOUT)
}
private fun removeTimeout() {
- launchContainer.removeCallbacks(onTimeout)
+ timeoutHandler?.removeCallbacks(onTimeout)
}
@UiThread
diff --git a/packages/SystemUI/tests/src/com/android/systemui/animation/ActivityLaunchAnimatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/animation/ActivityLaunchAnimatorTest.kt
index cc004363a049..59c7e7669b63 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/animation/ActivityLaunchAnimatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/animation/ActivityLaunchAnimatorTest.kt
@@ -57,7 +57,8 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() {
@Before
fun setup() {
- activityLaunchAnimator = ActivityLaunchAnimator(testLaunchAnimator, testLaunchAnimator)
+ activityLaunchAnimator =
+ ActivityLaunchAnimator(testLaunchAnimator, testLaunchAnimator, disableWmTimeout = true)
activityLaunchAnimator.callback = callback
activityLaunchAnimator.addListener(listener)
}