From 1463f86a38af8b8f317c4689fcfb5f6ddbd17ecc Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Thu, 13 Jul 2023 10:50:09 -0700 Subject: [PATCH] Fix null pointer in createRecentsWindowAnimator. Flag: not needed Fixes: 289715966 Test: performed several gestures Change-Id: Ib18dd0ffbfbc99220e1c7f1970259f139e21f67f --- .../src/com/android/quickstep/RecentsActivity.java | 14 +++++++++++--- .../src/com/android/quickstep/TaskViewUtils.java | 9 +++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index 8a9c3c826a..c785a9ab04 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -45,6 +45,7 @@ import android.view.View; import android.window.RemoteTransition; import android.window.SplashScreen; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.app.animation.Interpolators; @@ -239,6 +240,11 @@ public final class RecentsActivity extends StatefulActivity { } final TaskView taskView = (TaskView) v; + final RecentsView recentsView = taskView.getRecentsView(); + if (recentsView == null) { + return super.getActivityLaunchOptions(v, item); + } + RunnableList onEndCallback = new RunnableList(); mActivityLaunchAnimationRunner = new RemoteAnimationFactory() { @@ -247,7 +253,7 @@ public final class RecentsActivity extends StatefulActivity { RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets, AnimationResult result) { mHandler.removeCallbacks(mAnimationStartTimeoutRunnable); - AnimatorSet anim = composeRecentsLaunchAnimator(taskView, appTargets, + AnimatorSet anim = composeRecentsLaunchAnimator(recentsView, taskView, appTargets, wallpaperTargets, nonAppTargets); anim.addListener(resetStateListener()); result.setAnimation(anim, RecentsActivity.this, onEndCallback::executeAllAndDestroy, @@ -282,14 +288,16 @@ public final class RecentsActivity extends StatefulActivity { /** * Composes the animations for a launch from the recents list if possible. */ - private AnimatorSet composeRecentsLaunchAnimator(TaskView taskView, + private AnimatorSet composeRecentsLaunchAnimator( + @NonNull RecentsView recentsView, + @NonNull TaskView taskView, RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets) { AnimatorSet target = new AnimatorSet(); boolean activityClosing = taskIsATargetWithMode(appTargets, getTaskId(), MODE_CLOSING); PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION); - createRecentsWindowAnimator(taskView, !activityClosing, appTargets, + createRecentsWindowAnimator(recentsView, taskView, !activityClosing, appTargets, wallpaperTargets, nonAppTargets, null /* depthController */, pa); target.play(pa.buildAnim()); diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index c9bad38546..538aba9e21 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -160,13 +160,14 @@ public final class TaskViewUtils { } public static void createRecentsWindowAnimator( - @NonNull TaskView v, boolean skipViewChanges, + @NonNull RecentsView recentsView, + @NonNull TaskView v, + boolean skipViewChanges, @NonNull RemoteAnimationTarget[] appTargets, @NonNull RemoteAnimationTarget[] wallpaperTargets, @NonNull RemoteAnimationTarget[] nonAppTargets, @Nullable DepthController depthController, PendingAnimation out) { - RecentsView recentsView = v.getRecentsView(); boolean isQuickSwitch = v.isEndQuickswitchCuj(); v.setEndQuickswitchCuj(false); @@ -606,8 +607,8 @@ public final class TaskViewUtils { TaskView taskView = findTaskViewToLaunch(recentsView, v, appTargets); PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION); - createRecentsWindowAnimator(taskView, skipLauncherChanges, appTargets, wallpaperTargets, - nonAppTargets, depthController, pa); + createRecentsWindowAnimator(recentsView, taskView, skipLauncherChanges, appTargets, + wallpaperTargets, nonAppTargets, depthController, pa); if (launcherClosing) { // TODO(b/182592057): differentiate between "restore split" vs "launch fullscreen app" TaskViewUtils.createSplitAuxiliarySurfacesAnimator(nonAppTargets, true /*shown*/,