diff options
author | android-build-team Robot | 2018-04-01 02:22:45 -0500 |
---|---|---|
committer | android-build-team Robot | 2018-04-01 02:22:45 -0500 |
commit | 1eaa23b778c02cf2b686112b583c3a30b0f6df07 (patch) | |
tree | 98c449dbe6c994265a0cfef7da12983c448aac8f | |
parent | d2d2f72a38b42b029de7092e12b8c2d56b3c4a37 (diff) | |
parent | 9adf115f40240d1f8bfd0266c2445f7a9b3e0262 (diff) | |
download | platform-system-libvintf-1eaa23b778c02cf2b686112b583c3a30b0f6df07.tar.gz platform-system-libvintf-1eaa23b778c02cf2b686112b583c3a30b0f6df07.tar.xz platform-system-libvintf-1eaa23b778c02cf2b686112b583c3a30b0f6df07.zip |
Snap for 4693621 from 9adf115f40240d1f8bfd0266c2445f7a9b3e0262 to pi-release
Change-Id: Ic74c65776067394e5aa7860265311b62421eb6f8
-rw-r--r-- | AssembleVintf.cpp | 40 | ||||
-rw-r--r-- | test/AssembleVintfTest.cpp | 2 |
2 files changed, 36 insertions, 6 deletions
diff --git a/AssembleVintf.cpp b/AssembleVintf.cpp index 7f86b94..ef7c8ba 100644 --- a/AssembleVintf.cpp +++ b/AssembleVintf.cpp | |||
@@ -263,6 +263,37 @@ class AssembleVintfImpl : public AssembleVintf { | |||
263 | 263 | ||
264 | std::basic_ostream<char>& out() const { return mOutRef == nullptr ? std::cout : *mOutRef; } | 264 | std::basic_ostream<char>& out() const { return mOutRef == nullptr ? std::cout : *mOutRef; } |
265 | 265 | ||
266 | // If -c is provided, check it. | ||
267 | bool checkDualFile(const HalManifest& manifest, const CompatibilityMatrix& matrix) { | ||
268 | if (getBooleanFlag("PRODUCT_ENFORCE_VINTF_MANIFEST")) { | ||
269 | std::string error; | ||
270 | if (!manifest.checkCompatibility(matrix, &error)) { | ||
271 | std::cerr << "Not compatible: " << error << std::endl; | ||
272 | return false; | ||
273 | } | ||
274 | } | ||
275 | |||
276 | // Check HALs in device manifest that are not in framework matrix. | ||
277 | if (getBooleanFlag("VINTF_ENFORCE_NO_UNUSED_HALS")) { | ||
278 | auto unused = manifest.checkUnusedHals(matrix); | ||
279 | if (!unused.empty()) { | ||
280 | std::cerr << "Error: The following instances are in the device manifest but " | ||
281 | << "not specified in framework compatibility matrix: " << std::endl | ||
282 | << " " << android::base::Join(unused, "\n ") << std::endl | ||
283 | << "Suggested fix:" << std::endl | ||
284 | << "1. Check for any typos in device manifest or framework compatibility " | ||
285 | << "matrices with FCM version >= " << matrix.level() << "." << std::endl | ||
286 | << "2. Add them to any framework compatibility matrix with FCM " | ||
287 | << "version >= " << matrix.level() << " where applicable." << std::endl | ||
288 | << "3. Add them to DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE." | ||
289 | << std::endl; | ||
290 | |||
291 | return false; | ||
292 | } | ||
293 | } | ||
294 | return true; | ||
295 | } | ||
296 | |||
266 | template <typename S> | 297 | template <typename S> |
267 | using Schemas = std::vector<Named<S>>; | 298 | using Schemas = std::vector<Named<S>>; |
268 | using HalManifests = Schemas<HalManifest>; | 299 | using HalManifests = Schemas<HalManifest>; |
@@ -342,8 +373,7 @@ class AssembleVintfImpl : public AssembleVintf { | |||
342 | << std::endl; | 373 | << std::endl; |
343 | return false; | 374 | return false; |
344 | } | 375 | } |
345 | if (!halManifest->checkCompatibility(checkMatrix, &error)) { | 376 | if (!checkDualFile(*halManifest, checkMatrix)) { |
346 | std::cerr << "Not compatible: " << error << std::endl; | ||
347 | return false; | 377 | return false; |
348 | } | 378 | } |
349 | } | 379 | } |
@@ -369,7 +399,7 @@ class AssembleVintfImpl : public AssembleVintf { | |||
369 | 399 | ||
370 | bool setDeviceFcmVersion(HalManifest* manifest) { | 400 | bool setDeviceFcmVersion(HalManifest* manifest) { |
371 | // Not needed for generating empty manifest for DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE. | 401 | // Not needed for generating empty manifest for DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE. |
372 | if (getBooleanFlag("IGNORE_TARGET_FCM_VERSION")) { | 402 | if (getBooleanFlag("VINTF_IGNORE_TARGET_FCM_VERSION")) { |
373 | return true; | 403 | return true; |
374 | } | 404 | } |
375 | 405 | ||
@@ -513,9 +543,7 @@ class AssembleVintfImpl : public AssembleVintf { | |||
513 | out() << gCompatibilityMatrixConverter(*matrix, mSerializeFlags); | 543 | out() << gCompatibilityMatrixConverter(*matrix, mSerializeFlags); |
514 | out().flush(); | 544 | out().flush(); |
515 | 545 | ||
516 | if (checkManifest != nullptr && getBooleanFlag("PRODUCT_ENFORCE_VINTF_MANIFEST") && | 546 | if (checkManifest != nullptr && !checkDualFile(*checkManifest, *matrix)) { |
517 | !checkManifest->checkCompatibility(*matrix, &error)) { | ||
518 | std::cerr << "Not compatible: " << error << std::endl; | ||
519 | return false; | 547 | return false; |
520 | } | 548 | } |
521 | 549 | ||
diff --git a/test/AssembleVintfTest.cpp b/test/AssembleVintfTest.cpp index b629c74..33acc1e 100644 --- a/test/AssembleVintfTest.cpp +++ b/test/AssembleVintfTest.cpp | |||
@@ -36,6 +36,8 @@ class AssembleVintfTest : public ::testing::Test { | |||
36 | auto s = makeStream(""); | 36 | auto s = makeStream(""); |
37 | mOutputStream = s.get(); | 37 | mOutputStream = s.get(); |
38 | mInstance->setOutputStream(std::move(s)); | 38 | mInstance->setOutputStream(std::move(s)); |
39 | |||
40 | getInstance()->setFakeEnv("PRODUCT_ENFORCE_VINTF_MANIFEST", "true"); | ||
39 | } | 41 | } |
40 | virtual void TearDown() override { mInstance = nullptr; } | 42 | virtual void TearDown() override { mInstance = nullptr; } |
41 | 43 | ||