diff options
| author | 2022-11-02 03:40:21 +0000 | |
|---|---|---|
| committer | 2022-11-02 03:47:57 +0000 | |
| commit | 9621f52c010fc882abae89ddf0c70612241adb1c (patch) | |
| tree | 317ecee71ae1dac4322792e2218f626d0b66220d | |
| parent | 625756bee7d2607eebf65a18b41f67fc45b8f4a2 (diff) | |
Animate PiP away on inset changes.
This specifically refers to the taskbar that can be expanded or
minimized, which changes the bottom inset, but PiP remained in it's
original position. This change will move it down if it was already by
the bottom edge, or move it up just enough to be within the movement
bounds.
Bug: 256560961
Test: manually
Test: http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/dSTq2oAg1k85bpIZRBDLIH
Change-Id: I487be6f54b2f9afae8d18df8cf6456858704c703
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java index 616d447247de..d28a9f3cf8ff 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java @@ -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); + } + } } }); |