Merge "Update "HALs incompatible" message with FCM version"
diff --git a/HalManifest.cpp b/HalManifest.cpp
index 6f05cab..05322d1 100644
--- a/HalManifest.cpp
+++ b/HalManifest.cpp
@@ -381,7 +381,12 @@
auto incompatibleHals = checkIncompatibleHals(mat);
if (!incompatibleHals.empty()) {
if (error != nullptr) {
- *error = "HALs incompatible. The following requirements are not met:\n";
+ *error = "HALs incompatible.";
+ if (mat.level() != Level::UNSPECIFIED)
+ *error += " Matrix level = " + to_string(mat.level()) + ".";
+ if (level() != Level::UNSPECIFIED)
+ *error += " Manifest level = " + to_string(level()) + ".";
+ *error += " The following requirements are not met:\n";
for (const auto& e : incompatibleHals) {
*error += e + "\n";
}
diff --git a/test/LibVintfTest.cpp b/test/LibVintfTest.cpp
index 33fd833..5e09ea1 100644
--- a/test/LibVintfTest.cpp
+++ b/test/LibVintfTest.cpp
@@ -2782,7 +2782,7 @@
HalManifest manifest;
xml =
- "<manifest version=\"1.0\" type=\"device\">\n"
+ "<manifest version=\"1.0\" type=\"device\" target-level=\"103\">\n"
" <hal format=\"hidl\">\n"
" <name>android.hardware.foo</name>\n"
" <transport>hwbinder</transport>\n"
@@ -2798,7 +2798,7 @@
{
CompatibilityMatrix cm;
xml =
- "<compatibility-matrix version=\"1.0\" type=\"framework\">\n"
+ "<compatibility-matrix version=\"1.0\" type=\"framework\" level=\"100\">\n"
" <hal format=\"hidl\" optional=\"false\">\n"
" <name>android.hardware.foo</name>\n"
" <version>1.2-3</version>\n"
@@ -2816,6 +2816,8 @@
"</compatibility-matrix>\n";
EXPECT_TRUE(gCompatibilityMatrixConverter(&cm, xml, &error)) << error;
EXPECT_FALSE(manifest.checkCompatibility(cm, &error));
+ EXPECT_IN("Manifest level = 103", error)
+ EXPECT_IN("Matrix level = 100", error)
EXPECT_IN(
"android.hardware.foo:\n"
" required: \n"