From 45301a4d5400bb338f36bb4c08637921ff9c59ba Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Wed, 21 Jun 2023 22:05:58 +0800 Subject: [PATCH] Skip null surface when validating transition If SystemUI is died somehow before finishing a transition, the validators may run after SystemUI is restarted and a new transition is finished. Then the validators could contains some outdated state such as the windows were detached (especially wallpaper is died with SystemUI). So check if the surface exists to avoid crashing SystemUI again. Bug: 287539388 Test: Repeat kill SystemUI when running transition animation. Change-Id: I756fa0bae8b2d64487bc158b933ed21246d3b506 --- services/core/java/com/android/server/wm/Transition.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 3d9edcac8eb10..d4555724853fc 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -2665,7 +2665,10 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { mController.mStateValidators.add(() -> { for (int i = mTargets.size() - 1; i >= 0; --i) { final ChangeInfo change = mTargets.get(i); - if (!change.mContainer.isVisibleRequested()) continue; + if (!change.mContainer.isVisibleRequested() + || change.mContainer.mSurfaceControl == null) { + continue; + } Slog.e(TAG, "Force show for visible " + change.mContainer + " which may be hidden by transition unexpectedly"); change.mContainer.getSyncTransaction().show(change.mContainer.mSurfaceControl);