Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9621f52c authored by Mateusz Cicheński's avatar Mateusz Cicheński
Browse files

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
parent 625756be
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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);
                            }
                        }
                    }
                });