From 6839f6742e9965a38da98100801fe7d2b8ebc538 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 28 Oct 2021 22:24:35 -0700 Subject: [PATCH] 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 --- health/aidl/default/Health.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/health/aidl/default/Health.cpp b/health/aidl/default/Health.cpp index 2d91ce0fcd..812e64abfc 100644 --- a/health/aidl/default/Health.cpp +++ b/health/aidl/default/Health.cpp @@ -261,7 +261,7 @@ ndk::ScopedAStatus Health::unregisterCallback( std::lock_guard 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());