From f4c6df542c8c0dca3afdbb9e42a490186cb8a6c6 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Tue, 22 Oct 2024 02:44:59 +0000 Subject: Fix NPE crash when start pending predictive back animation. BackNavigation will start pending predictive back animation after previous transition finish. While ensuer the visibility of the windows in previous transition, check whether the surface still exist before prepareSurfaces. Flag: EXEMPT bugfix Bug: 374814683 Test: presubmit Change-Id: I49faff57249f7b0ce255ea7c8b9f29fec1b97a36 --- .../core/java/com/android/server/wm/BackNavigationController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/BackNavigationController.java b/services/core/java/com/android/server/wm/BackNavigationController.java index ccd59969cec8..d76708b5f399 100644 --- a/services/core/java/com/android/server/wm/BackNavigationController.java +++ b/services/core/java/com/android/server/wm/BackNavigationController.java @@ -994,7 +994,9 @@ class BackNavigationController { // Ensure the final animation targets which hidden by transition could be visible. for (int i = 0; i < targets.size(); i++) { final WindowContainer wc = targets.get(i).mContainer; - wc.prepareSurfaces(); + if (wc.mSurfaceControl != null) { + wc.prepareSurfaces(); + } } // The pending builder could be cleared due to prepareSurfaces -- cgit v1.2.3-59-g8ed1b