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
This commit is contained in:
Winson Chung
2021-07-01 22:52:38 -07:00
parent 395c582b62
commit a4b441144d

View File

@@ -43,16 +43,18 @@ public class PipSurfaceTransactionHelper {
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 @@ public class PipSurfaceTransactionHelper {
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);