Use fullscreen sized buffer for drag resizing

- When drag resizing starts, set the surface size to fullscreen
  (plus any surface insets requested by win attrs), so that we don't
  reallocate buffers and the buffers don't get rejected by surfaceflinger
  due to size-mismatch.

- When drag resizing ends, restore the surface size to the original.

- Update shown frame before setSurfaceBoundariesLocked(), as the top-left
  of the window could change, we need to update the surface position. This
  fixes incorrect window positing during resizing by corners on top/left.

- When doing tap-detection, skip non-freeformed tasks. This fixes the
  bug where clicking near border of a window could dismiss it.

Change-Id: I5dc9fc34ff05685320b8fe5d491b9c066c6726e8
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 789354d..e467b19 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -557,7 +557,7 @@
 
         final Task task = mAppToken != null ? getTask() : null;
         final boolean nonFullscreenTask = task != null && !task.isFullscreen();
-        final boolean freeformWorkspace = inFreeformWorkspace();
+        final boolean freeformWorkspace = task != null && task.inFreeformWorkspace();
         if (nonFullscreenTask) {
             task.getBounds(mContainingFrame);
             final WindowState imeWin = mService.mInputMethodWindow;
@@ -897,6 +897,11 @@
         return stack == null ? mDisplayContent : stack.getDisplayContent();
     }
 
+    public DisplayInfo getDisplayInfo() {
+        final DisplayContent displayContent = getDisplayContent();
+        return displayContent != null ? displayContent.getDisplayInfo() : null;
+    }
+
     public int getDisplayId() {
         final DisplayContent displayContent = getDisplayContent();
         if (displayContent == null) {
@@ -935,7 +940,7 @@
         if (task != null) {
             task.getBounds(bounds);
             if (forTouch == BOUNDS_FOR_TOUCH) {
-                if (inFreeformWorkspace()) {
+                if (task.inFreeformWorkspace()) {
                     final int delta = calculatePixelFromDp(RESIZE_HANDLE_WIDTH_IN_DP);
                     bounds.inset(-delta, -delta);
                 }
@@ -1668,9 +1673,13 @@
     }
 
     boolean inFreeformWorkspace() {
-        final Task task = getTask();
-        return task != null && task.mStack != null &&
-                task.mStack.mStackId == FREEFORM_WORKSPACE_STACK_ID;
+        final Task task = mAppToken != null ? getTask() : null;
+        return task != null && task.inFreeformWorkspace();
+    }
+
+    boolean isDragResizing() {
+        final Task task = mAppToken != null ? getTask() : null;
+        return mService.mTaskPositioner != null && mService.mTaskPositioner.isTaskResizing(task);
     }
 
     private int calculatePixelFromDp(int dp) {