Fixing corner radius not properly scaled in TaskViewSimulator

Bug: 155016285
Change-Id: Ib49e79cb30fbd448f86806a98557ec27718e3499
This commit is contained in:
Sunny Goyal
2020-04-27 09:58:01 -07:00
committed by Winson Chung
parent fbb6d6a73a
commit fd0f8b0d1a
@@ -57,6 +57,7 @@ public class TaskViewSimulator {
private final Rect mTmpCropRect = new Rect();
private final RectF mTempRectF = new RectF();
private final float[] mTempPoint = new float[2];
private final RecentsOrientedState mOrientationState;
private final Context mContext;
@@ -267,7 +268,7 @@ public class TaskViewSimulator {
builder.withAlpha(alpha)
.withMatrix(mMatrix)
.withWindowCrop(mTmpCropRect)
.withCornerRadius(mCurrentFullscreenParams.mCurrentDrawnCornerRadius);
.withCornerRadius(getCurrentCornerRadius());
} else if (params.getTargetSet().hasRecents) {
// If home has a different target then recents, reverse anim the home target.
builder.withAlpha(fullScreenProgress.value * params.getTargetAlpha());
@@ -284,6 +285,20 @@ public class TaskViewSimulator {
applySurfaceParams(params.getSyncTransactionApplier(), surfaceParams);
}
/**
* Returns the corner radius that should be applied to the target so that it matches the
* TaskView
*/
public float getCurrentCornerRadius() {
float visibleRadius = mCurrentFullscreenParams.mCurrentDrawnCornerRadius;
mTempPoint[0] = visibleRadius;
mTempPoint[1] = 0;
mInversePositionMatrix.mapVectors(mTempPoint);
// Ideally we should use square-root. This is an optimization as one of the dimension is 0.
return Math.max(Math.abs(mTempPoint[0]), Math.abs(mTempPoint[1]));
}
/**
* Interface for calculating taskSize
*/