summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot2018-02-08 02:20:53 -0600
committerandroid-build-team Robot2018-02-08 02:20:53 -0600
commit330b2d71ee774cddfc70ae1c6c1269d04fd4ab38 (patch)
tree13f4bac8fcb093cb73d4cf09f9697ad2a0cb61a8
parent142b6b5d9fd11b71ddc5378a0d11ed284e980528 (diff)
parent7a9d05a1f72c6dc6d1a8569a3c6aedd7f896399c (diff)
downloadplatform-system-libvintf-330b2d71ee774cddfc70ae1c6c1269d04fd4ab38.tar.gz
platform-system-libvintf-330b2d71ee774cddfc70ae1c6c1269d04fd4ab38.tar.xz
platform-system-libvintf-330b2d71ee774cddfc70ae1c6c1269d04fd4ab38.zip
Snap for 4593582 from 7a9d05a1f72c6dc6d1a8569a3c6aedd7f896399c to pi-release
Change-Id: I5e10a3201ab1929d36b01785769bdd064704087f
-rw-r--r--AssembleVintf.cpp30
-rw-r--r--VintfObject.cpp42
-rw-r--r--test/AssembleVintfTest.cpp2
3 files changed, 41 insertions, 33 deletions
diff --git a/AssembleVintf.cpp b/AssembleVintf.cpp
index 07ce9f8..96e8537 100644
--- a/AssembleVintf.cpp
+++ b/AssembleVintf.cpp
@@ -472,14 +472,28 @@ class AssembleVintfImpl : public AssembleVintf {
472 return false; 472 return false;
473 } 473 }
474 474
475 // set sepolicy.sepolicy-version to BOARD_SEPOLICY_VERS when none is specified. 475 // Add PLATFORM_SEPOLICY_* to sepolicy.sepolicy-version. Remove dupes.
476 std::vector<VersionRange>* sepolicyVrs = 476 std::set<Version> sepolicyVersions;
477 &matrix->framework.mSepolicy.mSepolicyVersionRanges; 477 auto sepolicyVersionStrings = getEnvList("PLATFORM_SEPOLICY_COMPAT_VERSIONS");
478 VersionRange sepolicyVr; 478 auto currentSepolicyVersionString = getEnv("PLATFORM_SEPOLICY_VERSION");
479 if (!sepolicyVrs->empty()) sepolicyVr = sepolicyVrs->front(); 479 if (!currentSepolicyVersionString.empty()) {
480 if (getFlagIfUnset("BOARD_SEPOLICY_VERS", &sepolicyVr, 480 sepolicyVersionStrings.push_back(currentSepolicyVersionString);
481 deviceLevel == Level::UNSPECIFIED /* log */)) { 481 }
482 *sepolicyVrs = {{sepolicyVr}}; 482 for (auto&& s : sepolicyVersionStrings) {
483 Version v;
484 if (!parse(s, &v)) {
485 std::cerr << "Error: unknown sepolicy version '" << s << "' specified by "
486 << (s == currentSepolicyVersionString
487 ? "PLATFORM_SEPOLICY_VERSION"
488 : "PLATFORM_SEPOLICY_COMPAT_VERSIONS")
489 << ".";
490 return false;
491 }
492 sepolicyVersions.insert(v);
493 }
494 for (auto&& v : sepolicyVersions) {
495 matrix->framework.mSepolicy.mSepolicyVersionRanges.emplace_back(v.majorVer,
496 v.minorVer);
483 } 497 }
484 498
485 getFlagIfUnset("POLICYVERS", &matrix->framework.mSepolicy.mKernelSepolicyVersion, 499 getFlagIfUnset("POLICYVERS", &matrix->framework.mSepolicy.mKernelSepolicyVersion,
diff --git a/VintfObject.cpp b/VintfObject.cpp
index 7c55181..3f097f7 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -492,7 +492,6 @@ int32_t checkCompatibility(const std::vector<std::string>& xmls, bool mount,
492 updated.runtimeInfo = VintfObject::GetRuntimeInfo(true /* skipCache */); 492 updated.runtimeInfo = VintfObject::GetRuntimeInfo(true /* skipCache */);
493 493
494 // null checks for files and runtime info after the update 494 // null checks for files and runtime info after the update
495 // TODO(b/37321309) if a compat mat is missing, it is not matched and considered compatible.
496 if (updated.fwk.manifest == nullptr) { 495 if (updated.fwk.manifest == nullptr) {
497 ADD_MESSAGE("No framework manifest file from device or from update package"); 496 ADD_MESSAGE("No framework manifest file from device or from update package");
498 return NO_INIT; 497 return NO_INIT;
@@ -502,12 +501,12 @@ int32_t checkCompatibility(const std::vector<std::string>& xmls, bool mount,
502 return NO_INIT; 501 return NO_INIT;
503 } 502 }
504 if (updated.fwk.matrix == nullptr) { 503 if (updated.fwk.matrix == nullptr) {
505 ADD_MESSAGE("No framework matrix, skipping;"); 504 ADD_MESSAGE("No framework matrix file from device or from update package");
506 // TODO(b/37321309) consider missing matricies as errors. 505 return NO_INIT;
507 } 506 }
508 if (updated.dev.matrix == nullptr) { 507 if (updated.dev.matrix == nullptr) {
509 ADD_MESSAGE("No device matrix, skipping;"); 508 ADD_MESSAGE("No device matrix file from device or from update package");
510 // TODO(b/37321309) consider missing matricies as errors. 509 return NO_INIT;
511 } 510 }
512 if (updated.runtimeInfo == nullptr) { 511 if (updated.runtimeInfo == nullptr) {
513 ADD_MESSAGE("No runtime info from device"); 512 ADD_MESSAGE("No runtime info from device");
@@ -515,30 +514,25 @@ int32_t checkCompatibility(const std::vector<std::string>& xmls, bool mount,
515 } 514 }
516 515
517 // compatiblity check. 516 // compatiblity check.
518 // TODO(b/37321309) outer if checks can be removed if we consider missing matrices as errors. 517 if (!updated.dev.manifest->checkCompatibility(*updated.fwk.matrix, error)) {
519 if (updated.dev.manifest && updated.fwk.matrix) { 518 if (error) {
520 if (!updated.dev.manifest->checkCompatibility(*updated.fwk.matrix, error)) { 519 error->insert(0,
521 if (error) 520 "Device manifest and framework compatibility matrix are incompatible: ");
522 error->insert(0, "Device manifest and framework compatibility matrix "
523 "are incompatible: ");
524 return INCOMPATIBLE;
525 } 521 }
522 return INCOMPATIBLE;
526 } 523 }
527 if (updated.fwk.manifest && updated.dev.matrix) { 524 if (!updated.fwk.manifest->checkCompatibility(*updated.dev.matrix, error)) {
528 if (!updated.fwk.manifest->checkCompatibility(*updated.dev.matrix, error)) { 525 if (error) {
529 if (error) 526 error->insert(0,
530 error->insert(0, "Framework manifest and device compatibility matrix " 527 "Framework manifest and device compatibility matrix are incompatible: ");
531 "are incompatible: ");
532 return INCOMPATIBLE;
533 } 528 }
529 return INCOMPATIBLE;
534 } 530 }
535 if (updated.runtimeInfo && updated.fwk.matrix) { 531 if (!updated.runtimeInfo->checkCompatibility(*updated.fwk.matrix, error, disabledChecks)) {
536 if (!updated.runtimeInfo->checkCompatibility(*updated.fwk.matrix, error, disabledChecks)) { 532 if (error) {
537 if (error) 533 error->insert(0, "Runtime info and framework compatibility matrix are incompatible: ");
538 error->insert(0, "Runtime info and framework compatibility matrix "
539 "are incompatible: ");
540 return INCOMPATIBLE;
541 } 534 }
535 return INCOMPATIBLE;
542 } 536 }
543 537
544 return COMPATIBLE; 538 return COMPATIBLE;
diff --git a/test/AssembleVintfTest.cpp b/test/AssembleVintfTest.cpp
index 64dfc3e..4410a5c 100644
--- a/test/AssembleVintfTest.cpp
+++ b/test/AssembleVintfTest.cpp
@@ -74,7 +74,7 @@ TEST_F(AssembleVintfTest, FrameworkMatrixEmpty) {
74 addInput("compatibility_matrix.empty.xml", xmlEmpty); 74 addInput("compatibility_matrix.empty.xml", xmlEmpty);
75 setFakeEnvs({ 75 setFakeEnvs({
76 {"POLICYVERS", "30"}, 76 {"POLICYVERS", "30"},
77 {"BOARD_SEPOLICY_VERS", "10000.0"}, 77 {"PLATFORM_SEPOLICY_VERSION", "10000.0"},
78 {"FRAMEWORK_VBMETA_VERSION", "1.0"}, 78 {"FRAMEWORK_VBMETA_VERSION", "1.0"},
79 }); 79 });
80 getInstance()->addKernelConfigInputStream({3, 18, 0}, "android-base.cfg", 80 getInstance()->addKernelConfigInputStream({3, 18, 0}, "android-base.cfg",