Revert "Add androidx.tracing to sysui"

This reverts commit 63920d6dde.

Reason for revert: b/279715262

Bug: 279715262
Change-Id: I86e144a758af867d783f52baff3486358acb5f4a
This commit is contained in:
Peter Kalauskas
2023-04-26 17:49:37 +00:00
parent 63920d6dde
commit 8dd77c1140
2 changed files with 8 additions and 13 deletions

View File

@@ -173,7 +173,6 @@ android_library {
"androidx.palette_palette",
"androidx.legacy_legacy-preference-v14",
"androidx.leanback_leanback",
"androidx.tracing_tracing",
"androidx.slice_slice-core",
"androidx.slice_slice-view",
"androidx.slice_slice-builders",

View File

@@ -16,22 +16,20 @@
package com.android.systemui.util
import android.os.Handler
import android.os.Trace
import android.os.TraceNameSupplier
import androidx.tracing.Trace
/**
* Run a block within a [Trace] section. Calls [Trace.beginSection] before and [Trace.endSection]
* after the passed block. If tracing is disabled, it will run the block directly to avoid using an
* unnecessary try-finally block.
* Run a block within a [Trace] section.
* Calls [Trace.beginSection] before and [Trace.endSection] after the passed block.
*/
inline fun <T> traceSection(tag: String, block: () -> T): T =
if (Trace.isEnabled()) {
Trace.beginSection(tag)
if (Trace.isTagEnabled(Trace.TRACE_TAG_APP)) {
Trace.traceBegin(Trace.TRACE_TAG_APP, tag)
try {
block()
} finally {
Trace.endSection()
Trace.traceEnd(Trace.TRACE_TAG_APP)
}
} else {
block()
@@ -44,10 +42,8 @@ class TraceUtils {
}
/**
* Helper function for creating a [Runnable] that implements [TraceNameSupplier]. This is
* useful when posting to a [Handler] so that the [Runnable] has a meaningful name in the
* trace. Otherwise, the class name of the [Runnable] is used, which is often something like
* `pkg.MyClass$$ExternalSyntheticLambda0`.
* Helper function for creating a Runnable object that implements TraceNameSupplier.
* This is useful for posting Runnables to Handlers with meaningful names.
*/
inline fun namedRunnable(tag: String, crossinline block: () -> Unit): Runnable {
return object : Runnable, TraceNameSupplier {