summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Devin Moore <devinmoore@google.com> 2024-07-23 21:40:05 +0000
committer Devin Moore <devinmoore@google.com> 2024-07-23 21:45:35 +0000
commit9d1dfa011d1d33ba138beb547505fb0a5436da38 (patch)
tree89fd91dabbfdf2ed19eeb4060a3135370bd2b5b5
parent7bbb484092a7e40fc38df0acd6e9df3856216238 (diff)
Skip logging error when service name doesn't match vintf format
VINTF services are expected to have a specific format for their names. We now build an AidlName for each service so we can check for them in the manifest files. In these cases we don't want to produce a log when the format doesn't match because these services are not all vintf services. Test: m Bug: 355053763 Change-Id: I76a12985495892809d3319963a9c020d60fd4084
-rw-r--r--cmds/servicemanager/ServiceManager.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp
index 0f251d2b2a..d85182d915 100644
--- a/cmds/servicemanager/ServiceManager.cpp
+++ b/cmds/servicemanager/ServiceManager.cpp
@@ -112,13 +112,15 @@ struct AidlName {
std::string iface;
std::string instance;
- static bool fill(const std::string& name, AidlName* aname) {
+ static bool fill(const std::string& name, AidlName* aname, bool logError) {
size_t firstSlash = name.find('/');
size_t lastDot = name.rfind('.', firstSlash);
if (firstSlash == std::string::npos || lastDot == std::string::npos) {
- ALOGE("VINTF HALs require names in the format type/instance (e.g. "
- "some.package.foo.IFoo/default) but got: %s",
- name.c_str());
+ if (logError) {
+ ALOGE("VINTF HALs require names in the format type/instance (e.g. "
+ "some.package.foo.IFoo/default) but got: %s",
+ name.c_str());
+ }
return false;
}
aname->package = name.substr(0, lastDot);
@@ -151,7 +153,7 @@ static bool isVintfDeclared(const Access::CallingContext& ctx, const std::string
}
AidlName aname;
- if (!AidlName::fill(name, &aname)) return false;
+ if (!AidlName::fill(name, &aname, true)) return false;
bool found = forEachManifest([&](const ManifestWithDescription& mwd) {
if (mwd.manifest->hasAidlInstance(aname.package, aname.iface, aname.instance)) {
@@ -209,7 +211,7 @@ static std::optional<std::string> getVintfUpdatableApex(const std::string& name)
}
AidlName aname;
- if (!AidlName::fill(name, &aname)) return std::nullopt;
+ if (!AidlName::fill(name, &aname, true)) return std::nullopt;
std::optional<std::string> updatableViaApex;
@@ -251,7 +253,7 @@ static std::vector<std::string> getVintfUpdatableNames(const std::string& apexNa
static std::optional<std::string> getVintfAccessorName(const std::string& name) {
AidlName aname;
- if (!AidlName::fill(name, &aname)) return std::nullopt;
+ if (!AidlName::fill(name, &aname, false)) return std::nullopt;
std::optional<std::string> accessor;
forEachManifest([&](const ManifestWithDescription& mwd) {
@@ -270,7 +272,7 @@ static std::optional<std::string> getVintfAccessorName(const std::string& name)
static std::optional<ConnectionInfo> getVintfConnectionInfo(const std::string& name) {
AidlName aname;
- if (!AidlName::fill(name, &aname)) return std::nullopt;
+ if (!AidlName::fill(name, &aname, true)) return std::nullopt;
std::optional<std::string> ip;
std::optional<uint64_t> port;