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

Commit 93add0da authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Remove transition state tracing

To be added back as its own trace.

Bug: 277181336
Test: atest FlickerLibTest
Change-Id: Idf4ca69738be69a4d5c2eac750f51c4203603ee8
parent c8ccb5c2
Loading
Loading
Loading
Loading
+0 −27
Original line number Diff line number Diff line
@@ -64,30 +64,3 @@ message Target {
  optional int32 window_id = 3;  // Not dumped in always on tracing
  optional int32 flags = 4;
}

message TransitionState {
  enum State {
    COLLECTING = 0;
    PENDING = -1;
    STARTED = 1;
    PLAYING = 2;
    ABORT = 3;
    FINISHED = 4;
  }

  required int64 time_ns = 1;
  required int32 transition_id = 2;
  required int32 transition_type = 3;
  required State state = 4;
  required int32 flags = 5;
  repeated ChangeInfo change = 6;
  repeated com.android.server.wm.IdentifierProto participants = 7;
}

message ChangeInfo {
  required com.android.server.wm.IdentifierProto window_identifier = 1;
  required int32 transit_mode = 2;
  required bool has_changed = 3;
  required int32 change_flags = 4;
  required int32 windowing_mode = 5;
}
+0 −4
Original line number Diff line number Diff line
@@ -314,7 +314,6 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {

        mLogger.mCreateWallTimeMs = System.currentTimeMillis();
        mLogger.mCreateTimeNs = SystemClock.elapsedRealtimeNanos();
        controller.mTransitionTracer.logState(this);
    }

    @Nullable
@@ -532,7 +531,6 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {

        mLogger.mSyncId = mSyncId;
        mLogger.mCollectTimeNs = SystemClock.elapsedRealtimeNanos();
        mController.mTransitionTracer.logState(this);
    }

    /**
@@ -555,7 +553,6 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        applyReady();

        mLogger.mStartTimeNs = SystemClock.elapsedRealtimeNanos();
        mController.mTransitionTracer.logState(this);

        mController.updateAnimatingState(mTmpTransaction);
        // merge into the next-time the global transaction is applied. This is too-early to set
@@ -1232,7 +1229,6 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        validateVisibility();

        mState = STATE_FINISHED;
        mController.mTransitionTracer.logState(this);
        // Rotation change may be deferred while there is a display change transition, so check
        // again in case there is a new pending change.
        if (hasParticipatedDisplay && !mController.useShellTransitionsRotation()) {
+0 −2
Original line number Diff line number Diff line
@@ -941,7 +941,6 @@ class TransitionController {
        }
        mPlayingTransitions.add(transition);
        updateRunningRemoteAnimation(transition, true /* isPlaying */);
        mTransitionTracer.logState(transition);
        // Sync engine should become idle after this, so the idle listener will check the queue.
    }

@@ -1122,7 +1121,6 @@ class TransitionController {
                mLatestOnTopTasksReported.clear();
            }
        }
        mTransitionTracer.logState(transition);
        // This is called during Transition.abort whose codepath will eventually check the queue
        // via sync-engine idle.
    }
+0 −68
Original line number Diff line number Diff line
@@ -127,19 +127,6 @@ public class TransitionTracer {
        mTraceBuffer.add(outputStream);
    }

    /**
     * Records the current state of a transition in the transition trace (if it is running).
     * @param transition the transition that we want to record the state of.
     */
    public void logState(com.android.server.wm.Transition transition) {
        if (!mActiveTracingEnabled) {
            return;
        }
        final ProtoOutputStream outputStream = new ProtoOutputStream();
        dumpTransitionStateToProto(outputStream, transition);
        mTraceBuffer.pushTransitionState(outputStream);
    }

    private void dumpTransitionTargetsToProto(ProtoOutputStream outputStream,
            Transition transition, ArrayList<ChangeInfo> targets) {
        Trace.beginSection("TransitionTracer#dumpTransitionTargetsToProto");
@@ -182,61 +169,6 @@ public class TransitionTracer {
        Trace.endSection();
    }

    private void dumpTransitionStateToProto(ProtoOutputStream outputStream, Transition transition) {
        Trace.beginSection("TransitionTracer#dumpTransitionStateToProto");

        final long stateToken = outputStream
                .start(com.android.server.wm.shell.TransitionTraceProto.TRANSITION_STATES);

        outputStream.write(com.android.server.wm.shell.TransitionState.TIME_NS,
                SystemClock.elapsedRealtimeNanos());
        outputStream.write(com.android.server.wm.shell.TransitionState.TRANSITION_ID,
                transition.getSyncId());
        outputStream.write(com.android.server.wm.shell.TransitionState.TRANSITION_TYPE,
                transition.mType);
        outputStream.write(com.android.server.wm.shell.TransitionState.STATE,
                transition.getState());
        outputStream.write(com.android.server.wm.shell.TransitionState.FLAGS,
                transition.getFlags());

        for (int i = 0; i < transition.mChanges.size(); ++i) {
            final WindowContainer window = transition.mChanges.keyAt(i);
            final ChangeInfo changeInfo = transition.mChanges.valueAt(i);
            dumpChangeInfoToProto(outputStream, window, changeInfo);
        }

        for (int i = 0; i < transition.mParticipants.size(); ++i) {
            final WindowContainer window = transition.mParticipants.valueAt(i);
            window.writeIdentifierToProto(outputStream,
                    com.android.server.wm.shell.TransitionState.PARTICIPANTS);
        }

        outputStream.end(stateToken);
        Trace.endSection();
    }

    private void dumpChangeInfoToProto(ProtoOutputStream outputStream, WindowContainer window,
            ChangeInfo changeInfo) {
        Trace.beginSection("TransitionTraceBuffer#writeChange");
        final long changeEntryToken =
                outputStream.start(com.android.server.wm.shell.TransitionState.CHANGE);

        final int transitMode = changeInfo.getTransitMode(window);
        final boolean hasChanged = changeInfo.hasChanged();
        final int changeFlags = changeInfo.getChangeFlags(window);
        final int windowingMode = changeInfo.mWindowingMode;

        outputStream.write(com.android.server.wm.shell.ChangeInfo.TRANSIT_MODE, transitMode);
        outputStream.write(com.android.server.wm.shell.ChangeInfo.HAS_CHANGED, hasChanged);
        outputStream.write(com.android.server.wm.shell.ChangeInfo.CHANGE_FLAGS, changeFlags);
        outputStream.write(com.android.server.wm.shell.ChangeInfo.WINDOWING_MODE, windowingMode);
        window.writeIdentifierToProto(
                outputStream, com.android.server.wm.shell.ChangeInfo.WINDOW_IDENTIFIER);

        outputStream.end(changeEntryToken);
        Trace.endSection();
    }

    /**
     * Starts collecting transitions for the trace.
     * If called while a trace is already running, this will reset the trace.