Merge "Reduce flicker while split entering animation" into tm-qpr-dev
This commit is contained in:
@@ -163,7 +163,8 @@ public class SplitDecorManager extends WindowlessWindowManager {
|
||||
|
||||
/** Showing resizing hint. */
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
@@ -178,8 +179,8 @@ public class SplitDecorManager extends WindowlessWindowManager {
|
||||
|
||||
final boolean show =
|
||||
newBounds.width() > mBounds.width() || newBounds.height() > mBounds.height();
|
||||
final boolean animate = show != mShown;
|
||||
if (animate && mFadeAnimator != null && mFadeAnimator.isRunning()) {
|
||||
final boolean update = show != mShown;
|
||||
if (update && mFadeAnimator != null && mFadeAnimator.isRunning()) {
|
||||
// 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.
|
||||
mFadeAnimator.cancel();
|
||||
@@ -192,7 +193,7 @@ public class SplitDecorManager extends WindowlessWindowManager {
|
||||
.setLayer(mBackgroundLeash, Integer.MAX_VALUE - 1);
|
||||
}
|
||||
|
||||
if (mGapBackgroundLeash == null) {
|
||||
if (mGapBackgroundLeash == null && !immediately) {
|
||||
final boolean isLandscape = newBounds.height() == sideBounds.height();
|
||||
final int left = isLandscape ? mBounds.width() : 0;
|
||||
final int top = isLandscape ? 0 : mBounds.height();
|
||||
@@ -221,8 +222,13 @@ public class SplitDecorManager extends WindowlessWindowManager {
|
||||
newBounds.width() / 2 - mIconSize / 2,
|
||||
newBounds.height() / 2 - mIconSize / 2);
|
||||
|
||||
if (animate) {
|
||||
startFadeAnimation(show, null /* finishedConsumer */);
|
||||
if (update) {
|
||||
if (immediately) {
|
||||
t.setVisibility(mBackgroundLeash, show);
|
||||
t.setVisibility(mIconLeash, show);
|
||||
} else {
|
||||
startFadeAnimation(show, null /* finishedConsumer */);
|
||||
}
|
||||
mShown = show;
|
||||
}
|
||||
}
|
||||
@@ -319,10 +325,12 @@ public class SplitDecorManager extends WindowlessWindowManager {
|
||||
@Override
|
||||
public void onAnimationStart(@NonNull Animator animation) {
|
||||
if (show) {
|
||||
animT.show(mBackgroundLeash).show(mIconLeash).show(mGapBackgroundLeash).apply();
|
||||
} else {
|
||||
animT.hide(mGapBackgroundLeash).apply();
|
||||
animT.show(mBackgroundLeash).show(mIconLeash);
|
||||
}
|
||||
if (mGapBackgroundLeash != null) {
|
||||
animT.setVisibility(mGapBackgroundLeash, show);
|
||||
}
|
||||
animT.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -83,8 +83,8 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
|
||||
|
||||
private static final int FLING_RESIZE_DURATION = 250;
|
||||
private static final int FLING_SWITCH_DURATION = 350;
|
||||
private static final int FLING_ENTER_DURATION = 350;
|
||||
private static final int FLING_EXIT_DURATION = 350;
|
||||
private static final int FLING_ENTER_DURATION = 450;
|
||||
private static final int FLING_EXIT_DURATION = 450;
|
||||
|
||||
private int mDividerWindowWidth;
|
||||
private int mDividerInsets;
|
||||
|
||||
@@ -169,6 +169,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
private ValueAnimator mDividerFadeInAnimator;
|
||||
private boolean mDividerVisible;
|
||||
private boolean mKeyguardShowing;
|
||||
private boolean mShowDecorImmediately;
|
||||
private final SyncTransactionQueue mSyncQueue;
|
||||
private final ShellTaskOrganizer mTaskOrganizer;
|
||||
private final Context mContext;
|
||||
@@ -1556,6 +1557,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
if (mLogger.isEnterRequestedByDrag()) {
|
||||
updateSurfaceBounds(mSplitLayout, t, false /* applyResizingOffset */);
|
||||
} else {
|
||||
mShowDecorImmediately = true;
|
||||
mSplitLayout.flingDividerToCenter();
|
||||
}
|
||||
});
|
||||
@@ -1631,14 +1633,16 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
updateSurfaceBounds(layout, t, true /* applyResizingOffset */);
|
||||
getMainStageBounds(mTempRect1);
|
||||
getSideStageBounds(mTempRect2);
|
||||
mMainStage.onResizing(mTempRect1, mTempRect2, t, offsetX, offsetY);
|
||||
mSideStage.onResizing(mTempRect2, mTempRect1, t, offsetX, offsetY);
|
||||
mMainStage.onResizing(mTempRect1, mTempRect2, t, offsetX, offsetY, mShowDecorImmediately);
|
||||
mSideStage.onResizing(mTempRect2, mTempRect1, t, offsetX, offsetY, mShowDecorImmediately);
|
||||
t.apply();
|
||||
mTransactionPool.release(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayoutSizeChanged(SplitLayout layout) {
|
||||
// Reset this flag every time onLayoutSizeChanged.
|
||||
mShowDecorImmediately = false;
|
||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||
updateWindowBounds(layout, wct);
|
||||
sendOnBoundsChanged();
|
||||
|
||||
@@ -289,10 +289,10 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
|
||||
}
|
||||
|
||||
void onResizing(Rect newBounds, Rect sideBounds, SurfaceControl.Transaction t, int offsetX,
|
||||
int offsetY) {
|
||||
int offsetY, boolean immediately) {
|
||||
if (mSplitDecorManager != null && mRootTaskInfo != null) {
|
||||
mSplitDecorManager.onResizing(mRootTaskInfo, newBounds, sideBounds, t, offsetX,
|
||||
offsetY);
|
||||
offsetY, immediately);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user