Merge "Allow reentry bounds to be overriden before saving" into rvc-qpr-dev
This commit is contained in:
@@ -355,17 +355,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
|||||||
@Override
|
@Override
|
||||||
public void onPipTransitionStarted(ComponentName activity, int direction) {
|
public void onPipTransitionStarted(ComponentName activity, int direction) {
|
||||||
if (isOutPipDirection(direction)) {
|
if (isOutPipDirection(direction)) {
|
||||||
// On phones, the expansion animation that happens on pip tap before restoring
|
// Exiting PIP, save the reentry bounds to restore to when re-entering.
|
||||||
// to fullscreen makes it so that the bounds received here are the expanded
|
updateReentryBounds();
|
||||||
// bounds. We want to restore to the unexpanded bounds when re-entering pip,
|
|
||||||
// so we save the bounds before expansion (normal) instead of the current
|
|
||||||
// bounds.
|
|
||||||
mReentryBounds.set(mTouchHandler.getNormalBounds());
|
|
||||||
// Apply the snap fraction of the current bounds to the normal bounds.
|
|
||||||
final Rect bounds = mPipTaskOrganizer.getLastReportedBounds();
|
|
||||||
float snapFraction = mPipBoundsHandler.getSnapFraction(bounds);
|
|
||||||
mPipBoundsHandler.applySnapFraction(mReentryBounds, snapFraction);
|
|
||||||
// Save reentry bounds (normal non-expand bounds with current position applied).
|
|
||||||
mPipBoundsHandler.onSaveReentryBounds(activity, mReentryBounds);
|
mPipBoundsHandler.onSaveReentryBounds(activity, mReentryBounds);
|
||||||
}
|
}
|
||||||
// Disable touches while the animation is running
|
// Disable touches while the animation is running
|
||||||
@@ -379,6 +370,23 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the bounds used to save the re-entry size and snap fraction when exiting PIP.
|
||||||
|
*/
|
||||||
|
public void updateReentryBounds() {
|
||||||
|
// On phones, the expansion animation that happens on pip tap before restoring
|
||||||
|
// to fullscreen makes it so that the last reported bounds are the expanded
|
||||||
|
// bounds. We want to restore to the unexpanded bounds when re-entering pip,
|
||||||
|
// so we use the bounds before expansion (normal) instead of the reported
|
||||||
|
// bounds.
|
||||||
|
Rect reentryBounds = mTouchHandler.getNormalBounds();
|
||||||
|
// Apply the snap fraction of the current bounds to the normal bounds.
|
||||||
|
final Rect bounds = mPipTaskOrganizer.getLastReportedBounds();
|
||||||
|
float snapFraction = mPipBoundsHandler.getSnapFraction(bounds);
|
||||||
|
mPipBoundsHandler.applySnapFraction(reentryBounds, snapFraction);
|
||||||
|
mReentryBounds.set(reentryBounds);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPipTransitionFinished(ComponentName activity, int direction) {
|
public void onPipTransitionFinished(ComponentName activity, int direction) {
|
||||||
onPipTransitionFinishedOrCanceled(direction);
|
onPipTransitionFinishedOrCanceled(direction);
|
||||||
|
|||||||
Reference in New Issue
Block a user