Fix crash/flicker with taskbar when canceling drag and drop am: 729eb8458b

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

Change-Id: Ie965f2429a0b484e98dfed17d6bf702c11539c8f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java
index 9ba4a65..5c10565 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java
@@ -477,7 +477,6 @@
                 tx.setScale(dragSurface, scale, scale);
                 tx.setAlpha(dragSurface, alpha);
                 tx.apply();
-                tx.close();
             }
         });
         mReturnAnimator.addListener(new AnimatorListenerAdapter() {
@@ -498,6 +497,7 @@
             }
 
             private void cleanUpSurface() {
+                tx.close();
                 maybeOnDragEnd();
                 // Synchronize removing the drag surface with the next draw after calling
                 // maybeOnDragEnd()
@@ -508,7 +508,6 @@
                 syncer.addToSync(syncId, viewRoot.getView());
                 syncer.addTransactionToSync(syncId, transaction);
                 syncer.markSyncReady(syncId);
-
                 mReturnAnimator = null;
             }
         });