Add a section flag to bypass failure if a specific path can't be found.
This is a temporary solution to bypass failure of reading cpu info or
battery type in P if the path doesn't exist on some devices. See bug for
details. However in Q, incidentd should implement reading from the
common Linux kernel interfaces.
Bug: 78028767
Bug: 78239764
Test: atest incidentd_test
Change-Id: I08ffcb21709efe5478d2ac46121deb5795af1024
diff --git a/cmds/incidentd/src/Section.h b/cmds/incidentd/src/Section.h
index 20ecdb1..577892e 100644
--- a/cmds/incidentd/src/Section.h
+++ b/cmds/incidentd/src/Section.h
@@ -40,9 +40,10 @@
public:
const int id;
const int64_t timeoutMs; // each section must have a timeout
+ const bool deviceSpecific;
String8 name;
- Section(int id, const int64_t timeoutMs = REMOTE_CALL_TIMEOUT_MS);
+ Section(int id, int64_t timeoutMs = REMOTE_CALL_TIMEOUT_MS, bool deviceSpecific = false);
virtual ~Section();
virtual status_t Execute(ReportRequestSet* requests) const = 0;
@@ -75,7 +76,8 @@
*/
class FileSection : public Section {
public:
- FileSection(int id, const char* filename, const int64_t timeoutMs = 5000 /* 5 seconds */);
+ FileSection(int id, const char* filename, bool deviceSpecific = false,
+ int64_t timeoutMs = 5000 /* 5 seconds */);
virtual ~FileSection();
virtual status_t Execute(ReportRequestSet* requests) const;
@@ -105,7 +107,7 @@
*/
class WorkerThreadSection : public Section {
public:
- WorkerThreadSection(int id, const int64_t timeoutMs = REMOTE_CALL_TIMEOUT_MS);
+ WorkerThreadSection(int id, int64_t timeoutMs = REMOTE_CALL_TIMEOUT_MS);
virtual ~WorkerThreadSection();
virtual status_t Execute(ReportRequestSet* requests) const;
@@ -118,7 +120,7 @@
*/
class CommandSection : public Section {
public:
- CommandSection(int id, const int64_t timeoutMs, const char* command, ...);
+ CommandSection(int id, int64_t timeoutMs, const char* command, ...);
CommandSection(int id, const char* command, ...);
@@ -168,7 +170,7 @@
*/
class TombstoneSection : public WorkerThreadSection {
public:
- TombstoneSection(int id, const char* type, const int64_t timeoutMs = 30000 /* 30 seconds */);
+ TombstoneSection(int id, const char* type, int64_t timeoutMs = 30000 /* 30 seconds */);
virtual ~TombstoneSection();
virtual status_t BlockingCall(int pipeWriteFd) const;