Allow AIDL interfaces in service parsing

Bug: 138756857
Test: Manual (using mediaextractor as a test service)
Change-Id: Ice2c695fca7062d6a115df13a6ac1d6fe82a3a98
This commit is contained in:
Jon Spivack 2019-07-26 13:14:42 -07:00
parent 983f76b3c6
commit 16fb3f9e42
2 changed files with 19 additions and 9 deletions

View File

@ -77,6 +77,12 @@ Result<void> CheckInterfaceInheritanceHierarchy(const std::set<std::string>& ins
const InterfaceInheritanceHierarchyMap& hierarchy) {
std::set<FQName> interface_fqnames;
for (const std::string& instance : instances) {
// There is insufficient build-time information on AIDL interfaces to check them here
// TODO(b/139307527): Rework how services store interfaces to avoid excess string parsing
if (base::Split(instance, "/")[0] == "aidl") {
continue;
}
FqInstance fqinstance;
if (!fqinstance.setTo(instance)) {
return Error() << "Unable to parse interface instance '" << instance << "'";

View File

@ -145,17 +145,21 @@ Result<void> ServiceParser::ParseInterface(std::vector<std::string>&& args) {
const std::string& interface_name = args[1];
const std::string& instance_name = args[2];
FQName fq_name;
if (!FQName::parse(interface_name, &fq_name)) {
return Error() << "Invalid fully-qualified name for interface '" << interface_name << "'";
}
// AIDL services don't use fully qualified names and instead just use "interface aidl <name>"
if (interface_name != "aidl") {
FQName fq_name;
if (!FQName::parse(interface_name, &fq_name)) {
return Error() << "Invalid fully-qualified name for interface '" << interface_name
<< "'";
}
if (!fq_name.isFullyQualified()) {
return Error() << "Interface name not fully-qualified '" << interface_name << "'";
}
if (!fq_name.isFullyQualified()) {
return Error() << "Interface name not fully-qualified '" << interface_name << "'";
}
if (fq_name.isValidValueName()) {
return Error() << "Interface name must not be a value name '" << interface_name << "'";
if (fq_name.isValidValueName()) {
return Error() << "Interface name must not be a value name '" << interface_name << "'";
}
}
const std::string fullname = interface_name + "/" + instance_name;