From 5f46923634e87fecaa290fd25782b45903090f5e Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Tue, 5 Nov 2019 17:56:00 -0800 Subject: [PATCH] Trace.h: explicitly use global namespace Imagine an AIDL file: package android.foo; interface IFoo {} The AIDL C++ backend will generate classes like "::android::foo::IFoo". In order to avoid ODR conflict, the NDK (Stable C) backend linking against libbinder_ndk puts everything under the "::aidl" namespace. So, we have "::aidl::android::foo::IFoo". When using ScopedTrace in a class implementing a class from this backend, there is this problem. Bug: 141828236 Test: works Change-Id: Iafadea11788d4c011229657b4f53063bcf65f8d8 --- libutils/include/utils/Trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libutils/include/utils/Trace.h b/libutils/include/utils/Trace.h index fec0ffa82..9986bf5f9 100644 --- a/libutils/include/utils/Trace.h +++ b/libutils/include/utils/Trace.h @@ -33,7 +33,7 @@ // ATRACE_NAME traces from its location until the end of its enclosing scope. #define _PASTE(x, y) x ## y #define PASTE(x, y) _PASTE(x,y) -#define ATRACE_NAME(name) android::ScopedTrace PASTE(___tracer, __LINE__) (ATRACE_TAG, name) +#define ATRACE_NAME(name) ::android::ScopedTrace PASTE(___tracer, __LINE__)(ATRACE_TAG, name) // ATRACE_CALL is an ATRACE_NAME that uses the current function name. #define ATRACE_CALL() ATRACE_NAME(__FUNCTION__)