Merge "Pass the transform from Launcher to SysUI" into sc-dev
This commit is contained in:
commit
5b7c5e79a0
3 files changed
+39
-12
No files matched your search
@@ -1469,7 +1469,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
|
||||
mSwipePipToHomeAnimator.getDestinationBounds());
|
||||
mRecentsAnimationController.setFinishTaskBounds(
|
||||
mSwipePipToHomeAnimator.getTaskId(),
|
||||
mSwipePipToHomeAnimator.getDestinationBounds());
|
||||
mSwipePipToHomeAnimator.getDestinationBounds(),
|
||||
mSwipePipToHomeAnimator.getFinishWindowCrop(),
|
||||
mSwipePipToHomeAnimator.getFinishTransform());
|
||||
mIsSwipingPipToHome = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,10 +149,14 @@ public class RecentsAnimationController {
|
||||
* accordingly. This should be called before `finish`
|
||||
* @param taskId for which the leash should be updated
|
||||
* @param destinationBounds bounds of the final PiP window
|
||||
* @param windowCrop bounds to crop as part of final transform.
|
||||
* @param float9 An array of 9 floats to be used as matrix transform.
|
||||
*/
|
||||
public void setFinishTaskBounds(int taskId, Rect destinationBounds) {
|
||||
public void setFinishTaskBounds(int taskId, Rect destinationBounds, Rect windowCrop,
|
||||
float[] float9) {
|
||||
UI_HELPER_EXECUTOR.execute(
|
||||
() -> mController.setFinishTaskBounds(taskId, destinationBounds));
|
||||
() -> mController.setFinishTaskBounds(taskId, destinationBounds, windowCrop,
|
||||
float9));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -134,8 +134,9 @@ public class SwipePipToHomeAnimator extends ValueAnimator implements
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (!mHasAnimationEnded) super.onAnimationEnd(animation);
|
||||
SwipePipToHomeAnimator.this.onAnimationEnd();
|
||||
if (mHasAnimationEnded) return;
|
||||
super.onAnimationEnd(animation);
|
||||
mHasAnimationEnded = true;
|
||||
}
|
||||
});
|
||||
addUpdateListener(this);
|
||||
@@ -223,14 +224,34 @@ public class SwipePipToHomeAnimator extends ValueAnimator implements
|
||||
return mDestinationBounds;
|
||||
}
|
||||
|
||||
private void onAnimationEnd() {
|
||||
if (mHasAnimationEnded) return;
|
||||
/**
|
||||
* @return {@link Rect} of the final window crop in destination orientation.
|
||||
*/
|
||||
public Rect getFinishWindowCrop() {
|
||||
final Rect windowCrop = new Rect(mAppBounds);
|
||||
if (mSourceHintRectInsets != null) {
|
||||
windowCrop.inset(mSourceHintRectInsets);
|
||||
}
|
||||
return windowCrop;
|
||||
}
|
||||
|
||||
final SurfaceControl.Transaction tx =
|
||||
PipSurfaceTransactionHelper.newSurfaceControlTransaction();
|
||||
mSurfaceTransactionHelper.reset(tx, mLeash, mDestinationBoundsTransformed, mFromRotation);
|
||||
tx.apply();
|
||||
mHasAnimationEnded = true;
|
||||
/**
|
||||
* @return Array of 9 floats represents the final transform in destination orientation.
|
||||
*/
|
||||
public float[] getFinishTransform() {
|
||||
final Matrix transform = new Matrix();
|
||||
final float[] float9 = new float[9];
|
||||
if (mSourceHintRectInsets == null) {
|
||||
transform.setRectToRect(new RectF(mAppBounds), new RectF(mDestinationBounds),
|
||||
Matrix.ScaleToFit.FILL);
|
||||
} else {
|
||||
final float scale = mAppBounds.width() <= mAppBounds.height()
|
||||
? (float) mDestinationBounds.width() / mAppBounds.width()
|
||||
: (float) mDestinationBounds.height() / mAppBounds.height();
|
||||
transform.setScale(scale, scale);
|
||||
}
|
||||
transform.getValues(float9);
|
||||
return float9;
|
||||
}
|
||||
|
||||
private RotatedPosition getRotatedPosition(float fraction) {
|
||||
|
||||
Reference in new issue
Block a user