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

Commit 2b30017c authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Add removal time of starting window in transition trace proto" into udc-qpr-dev

parents f44c4ffb dea7e1e6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ message Transition {
  repeated Target targets = 8;
  optional int32 flags = 9;
  optional int64 abort_time_ns = 10;
  optional int64 starting_window_remove_time_ns = 11;
}

message Target {
+3 −0
Original line number Diff line number Diff line
@@ -2784,6 +2784,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            } else if (isEmbedded()) {
                associateStartingWindowWithTaskIfNeeded();
            }
            if (mTransitionController.isCollecting()) {
                mStartingData.mTransitionId = mTransitionController.getCollectingTransitionId();
            }
        }
    }

+3 −0
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ public abstract class StartingData {
    /** Whether to prepare the removal animation. */
    boolean mPrepareRemoveAnimation;

    /** Non-zero if this starting window is added in a collecting transition. */
    int mTransitionId;

    protected StartingData(WindowManagerService service, int typeParams) {
        mService = service;
        mTypeParams = typeParams;
+21 −0
Original line number Diff line number Diff line
@@ -145,6 +145,27 @@ public class TransitionTracer {
        }
    }

    void logRemovingStartingWindow(@NonNull StartingData startingData) {
        if (startingData.mTransitionId == 0) {
            return;
        }
        try {
            final ProtoOutputStream outputStream = new ProtoOutputStream(CHUNK_SIZE);
            final long protoToken = outputStream
                    .start(com.android.server.wm.shell.TransitionTraceProto.TRANSITIONS);
            outputStream.write(com.android.server.wm.shell.Transition.ID,
                    startingData.mTransitionId);
            outputStream.write(
                    com.android.server.wm.shell.Transition.STARTING_WINDOW_REMOVE_TIME_NS,
                    SystemClock.elapsedRealtimeNanos());
            outputStream.end(protoToken);

            mTraceBuffer.add(outputStream);
        } catch (Exception e) {
            Log.e(LOG_TAG, "Unexpected exception thrown while logging transitions", e);
        }
    }

    private void dumpTransitionTargetsToProto(ProtoOutputStream outputStream,
            Transition transition, ArrayList<ChangeInfo> targets) {
        Trace.beginSection("TransitionTracer#dumpTransitionTargetsToProto");
+2 −1
Original line number Diff line number Diff line
@@ -2412,7 +2412,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        ProtoLog.v(WM_DEBUG_ADD_REMOVE,
                "removeIfPossible: %s callers=%s", this, Debug.getCallers(5));

        final boolean startingWindow = mAttrs.type == TYPE_APPLICATION_STARTING;
        final boolean startingWindow = mStartingData != null;
        if (startingWindow) {
            ProtoLog.d(WM_DEBUG_STARTING_WINDOW, "Starting window removed %s", this);
            // Cancel the remove starting window animation on shell. The main window might changed
@@ -2426,6 +2426,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
                    return false;
                }, true);
            }
            mTransitionController.mTransitionTracer.logRemovingStartingWindow(mStartingData);
        } else if (mAttrs.type == TYPE_BASE_APPLICATION
                && isSelfAnimating(0, ANIMATION_TYPE_STARTING_REVEAL)) {
            // Cancel the remove starting window animation in case the binder dead before remove