Merge "health impl: compare interfaces with their binders" am: 1f5c57c965 am: e1bc376ed4

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

Change-Id: Ia245dfb5e5a8511b3a2b98b08745225b03b63044
This commit is contained in:
Yifan Hong 2021-10-29 21:26:06 +00:00 committed by Automerger Merge Worker
commit 2faf3adc25

View file

@ -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());