Skip to content

Commit 325be8a

Browse files
committed
Reduce emulator logspam
The emulator doesn't support systrace, but we should point that out at most once per process. Bug 7436352 Change-Id: I30e0094dc3b24bc3ab6bc2799ce81ca0a6bb7d9d
1 parent 71a408b commit 325be8a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

core/java/android/os/Trace.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public final class Trace {
4444
public static final long TRACE_TAG_AUDIO = 1L << 8;
4545
public static final long TRACE_TAG_VIDEO = 1L << 9;
4646
public static final long TRACE_TAG_CAMERA = 1L << 10;
47+
private static final long TRACE_TAG_NOT_READY = 1L << 63;
4748

4849
public static final int TRACE_FLAGS_START_BIT = 1;
4950
public static final String[] TRACE_TAGS = {
@@ -53,11 +54,8 @@ public final class Trace {
5354

5455
public static final String PROPERTY_TRACE_TAG_ENABLEFLAGS = "debug.atrace.tags.enableflags";
5556

56-
// This works as a "not ready" flag because TRACE_TAG_ALWAYS is always set.
57-
private static final long TRACE_FLAGS_NOT_READY = 0;
58-
5957
// Must be volatile to avoid word tearing.
60-
private static volatile long sEnabledTags = TRACE_FLAGS_NOT_READY;
58+
private static volatile long sEnabledTags = TRACE_TAG_NOT_READY;
6159

6260
private static native long nativeGetEnabledTags();
6361
private static native void nativeTraceCounter(long tag, String name, int value);
@@ -99,7 +97,7 @@ private Trace() {
9997
*/
10098
private static long cacheEnabledTags() {
10199
long tags = nativeGetEnabledTags();
102-
if (tags == TRACE_FLAGS_NOT_READY) {
100+
if (tags == TRACE_TAG_NOT_READY) {
103101
Log.w(TAG, "Unexpected value from nativeGetEnabledTags: " + tags);
104102
// keep going
105103
}
@@ -115,7 +113,7 @@ private static long cacheEnabledTags() {
115113
*/
116114
public static boolean isTagEnabled(long traceTag) {
117115
long tags = sEnabledTags;
118-
if (tags == TRACE_FLAGS_NOT_READY) {
116+
if (tags == TRACE_TAG_NOT_READY) {
119117
tags = cacheEnabledTags();
120118
}
121119
return (tags & traceTag) != 0;

0 commit comments

Comments
 (0)