Add ManifestHal::isOverride().

Hide the isOverride field.

Bug: 73556059
Test: vts_treble_vintf_test
Test: libvintf_test
Change-Id: Ib7d4a96e7043124617841277b06afc456d01672a
diff --git a/HalManifest.cpp b/HalManifest.cpp
index 454e0fc..c1b747a 100644
--- a/HalManifest.cpp
+++ b/HalManifest.cpp
@@ -42,7 +42,7 @@
     if (!hal.isValid()) {
         return false;
     }
-    if (hal.isOverride) {
+    if (hal.isOverride()) {
         return true;
     }
     auto existingHals = mHals.equal_range(hal.name);
@@ -88,7 +88,7 @@
 }
 
 bool HalManifest::add(ManifestHal&& halToAdd) {
-    if (halToAdd.isOverride) {
+    if (halToAdd.isOverride()) {
         if (halToAdd.versions.empty()) {
             // Special syntax when there are no <version> tags at all. Remove all existing HALs
             // with the given name.
diff --git a/include/vintf/ManifestHal.h b/include/vintf/ManifestHal.h
index 4cedaba..09a395a 100644
--- a/include/vintf/ManifestHal.h
+++ b/include/vintf/ManifestHal.h
@@ -57,7 +57,6 @@
     std::vector<Version> versions;
     TransportArch transportArch;
     std::map<std::string, HalInterface> interfaces;
-    bool isOverride = false;
 
     inline bool hasInterface(const std::string& interface_name) const {
         return interfaces.find(interface_name) != interfaces.end();
@@ -69,6 +68,8 @@
     inline const std::string& getName() const { return name; }
     bool forEachInstance(const std::function<bool(const ManifestInstance&)>& func) const;
 
+    bool isOverride() const { return mIsOverride; }
+
    private:
     friend struct LibVintfTest;
     friend struct ManifestHalConverter;
@@ -78,6 +79,8 @@
     // Whether this hal is a valid one. Note that an empty ManifestHal
     // (constructed via ManifestHal()) is valid.
     bool isValid() const;
+
+    bool mIsOverride = false;
 };
 
 } // namespace vintf
diff --git a/parse_xml.cpp b/parse_xml.cpp
index bca26e1..bf8889f 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -608,14 +608,14 @@
         appendChild(root, transportArchConverter(hal.transportArch, d));
         appendChildren(root, versionConverter, hal.versions, d);
         appendChildren(root, halInterfaceConverter, iterateValues(hal.interfaces), d);
-        if (hal.isOverride) {
-            appendAttr(root, "override", hal.isOverride);
+        if (hal.isOverride()) {
+            appendAttr(root, "override", hal.isOverride());
         }
     }
     bool buildObject(ManifestHal* object, NodeType* root, std::string* error) const override {
         std::vector<HalInterface> interfaces;
         if (!parseOptionalAttr(root, "format", HalFormat::HIDL, &object->format, error) ||
-            !parseOptionalAttr(root, "override", false, &object->isOverride, error) ||
+            !parseOptionalAttr(root, "override", false, &object->mIsOverride, error) ||
             !parseTextElement(root, "name", &object->name, error) ||
             !parseOptionalChild(root, transportArchConverter, {}, &object->transportArch, error) ||
             !parseChildren(root, versionConverter, &object->versions, error) ||
diff --git a/test/LibVintfTest.cpp b/test/LibVintfTest.cpp
index a9f8df6..f0f0423 100644
--- a/test/LibVintfTest.cpp
+++ b/test/LibVintfTest.cpp
@@ -2407,10 +2407,10 @@
     EXPECT_TRUE(gHalManifestConverter(&manifest, xml)) << gHalManifestConverter.lastError();
     const auto& foo = manifest.getHals("android.hardware.foo");
     ASSERT_FALSE(foo.empty());
-    EXPECT_TRUE(foo.front()->isOverride);
+    EXPECT_TRUE(foo.front()->isOverride());
     const auto& bar = manifest.getHals("android.hardware.bar");
     ASSERT_FALSE(bar.empty());
-    EXPECT_FALSE(bar.front()->isOverride);
+    EXPECT_FALSE(bar.front()->isOverride());
 }
 
 // Test functionality of override="true" tag