Set kernel FCM in RuntimeInfo

When RuntimeInfo object is retrieved, VintfObject
gets kernel FCM version from device manifest and store it in RuntimeInfo.

This is helpful when checking RuntimeInfo kernel
compatibility with FCM.

Bug: 139309488
Test: vintf_object_test
Change-Id: Ibcb443be693862cdd08efdaad83c81996487c883
diff --git a/VintfObject.cpp b/VintfObject.cpp
index ce037a5..1f4d185 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -461,6 +461,21 @@
         mDeviceRuntimeInfo.object = getRuntimeInfoFactory()->make_shared();
     }
 
+    // Fetch kernel FCM version from device HAL manifest and store it in RuntimeInfo too.
+    if ((flags & RuntimeInfo::FetchFlag::KERNEL_FCM) != 0) {
+        auto manifest = getDeviceHalManifest();
+        if (!manifest) {
+            mDeviceRuntimeInfo.fetchedFlags &= ~RuntimeInfo::FetchFlag::KERNEL_FCM;
+            return nullptr;
+        }
+        Level level = Level::UNSPECIFIED;
+        if (manifest->kernel().has_value()) {
+            level = manifest->kernel()->level();
+        }
+        mDeviceRuntimeInfo.object->setKernelLevel(level);
+        flags &= ~RuntimeInfo::FetchFlag::KERNEL_FCM;
+    }
+
     status_t status = mDeviceRuntimeInfo.object->fetchAllInformation(flags);
     if (status != OK) {
         mDeviceRuntimeInfo.fetchedFlags &= (~flags);  // mark the fields as "not fetched"