Add getHalNames and getInterfaceNames functions to HalManifest.
getHalNames returns all hal names in vintf.
getInterfaceNames returns all interface names of a given hal.
Test: mmma system/libvintf
Change-Id: I83147179eecbea299304305b68f119eb18f096a6
diff --git a/test/main.cpp b/test/main.cpp
index 89eac7b..ef52d13 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -412,6 +412,20 @@
EXPECT_FALSE(add(vm2, std::move(invalidHal)));
}
+TEST_F(LibVintfTest, HalManifestGetHalNames) {
+ HalManifest vm = testHalManifest();
+ EXPECT_EQ(vm.getHalNames(), std::set<std::string>(
+ {"android.hardware.camera", "android.hardware.nfc"}));
+}
+
+TEST_F(LibVintfTest, HalManifestGetInterfaceNames) {
+ HalManifest vm = testHalManifest();
+ EXPECT_EQ(vm.getInterfaceNames("android.hardware.camera"),
+ std::set<std::string>({"ICamera", "IBetterCamera"}));
+ EXPECT_EQ(vm.getInterfaceNames("android.hardware.nfc"),
+ std::set<std::string>({"INfc"}));
+}
+
TEST_F(LibVintfTest, HalManifestGetHal) {
HalManifest vm = testHalManifest();
EXPECT_NE(getHal(vm, "android.hardware.camera"), nullptr);