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

Commit db155a11 authored by Peter Kalauskas's avatar Peter Kalauskas Committed by Automerger Merge Worker
Browse files

Disable coroutine tracing on user builds am: 9fe13e49

parents cf74f593 9fe13e49
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -44,4 +44,7 @@ java_library {
            exclude_srcs: [":compilelib-ReleaseJavaFiles"],
        },
    },
    sdk_version: "31",
    min_sdk_version: "19",
    java_version: "17",
}
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ java_library {
    static_libs: [
        "kotlinx_coroutines_android",
        "com_android_systemui_flags_lib",
        "//frameworks/libs/systemui:compilelib",
    ],
    srcs: ["android/src-platform-api/**/*.kt"],
}
@@ -32,6 +33,7 @@ java_library {
    static_libs: [
        "kotlinx_coroutines_android",
        "com_android_systemui_flags_lib",
        "//frameworks/libs/systemui:compilelib",
        "androidx.tracing_tracing",
    ],
    srcs: ["android/src-public-api/**/*.kt"],
+7 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.app.tracing.coroutines

import com.android.systemui.Flags.coroutineTracing
import com.android.systemui.util.Compile
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlinx.coroutines.CopyableThreadContextElement
@@ -47,8 +48,11 @@ private inline fun debug(message: () -> String) {
/**
 * Returns a new [CoroutineContext] used for tracing. Used to hide internal implementation details.
 */
fun createCoroutineTracingContext(): CoroutineContext {
    return if (coroutineTracing()) TraceContextElement(TraceData()) else EmptyCoroutineContext
fun createCoroutineTracingContext(): CoroutineContext =
    if (Compile.IS_DEBUG && coroutineTracing()) {
        TraceContextElement(TraceData())
    } else {
        EmptyCoroutineContext
    }

/**
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.util

@Suppress("UNUSED_PARAMETER")
object Compile {
    const val IS_DEBUG = true
}