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

Commit cab2665f authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Report correct transition starting reason

Correct the cases "snapshot starting window" and "timeout"
which were reported as normal drawn.

Bug: 413580576
Flag: EXEMPT bugfix
Test: ActivityMetricsLoggerTests
Change-Id: I22fd513773ff2ec467fe8487abcb6b61647fb0ef
parent 27c41e49
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ class BLASTSyncEngine {
        void onTransactionReady(int mSyncId, SurfaceControl.Transaction transaction);
        default void onTransactionCommitted() {}
        default void onTransactionCommitTimeout() {}
        default void onReadyTimeout() {}
        default void onSyncGroupTimeout(boolean isReadinessTimeout) {}

        default void onReadyTraceStart(String name, int id) {
            Trace.asyncTraceBegin(TRACE_TAG_WINDOW_MANAGER, name, id);
@@ -434,11 +434,13 @@ class BLASTSyncEngine {
                allFinished = false;
                Slog.i(TAG, "Unfinished dependency: " + mDependencies.get(i).mSyncId);
            }
            boolean isReadinessTimeout = false;
            if (allFinished && !mReady) {
                Slog.w(TAG, "Sync group " + mSyncId + " timed-out because not ready. If you see "
                        + "this, please file a bug.");
                mListener.onReadyTimeout();
                isReadinessTimeout = true;
            }
            mListener.onSyncGroupTimeout(isReadinessTimeout);
            finishNow();
            removeFromDependencies(this);
        }
+18 −3
Original line number Diff line number Diff line
@@ -71,7 +71,9 @@ import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.wm.ActivityRecord.State.RESUMED;
import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_RECENTS_ANIM;
import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_SNAPSHOT;
import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_SPLASH_SCREEN;
import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_TIMEOUT;
import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_WINDOWS_DRAWN;
import static com.android.server.wm.StartingData.AFTER_TRANSACTION_IDLE;
import static com.android.server.wm.StartingData.AFTER_TRANSITION_FINISH;
@@ -297,6 +299,9 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {

    final TransitionController.Logger mLogger = new TransitionController.Logger();

    /** Whether the corresponding sync group is timed out. */
    private boolean mIsTimedOut;

    /** Whether this transition was forced to play early (eg for a SLEEP signal). */
    private boolean mForcePlaying = false;

@@ -2538,11 +2543,17 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        for (int i = mParticipants.size() - 1; i >= 0; --i) {
            ActivityRecord r = mParticipants.valueAt(i).asActivityRecord();
            if (r == null || !r.isVisibleRequested()) continue;
            if (mIsTimedOut) {
                reasons.put(r, APP_TRANSITION_TIMEOUT);
                continue;
            }
            int transitionReason = APP_TRANSITION_WINDOWS_DRAWN;
            // At this point, r is "ready", but if it's not "ALL ready" then it is probably only
            // ready due to starting-window.
            if (r.mStartingData instanceof SplashScreenStartingData && !r.mLastAllReadyAtSync) {
                transitionReason = APP_TRANSITION_SPLASH_SCREEN;
            if (r.mStartingData != null && !r.mLastAllReadyAtSync) {
                transitionReason = r.mStartingData instanceof SplashScreenStartingData
                        ? APP_TRANSITION_SPLASH_SCREEN
                        : APP_TRANSITION_SNAPSHOT;
            } else if (r.isActivityTypeHomeOrRecents() && isTransientLaunch(r)) {
                transitionReason = APP_TRANSITION_RECENTS_ANIM;
            }
@@ -3847,7 +3858,11 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
    }

    @Override
    public void onReadyTimeout() {
    public void onSyncGroupTimeout(boolean isReadinessTimeout) {
        mIsTimedOut = true;
        if (!isReadinessTimeout) {
            return;
        }
        if (!mController.useFullReadyTracking()) {
            Slog.e(TAG, "#" + mSyncId + " readiness timeout, used=" + mReadyTrackerOld.mUsed
                    + " deferReadyDepth=" + mReadyTrackerOld.mDeferReadyDepth
+1 −1
Original line number Diff line number Diff line
@@ -3188,7 +3188,7 @@ public class ActivityRecordTests extends WindowTestsBase {
        // without a running process.
        if (!transition.allReady()) {
            // Print unsatisfied conditions.
            transition.onReadyTimeout();
            transition.onSyncGroupTimeout(true /* isReadinessTimeout */);
            Assert.fail(transition + " must be ready by onStartingWindowDrawn");
        }