[REFACTOR] simplify add logic.

Previously, both CompatibilityMatrix and HalManifest share the same
addAllHals function. However:
- For HalManifest, the error message is not clear. This will be fixed
  in follow up CLs.
- For CompatibilityMatrix, the error case is never hit because
  shouldAdd always returns true.

This change:
- Move addAllHals to CompatibilityMatrix and HalManifest, respectively.
- Remove shouldAdd from CompatibilityMatrix because it is no longer needed.
- Also add error message param to HalGroup::add() and HalManifest::shouldAdd
  to be used later.

Test: libvintf_test
Test: vintf_object_Test
Bug: 118757553
Change-Id: I404b0981852b718e06a95d8f28fc0096b0646b27
diff --git a/CompatibilityMatrix.cpp b/CompatibilityMatrix.cpp
index ae13d99..8ca2dbd 100644
--- a/CompatibilityMatrix.cpp
+++ b/CompatibilityMatrix.cpp
@@ -31,6 +31,20 @@
 
 using details::mergeField;
 
+bool CompatibilityMatrix::add(MatrixHal&& halToAdd, std::string*) {
+    CHECK(addInternal(std::move(halToAdd)) != nullptr);
+    return true;
+}
+
+bool CompatibilityMatrix::addAllHals(CompatibilityMatrix* other, std::string*) {
+    std::string internalError;
+    for (auto& pair : other->mHals) {
+        CHECK(add(std::move(pair.second), &internalError)) << internalError;
+    }
+    other->mHals.clear();
+    return true;
+}
+
 bool CompatibilityMatrix::addKernel(MatrixKernel&& kernel, std::string* error) {
     if (mType != SchemaType::FRAMEWORK) {
         if (error) {