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

Commit bbf788a7 authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

[PiP2] Update size spec before enter PiP

Size spec updates are triggered when display change
happens and we are in PiP, or when PiP aspect ratio changes.

However there might be cases where size spec is left untouched.
For instance, say we enter PiP with the default aspect ratio,
exit PiP, then display change happens (updates the cached layout but not
size spec). If we re-enter PiP at this point with the same aspect ratio,
with the current logic, size spec will remain the same.

Instead we wanna updaate the size spec no matter what upon entry,
before calculating the entry destination bounds.

Bug: 396522512
Flag: com.android.wm.shell.enable_pip2
Test: ABTD run v2/android-crystalball-eng/health/microbench
  /launcher/main/launcher-swipeupapptopip-jank-suite

Change-Id: I48b7736d8609ebe74395bfdb66c7e4bacf71d646
parent 33957a5a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -404,6 +404,10 @@ public class PipController implements ConfigurationChangeListener,

        mPipBoundsState.setBoundsStateForEntry(componentName, activityInfo, pictureInPictureParams,
                mPipBoundsAlgorithm);

        // Update the size spec in case aspect ratio is invariant, but display has changed
        // since the last PiP session, or this is the first PiP session altogether.
        mPipBoundsState.updateMinMaxSize(mPipBoundsState.getAspectRatio());
        return mPipBoundsAlgorithm.getEntryDestinationBounds();
    }

+7 −0
Original line number Diff line number Diff line
@@ -738,6 +738,13 @@ public class PipTransition extends PipTransitionController implements
            }
        }

        if (!mPipTransitionState.isInSwipePipToHomeTransition()) {
            // Update the size spec in case aspect ratio is invariant, but display has changed
            // since the last PiP session, or this is the first PiP session altogether.
            // Skip the update if in swipe PiP to home, as this has already been done.
            mPipBoundsState.updateMinMaxSize(mPipBoundsState.getAspectRatio());
        }

        // calculate the entry bounds and notify core to move task to pinned with final bounds
        final Rect entryBounds = mPipBoundsAlgorithm.getEntryDestinationBounds();
        mPipBoundsState.setBounds(entryBounds);