summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yohei Yukawa <yukawa@google.com> 2021-03-10 01:12:08 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2021-03-10 01:12:08 +0000
commit63ec1cfac84b58aecb7f320a5763faf6a893f890 (patch)
tree543904d43e95dc172dfc3683583561361812ab54
parenta7836eb3ded16ace0f1fe4a8596184b081daa48b (diff)
parent5f4d949287274ed9125b8083b42ab6495b7d244b (diff)
Merge "Let dumpstate call "cmd window trace save-for-bugreport"" am: 92be52328a am: 53aa93fed5 am: 5f4d949287
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1595528 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I520726e11ffff6df717620a5919d6d2cccdfd28a
-rw-r--r--cmds/dumpstate/dumpstate.cpp12
-rw-r--r--cmds/dumpstate/dumpstate.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 31930ff08c..a999c9f22e 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -2911,6 +2911,10 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid,
// own activity pushes out interesting data from the trace ring buffer.
// The trace file is added to the zip by MaybeAddSystemTraceToZip().
MaybeSnapshotSystemTrace();
+
+ // If a winscope trace is running, snapshot it now. It will be pulled into bugreport later
+ // from WMTRACE_DATA_DIR.
+ MaybeSnapshotWinTrace();
}
onUiIntensiveBugreportDumpsFinished(calling_uid);
MaybeCheckUserConsent(calling_uid, calling_package);
@@ -3022,6 +3026,14 @@ void Dumpstate::MaybeSnapshotSystemTrace() {
// file in the later stages.
}
+void Dumpstate::MaybeSnapshotWinTrace() {
+ RunCommand(
+ // Empty name because it's not intended to be classified as a bugreport section.
+ // Actual tracing files can be found in "/data/misc/wmtrace/" in the bugreport.
+ "", {"cmd", "window", "tracing", "save-for-bugreport"},
+ CommandOptions::WithTimeout(10).Always().DropRoot().RedirectStderr().Build());
+}
+
void Dumpstate::onUiIntensiveBugreportDumpsFinished(int32_t calling_uid) {
if (calling_uid == AID_SHELL || !CalledByApi()) {
return;
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index f83968b59e..83e6787ebf 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -549,6 +549,7 @@ class Dumpstate {
void MaybeTakeEarlyScreenshot();
void MaybeSnapshotSystemTrace();
+ void MaybeSnapshotWinTrace();
void onUiIntensiveBugreportDumpsFinished(int32_t calling_uid);