diff options
| author | 2024-02-22 19:12:56 +0000 | |
|---|---|---|
| committer | 2024-02-22 19:12:56 +0000 | |
| commit | 7386ea76a08b7923817e8a93b5b433ae55ad5018 (patch) | |
| tree | 41fe03bcac9758fb7ed4e94323d176287485fd5e | |
| parent | 6f38816be17df6356cefab8638ea982dfe70814e (diff) | |
| parent | 448c137003b384cab4de5b4113487ef0d91b3d30 (diff) | |
Merge "Adds an option to disable capture logcat in proto file" into main
| -rw-r--r-- | cmds/am/src/com/android/commands/am/Am.java | 2 | ||||
| -rw-r--r-- | cmds/am/src/com/android/commands/am/Instrument.java | 19 |
2 files changed, 13 insertions, 8 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index d79131ca5d7c..3b16cab06bab 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -183,6 +183,8 @@ public class Am extends BaseCommand { instrument.disableTestApiChecks = false; } else if (opt.equals("--no-isolated-storage")) { instrument.disableIsolatedStorage = true; + } else if (opt.equals("--no-logcat")) { + instrument.captureLogcat = false; } else if (opt.equals("--user")) { instrument.userId = parseUserArg(nextArgRequired()); } else if (opt.equals("--abi")) { diff --git a/cmds/am/src/com/android/commands/am/Instrument.java b/cmds/am/src/com/android/commands/am/Instrument.java index e60593e8b633..e0d949e04a92 100644 --- a/cmds/am/src/com/android/commands/am/Instrument.java +++ b/cmds/am/src/com/android/commands/am/Instrument.java @@ -85,6 +85,7 @@ public class Instrument { public String profileFile = null; public boolean wait = false; public boolean rawMode = false; + public boolean captureLogcat = true; boolean protoStd = false; // write proto to stdout boolean protoFile = false; // write proto to a file String logPath = null; @@ -266,16 +267,18 @@ public class Instrument { proto.write(InstrumentationData.TestStatus.RESULT_CODE, resultCode); writeBundle(proto, InstrumentationData.TestStatus.RESULTS, results); - if (resultCode == STATUS_TEST_STARTED) { - // Logcat -T takes wall clock time (!?) - mTestStartMs = System.currentTimeMillis(); - } else { - if (mTestStartMs > 0) { - proto.write(InstrumentationData.TestStatus.LOGCAT, readLogcat(mTestStartMs)); + if (captureLogcat) { + if (resultCode == STATUS_TEST_STARTED) { + // Logcat -T takes wall clock time (!?) + mTestStartMs = System.currentTimeMillis(); + } else { + if (mTestStartMs > 0) { + proto.write(InstrumentationData.TestStatus.LOGCAT, + readLogcat(mTestStartMs)); + } + mTestStartMs = 0; } - mTestStartMs = 0; } - proto.end(testStatusToken); outputProto(proto); |