[wm]: Fixed TaskPositioner leak

If application process handles motion events late, it requests to start
moving task after MotionEvent.ACTION_UP is already fired. In that case,
system will wait for event that is not comming and cannot end drag state.
It's expected that the system finishes moving task when system receives
ACTION_UP by transfering touch focus. In a problem case, ACTION_UP event
is already sent to the application process before transfering touch focus.

If application receives ACTION_UP event after requesting moving task,
notify the system of finishing previous request.

Test: Quickly try to resize freeform windowing app repeatedly.
Test: atest WmTests:TaskPositioningControllerTests
Bug: 129507487

Change-Id: Ifa457ddc55524cae6da455e770472781a7805282
(cherry picked from commit 9a1cd7b5063229da536a1281916ae15ec9246d1a)
diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java
index 34273f3..ecb0941 100644
--- a/services/core/java/com/android/server/wm/Session.java
+++ b/services/core/java/com/android/server/wm/Session.java
@@ -316,6 +316,18 @@
     }
 
     @Override
+    public void finishMovingTask(IWindow window) {
+        if (DEBUG_TASK_POSITIONING) Slog.d(TAG_WM, "finishMovingTask");
+
+        long ident = Binder.clearCallingIdentity();
+        try {
+            mService.mTaskPositioningController.finishTaskPositioning(window);
+        } finally {
+            Binder.restoreCallingIdentity(ident);
+        }
+    }
+
+    @Override
     public void reportSystemGestureExclusionChanged(IWindow window, List<Rect> exclusionRects) {
         long ident = Binder.clearCallingIdentity();
         try {