VintfObject::CheckCompatibility: require matrices

The original behavior was that missing matrices are silenced
because the schema for matrices were not properly defined yet.
Right now, it is safe to assume that these files exist (and
raise an error when they do not) because:

- fwk matrix: it is always built
- device matrix: an essentially-empty device matrix is installed
  to the device when no DEIVCE_MATRIX_FILE is defined (which
  impose no requirement at all besides android.hidl.manager@1.0).

Bug: 67974785
Test: vintf_object_test
Test: libvintf_test
Change-Id: Ib39d00dc535416a30a730ef46380c4c5dd282884
diff --git a/VintfObject.cpp b/VintfObject.cpp
index 7c55181..3f097f7 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -492,7 +492,6 @@
     updated.runtimeInfo = VintfObject::GetRuntimeInfo(true /* skipCache */);
 
     // null checks for files and runtime info after the update
-    // TODO(b/37321309) if a compat mat is missing, it is not matched and considered compatible.
     if (updated.fwk.manifest == nullptr) {
         ADD_MESSAGE("No framework manifest file from device or from update package");
         return NO_INIT;
@@ -502,12 +501,12 @@
         return NO_INIT;
     }
     if (updated.fwk.matrix == nullptr) {
-        ADD_MESSAGE("No framework matrix, skipping;");
-        // TODO(b/37321309) consider missing matricies as errors.
+        ADD_MESSAGE("No framework matrix file from device or from update package");
+        return NO_INIT;
     }
     if (updated.dev.matrix == nullptr) {
-        ADD_MESSAGE("No device matrix, skipping;");
-        // TODO(b/37321309) consider missing matricies as errors.
+        ADD_MESSAGE("No device matrix file from device or from update package");
+        return NO_INIT;
     }
     if (updated.runtimeInfo == nullptr) {
         ADD_MESSAGE("No runtime info from device");
@@ -515,30 +514,25 @@
     }
 
     // compatiblity check.
-    // TODO(b/37321309) outer if checks can be removed if we consider missing matrices as errors.
-    if (updated.dev.manifest && updated.fwk.matrix) {
-        if (!updated.dev.manifest->checkCompatibility(*updated.fwk.matrix, error)) {
-            if (error)
-                error->insert(0, "Device manifest and framework compatibility matrix "
-                                 "are incompatible: ");
-            return INCOMPATIBLE;
+    if (!updated.dev.manifest->checkCompatibility(*updated.fwk.matrix, error)) {
+        if (error) {
+            error->insert(0,
+                          "Device manifest and framework compatibility matrix are incompatible: ");
         }
+        return INCOMPATIBLE;
     }
-    if (updated.fwk.manifest && updated.dev.matrix) {
-        if (!updated.fwk.manifest->checkCompatibility(*updated.dev.matrix, error)) {
-            if (error)
-                error->insert(0, "Framework manifest and device compatibility matrix "
-                                 "are incompatible: ");
-            return INCOMPATIBLE;
+    if (!updated.fwk.manifest->checkCompatibility(*updated.dev.matrix, error)) {
+        if (error) {
+            error->insert(0,
+                          "Framework manifest and device compatibility matrix are incompatible: ");
         }
+        return INCOMPATIBLE;
     }
-    if (updated.runtimeInfo && updated.fwk.matrix) {
-        if (!updated.runtimeInfo->checkCompatibility(*updated.fwk.matrix, error, disabledChecks)) {
-            if (error)
-                error->insert(0, "Runtime info and framework compatibility matrix "
-                                 "are incompatible: ");
-            return INCOMPATIBLE;
+    if (!updated.runtimeInfo->checkCompatibility(*updated.fwk.matrix, error, disabledChecks)) {
+        if (error) {
+            error->insert(0, "Runtime info and framework compatibility matrix are incompatible: ");
         }
+        return INCOMPATIBLE;
     }
 
     return COMPATIBLE;