summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2018-01-16 17:20:32 -0800
committerYifan Hong <elsk@google.com>2018-01-16 19:19:37 -0800
commit4a43bdc5f50eef12356ca37e98d1149ecbdba849 (patch)
tree8b74e9eb7cc0a0490335a9402340b02d57a4c700
parent70c44e7a6a77222bcd9bccf737278774fd868c9d (diff)
downloadsystem_core-4a43bdc5f50eef12356ca37e98d1149ecbdba849.tar.gz
system_core-4a43bdc5f50eef12356ca37e98d1149ecbdba849.tar.bz2
system_core-4a43bdc5f50eef12356ca37e98d1149ecbdba849.zip
storaged: storaged_t replace initHealthService with init.
storaged_t has more fields that depend on the health service; they should be initialized in the new init() function. Test: storaged unit tests Change-Id: I70d41e5d0a0ef20c39c41c7539a284937bd21ad5
-rw-r--r--storaged/include/storaged.h6
-rw-r--r--storaged/main.cpp2
-rw-r--r--storaged/storaged.cpp4
3 files changed, 9 insertions, 3 deletions
diff --git a/storaged/include/storaged.h b/storaged/include/storaged.h
index 6bf6c9c1a..10175123a 100644
--- a/storaged/include/storaged.h
+++ b/storaged/include/storaged.h
@@ -96,8 +96,11 @@ class storaged_t : public android::hardware::health::V2_0::IHealthInfoCallback,
return string("/data/misc_ce/") + to_string(user_id) +
"/storaged/storaged.proto";
}
-public:
+ void init_health_service();
+
+ public:
storaged_t(void);
+ void init(void);
void event(void);
void event_checked(void);
void pause(void) {
@@ -130,7 +133,6 @@ public:
void add_user_ce(userid_t user_id);
void remove_user_ce(userid_t user_id);
- void init_health_service();
virtual ::android::hardware::Return<void> healthInfoChanged(
const ::android::hardware::health::V1_0::HealthInfo& info);
void serviceDied(uint64_t cookie, const wp<::android::hidl::base::V1_0::IBase>& who);
diff --git a/storaged/main.cpp b/storaged/main.cpp
index c1b13292e..b3f1281fc 100644
--- a/storaged/main.cpp
+++ b/storaged/main.cpp
@@ -51,7 +51,7 @@ sp<storaged_t> storaged_sp;
void* storaged_main(void* /* unused */) {
storaged_sp = new storaged_t();
- storaged_sp->init_health_service();
+ storaged_sp->init();
storaged_sp->report_storage_info();
LOG_TO(SYSTEM, INFO) << "storaged: Start";
diff --git a/storaged/storaged.cpp b/storaged/storaged.cpp
index ef41b5732..7086887e0 100644
--- a/storaged/storaged.cpp
+++ b/storaged/storaged.cpp
@@ -84,6 +84,10 @@ Return<void> storaged_t::healthInfoChanged(const HealthInfo& props) {
return android::hardware::Void();
}
+void storaged_t::init() {
+ init_health_service();
+}
+
void storaged_t::init_health_service() {
if (!mUidm.enabled())
return;