Skip to content

Commit 616edb5

Browse files
Treehugger RobotGerrit Code Review
authored andcommitted
Merge "Skip logging error when service name doesn't match vintf format" into main
2 parents 7bbb484 + 9d1dfa0 commit 616edb5

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

cmds/servicemanager/ServiceManager.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,15 @@ struct AidlName {
112112
std::string iface;
113113
std::string instance;
114114

115-
static bool fill(const std::string& name, AidlName* aname) {
115+
static bool fill(const std::string& name, AidlName* aname, bool logError) {
116116
size_t firstSlash = name.find('/');
117117
size_t lastDot = name.rfind('.', firstSlash);
118118
if (firstSlash == std::string::npos || lastDot == std::string::npos) {
119-
ALOGE("VINTF HALs require names in the format type/instance (e.g. "
120-
"some.package.foo.IFoo/default) but got: %s",
121-
name.c_str());
119+
if (logError) {
120+
ALOGE("VINTF HALs require names in the format type/instance (e.g. "
121+
"some.package.foo.IFoo/default) but got: %s",
122+
name.c_str());
123+
}
122124
return false;
123125
}
124126
aname->package = name.substr(0, lastDot);
@@ -151,7 +153,7 @@ static bool isVintfDeclared(const Access::CallingContext& ctx, const std::string
151153
}
152154

153155
AidlName aname;
154-
if (!AidlName::fill(name, &aname)) return false;
156+
if (!AidlName::fill(name, &aname, true)) return false;
155157

156158
bool found = forEachManifest([&](const ManifestWithDescription& mwd) {
157159
if (mwd.manifest->hasAidlInstance(aname.package, aname.iface, aname.instance)) {
@@ -209,7 +211,7 @@ static std::optional<std::string> getVintfUpdatableApex(const std::string& name)
209211
}
210212

211213
AidlName aname;
212-
if (!AidlName::fill(name, &aname)) return std::nullopt;
214+
if (!AidlName::fill(name, &aname, true)) return std::nullopt;
213215

214216
std::optional<std::string> updatableViaApex;
215217

@@ -251,7 +253,7 @@ static std::vector<std::string> getVintfUpdatableNames(const std::string& apexNa
251253

252254
static std::optional<std::string> getVintfAccessorName(const std::string& name) {
253255
AidlName aname;
254-
if (!AidlName::fill(name, &aname)) return std::nullopt;
256+
if (!AidlName::fill(name, &aname, false)) return std::nullopt;
255257

256258
std::optional<std::string> accessor;
257259
forEachManifest([&](const ManifestWithDescription& mwd) {
@@ -270,7 +272,7 @@ static std::optional<std::string> getVintfAccessorName(const std::string& name)
270272

271273
static std::optional<ConnectionInfo> getVintfConnectionInfo(const std::string& name) {
272274
AidlName aname;
273-
if (!AidlName::fill(name, &aname)) return std::nullopt;
275+
if (!AidlName::fill(name, &aname, true)) return std::nullopt;
274276

275277
std::optional<std::string> ip;
276278
std::optional<uint64_t> port;

0 commit comments

Comments
 (0)