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

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

Change-Id: I73f278599fb0909686803fc9d8709ff24260789b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Mateusz Cicheński
2022-09-13 05:08:43 +00:00
committed by Automerger Merge Worker

View File

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