From 5b9c3bf25ef7660e6ea0025df78bb40f4f15bff7 Mon Sep 17 00:00:00 2001 From: Jordan Demeulenaere Date: Tue, 19 Jul 2022 16:47:14 +0200 Subject: Don't schedule SurfaceControl transaction if it is not valid This CL adds a preventive check to ensure that we don't schedule a transaction on a SurfaceControl that was released. Bug: 237183762 Test: Manual Change-Id: I86f8372c7de8234f5f1dd941dbf1c9eb9fbef647 Merged-In: I86f8372c7de8234f5f1dd941dbf1c9eb9fbef647 --- .../android/systemui/animation/ActivityLaunchAnimator.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 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 bb6eb78aac65..323db8526470 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt @@ -494,9 +494,10 @@ class ActivityLaunchAnimator( } private fun applyStateToWindow(window: RemoteAnimationTarget, state: LaunchAnimator.State) { - if (transactionApplierView.viewRootImpl == null) { - // If the view root we synchronize with was detached, don't apply any transaction - // (as [SyncRtSurfaceTransactionApplier.scheduleApply] would otherwise throw). + if (transactionApplierView.viewRootImpl == null || !window.leash.isValid) { + // Don't apply any transaction if the view root we synchronize with was detached or + // if the SurfaceControl associated with [window] is not valid, as + // [SyncRtSurfaceTransactionApplier.scheduleApply] would otherwise throw. return } @@ -557,9 +558,10 @@ class ActivityLaunchAnimator( state: LaunchAnimator.State, linearProgress: Float ) { - if (transactionApplierView.viewRootImpl == null) { - // If the view root we synchronize with was detached, don't apply any transaction - // (as [SyncRtSurfaceTransactionApplier.scheduleApply] would otherwise throw). + if (transactionApplierView.viewRootImpl == null || !navigationBar.leash.isValid) { + // Don't apply any transaction if the view root we synchronize with was detached or + // if the SurfaceControl associated with [navigationBar] is not valid, as + // [SyncRtSurfaceTransactionApplier.scheduleApply] would otherwise throw. return } -- cgit v1.2.3-59-g8ed1b