Fixing corner radius not properly scaled in TaskViewSimulator am: fd0f8b0d1a

Change-Id: I9fa130d1878f1623be7f3a86a3412be84ce30ed7
This commit is contained in:
Sunny Goyal
2020-04-27 19:29:09 +00:00
committed by Automerger Merge Worker
@@ -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
*/