Snap for 11273583 from abfbdb4f0f3b8a7637433a75b902f3f97d90d3e5 to mainline-ipsec-release
Change-Id: Ia2ab82174bac1c01690e08397e8fc27d0865bc0d
diff --git a/HalManifest.cpp b/HalManifest.cpp
index 54f709f..5fffc62 100644
--- a/HalManifest.cpp
+++ b/HalManifest.cpp
@@ -389,56 +389,6 @@
return ret;
}
-std::vector<std::string> HalManifest::checkApexHals(const CompatibilityMatrix& mat) const {
- std::vector<std::string> ret;
-
- // Validate any APEX-implemented HALs.
- // Any HALs found within an APEX (hal.updatableViaApex()) must
- // be declared as updatable-via-apex in the compatibility matrix (matrixHal.updatableViaApex).
- //
- // hal.updatableViaApex == <any> AND matrixHal.updatableViaApex == true # VALID
- // hal.updatableViaApex == <any> AND matrixHal.updatableViaApex == false # INVALID
- // hal.updatableViaApex == "" (not updatable) # VALID
- //
- // Below check for INVALID case (hal.updatableViaApex == <any> && !matrixHal.updatableViaApex)
-
- for (const auto& hal : getHals()) {
- bool updatableViaApex =
- hal.updatableViaApex().has_value() && !hal.updatableViaApex()->empty();
-
- if (updatableViaApex) {
- // Check every instance is contained in the matrix with an updatable apex attribute
- (void)hal.forEachInstance([&mat, &ret](const auto& manifestInstance) {
- LOG(DEBUG) << "Checking APEX HAL " << manifestInstance.description();
- bool supported = false;
- for (const auto& matrixHal : mat.getHals()) {
- if (matrixHal.updatableViaApex) {
- // Use false to break out of forEachInstance to indicate a matrix instance
- // that supports the manifest instance.
- supported = !matrixHal.forEachInstance([&manifestInstance](
- const auto& matrixInstance) {
- if (matrixInstance.isSatisfiedBy(manifestInstance.getFqInstance())) {
- // break out of forEachInstance
- return false;
- }
- return true;
- });
- if (supported) {
- break;
- }
- }
- }
- if (!supported) {
- ret.push_back(manifestInstance.description());
- }
- // check all instances
- return true;
- });
- }
- }
- return ret;
-}
-
static bool checkVendorNdkCompatibility(const VendorNdk& matVendorNdk,
const std::vector<VendorNdk>& manifestVendorNdk,
std::string* error) {
@@ -557,17 +507,6 @@
.empty()) {
return false;
}
- // Check APEX-implemented HALs are supported in matrix
- auto unsupportedApexHals = checkApexHals(mat);
- if (!unsupportedApexHals.empty()) {
- if (error != nullptr) {
- *error = "APEX-implemented HALs not supported in compatibility matrix:\n";
- for (auto const& n : unsupportedApexHals) {
- *error += "\n" + n;
- }
- }
- return false;
- }
}
return true;
diff --git a/include/vintf/HalManifest.h b/include/vintf/HalManifest.h
index e0c7559..dd4ab21 100644
--- a/include/vintf/HalManifest.h
+++ b/include/vintf/HalManifest.h
@@ -185,10 +185,6 @@
// (instance in matrix) => (instance in manifest).
std::vector<std::string> checkIncompatibleHals(const CompatibilityMatrix& mat) const;
- // Return vector of instance names that are defined in an APEX that are not
- // specified as updatable apex hals in the compatibility matrix.
- std::vector<std::string> checkApexHals(const CompatibilityMatrix& mat) const;
-
void removeHals(const std::string& name, size_t majorVer);
// Returns a list of instance names that are in this manifest but
diff --git a/test/vintf_object_tests.cpp b/test/vintf_object_tests.cpp
index 8cc6853..197fd44 100644
--- a/test/vintf_object_tests.cpp
+++ b/test/vintf_object_tests.cpp
@@ -611,103 +611,6 @@
ASSERT_EQ(result, 1) << "Should have failed:" << error.c_str();
}
-// APEX-implemented HAL compatibility matrix tests.
-// Each test will include apexManifest as an APEX-implemented HAL
-// the test cases will cover different settings in the compatibility
-// matrix.
-class ApexCompatibilityTest : public VintfObjectTestBase {
- protected:
- // Create string with system matrix based off of systemMatrixXml1
- // adding the input APEX HAL definition
- std::string CreateSystemMatrix(const std::string & apexHal) const {
- std::string out =
- "<compatibility-matrix " + kMetaVersionStr + " type=\"framework\">\n"
- " <hal format=\"hidl\" optional=\"false\">\n"
- " <name>android.hardware.camera</name>\n"
- " <version>2.0-5</version>\n"
- " <version>3.4-16</version>\n"
- " </hal>\n"
- " <hal format=\"hidl\" optional=\"false\">\n"
- " <name>android.hardware.nfc</name>\n"
- " <version>1.0</version>\n"
- " <version>2.0</version>\n"
- " </hal>\n"
- " <hal format=\"hidl\" optional=\"true\">\n"
- " <name>android.hardware.foo</name>\n"
- " <version>1.0</version>\n"
- " </hal>\n"
- + apexHal +
- " <kernel version=\"3.18.31\"></kernel>\n"
- " <sepolicy>\n"
- " <kernel-sepolicy-version>30</kernel-sepolicy-version>\n"
- " <sepolicy-version>25.5</sepolicy-version>\n"
- " <sepolicy-version>26.0-3</sepolicy-version>\n"
- " </sepolicy>\n"
- " <avb>\n"
- " <vbmeta-version>0.0</vbmeta-version>\n"
- " </avb>\n"
- "</compatibility-matrix>\n";
- return out;
- }
- std::string CreateApexHal(const std::string &attr) const {
- // Create HAL for compatibility matrix.
- //
- // Use input attr to determine how to set updatable-via-apex
- // attribute.
- //
- // Cases:
- // - true : updatable-via-apex=true
- // - false : updatable-via-apex=false
- // - "" : do not include updatable-via-apex
- std::string updatable;
- if (!attr.empty()) {
- updatable ="updatable-via-apex=\""+attr+"\"";
- }
- std::string apexHal =
- " <hal format=\"aidl\" " + updatable + ">\n"
- " <name>android.apex.foo</name>"
- " <interface> \n"
- " <name>IApex</name> \n"
- " <instance>default</instance> \n"
- " </interface> \n"
- " </hal>\n";
- return apexHal;
- }
- void setup(const std::string& systemMatrix) {
- VintfObjectTestBase::SetUp();
- setupMockFetcher(vendorManifestXml1, systemMatrix,
- systemManifestXml1, vendorMatrixXml1);
- expectVendorManifest();
- expectSystemManifest();
- expectVendorMatrix();
- expectSystemMatrix();
- SetUpApex();
- }
-};
-
-// Test updatable-via-apex attribute in compatibility matrix, only
-// the case with updatable-via-apex=true should be compatible.
-TEST_F(ApexCompatibilityTest, TRUE) {
- std::string error;
- // Set updatable-via-apex=true
- std::string systemMatrix = CreateSystemMatrix(CreateApexHal("true"));
- setup(systemMatrix);
- ASSERT_EQ(COMPATIBLE,vintfObject->checkCompatibility(&error))<<error;
-}
-TEST_F(ApexCompatibilityTest, FALSE) {
- std::string error;
- // Set updatable-via-apex=false
- std::string systemMatrix = CreateSystemMatrix(CreateApexHal("false"));
- setup(systemMatrix);
- ASSERT_NE(COMPATIBLE,vintfObject->checkCompatibility(&error))<< "Should have failed";
-}
-TEST_F(ApexCompatibilityTest, UNSET) {
- std::string error;
- // Do not include updatable-via-apex attribute
- std::string systemMatrix = CreateSystemMatrix(CreateApexHal(""));
- setup(systemMatrix);
- ASSERT_NE(COMPATIBLE,vintfObject->checkCompatibility(&error))<< "Should have failed";
-}
const std::string vendorManifestKernelFcm =
"<manifest " + kMetaVersionStr + " type=\"device\">\n"
" <kernel version=\"3.18.999\" target-level=\"92\"/>\n"