Merge "Animate PiP away on inset changes." into tm-qpr-dev am: 3aac107972 am: 1099f31450

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20349632

Change-Id: Ib96f863ad9e0fc8b316b775b2b88ce2c160eb1cd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Mateusz Cicheński
2022-11-02 18:16:49 +00:00
committed by Automerger Merge Worker

View File

@@ -612,9 +612,24 @@ public class PipController implements PipTransitionController.PipTransitionCallb
new DisplayInsetsController.OnInsetsChangedListener() {
@Override
public void insetsChanged(InsetsState insetsState) {
int oldMaxMovementBound = mPipBoundsState.getMovementBounds().bottom;
onDisplayChanged(
mDisplayController.getDisplayLayout(mPipBoundsState.getDisplayId()),
false /* saveRestoreSnapFraction */);
int newMaxMovementBound = mPipBoundsState.getMovementBounds().bottom;
if (!mEnablePipKeepClearAlgorithm) {
int pipTop = mPipBoundsState.getBounds().top;
int diff = newMaxMovementBound - oldMaxMovementBound;
if (diff < 0 && pipTop > newMaxMovementBound) {
// bottom inset has increased, move PiP up if it is too low
mPipMotionHelper.animateToOffset(mPipBoundsState.getBounds(),
newMaxMovementBound - pipTop);
}
if (diff > 0 && oldMaxMovementBound == pipTop) {
// bottom inset has decreased, move PiP down if it was by the edge
mPipMotionHelper.animateToOffset(mPipBoundsState.getBounds(), diff);
}
}
}
});