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.

Bug: 161145462
Test: Make and check the logcat.
Change-Id: I3cb24cace060cff381ab3c5770ff6c1c948a2d89
This commit is contained in:
yawanng
2020-07-14 23:58:07 +00:00
parent 68bdd1abae
commit ef5e1a6dbe

View File

@@ -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,10 +256,12 @@ 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.wtf(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));
}
}
}