Add matrix.kernel.level.

Indicates at which level is the kernel requirement from.

Also fix tests now that matrix.kernel.level is serialized.

Bug: 139309488
Test: vintf_object_test
Test: libvintf_test

Change-Id: Ic65b0a2a95a2311b480753a139f3029e87848786
diff --git a/CompatibilityMatrix.cpp b/CompatibilityMatrix.cpp
index 7c52296..faba552 100644
--- a/CompatibilityMatrix.cpp
+++ b/CompatibilityMatrix.cpp
@@ -255,6 +255,9 @@
 // A1, B1 (from 1.xml, required), C2, D2, E3 (optional, use earliest possible).
 bool CompatibilityMatrix::addAllKernels(CompatibilityMatrix* other, std::string* error) {
     for (MatrixKernel& kernel : other->framework.mKernels) {
+        if (kernel.getSourceMatrixLevel() == Level::UNSPECIFIED) {
+            kernel.setSourceMatrixLevel(other->level());
+        }
         KernelVersion ver = kernel.minLts();
         if (!addKernel(std::move(kernel), error)) {
             if (error) {
@@ -285,7 +288,9 @@
             continue;
         }
 
-        (void)kernelToAdd.setSourceMatrixLevel(other->level());
+        if (kernelToAdd.getSourceMatrixLevel() == Level::UNSPECIFIED) {
+            kernelToAdd.setSourceMatrixLevel(other->level());
+        }
 
         KernelVersion minLts = kernelToAdd.minLts();
         if (!addKernel(std::move(kernelToAdd), error)) {