Merge changes from topic "assemble_vintf_cleanup"
* changes:
AssembleVintfTest: EXPECT_TRUE(assemble())
AssembleVintfTest: std::make_unique<std::stringstream> to a function
diff --git a/AssembleVintf.cpp b/AssembleVintf.cpp
index d2a0b8f..638022f 100644
--- a/AssembleVintf.cpp
+++ b/AssembleVintf.cpp
@@ -151,18 +151,6 @@
return ::android::base::Basename(path) == gBaseConfig;
}
- static Level convertFromApiLevel(size_t apiLevel) {
- if (apiLevel < 26) {
- return Level::LEGACY;
- } else if (apiLevel == 26) {
- return Level::O;
- } else if (apiLevel == 27) {
- return Level::O_MR1;
- } else {
- return Level::UNSPECIFIED;
- }
- }
-
// nullptr on any error, otherwise the condition.
static Condition generateCondition(const std::string& path) {
std::string fname = ::android::base::Basename(path);
@@ -256,14 +244,6 @@
return ret;
}
- static std::string getFileNameFromPath(std::string path) {
- auto idx = path.find_last_of("\\/");
- if (idx != std::string::npos) {
- path.erase(0, idx + 1);
- }
- return path;
- }
-
std::basic_ostream<char>& out() const { return mOutRef == nullptr ? std::cout : *mOutRef; }
template <typename S>
@@ -375,7 +355,7 @@
if (shippingApiLevel) {
std::cerr << "Warning: Shipping FCM Version is inferred from Shipping API level. "
<< "Declare Shipping FCM Version in device manifest directly." << std::endl;
- manifest->mLevel = convertFromApiLevel(shippingApiLevel);
+ manifest->mLevel = details::convertFromApiLevel(shippingApiLevel);
if (manifest->mLevel == Level::UNSPECIFIED) {
std::cerr << "Error: Shipping FCM Version cannot be inferred from Shipping API "
<< "level " << shippingApiLevel << "."
@@ -465,7 +445,7 @@
out() << " Input:" << std::endl;
for (const auto& e : *matrices) {
if (!e.name.empty()) {
- out() << " " << getFileNameFromPath(e.name) << std::endl;
+ out() << " " << base::Basename(e.name) << std::endl;
}
}
out() << "-->" << std::endl;
diff --git a/parse_xml.cpp b/parse_xml.cpp
index 3df7e19..1723bd0 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -901,7 +901,9 @@
}
} else if (m.mType == SchemaType::DEVICE) {
if (!(flags & SerializeFlag::NO_VNDK)) {
- appendChild(root, vndkConverter(m.device.mVndk, d));
+ if (!(m.device.mVndk == Vndk{})) {
+ appendChild(root, vndkConverter(m.device.mVndk, d));
+ }
}
}
diff --git a/utils.h b/utils.h
index dce03b3..5f28b6d 100644
--- a/utils.h
+++ b/utils.h
@@ -107,6 +107,19 @@
};
extern ObjectFactory<RuntimeInfo>* gRuntimeInfoFactory;
+// TODO(b/70628538): Do not infer from Shipping API level.
+inline Level convertFromApiLevel(size_t apiLevel) {
+ if (apiLevel < 26) {
+ return Level::LEGACY;
+ } else if (apiLevel == 26) {
+ return Level::O;
+ } else if (apiLevel == 27) {
+ return Level::O_MR1;
+ } else {
+ return Level::UNSPECIFIED;
+ }
+}
+
} // namespace details
} // namespace vintf
} // namespace android