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

Commit 81630075 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add asyncTraceForTrackBegin and asyncTraceForTrackEnd System APIs" into main

parents 2eee5395 735d79da
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -11644,6 +11644,8 @@ package android.os {
  }
  public final class Trace {
    method @FlaggedApi("android.os.async_trace_for_track") public static void asyncTraceForTrackBegin(@NonNull String, @NonNull String, int);
    method @FlaggedApi("android.os.async_trace_for_track") public static void asyncTraceForTrackEnd(@NonNull String, int);
    field public static final long TRACE_TAG_AIDL = 16777216L; // 0x1000000L
  }
+45 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.os;

import static android.annotation.SystemApi.Client.MODULE_LIBRARIES;

import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
@@ -387,6 +388,29 @@ public final class Trace {
        }
    }

    /**
     * Writes a trace message to indicate that a given section of code has
     * begun. Must be followed by a call to {@link #asyncTraceForTrackEnd} using the same
     * track name and cookie.
     *
     * Events with the same trackName and cookie nest inside each other in the
     * same way as calls to {@link #traceBegin(long, String)} and
     * {@link #traceEnd(long)}.
     *
     * @param trackName  The track where the event should appear in the trace.
     * @param methodName The method name to appear in the trace.
     * @param cookie     Unique identifier used for nesting events on a single
     *                   track. Events which overlap without nesting on the same
     *                   track must have different values for cookie.
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_ASYNC_TRACE_FOR_TRACK)
    public static void asyncTraceForTrackBegin(
            @NonNull String trackName, @NonNull String methodName, int cookie) {
        asyncTraceForTrackBegin(TRACE_TAG_APP, trackName, methodName, cookie);
    }

    /**
     * Writes a trace message to indicate that the current method has ended.
     * Must be called exactly once for each call to
@@ -411,6 +435,27 @@ public final class Trace {
        }
    }

    /**
     * Writes a trace message to indicate that the current method has ended.
     * Must be called exactly once for each call to
     * {@link #asyncTraceForTrackBegin(String, String, int)}
     * using the same track name, and cookie.
     *
     * See the documentation for {@link #asyncTraceForTrackBegin(String, String, int)}.
     * for intended usage of this method.
     *
     * @param trackName The track where the event should appear in the trace.
     * @param cookie    Unique identifier used for nesting events on a single
     *                  track. Events which overlap without nesting on the same
     *                  track must have different values for cookie.
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_ASYNC_TRACE_FOR_TRACK)
    public static void asyncTraceForTrackEnd(@NonNull String trackName, int cookie) {
        asyncTraceForTrackEnd(TRACE_TAG_APP, trackName, cookie);
    }

    /**
     * Writes a trace message to indicate that a given section of code was invoked.
     *
+8 −0
Original line number Diff line number Diff line
@@ -157,6 +157,14 @@ flag {
     bug: "361799815"
}

flag {
    name: "async_trace_for_track"
    is_exported: true
    namespace: "perfetto"
    description: "Enable async trace for track."
    bug: "407831889"
}

flag {
    name: "battery_part_status_api"
    is_exported: true