Merge "Work around for display info mismatch during the PiP transition" into rvc-dev
This commit is contained in:
@@ -110,6 +110,10 @@ public class PipAnimationController {
|
||||
return mCurrentAnimator;
|
||||
}
|
||||
|
||||
PipTransitionAnimator getCurrentAnimator() {
|
||||
return mCurrentAnimator;
|
||||
}
|
||||
|
||||
private PipTransitionAnimator setupPipTransitionAnimator(PipTransitionAnimator animator) {
|
||||
animator.setSurfaceTransactionHelper(mSurfaceTransactionHelper);
|
||||
animator.setInterpolator(mFastOutSlowInInterpolator);
|
||||
@@ -239,6 +243,9 @@ public class PipAnimationController {
|
||||
|
||||
void setDestinationBounds(Rect destinationBounds) {
|
||||
mDestinationBounds.set(destinationBounds);
|
||||
if (mAnimationType == ANIM_TYPE_ALPHA) {
|
||||
onStartTransaction(mLeash, newSurfaceControlTransaction());
|
||||
}
|
||||
}
|
||||
|
||||
void setCurrentValue(T value) {
|
||||
|
||||
@@ -199,6 +199,10 @@ public class PipBoundsHandler {
|
||||
return mLastDestinationBounds;
|
||||
}
|
||||
|
||||
public Rect getDisplayBounds() {
|
||||
return new Rect(0, 0, mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Responds to IPinnedStackListener on {@link DisplayInfo} change.
|
||||
* It will normally follow up with a
|
||||
|
||||
@@ -318,6 +318,29 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
|
||||
null /* updateBoundsCallback */);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO(b/152809058): consolidate the display info handling logic in SysUI
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void mayUpdateCurrentAnimationOnRotationChange() {
|
||||
final PipAnimationController.PipTransitionAnimator animator =
|
||||
mPipAnimationController.getCurrentAnimator();
|
||||
if (animator != null && animator.isRunning()
|
||||
&& animator.getTransitionDirection() == TRANSITION_DIRECTION_TO_PIP) {
|
||||
final Rect currentDestinationBounds = animator.getDestinationBounds();
|
||||
if (mPipBoundsHandler.getDisplayBounds().contains(currentDestinationBounds)) {
|
||||
return;
|
||||
}
|
||||
final Rect newDestinationBounds = mPipBoundsHandler.getDestinationBounds(
|
||||
getAspectRatioOrDefault(mTaskInfo.pictureInPictureParams),
|
||||
null /* bounds */, getMinimalSize(mTaskInfo.topActivityInfo));
|
||||
if (animator.getAnimationType() == ANIM_TYPE_BOUNDS) {
|
||||
animator.updateEndValue(newDestinationBounds);
|
||||
}
|
||||
animator.setDestinationBounds(newDestinationBounds);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the aspect ratio is changed since no other parameters within
|
||||
* {@link PictureInPictureParams} would affect the bounds.
|
||||
|
||||
@@ -363,6 +363,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
||||
mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds,
|
||||
animatingBounds, fromImeAdjustment, fromShelfAdjustment,
|
||||
mTmpDisplayInfo.rotation);
|
||||
mPipTaskOrganizer.mayUpdateCurrentAnimationOnRotationChange();
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw) {
|
||||
|
||||
Reference in New Issue
Block a user