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

Commit 401f78e8 authored by Winson Chung's avatar Winson Chung
Browse files

Fixing issue with PiP aspect ratio being clobbered.

- We should only initialize the initial aspect ratio to the default
  aspect ratio once, instead of when the resources are reloaded.
  Otherwise, they will be clobbered when the configuration changes.
  This is a regression from ag/2295004.

Bug: 62702553
Test: Set PiP aspect ratio from landscape-locked activity, ensure that
      it stays in that aspect ratio after the pip menu dismisses.

Change-Id: Id82f9081c25c7d6482cf7bcf0268fedb9068eabe
parent 627fbf81
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -155,6 +155,10 @@ class PinnedStackController {
        mSnapAlgorithm = new PipSnapAlgorithm(service.mContext);
        mDisplayInfo.copyFrom(mDisplayContent.getDisplayInfo());
        reloadResources();
        // Initialize the aspect ratio to the default aspect ratio.  Don't do this in reload
        // resources as it would clobber mAspectRatio when entering PiP from fullscreen which
        // triggers a configuration change and the resources to be reloaded.
        mAspectRatio = mDefaultAspectRatio;
    }

    void onConfigurationChanged() {
@@ -171,7 +175,6 @@ class PinnedStackController {
        mCurrentMinSize = mDefaultMinSize;
        mDefaultAspectRatio = res.getFloat(
                com.android.internal.R.dimen.config_pictureInPictureDefaultAspectRatio);
        mAspectRatio = mDefaultAspectRatio;
        final String screenEdgeInsetsDpString = res.getString(
                com.android.internal.R.string.config_defaultPictureInPictureScreenEdgeInsets);
        final Size screenEdgeInsetsDp = !screenEdgeInsetsDpString.isEmpty()