Only get trace name if tracing is enabled
String formatting creates new objects, so only do it if needed.
Bug: 30549756
Change-Id: I8035357c2b9c3066ef7663b938654f698a2321bc
diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java
index b58ff1f..d299672 100644
--- a/core/java/android/os/Looper.java
+++ b/core/java/android/os/Looper.java
@@ -147,7 +147,7 @@
}
final long traceTag = me.mTraceTag;
- if (traceTag != 0) {
+ if (traceTag != 0 && Trace.isTagEnabled(traceTag)) {
Trace.traceBegin(traceTag, msg.target.getTraceName(msg));
}
try {