Correctly handle click (with no drag) when resizing a window.

Currently if user moves the mouse to the window edge where
the pointer changes to a double arrow and then clicks (without
dragging) the freeform window will resize to fullscreen which is
strange.

Bug: 28318822
Change-Id: Ie47a80953dd91f998aa1c32662b363fe0a08fa90
diff --git a/services/core/java/com/android/server/wm/TaskPositioner.java b/services/core/java/com/android/server/wm/TaskPositioner.java
index ae70aa8..b5bde403 100644
--- a/services/core/java/com/android/server/wm/TaskPositioner.java
+++ b/services/core/java/com/android/server/wm/TaskPositioner.java
@@ -189,9 +189,10 @@
                     final boolean wasResizing = mResizing;
                     synchronized (mService.mWindowMap) {
                         endDragLocked();
+                        mTask.getDimBounds(mTmpRect);
                     }
                     try {
-                        if (wasResizing) {
+                        if (wasResizing && !mTmpRect.equals(mWindowDragBounds)) {
                             // We were using fullscreen surface during resizing. Request
                             // resizeTask() one last time to restore surface to window size.
                             mService.mActivityManager.resizeTask(
@@ -376,6 +377,10 @@
         }
 
         mWindowOriginalBounds.set(mTmpRect);
+
+        // Make sure we always have valid drag bounds even if the drag ends before any move events
+        // have been handled.
+        mWindowDragBounds.set(mTmpRect);
     }
 
     private void endDragLocked() {