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

Commit 183b70fc authored by Bill Yi's avatar Bill Yi
Browse files

Merge RQ1A.210205.004 to aosp-master - DO NOT MERGE

Merged-In: If196679f41cd9a46e51bbe568a194d91e3fddccc
Merged-In: I841b7d4f3dffeb056a2c3deb4ecba2e517ef74b4
Change-Id: I8863ce6b6d63a77f81417a7826aee82836bd11f2
parents 4b3f556e 2e72d75c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ class storaged_t : public android::hardware::health::V2_0::IHealthInfoCallback,
    sp<android::hardware::health::V2_0::IHealth> health;
    unique_ptr<storage_info_t> storage_info;
    static const uint32_t current_version;
    Mutex proto_lock;
    unordered_map<userid_t, bool> proto_loaded;
    void load_proto(userid_t user_id);
    char* prepare_proto(userid_t user_id, StoragedProto* proto);
+6 −0
Original line number Diff line number Diff line
@@ -162,6 +162,8 @@ storaged_t::storaged_t(void) {
}

void storaged_t::add_user_ce(userid_t user_id) {
    Mutex::Autolock _l(proto_lock);

    if (!proto_loaded[user_id]) {
        load_proto(user_id);
        proto_loaded[user_id] = true;
@@ -169,6 +171,8 @@ void storaged_t::add_user_ce(userid_t user_id) {
}

void storaged_t::remove_user_ce(userid_t user_id) {
    Mutex::Autolock _l(proto_lock);

    proto_loaded[user_id] = false;
    mUidm.clear_user_history(user_id);
    RemoveFileIfExists(proto_path(user_id), nullptr);
@@ -298,6 +302,8 @@ void storaged_t::flush_proto(userid_t user_id, StoragedProto* proto) {
}

void storaged_t::flush_protos(unordered_map<int, StoragedProto>* protos) {
    Mutex::Autolock _l(proto_lock);

    for (auto& it : *protos) {
        /*
         * Don't flush proto if we haven't attempted to load it from file.