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

Commit d91ff727 authored by Mateusz Cicheński's avatar Mateusz Cicheński Committed by Automerger Merge Worker
Browse files

Merge "Make PiP move away to not occlude IME when it's too big" into udc-dev...

Merge "Make PiP move away to not occlude IME when it's too big" into udc-dev am: c1fac95c am: 7b353ef1 am: 43497b15

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



Change-Id: Id58511f1ed9dfec1df20cfe825af23c71daca9af
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4fe2fe36 43497b15
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -65,9 +65,18 @@ public class PhonePipKeepClearAlgorithm implements PipKeepClearAlgorithmInterfac
        }
        Rect pipBounds = new Rect(startingBounds);

        // move PiP towards corner if user hasn't moved it manually or the flag is on
        if (mKeepClearAreaGravityEnabled
                || (!pipBoundsState.hasUserMovedPip() && !pipBoundsState.hasUserResizedPip())) {
        boolean shouldApplyGravity = false;
        // if PiP is outside of screen insets, reposition using gravity
        if (!insets.contains(pipBounds)) {
            shouldApplyGravity = true;
        }
        // if user has not interacted with PiP, reposition using gravity
        if (!pipBoundsState.hasUserMovedPip() && !pipBoundsState.hasUserResizedPip()) {
            shouldApplyGravity = true;
        }

        // apply gravity that will position PiP in bottom left or bottom right corner within insets
        if (mKeepClearAreaGravityEnabled || shouldApplyGravity) {
            float snapFraction = pipBoundsAlgorithm.getSnapFraction(startingBounds);
            int verticalGravity = Gravity.BOTTOM;
            int horizontalGravity;