diff options
author | 2023-04-19 09:44:47 +0000 | |
---|---|---|
committer | 2023-04-26 12:57:18 +0000 | |
commit | efdc59246f25f17a1c3dafdc74640cbe474b4961 (patch) | |
tree | a9bbf430585b25722bc2d66a5de200029db8e7c1 | |
parent | 8069bc2a15ee60bb5ad7314ee13619e3bd0f786e (diff) |
Dump shell side transition trace with bug reports
Test: atest dumpstate_test
Bug: 276701336
Bug: 277181336
Bug: 278691227
Change-Id: I6050899eb739bd640b1842caff46c1dee9dbf3a7
-rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 22 | ||||
-rw-r--r-- | cmds/dumpstate/tests/dumpstate_test.cpp | 23 |
2 files changed, 26 insertions, 19 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 8ca927e920..5dbf7ac715 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -3362,23 +3362,25 @@ void Dumpstate::MaybeSnapshotUiTraces() { return; } - // Include the proto logging from WMShell. - RunCommand( - // Empty name because it's not intended to be classified as a bugreport section. - // Actual logging files can be found as "/data/misc/wmtrace/shell_log.winscope" - // in the bugreport. - "", {"dumpsys", "activity", "service", "SystemUIService", - "WMShell", "protolog", "save-for-bugreport"}, - CommandOptions::WithTimeout(10).Always().DropRoot().RedirectStderr().Build()); + const std::vector<std::vector<std::string>> dumpTracesForBugReportCommands = { + {"dumpsys", "activity", "service", "SystemUIService", "WMShell", "protolog", + "save-for-bugreport"}, + {"dumpsys", "activity", "service", "SystemUIService", "WMShell", "transitions", "tracing", + "save-for-bugreport"}, + {"cmd", "input_method", "tracing", "save-for-bugreport"}, + {"cmd", "window", "tracing", "save-for-bugreport"}, + {"cmd", "window", "shell", "tracing", "save-for-bugreport"}, + }; - for (const auto& service : {"input_method", "window", "window shell"}) { + for (const auto& command : dumpTracesForBugReportCommands) { 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", service, "tracing", "save-for-bugreport"}, + "", command, CommandOptions::WithTimeout(10).Always().DropRoot().RedirectStderr().Build()); } + // This command needs to be run as root static const auto SURFACEFLINGER_COMMAND_SAVE_ALL_TRACES = std::vector<std::string> { "service", "call", "SurfaceFlinger", "1042" }; diff --git a/cmds/dumpstate/tests/dumpstate_test.cpp b/cmds/dumpstate/tests/dumpstate_test.cpp index 93d8cdfb83..5cbcf9fdf6 100644 --- a/cmds/dumpstate/tests/dumpstate_test.cpp +++ b/cmds/dumpstate/tests/dumpstate_test.cpp @@ -997,17 +997,22 @@ TEST_F(DumpstateTest, DumpPool_withParallelRunDisabled_isNull) { EXPECT_FALSE(ds.dump_pool_); } -TEST_F(DumpstateBaseTest, PreDumpUiData) { - // SurfaceFlinger's transactions trace is always enabled, i.e. it is always pre-dumped - static const auto kTransactionsTrace = - std::filesystem::path {"/data/misc/wmtrace/transactions_trace.winscope"}; +TEST_F(DumpstateTest, PreDumpUiData) { + // These traces are always enabled, i.e. they are always pre-dumped + const std::vector<std::filesystem::path> uiTraces = { + std::filesystem::path{"/data/misc/wmtrace/transactions_trace.winscope"}, + std::filesystem::path{"/data/misc/wmtrace/transition_trace.winscope"}, + std::filesystem::path{"/data/misc/wmtrace/shell_transition_trace.winscope"}, + }; - std::system(("rm " + kTransactionsTrace.string()).c_str()); - EXPECT_FALSE(std::filesystem::exists(kTransactionsTrace)); + for (const auto traceFile : uiTraces) { + std::system(("rm -f " + traceFile.string()).c_str()); + EXPECT_FALSE(std::filesystem::exists(traceFile)) << traceFile << " was not deleted."; - Dumpstate& ds_ = Dumpstate::GetInstance(); - ds_.PreDumpUiData(); - EXPECT_TRUE(std::filesystem::exists(kTransactionsTrace)); + Dumpstate& ds_ = Dumpstate::GetInstance(); + ds_.PreDumpUiData(); + EXPECT_TRUE(std::filesystem::exists(traceFile)) << traceFile << " was not created."; + } } class ZippedBugReportStreamTest : public DumpstateBaseTest { |