Remove sepolicy files from libvintf.
CTS device info collects sepolicy files via
adb pull, not via libvintf.
Changes RuntimeInfo::fetchAllInformation
errors to warnings.
Bug: 38070361
Test: pass
Change-Id: I5157efcbe65940bc5e71f5df8b6e3f208368797c
Merged-In: I5157efcbe65940bc5e71f5df8b6e3f208368797c
diff --git a/RuntimeInfo-target.cpp b/RuntimeInfo-target.cpp
index 0454f43..95c0ae0 100644
--- a/RuntimeInfo-target.cpp
+++ b/RuntimeInfo-target.cpp
@@ -67,7 +67,6 @@
status_t fetchKernelConfigs();
status_t fetchCpuInfo();
status_t fetchKernelSepolicyVers();
- status_t fetchSepolicyFiles();
status_t fetchAvb();
status_t parseKernelVersion();
RuntimeInfo *mRuntimeInfo;
@@ -200,35 +199,6 @@
return OK;
}
-static const std::string gSepolicyFilesDir{"/vendor/etc/selinux/"};
-
-// Grab sepolicy file paths.
-status_t RuntimeInfoFetcher::fetchSepolicyFiles() {
- mRuntimeInfo->mSepolicyFilePaths.clear();
- DIR *dir = opendir(gSepolicyFilesDir.c_str());
- if (dir == NULL) {
- LOG(ERROR) << "Could not open directory \""
- << gSepolicyFilesDir << "\"";
- return -errno;
- }
- struct dirent *e;
- status_t status = OK;
- errno = 0;
- while ((e = readdir(dir))) {
- if (e->d_type == DT_REG || e->d_type == DT_LNK) {
- mRuntimeInfo->mSepolicyFilePaths.push_back(
- gSepolicyFilesDir + e->d_name);
- }
- }
- if (errno != 0) {
- LOG(ERROR) << "Could not read directory \""
- << gSepolicyFilesDir << "\"";
- status = -errno;
- }
- (void)closedir(dir);
- return status;
-}
-
status_t RuntimeInfoFetcher::fetchAvb() {
char prop[PROPERTY_VALUE_MAX];
property_get("ro.boot.vbmeta.avb_version", prop, "0.0");
@@ -245,22 +215,19 @@
status_t RuntimeInfoFetcher::fetchAllInformation() {
status_t err;
if ((err = fetchVersion()) != OK) {
- LOG(ERROR) << "Cannot fetch or parse /proc/version: " << strerror(-err);
+ LOG(WARNING) << "Cannot fetch or parse /proc/version: " << strerror(-err);
}
if ((err = fetchKernelConfigs()) != OK) {
- LOG(ERROR) << "Cannot fetch or parse /proc/config.gz: " << strerror(-err);
+ LOG(WARNING) << "Cannot fetch or parse /proc/config.gz: " << strerror(-err);
}
if ((err = fetchCpuInfo()) != OK) {
- LOG(ERROR) << "Cannot fetch /proc/cpuinfo: " << strerror(-err);
+ LOG(WARNING) << "Cannot fetch /proc/cpuinfo: " << strerror(-err);
}
if ((err = fetchKernelSepolicyVers()) != OK) {
- LOG(ERROR) << "Cannot fetch kernel sepolicy version: " << strerror(-err);
- }
- if ((err = fetchSepolicyFiles()) != OK) {
- LOG(ERROR) << "Cannot fetch sepolicy file paths: " << strerror(-err);
+ LOG(WARNING) << "Cannot fetch kernel sepolicy version: " << strerror(-err);
}
if ((err = fetchAvb()) != OK) {
- LOG(ERROR) << "Cannot fetch sepolicy avb version: " << strerror(-err);
+ LOG(WARNING) << "Cannot fetch sepolicy avb version: " << strerror(-err);
}
return OK;
}
diff --git a/RuntimeInfo.cpp b/RuntimeInfo.cpp
index cee5d89..7b97e94 100644
--- a/RuntimeInfo.cpp
+++ b/RuntimeInfo.cpp
@@ -49,11 +49,6 @@
return mKernelVersion;
}
-
-const std::vector<std::string> &RuntimeInfo::sepolicyFilePaths() const {
- return mSepolicyFilePaths;
-}
-
const std::map<std::string, std::string> &RuntimeInfo::kernelConfigs() const {
return mKernelConfigs;
}
diff --git a/include/vintf/RuntimeInfo.h b/include/vintf/RuntimeInfo.h
index fb922db..5ebbac7 100644
--- a/include/vintf/RuntimeInfo.h
+++ b/include/vintf/RuntimeInfo.h
@@ -49,9 +49,6 @@
// extract from utsname.release
const KernelVersion &kernelVersion() const;
- // files under /vendor/etc/selinux/
- const std::vector<std::string> &sepolicyFilePaths() const;
-
const std::map<std::string, std::string> &kernelConfigs() const;
const Version &bootVbmetaAvbVersion() const;
diff --git a/parse_string.cpp b/parse_string.cpp
index b57b25e..d412ac4 100644
--- a/parse_string.cpp
+++ b/parse_string.cpp
@@ -382,14 +382,10 @@
<< ki.hardwareId() << ";"
<< ki.mBootAvbVersion << "/"
<< ki.mBootVbmetaAvbVersion << ";"
- << "kernelSepolicyVersion = " << ki.kernelSepolicyVersion() << ";\n"
- << "sepolicy files:\n";
- for (const auto &file : ki.sepolicyFilePaths()) {
- oss << " " << file << "\n";
- }
- oss << "\ncpu info:\n";
- oss << ki.cpuInfo();
- oss << "\n#CONFIG's loaded = " << ki.mKernelConfigs.size() << ";\n";
+ << "kernelSepolicyVersion = " << ki.kernelSepolicyVersion()
+ << ";\n\ncpu info:\n"
+ << ki.cpuInfo()
+ << "\n#CONFIG's loaded = " << ki.mKernelConfigs.size() << ";\n";
for (const auto &pair : ki.mKernelConfigs) {
oss << pair.first << "=" << pair.second << "\n";
}