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

Commit b26be926 authored by Pablo Gamito's avatar Pablo Gamito Committed by Android (Google) Code Review
Browse files

Merge changes from topic "update-transition-trace-dumping-structure" into udc-dev

* changes:
  Remove transition state tracing
  Update transition dumping structure
  Add real to elapsed offset to shell transition trace
  Update WM side transition trace file name
parents 56675d07 93add0da
Loading
Loading
Loading
Loading
+11 −52
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import "frameworks/base/core/proto/android/server/windowmanagerservice.proto";
option java_multiple_files = true;

/* Represents a file full of transition entries.
   Encoded, it should start with 0x09 0x54 0x52 0x4E 0x54 0x52 0x41 0x43 0x45 (TRNTRACE), such
   Encoded, it should start with 0x09 0x54 0x52 0x4E 0x54 0x52 0x41 0x43 0x45 (.TRNTRACE), such
   that it can be easily identified. */
message TransitionTraceProto {

@@ -38,28 +38,24 @@ message TransitionTraceProto {

  // Must be the first field, set to value in MagicNumber
  required fixed64 magic_number = 1;
  // Transitions that don't have a finish time are considered aborted
  repeated Transition finished_transitions = 2;

  // Additional debugging info only collected and dumped when explicitly requested to trace
  repeated TransitionState transition_states = 3;
  repeated TransitionInfo transition_info = 4;
  repeated Transition transitions = 2;

  /* offset between real-time clock and elapsed time clock in nanoseconds.
   Calculated as: 1000000 * System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() */
  optional fixed64 real_to_elapsed_time_offset_nanos = 5;
  optional fixed64 real_to_elapsed_time_offset_nanos = 3;
}

message Transition {
  optional int32 id = 1; // Not dumped in always on tracing
  required uint64 start_transaction_id = 2;
  required uint64 finish_transaction_id = 3;
  required int64 create_time_ns = 4;
  required int64 send_time_ns = 5;
  optional int64 finish_time_ns = 6; // consider aborted if not provided
  required int32 type = 7;
  required int32 id = 1;
  optional uint64 start_transaction_id = 2;
  optional uint64 finish_transaction_id = 3;
  optional int64 create_time_ns = 4;
  optional int64 send_time_ns = 5;
  optional int64 finish_time_ns = 6;
  optional int32 type = 7;
  repeated Target targets = 8;
  optional int32 flags = 9;
  optional int64 abort_time_ns = 10;
}

message Target {
@@ -68,40 +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;
}

message TransitionInfo {
  required int32 transition_id = 1;
  repeated TransitionInfoChange change = 2;
}

message TransitionInfoChange {
  required int32 layer_id = 1;
  required int32 mode = 2;
}
+3 −0
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@ message WmShellTransitionTraceProto {
    required fixed64 magic_number = 1;
    repeated Transition transitions = 2;
    repeated HandlerMapping handlerMappings = 3;
    /* offset between real-time clock and elapsed time clock in nanoseconds.
    Calculated as: 1000000 * System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() */
    optional fixed64 real_to_elapsed_time_offset_nanos = 4;
}

message Transition {
+5 −1
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.os.Trace;
import android.util.Log;

import com.android.internal.util.TraceBuffer;
import com.android.wm.shell.nano.HandlerMapping;
import com.android.wm.shell.sysui.ShellCommandHandler;

import com.google.protobuf.nano.MessageNano;
@@ -41,6 +40,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.TimeUnit;

/**
 * Helper class to collect and dump transition traces.
@@ -241,6 +241,10 @@ public class Tracer implements ShellCommandHandler.ShellCommandActionHandler {
                    new com.android.wm.shell.nano.WmShellTransitionTraceProto();
            proto.magicNumber = MAGIC_NUMBER_VALUE;
            writeHandlerMappingToProto(proto);
            long timeOffsetNs =
                    TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis())
                            - SystemClock.elapsedRealtimeNanos();
            proto.realToElapsedTimeOffsetNanos = timeOffsetNs;
            int pid = android.os.Process.myPid();
            LogAndPrintln.i(pw, "Writing file to " + file.getAbsolutePath()
                    + " from process " + pid);
+1 −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()) {
@@ -1261,6 +1257,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        }
        ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS, "Aborting Transition: %d", mSyncId);
        mState = STATE_ABORT;
        mLogger.mAbortTimeNs = SystemClock.elapsedRealtimeNanos();
        mController.mTransitionTracer.logAbortedTransition(this);
        // Syncengine abort will call through to onTransactionReady()
        mSyncEngine.abort(mSyncId);
+1 −4
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.
    }
@@ -1416,12 +1414,11 @@ class TransitionController {
        long mReadyTimeNs;
        long mSendTimeNs;
        long mFinishTimeNs;
        long mAbortTimeNs;
        TransitionRequestInfo mRequest;
        WindowContainerTransaction mStartWCT;
        int mSyncId;
        TransitionInfo mInfo;
        ProtoOutputStream mProtoOutputStream = new ProtoOutputStream();
        long mProtoToken;

        private String buildOnSendLog() {
            StringBuilder sb = new StringBuilder("Sent Transition #").append(mSyncId)
Loading