From d86c5657e0458cbc5674c9d76c3a93c773a55060 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Fri, 5 May 2023 13:02:36 -0700 Subject: [PATCH] Fix null-pointers in SurfaceTransactionApplier constructor. A recurring class of null pointers are caused by using views with no view root implementation in SurfaceTransactionApplier from QuickstepTransitionManager. This can happen when we use launcher views after it has been destroyed. - No longer using mDragLayer in getFallbackClosingWindowAnimators; simply applying the transaction immediately. - Forcefully using getFallbackClosingWindowAnimators when launcher is destroyed. Flag: not needed Bug: 278833389 Test: launches and closed several apps in 3-button and gesture nav mode Change-Id: I83b3aec1488fe9666bd0301a6044a181bb05dbdd --- .../com/android/launcher3/QuickstepTransitionManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 45163cb0a8..0d5f5dfffa 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -1448,7 +1448,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener */ private Animator getFallbackClosingWindowAnimators(RemoteAnimationTarget[] appTargets) { final int rotationChange = getRotationChange(appTargets); - SurfaceTransactionApplier surfaceApplier = new SurfaceTransactionApplier(mDragLayer); Matrix matrix = new Matrix(); Point tmpPos = new Point(); Rect tmpRect = new Rect(); @@ -1504,7 +1503,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener .setAlpha(1f); } } - surfaceApplier.scheduleApply(transaction); + transaction.getTransaction().apply(); } }); @@ -1592,7 +1591,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener boolean playFallBackAnimation = (launcherView == null && launcherIsForceInvisibleOrOpening) || mLauncher.getWorkspace().isOverlayShown() - || hasMultipleTargetsWithMode(appTargets, MODE_CLOSING); + || hasMultipleTargetsWithMode(appTargets, MODE_CLOSING) + || mLauncher.isDestroyed(); boolean playWorkspaceReveal = true; boolean skipAllAppsScale = false;