Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a43bdc5 authored by Yifan Hong's avatar Yifan Hong
Browse files

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
parent 70c44e7a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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";
    }
    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);
+1 −1
Original line number Diff line number Diff line
@@ -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";
+4 −0
Original line number Diff line number Diff line
@@ -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;