From 8dd77c1140bcfe1df61e8b35368dbb38477f767f Mon Sep 17 00:00:00 2001 From: Peter Kalauskas Date: Wed, 26 Apr 2023 17:49:37 +0000 Subject: [PATCH] Revert "Add androidx.tracing to sysui" This reverts commit 63920d6dde32b31ea3902650c3004c83ef69c967. Reason for revert: b/279715262 Bug: 279715262 Change-Id: I86e144a758af867d783f52baff3486358acb5f4a --- packages/SystemUI/Android.bp | 1 - .../com/android/systemui/util/TraceUtils.kt | 20 ++++++++----------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index 865b0dfe0ee83..62c6c1df91b2d 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 41c6b5d8493bd..64234c205617a 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 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 {