Add HalManifest::shouldCheckKernelCompatibility
Now that <kernel> may exist in a HAL manifest without version and
configs, HalManifest::kernel().has_value() does not indicate whether
kernel information exists.
Add a function, shouldCheckKernelCompatibility(), that also checks
the existance of kernel version. kernel()->checkCompatibility may
be called if and only if this function returns true.
Test: cuttlefish vintf vts test
Test: libvintf_test
Test: vintf_object_test
Change-Id: I147703da6823275ceed9a134a75aefaa0ceae099
diff --git a/VintfObject.cpp b/VintfObject.cpp
index c0ce79b..15ea4d2 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -602,7 +602,7 @@
}
CheckFlags::Type runtimeInfoCheckFlags = flags;
- if (!!getDeviceHalManifest()->kernel()) {
+ if (getDeviceHalManifest()->shouldCheckKernelCompatibility()) {
// Use kernel from incoming OTA package, but not on the device.
runtimeInfoCheckFlags = runtimeInfoCheckFlags.disableKernel();
}