Merge "health: AIDL HAL may replace HIDL HAL." am: 865b57a813 am: 8bc42d79b1 am: 1451cbdb30 am: f2a923f7e4

Original change: https://android-review.googlesource.com/c/platform/test/vts-testcase/hal/+/1929531

Change-Id: I68e300a6b940b55770e02487d900ec135e012847
diff --git a/treble/vintf/DeviceManifestTest.cpp b/treble/vintf/DeviceManifestTest.cpp
index 2d18242..897542d 100644
--- a/treble/vintf/DeviceManifestTest.cpp
+++ b/treble/vintf/DeviceManifestTest.cpp
@@ -96,6 +96,21 @@
       "android.hardware.graphics.mapper", {2, 1}, "IMapper", "default"));
 }
 
+// Devices with Shipping FCM version 3~6 must have either the HIDL or the
+// AIDL health HAL. Because compatibility matrices cannot express OR condition
+// between <hal>'s, add a test here.
+//
+// There's no need to enforce minimum HAL versions because
+// NoDeprecatedHalsOnManifest already checks it.
+TEST_F(DeviceManifestTest, HealthHal) {
+  bool has_hidl = vendor_manifest_->hasHidlInstance(
+      "android.hardware.health", {2, 0}, "IHealth", "default");
+  bool has_aidl = vendor_manifest_->hasAidlInstance("android.hardware.health",
+                                                    1, "IHealth", "default");
+  ASSERT_TRUE(has_hidl || has_aidl)
+      << "Device must have either health HIDL HAL or AIDL HAL";
+}
+
 static std::vector<HalManifestPtr> GetTestManifests() {
   return {
       VintfObject::GetDeviceHalManifest(),