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

Commit 722b72ad authored by Tony Huang's avatar Tony Huang Committed by Automerger Merge Worker
Browse files

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

parents 2a0dbb45 455985f9
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -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) {
        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
+2 −2
Original line number Diff line number Diff line
@@ -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;
+6 −2
Original line number Diff line number Diff line
@@ -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();
+2 −2
Original line number Diff line number Diff line
@@ -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);
        }
    }