Merge "Delay PiP movement in response to keep clear areas changed." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
839a5d1209
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user