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

Commit 4f1be449 authored by Zimuzo Ezeozue's avatar Zimuzo Ezeozue
Browse files

Use setFlow instead of addFlow

Test: atest PerfettoTraceTest
Bug: 303199244
Flag: android.os.perfetto_sdk_tracing_v2
Change-Id: I80c8d94b9ad660e7ad69b389d8aa2ba33237cede
parent d015ca58
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -286,7 +286,9 @@ internal class TraceContextElement(

    init {
        if (usePerfettoSdk) {
            PerfettoTrace.end(PerfettoTraceConfig.COROUTINE_CATEGORY).addFlow(continuationId).emit()
            PerfettoTrace.end(PerfettoTraceConfig.COROUTINE_CATEGORY)
                .setFlow(continuationId.toLong())
                .emit()
        } else {
            Trace.traceEnd(Trace.TRACE_TAG_APP) // end: "TCE#init"
        }
@@ -321,7 +323,7 @@ internal class TraceContextElement(
                    PerfettoTraceConfig.COROUTINE_CATEGORY,
                    coroutineTraceName + if (continuationCount < 0) "" else continuationCount,
                )
                .addTerminatingFlow(continuationId)
                .setTerminatingFlow(continuationId.toLong())
                .emit()
            continuationId = nextRandomInt()
        } else {
@@ -371,7 +373,9 @@ internal class TraceContextElement(
        if (storage.data === oldState) return
        val contId = storage.restoreDataForSuspension(oldState)
        if (usePerfettoSdk) {
            PerfettoTrace.end(PerfettoTraceConfig.COROUTINE_CATEGORY).addFlow(contId).emit()
            PerfettoTrace.end(PerfettoTraceConfig.COROUTINE_CATEGORY)
                .setFlow(contId.toLong())
                .emit()
        } else {
            Trace.traceEnd(Trace.TRACE_TAG_APP) // end: coroutineTraceName
        }