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

Commit 15326b1a authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Automerger Merge Worker
Browse files

Merge "Defer remove splash screen window until start transaction apply." into...

Merge "Defer remove splash screen window until start transaction apply." into udc-dev am: d9a252dc

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



Change-Id: Iab8373320d0c0b5bb1d7177937c6f9e434fd4fe3
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 00847229 d9a252dc
Loading
Loading
Loading
Loading
+28 −12
Original line number Diff line number Diff line
@@ -2821,6 +2821,27 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }
    }

    @Override
    void waitForSyncTransactionCommit(ArraySet<WindowContainer> wcAwaitingCommit) {
        super.waitForSyncTransactionCommit(wcAwaitingCommit);
        if (mStartingData != null) {
            mStartingData.mWaitForSyncTransactionCommit = true;
        }
    }

    @Override
    void onSyncTransactionCommitted(SurfaceControl.Transaction t) {
        super.onSyncTransactionCommitted(t);
        if (mStartingData == null) {
            return;
        }
        mStartingData.mWaitForSyncTransactionCommit = false;
        if (mStartingData.mRemoveAfterTransaction) {
            mStartingData.mRemoveAfterTransaction = false;
            removeStartingWindowAnimation(mStartingData.mPrepareRemoveAnimation);
        }
    }

    void removeStartingWindowAnimation(boolean prepareAnimation) {
        mTransferringSplashScreenState = TRANSFER_SPLASH_SCREEN_IDLE;
        if (task != null) {
@@ -2843,6 +2864,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        final WindowState startingWindow = mStartingWindow;
        final boolean animate;
        if (mStartingData != null) {
            if (mStartingData.mWaitForSyncTransactionCommit
                    || mTransitionController.inCollectingTransition(startingWindow)) {
                mStartingData.mRemoveAfterTransaction = true;
                mStartingData.mPrepareRemoveAnimation = prepareAnimation;
                return;
            }
            animate = prepareAnimation && mStartingData.needRevealAnimation()
                    && mStartingWindow.isVisibleByPolicy();
            ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Schedule remove starting %s startingWindow=%s"
@@ -2863,19 +2890,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                    this);
            return;
        }

        if (animate && mTransitionController.inCollectingTransition(startingWindow)) {
            // Defer remove starting window after transition start.
            // The surface of app window could really show after the transition finish.
            startingWindow.mSyncTransaction.addTransactionCommittedListener(Runnable::run, () -> {
                synchronized (mAtmService.mGlobalLock) {
                    surface.remove(true);
                }
            });
        } else {
        surface.remove(animate);
    }
    }

    /**
     * Reparents this activity into {@param newTaskFrag} at the provided {@param position}. The
+20 −0
Original line number Diff line number Diff line
@@ -41,6 +41,26 @@ public abstract class StartingData {
    /** Whether the starting window is drawn. */
    boolean mIsDisplayed;

    /**
     * For Shell transition.
     * There will be a transition happen on attached activity, do not remove starting window during
     * this period, because the transaction to show app window may not apply before remove starting
     * window.
     * Note this isn't equal to transition playing, the period should be
     * Sync finishNow -> Start transaction apply.
     */
    boolean mWaitForSyncTransactionCommit;

    /**
     * For Shell transition.
     * This starting window should be removed after applying the start transaction of transition,
     * which ensures the app window has shown.
     */
    boolean mRemoveAfterTransaction;

    /** Whether to prepare the removal animation. */
    boolean mPrepareRemoveAnimation;

    protected StartingData(WindowManagerService service, int typeParams) {
        mService = service;
        mTypeParams = typeParams;