Don't offset TaskView when it is not in the bounds of parent.

- This offset leads to 2 problems:
  1. If TaskView is inside a scrollable view and off the parent bounds, the surface bounds become out of sync with window bounds.
  2. As a result of 1. the window always goes to 0,0 & system thinks that the status bar insets should be applied and hence the taskview is shifted down.

Fix: 239252850
Test: atest TaskView
Test: Tested manually by making TaskView go out of parent bounds.
Change-Id: Ia5b614f9f4d681c48a9a117a06c98a576670e7dc
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java
index bd2ea9c..94e01e9 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java
@@ -223,16 +223,6 @@
         mObscuredTouchRegion = obscuredRegion;
     }
 
-    private void onLocationChanged(WindowContainerTransaction wct) {
-        // Update based on the screen bounds
-        getBoundsOnScreen(mTmpRect);
-        getRootView().getBoundsOnScreen(mTmpRootRect);
-        if (!mTmpRootRect.contains(mTmpRect)) {
-            mTmpRect.offsetTo(0, 0);
-        }
-        wct.setBounds(mTaskToken, mTmpRect);
-    }
-
     /**
      * Call when view position or size has changed. Do not call when animating.
      */
@@ -245,10 +235,15 @@
         if (isUsingShellTransitions() && mTaskViewTransitions.hasPending()) return;
 
         WindowContainerTransaction wct = new WindowContainerTransaction();
-        onLocationChanged(wct);
+        updateWindowBounds(wct);
         mSyncQueue.queue(wct);
     }
 
+    private void updateWindowBounds(WindowContainerTransaction wct) {
+        getBoundsOnScreen(mTmpRect);
+        wct.setBounds(mTaskToken, mTmpRect);
+    }
+
     /**
      * Release this container if it is initialized.
      */
@@ -572,7 +567,7 @@
                     .apply();
 
             // TODO: determine if this is really necessary or not
-            onLocationChanged(wct);
+            updateWindowBounds(wct);
         } else {
             // The surface has already been destroyed before the task has appeared,
             // so go ahead and hide the task entirely