Ensure that the pip transaction matrix has only scale & rotation info

Bug: 191672541
Test: Swipe up from an app w/ auto-enter and no source hint rect
Change-Id: I4d8eccd56a31eea922e99ccb4dcbc64ed58e37d4
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java
index 42d628a..7d0fb5d 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java
@@ -43,16 +43,18 @@
     public PictureInPictureSurfaceTransaction scale(
             SurfaceControl.Transaction tx, SurfaceControl leash,
             Rect sourceBounds, Rect destinationBounds) {
+        float positionX = destinationBounds.left;
+        float positionY = destinationBounds.top;
         mTmpSourceRectF.set(sourceBounds);
         mTmpDestinationRectF.set(destinationBounds);
+        mTmpDestinationRectF.offsetTo(0, 0);
         mTmpTransform.setRectToRect(mTmpSourceRectF, mTmpDestinationRectF, Matrix.ScaleToFit.FILL);
         final float cornerRadius = getScaledCornerRadius(sourceBounds, destinationBounds);
         tx.setMatrix(leash, mTmpTransform, mTmpFloat9)
-                .setPosition(leash, mTmpDestinationRectF.left, mTmpDestinationRectF.top)
+                .setPosition(leash, positionX, positionY)
                 .setCornerRadius(leash, cornerRadius);
         return new PictureInPictureSurfaceTransaction(
-                mTmpDestinationRectF.left, mTmpDestinationRectF.top,
-                mTmpFloat9, 0 /* rotation */, cornerRadius, sourceBounds);
+                positionX, positionY, mTmpFloat9, 0 /* rotation */, cornerRadius, sourceBounds);
     }
 
     public PictureInPictureSurfaceTransaction scale(
@@ -61,6 +63,7 @@
             float degree, float positionX, float positionY) {
         mTmpSourceRectF.set(sourceBounds);
         mTmpDestinationRectF.set(destinationBounds);
+        mTmpDestinationRectF.offsetTo(0, 0);
         mTmpTransform.setRectToRect(mTmpSourceRectF, mTmpDestinationRectF, Matrix.ScaleToFit.FILL);
         mTmpTransform.postRotate(degree, 0, 0);
         final float cornerRadius = getScaledCornerRadius(sourceBounds, destinationBounds);