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

Commit 6839f674 authored by Yifan Hong's avatar Yifan Hong
Browse files

health impl: compare interfaces with their binders

The intention is to compare binder objects not the
outer interface class.

Test: VTS
Bug: 177269435
Change-Id: I1c48112a75cb229b40c42ed2a3f347472d1860f9
parent 236fa890
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -261,7 +261,7 @@ ndk::ScopedAStatus Health::unregisterCallback(
    std::lock_guard<decltype(callbacks_lock_)> lock(callbacks_lock_);

    auto matches = [callback](const auto& linked) {
        return linked->callback() == callback;  // compares shared_ptr
        return linked->callback()->asBinder() == callback->asBinder();  // compares binder object
    };
    auto it = std::remove_if(callbacks_.begin(), callbacks_.end(), matches);
    bool removed = (it != callbacks_.end());