Add apex name to service
Passed apex file name to service. The file name will be parsed
to determine 1) whether the service is from an apex; 2) apex name
Bug: 236090201
Change-Id: I2c292c0c067f4bf44bb25b1f80e4f972b94f7258
diff --git a/init/subcontext.cpp b/init/subcontext.cpp
index bd2bec5..961e006 100644
--- a/init/subcontext.cpp
+++ b/init/subcontext.cpp
@@ -251,11 +251,8 @@
}
bool Subcontext::PathMatchesSubcontext(const std::string& path) const {
- static const std::string kApexDir = "/apex/";
- if (StartsWith(path, kApexDir)) {
- auto begin = kApexDir.size();
- auto end = path.find('/', begin);
- auto apex_name = path.substr(begin, end - begin);
+ auto apex_name = GetApexNameFromFileName(path);
+ if (!apex_name.empty()) {
return std::find(apex_list_.begin(), apex_list_.end(), apex_name) != apex_list_.end();
}
for (const auto& prefix : path_prefixes_) {