Add /proc/cpuinfo to RuntimeInfo.
Test: adb shell vintf
Bug: 37513906
Change-Id: I94617cb2ca0ae961ec56b2d22b663ecafbcbed48
diff --git a/RuntimeInfo-target.cpp b/RuntimeInfo-target.cpp
index 3b094c9..8f3d8b4 100644
--- a/RuntimeInfo-target.cpp
+++ b/RuntimeInfo-target.cpp
@@ -28,6 +28,10 @@
#include <sys/utsname.h>
#include <unistd.h>
+#include <fstream>
+#include <iostream>
+#include <sstream>
+
#include <cutils/properties.h>
#include <selinux/selinux.h>
#include <zlib.h>
@@ -135,6 +139,14 @@
status_t RuntimeInfoFetcher::fetchCpuInfo() {
// TODO implement this; 32-bit and 64-bit has different format.
+ std::ifstream in{"/proc/cpuinfo"};
+ if (!in.is_open()) {
+ LOG(WARNING) << "Cannot read /proc/cpuinfo";
+ return UNKNOWN_ERROR;
+ }
+ std::stringstream sstream;
+ sstream << in.rdbuf();
+ mRuntimeInfo->mCpuInfo = sstream.str();
return OK;
}