Fix dumpsys timeouts.
Both dumpstate and dumpsys can timeout when a child process hangs;
usually these values match, except when running dumpsys to dump all
services, in which case we need a timeout for all services (90s) and
individual timeouts for each service (10s).
BUG: 26379932
Test: manual
Change-Id: I37129ba9980976aa9bfe8eb132cdd0870fd93e59
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index f656266..1eeef51 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -894,9 +894,9 @@
}
void RunDumpsys(const std::string& title, const std::vector<std::string>& dumpsysArgs,
- const CommandOptions& options) {
- std::vector<std::string> dumpsys = {"/system/bin/dumpsys", "-t",
- std::to_string(options.Timeout())};
+ const CommandOptions& options, long dumpsysTimeout) {
+ long timeout = dumpsysTimeout > 0 ? dumpsysTimeout : options.Timeout();
+ std::vector<std::string> dumpsys = {"/system/bin/dumpsys", "-t", std::to_string(timeout)};
dumpsys.insert(dumpsys.end(), dumpsysArgs.begin(), dumpsysArgs.end());
RunCommand(title.c_str(), dumpsys, options);
}