Snap for 11200902 from 338de715263fa7510e69e97fbf7376a6a119da46 to mainline-healthfitness-release
Change-Id: Icb5ef6be3c730ea27eaf4b5e8269d386122946e9
diff --git a/treble/vintf/SingleManifestTest.cpp b/treble/vintf/SingleManifestTest.cpp
index 0cfedfe..2cc21b9 100644
--- a/treble/vintf/SingleManifestTest.cpp
+++ b/treble/vintf/SingleManifestTest.cpp
@@ -633,6 +633,16 @@
return false;
}
+static bool IsAndroidTvVertical() {
+ return DeviceSupportsFeature("android.software.leanback");
+}
+
+// For Android TV devices that have ThreadNetwork HAL backported, exempt the AIDL
+// frozen requirement.
+static bool IsHalPackageFreezeExempt(const string& package) {
+ return IsAndroidTvVertical() && package == "android.hardware.threadnetwork";
+}
+
// An AIDL HAL with VINTF stability can only be registered if it is in the
// manifest. However, we still must manually check that every declared HAL is
// actually present on the device.
@@ -681,7 +691,11 @@
if (is_aosp) {
if (!found_hash) {
- if (is_release || (reliable_version && is_existing)) {
+ if (IsHalPackageFreezeExempt(package)) {
+ std::cout << "Warning: Interface " << name << " has an unrecognized hash: '"
+ << hash << "' but the package '" << package
+ << "' has been exempted from the test.";
+ } else if (is_release || (reliable_version && is_existing)) {
ADD_FAILURE() << "Interface " << name << " has an unrecognized hash: '"
<< hash << "'. The following hashes are known:\n"
<< base::Join(hashes, '\n')
diff --git a/treble/vintf/utils.cpp b/treble/vintf/utils.cpp
index c749539..2548759 100644
--- a/treble/vintf/utils.cpp
+++ b/treble/vintf/utils.cpp
@@ -167,6 +167,26 @@
return Partition::UNKNOWN;
}
+bool DeviceSupportsFeature(const char *feature) {
+ bool device_supports_feature = false;
+ FILE *p = popen("pm list features", "re");
+ if (!p) {
+ return false;
+ }
+
+ char *line = NULL;
+ size_t len = 0;
+ while (getline(&line, &len, p) > 0) {
+ if (strstr(line, feature)) {
+ device_supports_feature = true;
+ break;
+ }
+ }
+ pclose(p);
+
+ return device_supports_feature;
+}
+
} // namespace testing
} // namespace vintf
} // namespace android
diff --git a/treble/vintf/utils.h b/treble/vintf/utils.h
index cd89e16..fad1b87 100644
--- a/treble/vintf/utils.h
+++ b/treble/vintf/utils.h
@@ -174,6 +174,9 @@
// Returns SYSTEM for FRAMEWORK, VENDOR for DEVICE.
Partition PartitionOfType(SchemaType type);
+// Returns true iff the device has the specified feature.
+bool DeviceSupportsFeature(const char* feature);
+
} // namespace testing
} // namespace vintf