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

This commit is contained in:
Hongwei Wang authored and Android (Google) Code Review committed 2022-03-30 22:23:51 +00:00
commit fe43ca95da
3 files changed
+22 -3

No files matched your search

@@ -1413,6 +1413,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
.setStartBounds(startRect) .setStartBounds(startRect)
.setDestinationBounds(destinationBounds) .setDestinationBounds(destinationBounds)
.setCornerRadius(mRecentsView.getPipCornerRadius()) .setCornerRadius(mRecentsView.getPipCornerRadius())
.setShadowRadius(mRecentsView.getPipShadowRadius())
.setAttachedView(mRecentsView); .setAttachedView(mRecentsView);
// We would assume home and app window always in the same rotation While homeRotation // 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). // 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 fromRotation From rotation if different from final rotation, ROTATION_0 otherwise
* @param destinationBoundsTransformed Destination bounds in window space * @param destinationBoundsTransformed Destination bounds in window space
* @param cornerRadius Corner radius in pixel value for PiP window * @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 * @param view Attached view for logging purpose
*/ */
private SwipePipToHomeAnimator(@NonNull Context context, private SwipePipToHomeAnimator(@NonNull Context context,
@@ -115,6 +116,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
@RecentsOrientedState.SurfaceRotation int fromRotation, @RecentsOrientedState.SurfaceRotation int fromRotation,
@NonNull Rect destinationBoundsTransformed, @NonNull Rect destinationBoundsTransformed,
int cornerRadius, int cornerRadius,
int shadowRadius,
@NonNull View view) { @NonNull View view) {
super(startBounds, new RectF(destinationBoundsTransformed), context, null); super(startBounds, new RectF(destinationBoundsTransformed), context, null);
mTaskId = taskId; mTaskId = taskId;
@@ -126,7 +128,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
mDestinationBounds.set(destinationBounds); mDestinationBounds.set(destinationBounds);
mFromRotation = fromRotation; mFromRotation = fromRotation;
mDestinationBoundsTransformed.set(destinationBoundsTransformed); mDestinationBoundsTransformed.set(destinationBoundsTransformed);
mSurfaceTransactionHelper = new PipSurfaceTransactionHelper(cornerRadius); mSurfaceTransactionHelper = new PipSurfaceTransactionHelper(cornerRadius, shadowRadius);
if (sourceRectHint != null && (sourceRectHint.width() < destinationBounds.width() if (sourceRectHint != null && (sourceRectHint.width() < destinationBounds.width()
|| sourceRectHint.height() < destinationBounds.height())) { || sourceRectHint.height() < destinationBounds.height())) {
@@ -324,6 +326,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
private RectF mStartBounds; private RectF mStartBounds;
private Rect mDestinationBounds; private Rect mDestinationBounds;
private int mCornerRadius; private int mCornerRadius;
private int mShadowRadius;
private View mAttachedView; private View mAttachedView;
private @RecentsOrientedState.SurfaceRotation int mFromRotation = Surface.ROTATION_0; private @RecentsOrientedState.SurfaceRotation int mFromRotation = Surface.ROTATION_0;
private final Rect mDestinationBoundsTransformed = new Rect(); private final Rect mDestinationBoundsTransformed = new Rect();
@@ -378,6 +381,11 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
return this; return this;
} }
public Builder setShadowRadius(int shadowRadius) {
mShadowRadius = shadowRadius;
return this;
}
public Builder setAttachedView(View attachedView) { public Builder setAttachedView(View attachedView) {
mAttachedView = attachedView; mAttachedView = attachedView;
return this; return this;
@@ -422,7 +430,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
mSourceRectHint, mAppBounds, mSourceRectHint, mAppBounds,
mHomeToWindowPositionMap, mStartBounds, mDestinationBounds, mHomeToWindowPositionMap, mStartBounds, mDestinationBounds,
mFromRotation, mDestinationBoundsTransformed, 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 = private final PinnedStackAnimationListener mIPipAnimationListener =
new PinnedStackAnimationListener(); new PinnedStackAnimationListener();
private int mPipCornerRadius; 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 // 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 // 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 mPipCornerRadius;
} }
/**
* @return Shadow radius in pixel value for PiP window, which is updated via
* {@link #mIPipAnimationListener}
*/
public int getPipShadowRadius() {
return mPipShadowRadius;
}
@Override @Override
public boolean scrollLeft() { public boolean scrollLeft() {
if (!showAsGrid()) { if (!showAsGrid()) {
@@ -5099,9 +5108,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
} }
@Override @Override
public void onPipCornerRadiusChanged(int cornerRadius) { public void onPipResourceDimensionsChanged(int cornerRadius, int shadowRadius) {
if (mRecentsView != null) { if (mRecentsView != null) {
mRecentsView.mPipCornerRadius = cornerRadius; mRecentsView.mPipCornerRadius = cornerRadius;
mRecentsView.mPipShadowRadius = shadowRadius;
} }
} }