diff options
author | 2020-09-23 00:25:16 +0000 | |
---|---|---|
committer | 2020-09-24 16:43:41 +0000 | |
commit | 2e293aa8ae8dd977e54aa2c2f2e1ede2af5792ed (patch) | |
tree | 0e8875e2f3251a8d04e6b4152261f39b492f1080 /libs/binder/IServiceManager.cpp | |
parent | c68e32d3b03d1024d570dc4283a3201d7bc8429e (diff) |
servicemanager: vintf declared API
servicemanager already has to parse VINTF configurations, so exposing
this functionality here (mirroring hwservicemanager).
Note, this API, like isDeclared is not branded as "VINTF" for future
compatibility with APEX or other interfaces.
Bug: 168715768
Test: manual
Change-Id: Ifbc44677605de757c46ef17f7f29fd83e66a8161
Diffstat (limited to 'libs/binder/IServiceManager.cpp')
-rw-r--r-- | libs/binder/IServiceManager.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 9aa82d908c..6d728dc6b1 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -74,6 +74,7 @@ public: Vector<String16> listServices(int dumpsysPriority) override; sp<IBinder> waitForService(const String16& name16) override; bool isDeclared(const String16& name) override; + Vector<String16> getDeclaredInstances(const String16& interface) override; // for legacy ABI const String16& getInterfaceDescriptor() const override { @@ -373,4 +374,18 @@ bool ServiceManagerShim::isDeclared(const String16& name) { return declared; } +Vector<String16> ServiceManagerShim::getDeclaredInstances(const String16& interface) { + std::vector<std::string> out; + if (!mTheRealServiceManager->getDeclaredInstances(String8(interface).c_str(), &out).isOk()) { + return {}; + } + + Vector<String16> res; + res.setCapacity(out.size()); + for (const std::string& instance : out) { + res.push(String16(instance.c_str())); + } + return res; +} + } // namespace android |