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

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

Merge "Delay PiP movement in response to keep clear areas changed." into...

Merge "Delay PiP movement in response to keep clear areas changed." into tm-qpr-dev am: 839a5d12 am: 9d78bb15

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



Change-Id: I13c43bae8ade977db4d81b772b9d8d4443832415
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4f5b1bb1 9d78bb15
Loading
Loading
Loading
Loading
+20 −8
Original line number Diff line number Diff line
@@ -114,6 +114,9 @@ public class PipController implements PipTransitionController.PipTransitionCallb
        UserChangeListener {
    private static final String TAG = "PipController";

    private static final long PIP_KEEP_CLEAR_AREAS_DELAY =
            SystemProperties.getLong("persist.wm.debug.pip_keep_clear_areas_delay", 200);

    private boolean mEnablePipKeepClearAlgorithm =
            SystemProperties.getBoolean("persist.wm.debug.enable_pip_keep_clear_algorithm", false);

@@ -146,6 +149,8 @@ public class PipController implements PipTransitionController.PipTransitionCallb
    private final Rect mTmpInsetBounds = new Rect();
    private final int mEnterAnimationDuration;

    private final Runnable mMovePipInResponseToKeepClearAreasChangeCallback;

    private boolean mIsInFixedRotation;
    private PipAnimationListener mPinnedStackAnimationRecentsCallback;

@@ -277,14 +282,12 @@ public class PipController implements PipTransitionController.PipTransitionCallb
                    if (mPipBoundsState.getDisplayId() == displayId) {
                        if (mEnablePipKeepClearAlgorithm) {
                            mPipBoundsState.setKeepClearAreas(restricted, unrestricted);
                            // only move if already in pip, other transitions account for keep clear
                            // areas
                            if (mPipTransitionState.hasEnteredPip()) {
                                Rect destBounds = mPipKeepClearAlgorithm.adjust(mPipBoundsState,
                                        mPipBoundsAlgorithm);
                                mPipTaskOrganizer.scheduleAnimateResizePip(destBounds,
                                        mEnterAnimationDuration, null);
                            }

                            mMainExecutor.removeCallbacks(
                                    mMovePipInResponseToKeepClearAreasChangeCallback);
                            mMainExecutor.executeDelayed(
                                    mMovePipInResponseToKeepClearAreasChangeCallback,
                                    PIP_KEEP_CLEAR_AREAS_DELAY);
                        }
                    }
                }
@@ -411,6 +414,15 @@ public class PipController implements PipTransitionController.PipTransitionCallb

        mEnterAnimationDuration = mContext.getResources()
                .getInteger(R.integer.config_pipEnterAnimationDuration);
        mMovePipInResponseToKeepClearAreasChangeCallback = () -> {
            // only move if already in pip, other transitions account for keep clear areas
            if (mPipTransitionState.hasEnteredPip()) {
                Rect destBounds = mPipKeepClearAlgorithm.adjust(mPipBoundsState,
                        mPipBoundsAlgorithm);
                mPipTaskOrganizer.scheduleAnimateResizePip(destBounds,
                        mEnterAnimationDuration, null);
            }
        };
        mPipParamsChangedForwarder = pipParamsChangedForwarder;
        mDisplayInsetsController = displayInsetsController;