summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2017-08-24 16:42:54 -0500
committerYifan Hong2017-08-25 17:41:27 -0500
commit4c9c32b767461adb3b779563c0d165757ea022dd (patch)
treed568fac48ff863c251252d582d751d6fb87d26b8
parent56ca3bf6179a9c2efcc772ac42ba880b4fd3bb59 (diff)
downloadplatform-system-libvintf-4c9c32b767461adb3b779563c0d165757ea022dd.tar.gz
platform-system-libvintf-4c9c32b767461adb3b779563c0d165757ea022dd.tar.xz
platform-system-libvintf-4c9c32b767461adb3b779563c0d165757ea022dd.zip
assemble_vintf: add assembleFrameworkCompatibilityMatrixKernels
Refactor code to execute the procedure of processing android-base.cfg files in a separate function. Test: m system_compatibility_matrix.xml -j Bug: 64124223 Change-Id: Ic6159fe3b6e69687a9a062f34e95e05733e7308a
-rw-r--r--assemble_vintf.cpp43
1 files changed, 26 insertions, 17 deletions
diff --git a/assemble_vintf.cpp b/assemble_vintf.cpp
index d75e889..febb2d9 100644
--- a/assemble_vintf.cpp
+++ b/assemble_vintf.cpp
@@ -154,6 +154,28 @@ public:
154 return true; 154 return true;
155 } 155 }
156 156
157 bool assembleFrameworkCompatibilityMatrixKernels(CompatibilityMatrix* matrix) {
158 for (const auto& pair : mKernels) {
159 std::vector<KernelConfig> configs;
160 if (!parseFilesForKernelConfigs(pair.second, &configs)) {
161 return false;
162 }
163 bool added = false;
164 for (auto& e : matrix->framework.mKernels) {
165 if (e.minLts() == pair.first) {
166 e.mConfigs.insert(e.mConfigs.end(), configs.begin(), configs.end());
167 added = true;
168 break;
169 }
170 }
171 if (!added) {
172 matrix->framework.mKernels.push_back(
173 MatrixKernel{KernelVersion{pair.first}, std::move(configs)});
174 }
175 }
176 return true;
177 }
178
157 bool assembleCompatibilityMatrix(CompatibilityMatrix* matrix) { 179 bool assembleCompatibilityMatrix(CompatibilityMatrix* matrix) {
158 std::string error; 180 std::string error;
159 181
@@ -166,24 +188,11 @@ public:
166 if (!getFlag("POLICYVERS", &kernelSepolicyVers)) { 188 if (!getFlag("POLICYVERS", &kernelSepolicyVers)) {
167 return false; 189 return false;
168 } 190 }
169 for (const auto& pair : mKernels) { 191
170 std::vector<KernelConfig> configs; 192 if (!assembleFrameworkCompatibilityMatrixKernels(matrix)) {
171 if (!parseFilesForKernelConfigs(pair.second, &configs)) { 193 return false;
172 return false;
173 }
174 bool added = false;
175 for (auto& e : matrix->framework.mKernels) {
176 if (e.minLts() == pair.first) {
177 e.mConfigs.insert(e.mConfigs.end(), configs.begin(), configs.end());
178 added = true;
179 break;
180 }
181 }
182 if (!added) {
183 matrix->framework.mKernels.push_back(
184 MatrixKernel{KernelVersion{pair.first}, std::move(configs)});
185 }
186 } 194 }
195
187 matrix->framework.mSepolicy = 196 matrix->framework.mSepolicy =
188 Sepolicy(kernelSepolicyVers, {{sepolicyVers.majorVer, sepolicyVers.minorVer}}); 197 Sepolicy(kernelSepolicyVers, {{sepolicyVers.majorVer, sepolicyVers.minorVer}});
189 198