Adding batterystats history to proto dump.
It will only print out a dump for userdebug or eng builds.
Bug: 77727638
Test: flash device and check output of incident proto and
'dumpsys batterystats -c --history'
Merged-In: Ib74d4c664f23a61e6fc33f700ba6a3c6fad32c74
Change-Id: Ia0c993d1281cc350d93f9c13f5540b349a4bfb84
diff --git a/cmds/incidentd/src/Section.cpp b/cmds/incidentd/src/Section.cpp
index e5bde0d..4bbe042 100644
--- a/cmds/incidentd/src/Section.cpp
+++ b/cmds/incidentd/src/Section.cpp
@@ -151,8 +151,11 @@
}
// ================================================================================
-Section::Section(int i, int64_t timeoutMs, bool deviceSpecific)
- : id(i), timeoutMs(timeoutMs), deviceSpecific(deviceSpecific) {}
+Section::Section(int i, int64_t timeoutMs, bool userdebugAndEngOnly, bool deviceSpecific)
+ : id(i),
+ timeoutMs(timeoutMs),
+ userdebugAndEngOnly(userdebugAndEngOnly),
+ deviceSpecific(deviceSpecific) {}
Section::~Section() {}
@@ -239,7 +242,7 @@
FileSection::FileSection(int id, const char* filename, const bool deviceSpecific,
const int64_t timeoutMs)
- : Section(id, timeoutMs, deviceSpecific), mFilename(filename) {
+ : Section(id, timeoutMs, false, deviceSpecific), mFilename(filename) {
name = filename;
mIsSysfs = isSysfs(filename);
}
@@ -417,8 +420,8 @@
WorkerThreadData::~WorkerThreadData() {}
// ================================================================================
-WorkerThreadSection::WorkerThreadSection(int id, const int64_t timeoutMs)
- : Section(id, timeoutMs) {}
+WorkerThreadSection::WorkerThreadSection(int id, const int64_t timeoutMs, bool userdebugAndEngOnly)
+ : Section(id, timeoutMs, userdebugAndEngOnly) {}
WorkerThreadSection::~WorkerThreadSection() {}
@@ -615,8 +618,8 @@
}
// ================================================================================
-DumpsysSection::DumpsysSection(int id, const char* service, ...)
- : WorkerThreadSection(id), mService(service) {
+DumpsysSection::DumpsysSection(int id, bool userdebugAndEngOnly, const char* service, ...)
+ : WorkerThreadSection(id, REMOTE_CALL_TIMEOUT_MS, userdebugAndEngOnly), mService(service) {
name = "dumpsys ";
name += service;