Merge changes from topic 'vintf_arch' am: 45370128a5 am: c2b36f5696
am: 628dafc85e
Change-Id: Ib17fb1e919fdc5a1d3ce652debf1f0d530fde57f
diff --git a/cmds/lshal/Lshal.cpp b/cmds/lshal/Lshal.cpp
index 9e60461..8750147 100644
--- a/cmds/lshal/Lshal.cpp
+++ b/cmds/lshal/Lshal.cpp
@@ -160,14 +160,14 @@
}
void Lshal::forEachTable(const std::function<void(Table &)> &f) {
- for (const Table &table : {mServicesTable, mPassthroughRefTable, mImplementationsTable}) {
- f(const_cast<Table &>(table));
- }
+ f(mServicesTable);
+ f(mPassthroughRefTable);
+ f(mImplementationsTable);
}
void Lshal::forEachTable(const std::function<void(const Table &)> &f) const {
- for (const Table &table : {mServicesTable, mPassthroughRefTable, mImplementationsTable}) {
- f(table);
- }
+ f(mServicesTable);
+ f(mPassthroughRefTable);
+ f(mImplementationsTable);
}
void Lshal::postprocess() {
@@ -183,6 +183,26 @@
}
}
});
+ // use a double for loop here because lshal doesn't care about efficiency.
+ for (TableEntry &packageEntry : mImplementationsTable) {
+ std::string packageName = packageEntry.interfaceName;
+ FQName fqPackageName{packageName.substr(0, packageName.find("::"))};
+ if (!fqPackageName.isValid()) {
+ continue;
+ }
+ for (TableEntry &interfaceEntry : mPassthroughRefTable) {
+ if (interfaceEntry.arch != ARCH_UNKNOWN) {
+ continue;
+ }
+ FQName interfaceName{splitFirst(interfaceEntry.interfaceName, '/').first};
+ if (!interfaceName.isValid()) {
+ continue;
+ }
+ if (interfaceName.getPackageAndVersion() == fqPackageName) {
+ interfaceEntry.arch = packageEntry.arch;
+ }
+ }
+ }
}
void Lshal::printLine(
@@ -247,10 +267,25 @@
&table == &mImplementationsTable ? "" : splittedFqInstanceName.second;
vintf::Transport transport;
+ vintf::Arch arch;
if (entry.transport == "hwbinder") {
transport = vintf::Transport::HWBINDER;
+ arch = vintf::Arch::ARCH_EMPTY;
} else if (entry.transport == "passthrough") {
transport = vintf::Transport::PASSTHROUGH;
+ switch (entry.arch) {
+ case lshal::ARCH32:
+ arch = vintf::Arch::ARCH_32; break;
+ case lshal::ARCH64:
+ arch = vintf::Arch::ARCH_64; break;
+ case lshal::ARCH_BOTH:
+ arch = vintf::Arch::ARCH_32_64; break;
+ case lshal::ARCH_UNKNOWN: // fallthrough
+ default:
+ mErr << "Warning: '" << fqName.package()
+ << "' doesn't have bitness info, assuming 32+64." << std::endl;
+ arch = vintf::Arch::ARCH_32_64;
+ }
} else {
mErr << "Warning: '" << entry.transport << "' is not a valid transport." << std::endl;
continue;
@@ -262,7 +297,7 @@
.format = vintf::HalFormat::HIDL,
.name = fqName.package(),
.impl = {.implLevel = vintf::ImplLevel::GENERIC, .impl = ""},
- .transport = transport
+ .transportArch = {transport, arch}
})) {
mErr << "Warning: cannot add hal '" << fqInstanceName << "'" << std::endl;
continue;
diff --git a/cmds/lshal/TableEntry.h b/cmds/lshal/TableEntry.h
index 2407b42..9ae8f78 100644
--- a/cmds/lshal/TableEntry.h
+++ b/cmds/lshal/TableEntry.h
@@ -37,8 +37,8 @@
enum : unsigned int {
ARCH_UNKNOWN = 0,
- ARCH64 = 1 << 0,
- ARCH32 = 1 << 1,
+ ARCH32 = 1 << 0,
+ ARCH64 = 1 << 1,
ARCH_BOTH = ARCH32 | ARCH64
};
using Architecture = unsigned int;