Add VintfObject::CheckCompatibility

Given an update package, caller should extract all manifests
/ matricies from the package, and feed it into CheckCompatibility.
CheckCompatibility will check these XML strings against
the files on the device. Partitions can be mounted if the optional
boolean argument is true.

This is also exposed as android.os.VintfObject.verify (via
JNI call).

Note that this is only a stub; actual implementations will
come in a follow up CL.

Test: pass
Bug: 36814503
Change-Id: Ia92a50f347a897d3eda1f57d08073b9df881a552
diff --git a/VintfObject.cpp b/VintfObject.cpp
index 65071a0..8b908be 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -67,6 +67,14 @@
             std::bind(&RuntimeInfo::fetchAllInformation, std::placeholders::_1));
 }
 
+// static
+int32_t VintfObject::CheckCompatibility(
+        const std::vector<std::string> &,
+        bool) {
+    // TODO(b/36814503): actually do the verification.
+    return -1;
+}
+
 
 } // namespace vintf
 } // namespace android
diff --git a/include/vintf/VintfObject.h b/include/vintf/VintfObject.h
index bbac491..1b4f6d8 100644
--- a/include/vintf/VintfObject.h
+++ b/include/vintf/VintfObject.h
@@ -62,6 +62,23 @@
      * Return the API that access device runtime info.
      */
     static const RuntimeInfo *GetRuntimeInfo();
+
+    /**
+     * Check compatibility, given a set of manifests / matrices in packageInfo.
+     * They will be checked against the manifests / matrices on the device.
+     * Partitions (/system, /vendor) are mounted if necessary.
+     *
+     * @param packageInfo a list of XMLs of HalManifest /
+     * CompatibilityMatrix objects.
+     * @param mount whether partitions should be mounted to do the check.
+     *
+     * @return = 0 if success (compatible)
+     *         > 0 if incompatible
+     *         < 0 if any error (mount partition fails, illformed XML, etc.)
+     */
+    static int32_t CheckCompatibility(
+            const std::vector<std::string> &packageInfo,
+            bool mount = false);
 };