diff options
author | Yifan Hong | 2018-10-08 16:55:11 -0500 |
---|---|---|
committer | android-build-merger | 2018-10-08 16:55:11 -0500 |
commit | 4d8d9fd44f8371a9332de0ef79038898ff700e3a (patch) | |
tree | 6afe5c70da3c2eb2ffe627d223db593588842f88 | |
parent | cf834c0f34ec0236d615023d83b69334e1e32d24 (diff) | |
parent | 34168f34e0263f76aa2e6bfde59c50bf3e9769f3 (diff) | |
download | platform-system-libvintf-4d8d9fd44f8371a9332de0ef79038898ff700e3a.tar.gz platform-system-libvintf-4d8d9fd44f8371a9332de0ef79038898ff700e3a.tar.xz platform-system-libvintf-4d8d9fd44f8371a9332de0ef79038898ff700e3a.zip |
Merge "<kernel> compat check can be split"
am: 34168f34e0
Change-Id: Ib1e2bc26efc6de3393a8dc0bfff6bec68119bd6a
-rw-r--r-- | RuntimeInfo.cpp | 64 | ||||
-rw-r--r-- | include/vintf/CheckFlags.h | 2 |
2 files changed, 35 insertions, 31 deletions
diff --git a/RuntimeInfo.cpp b/RuntimeInfo.cpp index 5727a21..2338cd2 100644 --- a/RuntimeInfo.cpp +++ b/RuntimeInfo.cpp | |||
@@ -122,43 +122,45 @@ bool RuntimeInfo::checkCompatibility(const CompatibilityMatrix& mat, std::string | |||
122 | // mat.mSepolicy.sepolicyVersion() is checked against static | 122 | // mat.mSepolicy.sepolicyVersion() is checked against static |
123 | // HalManifest.device.mSepolicyVersion in HalManifest::checkCompatibility. | 123 | // HalManifest.device.mSepolicyVersion in HalManifest::checkCompatibility. |
124 | 124 | ||
125 | bool foundMatchedKernelVersion = false; | 125 | if (flags.isKernelEnabled()) { |
126 | bool foundMatchedConditions = false; | 126 | bool foundMatchedKernelVersion = false; |
127 | for (const MatrixKernel& matrixKernel : mat.framework.mKernels) { | 127 | bool foundMatchedConditions = false; |
128 | if (!matchKernelVersion(matrixKernel.minLts())) { | 128 | for (const MatrixKernel& matrixKernel : mat.framework.mKernels) { |
129 | continue; | 129 | if (!matchKernelVersion(matrixKernel.minLts())) { |
130 | } | 130 | continue; |
131 | foundMatchedKernelVersion = true; | 131 | } |
132 | // ignore this fragment if not all conditions are met. | 132 | foundMatchedKernelVersion = true; |
133 | if (!matchKernelConfigs(matrixKernel.conditions(), error)) { | 133 | // ignore this fragment if not all conditions are met. |
134 | continue; | 134 | if (!matchKernelConfigs(matrixKernel.conditions(), error)) { |
135 | continue; | ||
136 | } | ||
137 | foundMatchedConditions = true; | ||
138 | if (!matchKernelConfigs(matrixKernel.configs(), error)) { | ||
139 | return false; | ||
140 | } | ||
135 | } | 141 | } |
136 | foundMatchedConditions = true; | 142 | if (!foundMatchedKernelVersion) { |
137 | if (!matchKernelConfigs(matrixKernel.configs(), error)) { | 143 | if (error != nullptr) { |
144 | std::stringstream ss; | ||
145 | ss << "Framework is incompatible with kernel version " << mKernelVersion | ||
146 | << ", compatible kernel versions are"; | ||
147 | for (const MatrixKernel& matrixKernel : mat.framework.mKernels) | ||
148 | ss << " " << matrixKernel.minLts(); | ||
149 | *error = ss.str(); | ||
150 | } | ||
138 | return false; | 151 | return false; |
139 | } | 152 | } |
140 | } | 153 | if (!foundMatchedConditions) { |
141 | if (!foundMatchedKernelVersion) { | 154 | // This should not happen because first <conditions> for each <kernel> must be |
142 | if (error != nullptr) { | 155 | // empty. Reject here for inconsistency. |
143 | std::stringstream ss; | 156 | if (error != nullptr) { |
144 | ss << "Framework is incompatible with kernel version " << mKernelVersion | 157 | error->insert(0, "Framework match kernel version with unmet conditions:"); |
145 | << ", compatible kernel versions are"; | 158 | } |
146 | for (const MatrixKernel& matrixKernel : mat.framework.mKernels) | 159 | return false; |
147 | ss << " " << matrixKernel.minLts(); | ||
148 | *error = ss.str(); | ||
149 | } | 160 | } |
150 | return false; | ||
151 | } | ||
152 | if (!foundMatchedConditions) { | ||
153 | // This should not happen because first <conditions> for each <kernel> must be | ||
154 | // empty. Reject here for inconsistency. | ||
155 | if (error != nullptr) { | 161 | if (error != nullptr) { |
156 | error->insert(0, "Framework match kernel version with unmet conditions:"); | 162 | error->clear(); |
157 | } | 163 | } |
158 | return false; | ||
159 | } | ||
160 | if (error != nullptr) { | ||
161 | error->clear(); | ||
162 | } | 164 | } |
163 | 165 | ||
164 | if (flags.isAvbEnabled()) { | 166 | if (flags.isAvbEnabled()) { |
diff --git a/include/vintf/CheckFlags.h b/include/vintf/CheckFlags.h index df247d9..d63a809 100644 --- a/include/vintf/CheckFlags.h +++ b/include/vintf/CheckFlags.h | |||
@@ -32,6 +32,7 @@ class Type { | |||
32 | 32 | ||
33 | VINTF_CHECK_FLAGS_FIELD(Avb, 0) | 33 | VINTF_CHECK_FLAGS_FIELD(Avb, 0) |
34 | VINTF_CHECK_FLAGS_FIELD(RuntimeInfo, 1) | 34 | VINTF_CHECK_FLAGS_FIELD(RuntimeInfo, 1) |
35 | VINTF_CHECK_FLAGS_FIELD(Kernel, 2) | ||
35 | #undef VINTF_CHECK_FLAGS_FIELD | 36 | #undef VINTF_CHECK_FLAGS_FIELD |
36 | 37 | ||
37 | explicit constexpr Type(int32_t value) : mValue(value) {} | 38 | explicit constexpr Type(int32_t value) : mValue(value) {} |
@@ -41,6 +42,7 @@ class Type { | |||
41 | }; | 42 | }; |
42 | 43 | ||
43 | constexpr Type ENABLE_ALL_CHECKS{~0}; | 44 | constexpr Type ENABLE_ALL_CHECKS{~0}; |
45 | constexpr Type DISABLE_ALL_CHECKS{0}; | ||
44 | // Disable AVB version check in RuntimeInfo::checkCompatibility | 46 | // Disable AVB version check in RuntimeInfo::checkCompatibility |
45 | constexpr Type DISABLE_AVB_CHECK = ENABLE_ALL_CHECKS.disableAvb(); | 47 | constexpr Type DISABLE_AVB_CHECK = ENABLE_ALL_CHECKS.disableAvb(); |
46 | // Disable RuntimeInfo <-> Framework Matrix check. This implies DISABLE_AVB_CHECK. | 48 | // Disable RuntimeInfo <-> Framework Matrix check. This implies DISABLE_AVB_CHECK. |