Merge "Handle shadow radius for auto-pip in Launcher" into tm-dev

This commit is contained in:
Hongwei Wang
2022-03-30 22:23:51 +00:00
committed by Android (Google) Code Review
3 changed files with 22 additions and 3 deletions
@@ -1413,6 +1413,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
.setStartBounds(startRect)
.setDestinationBounds(destinationBounds)
.setCornerRadius(mRecentsView.getPipCornerRadius())
.setShadowRadius(mRecentsView.getPipShadowRadius())
.setAttachedView(mRecentsView);
// We would assume home and app window always in the same rotation While homeRotation
// is not ROTATION_0 (which implies the rotation is turned on in launcher settings).
@@ -101,6 +101,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
* @param fromRotation From rotation if different from final rotation, ROTATION_0 otherwise
* @param destinationBoundsTransformed Destination bounds in window space
* @param cornerRadius Corner radius in pixel value for PiP window
* @param shadowRadius Shadow radius in pixel value for PiP window
* @param view Attached view for logging purpose
*/
private SwipePipToHomeAnimator(@NonNull Context context,
@@ -115,6 +116,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
@RecentsOrientedState.SurfaceRotation int fromRotation,
@NonNull Rect destinationBoundsTransformed,
int cornerRadius,
int shadowRadius,
@NonNull View view) {
super(startBounds, new RectF(destinationBoundsTransformed), context, null);
mTaskId = taskId;
@@ -126,7 +128,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
mDestinationBounds.set(destinationBounds);
mFromRotation = fromRotation;
mDestinationBoundsTransformed.set(destinationBoundsTransformed);
mSurfaceTransactionHelper = new PipSurfaceTransactionHelper(cornerRadius);
mSurfaceTransactionHelper = new PipSurfaceTransactionHelper(cornerRadius, shadowRadius);
if (sourceRectHint != null && (sourceRectHint.width() < destinationBounds.width()
|| sourceRectHint.height() < destinationBounds.height())) {
@@ -324,6 +326,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
private RectF mStartBounds;
private Rect mDestinationBounds;
private int mCornerRadius;
private int mShadowRadius;
private View mAttachedView;
private @RecentsOrientedState.SurfaceRotation int mFromRotation = Surface.ROTATION_0;
private final Rect mDestinationBoundsTransformed = new Rect();
@@ -378,6 +381,11 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
return this;
}
public Builder setShadowRadius(int shadowRadius) {
mShadowRadius = shadowRadius;
return this;
}
public Builder setAttachedView(View attachedView) {
mAttachedView = attachedView;
return this;
@@ -422,7 +430,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
mSourceRectHint, mAppBounds,
mHomeToWindowPositionMap, mStartBounds, mDestinationBounds,
mFromRotation, mDestinationBoundsTransformed,
mCornerRadius, mAttachedView);
mCornerRadius, mShadowRadius, mAttachedView);
}
}
@@ -539,6 +539,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
private final PinnedStackAnimationListener mIPipAnimationListener =
new PinnedStackAnimationListener();
private int mPipCornerRadius;
private int mPipShadowRadius;
// Used to keep track of the last requested task list id, so that we do not request to load the
// tasks again if we have already requested it and the task list has not changed
@@ -5004,6 +5005,14 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
return mPipCornerRadius;
}
/**
* @return Shadow radius in pixel value for PiP window, which is updated via
* {@link #mIPipAnimationListener}
*/
public int getPipShadowRadius() {
return mPipShadowRadius;
}
@Override
public boolean scrollLeft() {
if (!showAsGrid()) {
@@ -5099,9 +5108,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
}
@Override
public void onPipCornerRadiusChanged(int cornerRadius) {
public void onPipResourceDimensionsChanged(int cornerRadius, int shadowRadius) {
if (mRecentsView != null) {
mRecentsView.mPipCornerRadius = cornerRadius;
mRecentsView.mPipShadowRadius = shadowRadius;
}
}