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

Commit 7d1b211f authored by Yifan Hong's avatar Yifan Hong Committed by Automerger Merge Worker
Browse files

Merge "health: stop spamming." am: d615af1e

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1764905

Change-Id: I60af39724e5d6f27935b8fa326cef75aa0144725
parents 3e135619 d615af1e
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -35,10 +35,9 @@ namespace health {
namespace V2_1 {
namespace implementation {

bool IsDeadObjectLogged(const Return<void>& ret) {
bool IsDeadObject(const Return<void>& ret) {
    if (ret.isOk()) return false;
    if (ret.isDeadObject()) return true;
    LOG(ERROR) << "Cannot call healthInfoChanged* on callback: " << ret.description();
    return false;
}

@@ -77,7 +76,7 @@ Return<Result> BinderHealth::registerCallback(const sp<V2_0::IHealthInfoCallback
            return;
        }
        auto ret = wrapped->Notify(health_info);
        if (IsDeadObjectLogged(ret)) {
        if (IsDeadObject(ret)) {
            // Remove callback reference.
            std::lock_guard<decltype(callbacks_lock_)> lock(callbacks_lock_);
            auto it = std::find_if(callbacks_.begin(), callbacks_.end(),
@@ -133,7 +132,7 @@ void BinderHealth::OnHealthInfoChanged(const HealthInfo& health_info) {
    std::unique_lock<decltype(callbacks_lock_)> lock(callbacks_lock_);
    for (auto it = callbacks_.begin(); it != callbacks_.end();) {
        auto ret = (*it)->Notify(health_info);
        if (IsDeadObjectLogged(ret)) {
        if (IsDeadObject(ret)) {
            it = callbacks_.erase(it);
        } else {
            ++it;