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

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

Change-Id: I97cb4e32615d4310aff9d2f23a182fe8e1e1fb96
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Mateusz Cicheński
2023-05-20 00:21:36 +00:00
committed by Automerger Merge Worker

View File

@@ -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;