Add unbind() binder API.
It will remove the callback from the list and unregister death
notification for the callback.
Bug: 62293007
Test: mma
Change-Id: I527699a160feaad739c50ed1865d557d3cef22e8
diff --git a/binder_service_android.h b/binder_service_android.h
index 3293c0e..375dad4 100644
--- a/binder_service_android.h
+++ b/binder_service_android.h
@@ -61,6 +61,9 @@
android::binder::Status bind(
const android::sp<android::os::IUpdateEngineCallback>& callback,
bool* return_value) override;
+ android::binder::Status unbind(
+ const android::sp<android::os::IUpdateEngineCallback>& callback,
+ bool* return_value) override;
android::binder::Status suspend() override;
android::binder::Status resume() override;
android::binder::Status cancel() override;
@@ -68,8 +71,9 @@
private:
// Remove the passed |callback| from the list of registered callbacks. Called
- // whenever the callback object is destroyed.
- void UnbindCallback(android::os::IUpdateEngineCallback* callback);
+ // on unbind() or whenever the callback object is destroyed.
+ // Returns true on success.
+ bool UnbindCallback(android::os::IUpdateEngineCallback* callback);
// List of currently bound callbacks.
std::vector<android::sp<android::os::IUpdateEngineCallback>> callbacks_;