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

Commit f6a7b72c authored by Evan Rosky's avatar Evan Rosky Committed by Android (Google) Code Review
Browse files

Merge "Migrate some simple ready conditions to new ready tracker" into main

parents 173902c5 5f0dce84
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -499,3 +499,11 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "migrate_basic_legacy_ready"
    namespace: "windowing_frontend"
    description: "Migrate basic legacy ready-conditions to new ready tracking"
    bug: "294925498"
}
+2 −1
Original line number Diff line number Diff line
@@ -650,7 +650,8 @@ class KeyguardController {
        if (waiting && isAodShowing(DEFAULT_DISPLAY)) {
            mWaitingForWakeTransition = true;
            mWindowManager.mAtmService.getTransitionController().deferTransitionReady();
            mWaitAodHide = new Transition.ReadyCondition("AOD hidden", true /* newTrackerOnly */);
            mWaitAodHide = new Transition.ReadyCondition("AOD hidden",
                    !Flags.migrateBasicLegacyReady());
            mWindowManager.mAtmService.getTransitionController().waitFor(mWaitAodHide);
            mWindowManager.mH.postDelayed(mResetWaitTransition, DEFER_WAKE_TRANSITION_TIMEOUT_MS);
        } else if (!waiting) {
+1 −1
Original line number Diff line number Diff line
@@ -2087,7 +2087,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>

        transitionController.deferTransitionReady();
        final Transition.ReadyCondition pipChangesApplied =
                new Transition.ReadyCondition("movedToPip", true /* newTrackerOnly */);
                new Transition.ReadyCondition("movedToPip", !Flags.migrateBasicLegacyReady());
        transitionController.waitFor(pipChangesApplied);
        mService.deferWindowLayout();
        boolean localVisibilityDeferred = false;
+2 −1
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ import android.window.WindowContainerTransaction;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.ProtoLog;
import com.android.internal.protolog.WmProtoLogGroups;
import com.android.window.flags.Flags;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -534,7 +535,7 @@ public class TaskFragmentOrganizerController extends ITaskFragmentOrganizerContr
            mDeferredTransitions.put(transaction.getTransactionToken(), transitionId);
            mWindowOrganizerController.getTransitionController().deferTransitionReady();
            final Transition.ReadyCondition transactionApplied = new Transition.ReadyCondition(
                    "task-fragment transaction", transaction, true /* newTrackerOnly */);
                    "task-fragment transaction", transaction, !Flags.migrateBasicLegacyReady());
            mWindowOrganizerController.getTransitionController().waitFor(transactionApplied);
            mInFlightTransactions.put(transaction.getTransactionToken(), transactionApplied);
        }
+12 −6
Original line number Diff line number Diff line
@@ -288,7 +288,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
    private IRemoteCallback mClientAnimationFinishCallback = null;

    private @TransitionState int mState = STATE_PENDING;
    private final ReadyTrackerOld mReadyTrackerOld = new ReadyTrackerOld();
    final ReadyTrackerOld mReadyTrackerOld = new ReadyTrackerOld();
    final ReadyTracker mReadyTracker = new ReadyTracker(this);

    private int mRecentsDisplayId = INVALID_DISPLAY;
@@ -1110,8 +1110,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        if (mState < STATE_STARTED) return;
        // Since some legacy behavior relies on being able to "unready" the old tracker, we need
        // to always re-check the old tracker here even if it had become ready previously.
        final boolean ready = mReadyTracker.isReady()
                && (mController.useFullReadyTracking() || mReadyTrackerOld.allReady());
        final boolean ready = allReady();
        ProtoLog.v(WmProtoLogGroups.WM_DEBUG_WINDOW_TRANSITIONS,
                "Set transition ready=%b %d", ready, mSyncId);
        boolean changed = mSyncEngine.setReady(mSyncId, ready);
@@ -1138,12 +1137,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {

    @VisibleForTesting
    boolean allReady() {
        return mReadyTrackerOld.allReady();
        return mReadyTracker.isReady()
                && (mController.useFullReadyTracking() || mReadyTrackerOld.allReady());
    }

    /** This transition has all of its expected participants. */
    boolean isPopulated() {
        return mState >= STATE_STARTED && mReadyTrackerOld.allReady();
        return mState >= STATE_STARTED && allReady();
    }

    /**
@@ -4237,7 +4237,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
     * of readiness across the multiple groups. Currently, we assume that each display is a group
     * since that is how it has been until now.
     */
    private static class ReadyTrackerOld extends ReadyCondition {
    @VisibleForTesting
    static class ReadyTrackerOld extends ReadyCondition {
        private final ArrayMap<WindowContainer, Boolean> mReadyGroups = new ArrayMap<>();

        /**
@@ -4265,6 +4266,11 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            super("Legacy");
        }

        @VisibleForTesting
        int getDeferReadyDepth() {
            return mDeferReadyDepth;
        }

        /**
         * Adds a ready-group. Any setReady calls in this subtree will be tracked together. For
         * now these are only DisplayContents.
Loading