Update side stage outline visibility with swipe gesture

Bug: 200850654
Test: enabled side stage outline, observed the outline updates its
      visibility with swipe gesture properly.
Change-Id: I59fcb1fdbb07f5ad5327036972ebbe20ebeb11b7
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 11b9df0..3aeab7b 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -789,7 +789,7 @@
             mRecentsAnimationStartCallbacks.clear();
         }
 
-        TaskViewUtils.setDividerBarShown(mRecentsAnimationTargets.nonApps, false);
+        TaskViewUtils.setSplitAuxiliarySurfacesShown(mRecentsAnimationTargets.nonApps, false);
 
         // Only add the callback to enable the input consumer after we actually have the controller
         mStateCallback.runOnceAtState(STATE_APP_CONTROLLER_RECEIVED | STATE_GESTURE_STARTED,
@@ -806,7 +806,7 @@
         mStateCallback.setStateOnUiThread(STATE_GESTURE_CANCELLED | STATE_HANDLER_INVALIDATED);
 
         if (mRecentsAnimationTargets != null) {
-            TaskViewUtils.setDividerBarShown(mRecentsAnimationTargets.nonApps, true);
+            TaskViewUtils.setSplitAuxiliarySurfacesShown(mRecentsAnimationTargets.nonApps, true);
         }
 
         // Defer clearing the controller and the targets until after we've updated the state
@@ -955,7 +955,8 @@
                 } else {
                     mStateCallback.setState(STATE_RESUME_LAST_TASK);
                 }
-                TaskViewUtils.setDividerBarShown(mRecentsAnimationTargets.nonApps, true);
+                TaskViewUtils.setSplitAuxiliarySurfacesShown(
+                        mRecentsAnimationTargets.nonApps, true);
                 break;
         }
         ActiveGestureLog.INSTANCE.addLog("onSettledOnEndTarget " + endTarget);
@@ -1598,7 +1599,7 @@
         mActivityInterface.onTransitionCancelled(wasVisible, mGestureState.getEndTarget());
 
         if (mRecentsAnimationTargets != null) {
-            TaskViewUtils.setDividerBarShown(mRecentsAnimationTargets.nonApps, true);
+            TaskViewUtils.setSplitAuxiliarySurfacesShown(mRecentsAnimationTargets.nonApps, true);
         }
 
         // Leave the pending invisible flag, as it may be used by wallpaper open animation.
@@ -1841,7 +1842,7 @@
     @Override
     public void onRecentsAnimationFinished(RecentsAnimationController controller) {
         if (!controller.getFinishTargetIsLauncher()) {
-            TaskViewUtils.setDividerBarShown(mRecentsAnimationTargets.nonApps, true);
+            TaskViewUtils.setSplitAuxiliarySurfacesShown(mRecentsAnimationTargets.nonApps, true);
         }
         mRecentsAnimationController = null;
         mRecentsAnimationTargets = null;
diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java
index 37d88ae..284bc03 100644
--- a/quickstep/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java
@@ -35,7 +35,6 @@
 import static com.android.launcher3.anim.Interpolators.clampToProgress;
 import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
 import static com.android.launcher3.statehandlers.DepthController.DEPTH;
-import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
 import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
 import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
 
@@ -505,7 +504,7 @@
                 nonAppTargets, depthController, pa);
         if (launcherClosing) {
             // TODO(b/182592057): differentiate between "restore split" vs "launch fullscreen app"
-            TaskViewUtils.setDividerBarShown(nonAppTargets, true);
+            TaskViewUtils.setSplitAuxiliarySurfacesShown(nonAppTargets, true);
         }
 
         Animator childStateAnimation = null;
@@ -560,18 +559,20 @@
         anim.addListener(windowAnimEndListener);
     }
 
-    static void setDividerBarShown(RemoteAnimationTargetCompat[] nonApps, boolean shown) {
+    static void setSplitAuxiliarySurfacesShown(RemoteAnimationTargetCompat[] nonApps,
+            boolean shown) {
         // TODO(b/182592057): make this part of the animations instead.
         if (nonApps != null && nonApps.length > 0) {
+            SurfaceControl.Transaction t = new SurfaceControl.Transaction();
             for (int i = 0; i < nonApps.length; ++i) {
                 final RemoteAnimationTargetCompat targ = nonApps[i];
-                if (targ.windowType == TYPE_DOCK_DIVIDER) {
-                    SurfaceControl.Transaction t = new SurfaceControl.Transaction();
-                    t.setVisibility(targ.leash.getSurfaceControl(), shown);
-                    t.apply();
-                    t.close();
+                final SurfaceControl leash = targ.leash.getSurfaceControl();
+                if (targ.windowType == TYPE_DOCK_DIVIDER && leash != null) {
+                    t.setVisibility(leash, shown);
                 }
             }
+            t.apply();
+            t.close();
         }
     }
 }