summaryrefslogtreecommitdiff
path: root/libs/binder/IServiceManager.cpp
diff options
context:
space:
mode:
author Jooyung Han <jooyung@google.com> 2022-10-25 17:02:45 +0900
committer Jooyung Han <jooyung@google.com> 2022-10-26 09:42:59 +0900
commit76944fee1a642cdfbabaa72ef7d29e53af1d50db (patch)
tree3b0d45fa894dc8b3d9f7d2677e6a74d99323ba25 /libs/binder/IServiceManager.cpp
parent4e84148059c54ccbf64740c6841fdae46ce64b30 (diff)
servicemanager: getUpdatableNames()
This new method is a reverse of updatableViaApex(). It returns the list of declared instances which can be updated via the passed APEX. Updatable vendor apexes are supposed to be used only to update HAL services. APEXd can use this method to see if the target APEX is actually to updating HALs. It's not exposed to NDK/Java yet because there's no clients. Bug: 254201177 Test: TBD Change-Id: I7b5aa7d00a3ddeb13855816006a9561dfa601529
Diffstat (limited to 'libs/binder/IServiceManager.cpp')
-rw-r--r--libs/binder/IServiceManager.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
index 05db7743f2..a0c43349a7 100644
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -81,6 +81,7 @@ public:
bool isDeclared(const String16& name) override;
Vector<String16> getDeclaredInstances(const String16& interface) override;
std::optional<String16> updatableViaApex(const String16& name) override;
+ Vector<String16> getUpdatableNames(const String16& apexName) override;
std::optional<IServiceManager::ConnectionInfo> getConnectionInfo(const String16& name) override;
class RegistrationWaiter : public android::os::BnServiceCallback {
public:
@@ -479,6 +480,23 @@ std::optional<String16> ServiceManagerShim::updatableViaApex(const String16& nam
return declared ? std::optional<String16>(String16(declared.value().c_str())) : std::nullopt;
}
+Vector<String16> ServiceManagerShim::getUpdatableNames(const String16& apexName) {
+ std::vector<std::string> out;
+ if (Status status = mTheRealServiceManager->getUpdatableNames(String8(apexName).c_str(), &out);
+ !status.isOk()) {
+ ALOGW("Failed to getUpdatableNames for %s: %s", String8(apexName).c_str(),
+ status.toString8().c_str());
+ return {};
+ }
+
+ Vector<String16> res;
+ res.setCapacity(out.size());
+ for (const std::string& instance : out) {
+ res.push(String16(instance.c_str()));
+ }
+ return res;
+}
+
std::optional<IServiceManager::ConnectionInfo> ServiceManagerShim::getConnectionInfo(
const String16& name) {
std::optional<os::ConnectionInfo> connectionInfo;