diff options
author | yawanng <yawanng@google.com> | 2020-07-14 23:58:07 +0000 |
---|---|---|
committer | Calin Juravle <calin@google.com> | 2020-07-19 11:55:16 -0700 |
commit | edd2c9063146b91f88e130399527891e88a619c8 (patch) | |
tree | 0b4ee04404b84e757e07737a541a8a02345e474d /startop | |
parent | c29468777021f4970ab20b38601448fe81ecdcbb (diff) | |
download | base-edd2c9063146b91f88e130399527891e88a619c8.tar.gz |
EventSequenceValidator: Only record the debug log in debugging level.
The stack trace log may confuse other developers and mistakenly points
to IORap as the bug cause.
cherry-pick from ef5e1a6dbee8c7b2db4f150ea9463a8523a207ec
Bug: 161145462
Test: Make and check the logcat.
Merged-In: I3cb24cace060cff381ab3c5770ff6c1c948a2d89
Change-Id: I3cb24cace060cff381ab3c5770ff6c1c948a2d89
Diffstat (limited to 'startop')
-rw-r--r-- | startop/iorap/src/com/google/android/startop/iorap/EventSequenceValidator.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/startop/iorap/src/com/google/android/startop/iorap/EventSequenceValidator.java b/startop/iorap/src/com/google/android/startop/iorap/EventSequenceValidator.java index 67e1b440e28a..9b7a62b3a1df 100644 --- a/startop/iorap/src/com/google/android/startop/iorap/EventSequenceValidator.java +++ b/startop/iorap/src/com/google/android/startop/iorap/EventSequenceValidator.java @@ -96,7 +96,8 @@ import java.io.PrintWriter; */ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { static final String TAG = "EventSequenceValidator"; - + /** $> adb shell 'setprop log.tag.EventSequenceValidator VERBOSE' */ + public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private State state = State.INIT; private long accIntentStartedEvents = 0; @@ -255,9 +256,11 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { } private void logWarningWithStackTrace(String log) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - new Throwable("EventSequenceValidator#getStackTrace").printStackTrace(pw); - Log.d(TAG, String.format("%s\n%s", log, sw)); + if (DEBUG) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + new Throwable("EventSequenceValidator#getStackTrace").printStackTrace(pw); + Log.wtf(TAG, String.format("%s\n%s", log, sw)); + } } } |