Loading health/2.0/default/Health.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ Return<Result> Health::registerCallback(const sp<IHealthInfoCallback>& callback) } { std::lock_guard<std::mutex> _lock(callbacks_lock_); std::lock_guard<decltype(callbacks_lock_)> lock(callbacks_lock_); callbacks_.push_back(callback); // unlock } Loading @@ -65,7 +65,7 @@ bool Health::unregisterCallbackInternal(const sp<IBase>& callback) { if (callback == nullptr) return false; bool removed = false; std::lock_guard<std::mutex> _lock(callbacks_lock_); std::lock_guard<decltype(callbacks_lock_)> lock(callbacks_lock_); for (auto it = callbacks_.begin(); it != callbacks_.end();) { if (interfacesEqual(*it, callback)) { it = callbacks_.erase(it); Loading Loading @@ -175,7 +175,7 @@ void Health::notifyListeners(HealthInfo* healthInfo) { healthInfo->diskStats = stats; healthInfo->storageInfos = info; std::lock_guard<std::mutex> _lock(callbacks_lock_); std::lock_guard<decltype(callbacks_lock_)> lock(callbacks_lock_); for (auto it = callbacks_.begin(); it != callbacks_.end();) { auto ret = (*it)->healthInfoChanged(*healthInfo); if (!ret.isOk() && ret.isDeadObject()) { Loading health/2.0/default/include/health2/Health.h +1 −3 Original line number Diff line number Diff line Loading @@ -31,12 +31,10 @@ struct Health : public IHealth, hidl_death_recipient { // Should only be called by implementation itself (-impl, -service). // Clients should not call this function. Instead, initInstance() initializes and returns the // global instance that has fewer functions. // TODO(b/62229583): clean up and hide these functions after update() logic is simplified. static sp<Health> getImplementation(); Health(struct healthd_config* c); // TODO(b/62229583): clean up and hide these functions after update() logic is simplified. void notifyListeners(HealthInfo* info); // Methods from IHealth follow. Loading @@ -61,7 +59,7 @@ struct Health : public IHealth, hidl_death_recipient { private: static sp<Health> instance_; std::mutex callbacks_lock_; std::recursive_mutex callbacks_lock_; std::vector<sp<IHealthInfoCallback>> callbacks_; std::unique_ptr<BatteryMonitor> battery_monitor_; Loading Loading
health/2.0/default/Health.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ Return<Result> Health::registerCallback(const sp<IHealthInfoCallback>& callback) } { std::lock_guard<std::mutex> _lock(callbacks_lock_); std::lock_guard<decltype(callbacks_lock_)> lock(callbacks_lock_); callbacks_.push_back(callback); // unlock } Loading @@ -65,7 +65,7 @@ bool Health::unregisterCallbackInternal(const sp<IBase>& callback) { if (callback == nullptr) return false; bool removed = false; std::lock_guard<std::mutex> _lock(callbacks_lock_); std::lock_guard<decltype(callbacks_lock_)> lock(callbacks_lock_); for (auto it = callbacks_.begin(); it != callbacks_.end();) { if (interfacesEqual(*it, callback)) { it = callbacks_.erase(it); Loading Loading @@ -175,7 +175,7 @@ void Health::notifyListeners(HealthInfo* healthInfo) { healthInfo->diskStats = stats; healthInfo->storageInfos = info; std::lock_guard<std::mutex> _lock(callbacks_lock_); std::lock_guard<decltype(callbacks_lock_)> lock(callbacks_lock_); for (auto it = callbacks_.begin(); it != callbacks_.end();) { auto ret = (*it)->healthInfoChanged(*healthInfo); if (!ret.isOk() && ret.isDeadObject()) { Loading
health/2.0/default/include/health2/Health.h +1 −3 Original line number Diff line number Diff line Loading @@ -31,12 +31,10 @@ struct Health : public IHealth, hidl_death_recipient { // Should only be called by implementation itself (-impl, -service). // Clients should not call this function. Instead, initInstance() initializes and returns the // global instance that has fewer functions. // TODO(b/62229583): clean up and hide these functions after update() logic is simplified. static sp<Health> getImplementation(); Health(struct healthd_config* c); // TODO(b/62229583): clean up and hide these functions after update() logic is simplified. void notifyListeners(HealthInfo* info); // Methods from IHealth follow. Loading @@ -61,7 +59,7 @@ struct Health : public IHealth, hidl_death_recipient { private: static sp<Health> instance_; std::mutex callbacks_lock_; std::recursive_mutex callbacks_lock_; std::vector<sp<IHealthInfoCallback>> callbacks_; std::unique_ptr<BatteryMonitor> battery_monitor_; Loading