Merge "Use launcher surface when removing launch target" into sc-dev am: e55878cedf am: 2327552bad

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15193282

Change-Id: I6757587d671c2de1c6e8866b860331e72cdb1b8b
diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
index bb8b62d..82582ee 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
@@ -180,6 +180,12 @@
      * Sets the specified app target surface to apply the blur to.
      */
     public void setSurface(SurfaceControl surface) {
+        // Set launcher as the SurfaceControl when we don't need an external target anymore.
+        if (surface == null) {
+            ViewRootImpl viewRootImpl = mLauncher.getDragLayer().getViewRootImpl();
+            surface = viewRootImpl != null ? viewRootImpl.getSurfaceControl() : null;
+        }
+
         if (mSurface != surface) {
             mSurface = surface;
             if (surface != null) {