From 8ae56bd4e397e762aca90af8a371603b7c2feaab Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 29 Jun 2021 17:02:48 -0700 Subject: [PATCH] Fully null check mRecentsAnimationController It's already null checked everywhere else it's used. Test: none Fixes: 187354606 Change-Id: I50913c38b2653fe292d84fabe111ff3a3e10736d --- .../android/quickstep/AbsSwipeUpHandler.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 7f38923671..524cd53839 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -140,7 +140,8 @@ public abstract class AbsSwipeUpHandler, private final ArrayList mRecentsAnimationStartCallbacks = new ArrayList<>(); private final OnScrollChangedListener mOnRecentsScrollListener = this::onRecentsViewScroll; - protected RecentsAnimationController mRecentsAnimationController; + // Null if the recents animation hasn't started yet or has been canceled or finished. + protected @Nullable RecentsAnimationController mRecentsAnimationController; protected RecentsAnimationTargets mRecentsAnimationTargets; protected T mActivity; protected Q mRecentsView; @@ -1353,8 +1354,10 @@ public abstract class AbsSwipeUpHandler, @UiThread private void resumeLastTask() { - mRecentsAnimationController.finish(false /* toRecents */, null); - ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimation", false); + if (mRecentsAnimationController != null) { + mRecentsAnimationController.finish(false /* toRecents */, null); + ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimation", false); + } doLogGesture(LAST_TASK, null); reset(); } @@ -1662,13 +1665,17 @@ public abstract class AbsSwipeUpHandler, } } else { mActivityInterface.onLaunchTaskFailed(); - mRecentsAnimationController.finish(true /* toRecents */, null); + if (mRecentsAnimationController != null) { + mRecentsAnimationController.finish(true /* toRecents */, null); + } } }, true /* freezeTaskList */); } else { mActivityInterface.onLaunchTaskFailed(); Toast.makeText(mContext, R.string.activity_not_available, LENGTH_SHORT).show(); - mRecentsAnimationController.finish(true /* toRecents */, null); + if (mRecentsAnimationController != null) { + mRecentsAnimationController.finish(true /* toRecents */, null); + } } } mCanceled = false;