Implement UX for IME with freeform windows

UX desires for this are: when IME appears for a freeform window,
1. Temporarily push the freeform window up to make room for IME
1a. However, do not push the top of the window off the screen
2. Any part of the window left under the IME becomes inset and
   thus handled by adjustPan or adjustResize.
3. Return the window to its original position when IME closes.
3a. Unless the window is moved while IME is up.
4. If the window is moved around while IME is up, do not change
   the content (ie. don't adjust insets).

This CL includes some fixes to related bugs as well:
- During adjustPan, the caption is now "unscrolled" so that
  it remains at the top of the window. Previously, the caption
  would be scrolled out of the window along with the content.
  This is done via setTranslation so it won't trigger relayout.
- The starting bounds of task-drag uses the task bounds instead
  of dim bounds. Dim bounds was based on the visible frame
  which excludes the IME inset; so, it was causing the window
  to be resized if the user tried to drag the window while IME
  was open. Going through the history, this was done to resolve
  some issue with resizing dialog activities. I've verified
  that behavior in this case is the same before and after this
  CL.

Bug: 119375946
Test: Manual since UX: open desktop display, open apps that
      use IME (both adjustPan and adjustResize).
      Also, atest WindowFrameTests
Change-Id: Id81d0b0a5f82be28fabed3ad22e713fc4fa7536d
diff --git a/services/core/java/com/android/server/wm/TaskPositioner.java b/services/core/java/com/android/server/wm/TaskPositioner.java
index b88e581..4a0831e 100644
--- a/services/core/java/com/android/server/wm/TaskPositioner.java
+++ b/services/core/java/com/android/server/wm/TaskPositioner.java
@@ -43,16 +43,15 @@
 import android.view.BatchedInputEventReceiver;
 import android.view.Choreographer;
 import android.view.Display;
+import android.view.InputApplicationHandle;
 import android.view.InputChannel;
 import android.view.InputDevice;
 import android.view.InputEvent;
+import android.view.InputWindowHandle;
 import android.view.MotionEvent;
 import android.view.WindowManager;
 
 import com.android.internal.annotations.VisibleForTesting;
-import android.view.InputApplicationHandle;
-import android.view.InputWindowHandle;
-import com.android.server.wm.WindowManagerService.H;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -356,12 +355,10 @@
                     + startY + "}");
         }
         mTask = win.getTask();
-        // Use the dim bounds, not the original task bounds. The cursor
-        // movement should be calculated relative to the visible bounds.
-        // Also, use the dim bounds of the task which accounts for
+        // Use the bounds of the task which accounts for
         // multiple app windows. Don't use any bounds from win itself as it
         // may not be the same size as the task.
-        mTask.getDimBounds(mTmpRect);
+        mTask.getBounds(mTmpRect);
         startDrag(resize, preserveOrientation, startX, startY, mTmpRect);
     }