init: add an initializer for keychord_id_
Add unit test to ensure all POD types of Service are initialized.
Bug: 37855222
Test: Ensure bugreport is triggered via keychord properly.
Test: New unit tests
Change-Id: If2cfea15a74ab417a7b909a60c264cb8eb990de7
diff --git a/init/service.h b/init/service.h
index 634fe4e..426577f 100644
--- a/init/service.h
+++ b/init/service.h
@@ -94,14 +94,19 @@
const std::set<std::string>& classnames() const { return classnames_; }
unsigned flags() const { return flags_; }
pid_t pid() const { return pid_; }
+ int crash_count() const { return crash_count_; }
uid_t uid() const { return uid_; }
gid_t gid() const { return gid_; }
- int priority() const { return priority_; }
+ unsigned namespace_flags() const { return namespace_flags_; }
const std::vector<gid_t>& supp_gids() const { return supp_gids_; }
const std::string& seclabel() const { return seclabel_; }
const std::vector<int>& keycodes() const { return keycodes_; }
int keychord_id() const { return keychord_id_; }
void set_keychord_id(int keychord_id) { keychord_id_ = keychord_id; }
+ IoSchedClass ioprio_class() const { return ioprio_class_; }
+ int ioprio_pri() const { return ioprio_pri_; }
+ int priority() const { return priority_; }
+ int oom_score_adjust() const { return oom_score_adjust_; }
const std::vector<std::string>& args() const { return args_; }
private:
@@ -181,6 +186,9 @@
public:
static ServiceManager& GetInstance();
+ // Exposed for testing
+ ServiceManager();
+
void AddService(std::unique_ptr<Service> service);
Service* MakeExecOneshotService(const std::vector<std::string>& args);
bool Exec(const std::vector<std::string>& args);
@@ -199,8 +207,6 @@
void DumpState() const;
private:
- ServiceManager();
-
// Cleans up a child process that exited.
// Returns true iff a children was cleaned up.
bool ReapOneProcess();