From 09782e973223ebc1d3fecc14877a11fa3e66e51a Mon Sep 17 00:00:00 2001 From: Luca Zuccarini Date: Mon, 24 Mar 2025 12:46:31 +0000 Subject: Wrap reparent in a try-catch. Apparently checking for validity is not enough, as there can be a race condition that results in the leash being released between the check and the reparent call. Wrapping in a try-catch and logging the error instead to avoid crashing. Fix: 404507270 Flag: EXEMPT bugfix Test: manual Change-Id: Ie5b0787ff6cb0262b03e43224e5652173f71b401 --- .../com/android/systemui/animation/RemoteAnimationRunnerCompat.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/RemoteAnimationRunnerCompat.java b/packages/SystemUI/animation/src/com/android/systemui/animation/RemoteAnimationRunnerCompat.java index 9e08317d2c6b..041ccb567146 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/RemoteAnimationRunnerCompat.java +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/RemoteAnimationRunnerCompat.java @@ -199,8 +199,10 @@ public abstract class RemoteAnimationRunnerCompat extends IRemoteAnimationRunner info.releaseAllSurfaces(); // Make sure that the transition leashes created are not leaked. for (SurfaceControl leash : leashMap.values()) { - if (leash.isValid()) { + try { finishTransaction.reparent(leash, null); + } catch (Exception e) { + Log.e(TAG, "Failed to reparent leash", e); } } // Don't release here since launcher might still be using them. Instead -- cgit v1.2.3-59-g8ed1b