Merge "Reduce flicker while split entering animation" into tm-qpr-dev am: 455985f914

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

Change-Id: Ib0bd0143e44f8fc88efbaeb1d1d559c797238a81
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Tony Huang
2022-11-16 01:24:04 +00:00
committed by Automerger Merge Worker
4 changed files with 27 additions and 15 deletions

View File

@@ -163,7 +163,8 @@ public class SplitDecorManager extends WindowlessWindowManager {
/** Showing resizing hint. */ /** Showing resizing hint. */
public void onResizing(ActivityManager.RunningTaskInfo resizingTask, Rect newBounds, public void onResizing(ActivityManager.RunningTaskInfo resizingTask, Rect newBounds,
Rect sideBounds, SurfaceControl.Transaction t, int offsetX, int offsetY) { Rect sideBounds, SurfaceControl.Transaction t, int offsetX, int offsetY,
boolean immediately) {
if (mResizingIconView == null) { if (mResizingIconView == null) {
return; return;
} }
@@ -178,8 +179,8 @@ public class SplitDecorManager extends WindowlessWindowManager {
final boolean show = final boolean show =
newBounds.width() > mBounds.width() || newBounds.height() > mBounds.height(); newBounds.width() > mBounds.width() || newBounds.height() > mBounds.height();
final boolean animate = show != mShown; final boolean update = show != mShown;
if (animate && mFadeAnimator != null && mFadeAnimator.isRunning()) { if (update && mFadeAnimator != null && mFadeAnimator.isRunning()) {
// If we need to animate and animator still running, cancel it before we ensure both // If we need to animate and animator still running, cancel it before we ensure both
// background and icon surfaces are non null for next animation. // background and icon surfaces are non null for next animation.
mFadeAnimator.cancel(); mFadeAnimator.cancel();
@@ -192,7 +193,7 @@ public class SplitDecorManager extends WindowlessWindowManager {
.setLayer(mBackgroundLeash, Integer.MAX_VALUE - 1); .setLayer(mBackgroundLeash, Integer.MAX_VALUE - 1);
} }
if (mGapBackgroundLeash == null) { if (mGapBackgroundLeash == null && !immediately) {
final boolean isLandscape = newBounds.height() == sideBounds.height(); final boolean isLandscape = newBounds.height() == sideBounds.height();
final int left = isLandscape ? mBounds.width() : 0; final int left = isLandscape ? mBounds.width() : 0;
final int top = isLandscape ? 0 : mBounds.height(); final int top = isLandscape ? 0 : mBounds.height();
@@ -221,8 +222,13 @@ public class SplitDecorManager extends WindowlessWindowManager {
newBounds.width() / 2 - mIconSize / 2, newBounds.width() / 2 - mIconSize / 2,
newBounds.height() / 2 - mIconSize / 2); newBounds.height() / 2 - mIconSize / 2);
if (animate) { if (update) {
if (immediately) {
t.setVisibility(mBackgroundLeash, show);
t.setVisibility(mIconLeash, show);
} else {
startFadeAnimation(show, null /* finishedConsumer */); startFadeAnimation(show, null /* finishedConsumer */);
}
mShown = show; mShown = show;
} }
} }
@@ -319,10 +325,12 @@ public class SplitDecorManager extends WindowlessWindowManager {
@Override @Override
public void onAnimationStart(@NonNull Animator animation) { public void onAnimationStart(@NonNull Animator animation) {
if (show) { if (show) {
animT.show(mBackgroundLeash).show(mIconLeash).show(mGapBackgroundLeash).apply(); animT.show(mBackgroundLeash).show(mIconLeash);
} else {
animT.hide(mGapBackgroundLeash).apply();
} }
if (mGapBackgroundLeash != null) {
animT.setVisibility(mGapBackgroundLeash, show);
}
animT.apply();
} }
@Override @Override

View File

@@ -83,8 +83,8 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
private static final int FLING_RESIZE_DURATION = 250; private static final int FLING_RESIZE_DURATION = 250;
private static final int FLING_SWITCH_DURATION = 350; private static final int FLING_SWITCH_DURATION = 350;
private static final int FLING_ENTER_DURATION = 350; private static final int FLING_ENTER_DURATION = 450;
private static final int FLING_EXIT_DURATION = 350; private static final int FLING_EXIT_DURATION = 450;
private int mDividerWindowWidth; private int mDividerWindowWidth;
private int mDividerInsets; private int mDividerInsets;

View File

@@ -169,6 +169,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
private ValueAnimator mDividerFadeInAnimator; private ValueAnimator mDividerFadeInAnimator;
private boolean mDividerVisible; private boolean mDividerVisible;
private boolean mKeyguardShowing; private boolean mKeyguardShowing;
private boolean mShowDecorImmediately;
private final SyncTransactionQueue mSyncQueue; private final SyncTransactionQueue mSyncQueue;
private final ShellTaskOrganizer mTaskOrganizer; private final ShellTaskOrganizer mTaskOrganizer;
private final Context mContext; private final Context mContext;
@@ -1556,6 +1557,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
if (mLogger.isEnterRequestedByDrag()) { if (mLogger.isEnterRequestedByDrag()) {
updateSurfaceBounds(mSplitLayout, t, false /* applyResizingOffset */); updateSurfaceBounds(mSplitLayout, t, false /* applyResizingOffset */);
} else { } else {
mShowDecorImmediately = true;
mSplitLayout.flingDividerToCenter(); mSplitLayout.flingDividerToCenter();
} }
}); });
@@ -1631,14 +1633,16 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
updateSurfaceBounds(layout, t, true /* applyResizingOffset */); updateSurfaceBounds(layout, t, true /* applyResizingOffset */);
getMainStageBounds(mTempRect1); getMainStageBounds(mTempRect1);
getSideStageBounds(mTempRect2); getSideStageBounds(mTempRect2);
mMainStage.onResizing(mTempRect1, mTempRect2, t, offsetX, offsetY); mMainStage.onResizing(mTempRect1, mTempRect2, t, offsetX, offsetY, mShowDecorImmediately);
mSideStage.onResizing(mTempRect2, mTempRect1, t, offsetX, offsetY); mSideStage.onResizing(mTempRect2, mTempRect1, t, offsetX, offsetY, mShowDecorImmediately);
t.apply(); t.apply();
mTransactionPool.release(t); mTransactionPool.release(t);
} }
@Override @Override
public void onLayoutSizeChanged(SplitLayout layout) { public void onLayoutSizeChanged(SplitLayout layout) {
// Reset this flag every time onLayoutSizeChanged.
mShowDecorImmediately = false;
final WindowContainerTransaction wct = new WindowContainerTransaction(); final WindowContainerTransaction wct = new WindowContainerTransaction();
updateWindowBounds(layout, wct); updateWindowBounds(layout, wct);
sendOnBoundsChanged(); sendOnBoundsChanged();

View File

@@ -289,10 +289,10 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
} }
void onResizing(Rect newBounds, Rect sideBounds, SurfaceControl.Transaction t, int offsetX, void onResizing(Rect newBounds, Rect sideBounds, SurfaceControl.Transaction t, int offsetX,
int offsetY) { int offsetY, boolean immediately) {
if (mSplitDecorManager != null && mRootTaskInfo != null) { if (mSplitDecorManager != null && mRootTaskInfo != null) {
mSplitDecorManager.onResizing(mRootTaskInfo, newBounds, sideBounds, t, offsetX, mSplitDecorManager.onResizing(mRootTaskInfo, newBounds, sideBounds, t, offsetX,
offsetY); offsetY, immediately);
} }
} }