From d25fb5bd0b2681bcc3add2e60a7693ed5bf74420 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Wed, 5 Jan 2022 14:43:43 -0800 Subject: [PATCH] Use list instead of array when filtering non-app leashes * Non-apps leashes can contain non-divider targets, which was creating null elements in the array when an index didn't get assigned. * With a list we don't have to worry about empty index gaps * Also remove the animation for the divider for certain gestures because the surface isn't always valid for the full duration of the animation. We probably would need to synchronize with rest of recents animation Fixes: 212218930 Test: No longer crashes when swipe up, hold, then swipe down Change-Id: Ia1fc4d66e73f21b55fdbfe59342af025e2a525d9 --- quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java | 4 ++-- quickstep/src/com/android/quickstep/TaskViewUtils.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index c7f1edd292..9f1e47f15a 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1001,7 +1001,7 @@ public abstract class AbsSwipeUpHandler, } if (mRecentsAnimationTargets != null) { TaskViewUtils.setSplitAuxiliarySurfacesShown(mRecentsAnimationTargets.nonApps, - true /*shown*/, true /*animate*/); + true /*shown*/, false /*animate*/); } break; } @@ -1654,7 +1654,7 @@ public abstract class AbsSwipeUpHandler, if (mRecentsAnimationTargets != null) { TaskViewUtils.setSplitAuxiliarySurfacesShown(mRecentsAnimationTargets.nonApps, - true /*shown*/, true /*animate*/); + true /*shown*/, false /*animate*/); } // Leave the pending invisible flag, as it may be used by wallpaper open animation. diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 14f3ec453c..5d9a537165 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -84,6 +84,7 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams; import java.util.ArrayList; +import java.util.List; /** * Utility class for helpful methods related to {@link TaskView} objects and their tasks. @@ -606,13 +607,13 @@ public final class TaskViewUtils { } SurfaceControl.Transaction t = new SurfaceControl.Transaction(); - SurfaceControl[] auxiliarySurfaces = new SurfaceControl[nonApps.length]; + List auxiliarySurfaces = new ArrayList<>(nonApps.length); boolean hasSurfaceToAnimate = false; for (int i = 0; i < nonApps.length; ++i) { final RemoteAnimationTargetCompat targ = nonApps[i]; final SurfaceControl leash = targ.leash.getSurfaceControl(); if (targ.windowType == TYPE_DOCK_DIVIDER && leash != null) { - auxiliarySurfaces[i] = leash; + auxiliarySurfaces.add(leash); hasSurfaceToAnimate = true; } }