Add avb.vbmeta-version to CompatibilityMatrix and RuntimeInfo
RuntimeInfo fetch avb vbmeta version by reading the following two sysprops:
- ro.boot.vbmeta.avb_version
- ro.boot.avb_version
If the sysprop does not exist, 0.0 is set.
Test: libvintf_test
Test: adb shell vintf (shows 0.0 because CLs
for sysprops are not merged yet)
Bug: 35322304
Change-Id: I345bc792d1a7ceb585d246ec657707814b42ceff
diff --git a/RuntimeInfo-target.cpp b/RuntimeInfo-target.cpp
index 2d91fa5..e073562 100644
--- a/RuntimeInfo-target.cpp
+++ b/RuntimeInfo-target.cpp
@@ -27,6 +27,7 @@
#include <sys/utsname.h>
#include <unistd.h>
+#include <cutils/properties.h>
#include <selinux/selinux.h>
#include <zlib.h>
@@ -62,6 +63,7 @@
status_t fetchCpuInfo();
status_t fetchKernelSepolicyVers();
status_t fetchSepolicyFiles();
+ status_t fetchAvb();
status_t parseKernelVersion();
RuntimeInfo *mRuntimeInfo;
std::string mRemaining;
@@ -193,6 +195,19 @@
return OK;
}
+status_t RuntimeInfoFetcher::fetchAvb() {
+ char prop[PROPERTY_VALUE_MAX];
+ property_get("ro.boot.vbmeta.avb_version", prop, "0.0");
+ if (!parse(prop, &mRuntimeInfo->mAvbBootVersion)) {
+ return UNKNOWN_ERROR;
+ }
+ property_get("ro.boot.avb_version", prop, "0.0");
+ if (!parse(prop, &mRuntimeInfo->mAvbInitVersion)) {
+ return UNKNOWN_ERROR;
+ }
+ return OK;
+}
+
status_t RuntimeInfoFetcher::fetchAllInformation() {
status_t err;
if ((err = fetchVersion()) != OK) {
@@ -210,6 +225,9 @@
if ((err = fetchSepolicyFiles()) != OK) {
return err;
}
+ if ((err = fetchAvb()) != OK) {
+ return err;
+ }
return OK;
}