summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Peter Kalauskas <peskal@google.com> 2023-04-26 18:09:58 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-04-26 18:09:58 +0000
commit370e6b3cdcd46c1ffd26e7157952e94552e22614 (patch)
treed6b5b2576cd3ccce34282072bf20860ad3c4a663
parent8b3e70514591f56c2696ebd245cf872027b944ee (diff)
parent8dd77c1140bcfe1df61e8b35368dbb38477f767f (diff)
Merge "Revert "Add androidx.tracing to sysui"" into udc-dev
-rw-r--r--packages/SystemUI/Android.bp1
-rw-r--r--packages/SystemUI/src/com/android/systemui/util/TraceUtils.kt20
2 files changed, 8 insertions, 13 deletions
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index a5908a888449..e6bbf9759651 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -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",
diff --git a/packages/SystemUI/src/com/android/systemui/util/TraceUtils.kt b/packages/SystemUI/src/com/android/systemui/util/TraceUtils.kt
index 41c6b5d8493b..64234c205617 100644
--- a/packages/SystemUI/src/com/android/systemui/util/TraceUtils.kt
+++ b/packages/SystemUI/src/com/android/systemui/util/TraceUtils.kt
@@ -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 {