Update for IClientCallback
On kernels that support it, onNoClients will be called on HALs that
sign up for this notification.
Bug: 66921961
Test: hidl_test, manual
Change-Id: I1905e8a2a53e0dbe18dff3b4da2342cdde4ead9d
diff --git a/ServiceManager.h b/ServiceManager.h
index 0007de9..361cfd4 100644
--- a/ServiceManager.h
+++ b/ServiceManager.h
@@ -21,6 +21,7 @@
using ::android::hardware::Void;
using ::android::hidl::base::V1_0::IBase;
using ::android::hidl::manager::V1_0::IServiceNotification;
+using ::android::hidl::manager::V1_2::IClientCallback;
using ::android::sp;
using ::android::wp;
@@ -51,6 +52,14 @@
const hidl_string& name,
const sp<IServiceNotification>& callback) override;
+ // Methods from ::android::hidl::manager::V1_2::IServiceManager follow.
+ Return<bool> registerClientCallback(const sp<IBase>& server,
+ const sp<IClientCallback>& cb) override;
+ Return<bool> unregisterClientCallback(const sp<IBase>& server,
+ const sp<IClientCallback>& cb) override;
+
+ void handleClientCallbacks();
+
virtual void serviceDied(uint64_t cookie, const wp<IBase>& who);
private:
// if restrictToInstanceName is nullptr, remove all, otherwise only those services
@@ -59,8 +68,12 @@
bool removePackageListener(const wp<IBase>& who);
bool removeServiceListener(const wp<IBase>& who);
size_t countExistingService() const;
- void forEachExistingService(std::function<void(const HidlService *)> f) const;
- void forEachServiceEntry(std::function<void(const HidlService *)> f) const;
+
+ // true = continue, false = break
+ void forEachExistingService(std::function<bool(const HidlService *)> f) const;
+ void forEachExistingService(std::function<bool(HidlService *)> f);
+ void forEachServiceEntry(std::function<bool(const HidlService *)> f) const;
+ void forEachServiceEntry(std::function<bool(HidlService *)> f);
using InstanceMap = std::map<
std::string, // instance name e.x. "manager"