From 5841b168fb941d980ab82eb73b049fa0c17c52f4 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Mon, 21 Aug 2023 18:46:44 +0000 Subject: [PATCH] Add null check for mRecentsView when recents animation is canceled Flag: none Test: TaplTestsPersistentTaskbar#testHideTaskbarPersistsOnRecreate Fixes: 295796661 Change-Id: Idb454105cc86f1b9dbe720ba0ee28ad03436ec14 --- .../android/quickstep/AbsSwipeUpHandler.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 796840d829..7b6f10b8c5 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -518,20 +518,22 @@ public abstract class AbsSwipeUpHandler, // Set up a entire animation lifecycle callback to notify the current recents view when // the animation is canceled mGestureState.runOnceAtState(STATE_RECENTS_ANIMATION_CANCELED, () -> { - HashMap snapshots = - mGestureState.consumeRecentsAnimationCanceledSnapshot(); - if (snapshots != null) { - mRecentsView.switchToScreenshot(snapshots, () -> { - if (mRecentsAnimationController != null) { - mRecentsAnimationController.cleanupScreenshot(); - } else if (mDeferredCleanupRecentsAnimationController != null) { - mDeferredCleanupRecentsAnimationController.cleanupScreenshot(); - mDeferredCleanupRecentsAnimationController = null; - } - }); - mRecentsView.onRecentsAnimationComplete(); - } - }); + if (mRecentsView == null) return; + + HashMap snapshots = + mGestureState.consumeRecentsAnimationCanceledSnapshot(); + if (snapshots != null) { + mRecentsView.switchToScreenshot(snapshots, () -> { + if (mRecentsAnimationController != null) { + mRecentsAnimationController.cleanupScreenshot(); + } else if (mDeferredCleanupRecentsAnimationController != null) { + mDeferredCleanupRecentsAnimationController.cleanupScreenshot(); + mDeferredCleanupRecentsAnimationController = null; + } + }); + mRecentsView.onRecentsAnimationComplete(); + } + }); setupRecentsViewUi(); mRecentsView.runOnPageScrollsInitialized(this::linkRecentsViewScroll);