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

Commit bf770d72 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Fix unwanted PIP window dismissal when moving to the bottom

Display#getSize() returns screen size excluding certain system decor
elements. We should get a more accurate size using Display#getRealSize()
minus bottom inset instead for calculating whether the PIP window
should be dismissed.

Fixes: 80367557
Test: atest CtsActivityManagerDeviceTestCases:ActivityManagerPinnedStackTests and manual test
Change-Id: I20cd8ccfa53bd7cc1cb7176280a01dbcb64b5745
parent a8464603
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -225,9 +225,10 @@ public class PipMotionHelper implements Handler.Callback {
     */
    boolean shouldDismissPip() {
        Point displaySize = new Point();
        mContext.getDisplay().getSize(displaySize);
        if (mBounds.bottom > displaySize.y) {
            float offscreenFraction = (float) (mBounds.bottom - displaySize.y) / mBounds.height();
        mContext.getDisplay().getRealSize(displaySize);
        final int y = displaySize.y - mStableInsets.bottom;
        if (mBounds.bottom > y) {
            float offscreenFraction = (float) (mBounds.bottom - y) / mBounds.height();
            return offscreenFraction >= DISMISS_OFFSCREEN_FRACTION;
        }
        return false;