Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <stdlib.h> |
| 18 | #include <unistd.h> |
| 19 | |
| 20 | #include <fstream> |
| 21 | #include <iostream> |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 22 | #include <sstream> |
| 23 | #include <string> |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 24 | #include <unordered_map> |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 25 | |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 26 | #include <android-base/file.h> |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 27 | #include <android-base/parseint.h> |
Yifan Hong | b83e56b | 2018-01-09 14:36:30 -0800 | [diff] [blame] | 28 | #include <android-base/strings.h> |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 29 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 30 | #include <vintf/AssembleVintf.h> |
Yifan Hong | 79efa8a | 2017-07-06 14:10:28 -0700 | [diff] [blame] | 31 | #include <vintf/KernelConfigParser.h> |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 32 | #include <vintf/parse_string.h> |
| 33 | #include <vintf/parse_xml.h> |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 34 | #include "utils.h" |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 35 | |
Yifan Hong | 79efa8a | 2017-07-06 14:10:28 -0700 | [diff] [blame] | 36 | #define BUFFER_SIZE sysconf(_SC_PAGESIZE) |
| 37 | |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 38 | namespace android { |
| 39 | namespace vintf { |
| 40 | |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 41 | static const std::string gConfigPrefix = "android-base-"; |
| 42 | static const std::string gConfigSuffix = ".cfg"; |
| 43 | static const std::string gBaseConfig = "android-base.cfg"; |
| 44 | |
Yifan Hong | aa219f5 | 2017-12-18 18:51:59 -0800 | [diff] [blame] | 45 | // An input stream with a name. |
| 46 | // The input stream may be an actual file, or a stringstream for testing. |
| 47 | // It takes ownership on the istream. |
| 48 | class NamedIstream { |
| 49 | public: |
| 50 | NamedIstream(const std::string& name, std::unique_ptr<std::istream>&& stream) |
| 51 | : mName(name), mStream(std::move(stream)) {} |
| 52 | const std::string& name() const { return mName; } |
| 53 | std::istream& stream() { return *mStream; } |
| 54 | |
| 55 | private: |
| 56 | std::string mName; |
| 57 | std::unique_ptr<std::istream> mStream; |
| 58 | }; |
| 59 | |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 60 | /** |
| 61 | * Slurps the device manifest file and add build time flag to it. |
| 62 | */ |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 63 | class AssembleVintfImpl : public AssembleVintf { |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 64 | using Condition = std::unique_ptr<KernelConfig>; |
| 65 | using ConditionedConfig = std::pair<Condition, std::vector<KernelConfig> /* configs */>; |
| 66 | |
| 67 | public: |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 68 | void setFakeEnv(const std::string& key, const std::string& value) { mFakeEnv[key] = value; } |
| 69 | |
| 70 | std::string getEnv(const std::string& key) const { |
| 71 | auto it = mFakeEnv.find(key); |
| 72 | if (it != mFakeEnv.end()) { |
| 73 | return it->second; |
| 74 | } |
| 75 | const char* envValue = getenv(key.c_str()); |
| 76 | return envValue != nullptr ? std::string(envValue) : std::string(); |
| 77 | } |
| 78 | |
| 79 | template <typename T> |
| 80 | bool getFlag(const std::string& key, T* value) const { |
| 81 | std::string envValue = getEnv(key); |
| 82 | if (envValue.empty()) { |
| 83 | std::cerr << "Warning: " << key << " is missing, defaulted to " << (*value) << "." |
Yifan Hong | 488e16a | 2017-07-11 13:50:41 -0700 | [diff] [blame] | 84 | << std::endl; |
| 85 | return true; |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | if (!parse(envValue, value)) { |
| 89 | std::cerr << "Cannot parse " << envValue << "." << std::endl; |
| 90 | return false; |
| 91 | } |
| 92 | return true; |
| 93 | } |
| 94 | |
Yifan Hong | eff0466 | 2017-12-18 16:27:24 -0800 | [diff] [blame] | 95 | /** |
| 96 | * Set *out to environment variable if *out is not a dummy value (i.e. default constructed). |
| 97 | */ |
| 98 | template <typename T> |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 99 | bool getFlagIfUnset(const std::string& envKey, T* out) const { |
Yifan Hong | eff0466 | 2017-12-18 16:27:24 -0800 | [diff] [blame] | 100 | bool hasExistingValue = !(*out == T{}); |
| 101 | |
| 102 | bool hasEnvValue = false; |
| 103 | T envValue; |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 104 | std::string envStrValue = getEnv(envKey); |
| 105 | if (!envStrValue.empty()) { |
| 106 | if (!parse(envStrValue, &envValue)) { |
| 107 | std::cerr << "Cannot parse " << envValue << "." << std::endl; |
Yifan Hong | eff0466 | 2017-12-18 16:27:24 -0800 | [diff] [blame] | 108 | return false; |
| 109 | } |
| 110 | hasEnvValue = true; |
| 111 | } |
| 112 | |
| 113 | if (hasExistingValue) { |
| 114 | if (hasEnvValue) { |
| 115 | std::cerr << "Warning: cannot override existing value " << *out << " with " |
| 116 | << envKey << " (which is " << envValue << ")." << std::endl; |
| 117 | } |
| 118 | return false; |
| 119 | } |
| 120 | if (!hasEnvValue) { |
| 121 | std::cerr << "Warning: " << envKey << " is not specified. Default to " << T{} << "." |
| 122 | << std::endl; |
| 123 | return false; |
| 124 | } |
| 125 | *out = envValue; |
| 126 | return true; |
| 127 | } |
| 128 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 129 | bool getBooleanFlag(const std::string& key) const { return getEnv(key) == std::string("true"); } |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 130 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 131 | size_t getIntegerFlag(const std::string& key, size_t defaultValue = 0) const { |
| 132 | std::string envValue = getEnv(key); |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 133 | if (envValue.empty()) { |
| 134 | return defaultValue; |
| 135 | } |
| 136 | size_t value; |
| 137 | if (!base::ParseUint(envValue, &value)) { |
| 138 | std::cerr << "Error: " << key << " must be a number." << std::endl; |
| 139 | return defaultValue; |
| 140 | } |
| 141 | return value; |
| 142 | } |
| 143 | |
Yifan Hong | 4650ad8 | 2017-05-01 17:28:02 -0700 | [diff] [blame] | 144 | static std::string read(std::basic_istream<char>& is) { |
| 145 | std::stringstream ss; |
| 146 | ss << is.rdbuf(); |
| 147 | return ss.str(); |
| 148 | } |
| 149 | |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 150 | static bool isCommonConfig(const std::string& path) { |
| 151 | return ::android::base::Basename(path) == gBaseConfig; |
| 152 | } |
| 153 | |
Yifan Hong | 079ec24 | 2017-08-25 18:53:38 -0700 | [diff] [blame] | 154 | // nullptr on any error, otherwise the condition. |
| 155 | static Condition generateCondition(const std::string& path) { |
| 156 | std::string fname = ::android::base::Basename(path); |
| 157 | if (fname.size() <= gConfigPrefix.size() + gConfigSuffix.size() || |
| 158 | !std::equal(gConfigPrefix.begin(), gConfigPrefix.end(), fname.begin()) || |
| 159 | !std::equal(gConfigSuffix.rbegin(), gConfigSuffix.rend(), fname.rbegin())) { |
| 160 | return nullptr; |
| 161 | } |
| 162 | |
| 163 | std::string sub = fname.substr(gConfigPrefix.size(), |
| 164 | fname.size() - gConfigPrefix.size() - gConfigSuffix.size()); |
| 165 | if (sub.empty()) { |
| 166 | return nullptr; // should not happen |
| 167 | } |
| 168 | for (size_t i = 0; i < sub.size(); ++i) { |
| 169 | if (sub[i] == '-') { |
| 170 | sub[i] = '_'; |
| 171 | continue; |
| 172 | } |
| 173 | if (isalnum(sub[i])) { |
| 174 | sub[i] = toupper(sub[i]); |
| 175 | continue; |
| 176 | } |
| 177 | std::cerr << "'" << fname << "' (in " << path |
| 178 | << ") is not a valid kernel config file name. Must match regex: " |
| 179 | << "android-base(-[0-9a-zA-Z-]+)?\\.cfg" << std::endl; |
| 180 | return nullptr; |
| 181 | } |
| 182 | sub.insert(0, "CONFIG_"); |
| 183 | return std::make_unique<KernelConfig>(std::move(sub), Tristate::YES); |
| 184 | } |
| 185 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 186 | static bool parseFileForKernelConfigs(std::basic_istream<char>& stream, |
| 187 | std::vector<KernelConfig>* out) { |
Yifan Hong | 02e9400 | 2017-07-10 15:41:56 -0700 | [diff] [blame] | 188 | KernelConfigParser parser(true /* processComments */, true /* relaxedFormat */); |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 189 | std::string content = read(stream); |
Yifan Hong | 79efa8a | 2017-07-06 14:10:28 -0700 | [diff] [blame] | 190 | status_t err = parser.process(content.c_str(), content.size()); |
| 191 | if (err != OK) { |
Yifan Hong | ae53a0e | 2017-07-07 15:19:06 -0700 | [diff] [blame] | 192 | std::cerr << parser.error(); |
Yifan Hong | 79efa8a | 2017-07-06 14:10:28 -0700 | [diff] [blame] | 193 | return false; |
| 194 | } |
| 195 | err = parser.finish(); |
| 196 | if (err != OK) { |
Yifan Hong | ae53a0e | 2017-07-07 15:19:06 -0700 | [diff] [blame] | 197 | std::cerr << parser.error(); |
Yifan Hong | 79efa8a | 2017-07-06 14:10:28 -0700 | [diff] [blame] | 198 | return false; |
| 199 | } |
| 200 | |
| 201 | for (auto& configPair : parser.configs()) { |
| 202 | out->push_back({}); |
| 203 | KernelConfig& config = out->back(); |
| 204 | config.first = std::move(configPair.first); |
| 205 | if (!parseKernelConfigTypedValue(configPair.second, &config.second)) { |
| 206 | std::cerr << "Unknown value type for key = '" << config.first << "', value = '" |
| 207 | << configPair.second << "'\n"; |
| 208 | return false; |
| 209 | } |
| 210 | } |
| 211 | return true; |
| 212 | } |
| 213 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 214 | static bool parseFilesForKernelConfigs(std::vector<NamedIstream>* streams, |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 215 | std::vector<ConditionedConfig>* out) { |
| 216 | out->clear(); |
| 217 | ConditionedConfig commonConfig; |
| 218 | bool foundCommonConfig = false; |
Steve Muckle | 0bef868 | 2017-07-31 15:47:15 -0700 | [diff] [blame] | 219 | bool ret = true; |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 220 | |
| 221 | for (auto& namedStream : *streams) { |
| 222 | if (isCommonConfig(namedStream.name())) { |
| 223 | ret &= parseFileForKernelConfigs(namedStream.stream(), &commonConfig.second); |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 224 | foundCommonConfig = true; |
| 225 | } else { |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 226 | Condition condition = generateCondition(namedStream.name()); |
Yifan Hong | 079ec24 | 2017-08-25 18:53:38 -0700 | [diff] [blame] | 227 | ret &= (condition != nullptr); |
| 228 | |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 229 | std::vector<KernelConfig> kernelConfigs; |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 230 | if ((ret &= parseFileForKernelConfigs(namedStream.stream(), &kernelConfigs))) |
Yifan Hong | 079ec24 | 2017-08-25 18:53:38 -0700 | [diff] [blame] | 231 | out->emplace_back(std::move(condition), std::move(kernelConfigs)); |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 232 | } |
Steve Muckle | 0bef868 | 2017-07-31 15:47:15 -0700 | [diff] [blame] | 233 | } |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 234 | |
| 235 | if (!foundCommonConfig) { |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 236 | std::cerr << "No android-base.cfg is found in these paths:" << std::endl; |
| 237 | for (auto& namedStream : *streams) { |
| 238 | std::cerr << " " << namedStream.name() << std::endl; |
| 239 | } |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 240 | } |
| 241 | ret &= foundCommonConfig; |
| 242 | // first element is always common configs (no conditions). |
| 243 | out->insert(out->begin(), std::move(commonConfig)); |
Steve Muckle | 0bef868 | 2017-07-31 15:47:15 -0700 | [diff] [blame] | 244 | return ret; |
| 245 | } |
| 246 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 247 | std::basic_ostream<char>& out() const { return mOutRef == nullptr ? std::cout : *mOutRef; } |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 248 | |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 249 | template <typename S> |
Yifan Hong | ffcaf99 | 2018-01-09 17:08:51 -0800 | [diff] [blame] | 250 | using Schemas = std::vector<Named<S>>; |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 251 | using HalManifests = Schemas<HalManifest>; |
| 252 | using CompatibilityMatrices = Schemas<CompatibilityMatrix>; |
| 253 | |
| 254 | bool assembleHalManifest(HalManifests* halManifests) { |
Yifan Hong | 4650ad8 | 2017-05-01 17:28:02 -0700 | [diff] [blame] | 255 | std::string error; |
Yifan Hong | ffcaf99 | 2018-01-09 17:08:51 -0800 | [diff] [blame] | 256 | HalManifest* halManifest = &halManifests->front().object; |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 257 | for (auto it = halManifests->begin() + 1; it != halManifests->end(); ++it) { |
Yifan Hong | ffcaf99 | 2018-01-09 17:08:51 -0800 | [diff] [blame] | 258 | const std::string& path = it->name; |
| 259 | HalManifest& halToAdd = it->object; |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 260 | |
| 261 | if (halToAdd.level() != Level::UNSPECIFIED) { |
| 262 | if (halManifest->level() == Level::UNSPECIFIED) { |
| 263 | halManifest->mLevel = halToAdd.level(); |
| 264 | } else if (halManifest->level() != halToAdd.level()) { |
| 265 | std::cerr << "Inconsistent FCM Version in HAL manifests:" << std::endl |
Yifan Hong | ffcaf99 | 2018-01-09 17:08:51 -0800 | [diff] [blame] | 266 | << " File '" << halManifests->front().name << "' has level " |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 267 | << halManifest->level() << std::endl |
| 268 | << " File '" << path << "' has level " << halToAdd.level() |
| 269 | << std::endl; |
| 270 | return false; |
| 271 | } |
| 272 | } |
| 273 | |
Yifan Hong | ea25dd4 | 2017-12-18 17:03:24 -0800 | [diff] [blame] | 274 | if (!halManifest->addAllHals(&halToAdd, &error)) { |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 275 | std::cerr << "File \"" << path << "\" cannot be added: conflict on HAL \"" << error |
| 276 | << "\" with an existing HAL. See <hal> with the same name " |
| 277 | << "in previously parsed files or previously declared in this file." |
| 278 | << std::endl; |
| 279 | return false; |
| 280 | } |
| 281 | } |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 282 | |
| 283 | if (halManifest->mType == SchemaType::DEVICE) { |
| 284 | if (!getFlag("BOARD_SEPOLICY_VERS", &halManifest->device.mSepolicyVersion)) { |
| 285 | return false; |
| 286 | } |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 287 | if (!setDeviceFcmVersion(halManifest)) { |
| 288 | return false; |
| 289 | } |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | if (mOutputMatrix) { |
| 293 | CompatibilityMatrix generatedMatrix = halManifest->generateCompatibleMatrix(); |
| 294 | if (!halManifest->checkCompatibility(generatedMatrix, &error)) { |
| 295 | std::cerr << "FATAL ERROR: cannot generate a compatible matrix: " << error |
| 296 | << std::endl; |
| 297 | } |
| 298 | out() << "<!-- \n" |
| 299 | " Autogenerated skeleton compatibility matrix. \n" |
| 300 | " Use with caution. Modify it to suit your needs.\n" |
| 301 | " All HALs are set to optional.\n" |
| 302 | " Many entries other than HALs are zero-filled and\n" |
| 303 | " require human attention. \n" |
| 304 | "-->\n" |
Yifan Hong | a2635c4 | 2017-12-12 13:20:33 -0800 | [diff] [blame] | 305 | << gCompatibilityMatrixConverter(generatedMatrix, mSerializeFlags); |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 306 | } else { |
Yifan Hong | a2635c4 | 2017-12-12 13:20:33 -0800 | [diff] [blame] | 307 | out() << gHalManifestConverter(*halManifest, mSerializeFlags); |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 308 | } |
| 309 | out().flush(); |
| 310 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 311 | if (mCheckFile != nullptr) { |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 312 | CompatibilityMatrix checkMatrix; |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 313 | if (!gCompatibilityMatrixConverter(&checkMatrix, read(*mCheckFile))) { |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 314 | std::cerr << "Cannot parse check file as a compatibility matrix: " |
| 315 | << gCompatibilityMatrixConverter.lastError() << std::endl; |
| 316 | return false; |
| 317 | } |
| 318 | if (!halManifest->checkCompatibility(checkMatrix, &error)) { |
| 319 | std::cerr << "Not compatible: " << error << std::endl; |
| 320 | return false; |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | return true; |
| 325 | } |
| 326 | |
Yifan Hong | e88e167 | 2017-08-24 14:42:54 -0700 | [diff] [blame] | 327 | bool assembleFrameworkCompatibilityMatrixKernels(CompatibilityMatrix* matrix) { |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 328 | for (auto& pair : mKernels) { |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 329 | std::vector<ConditionedConfig> conditionedConfigs; |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 330 | if (!parseFilesForKernelConfigs(&pair.second, &conditionedConfigs)) { |
Yifan Hong | e88e167 | 2017-08-24 14:42:54 -0700 | [diff] [blame] | 331 | return false; |
| 332 | } |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 333 | for (ConditionedConfig& conditionedConfig : conditionedConfigs) { |
Yifan Hong | 48602df | 2017-08-28 13:04:12 -0700 | [diff] [blame] | 334 | MatrixKernel kernel(KernelVersion{pair.first.majorVer, pair.first.minorVer, 0u}, |
| 335 | std::move(conditionedConfig.second)); |
Yifan Hong | 079ec24 | 2017-08-25 18:53:38 -0700 | [diff] [blame] | 336 | if (conditionedConfig.first != nullptr) |
| 337 | kernel.mConditions.push_back(std::move(*conditionedConfig.first)); |
| 338 | matrix->framework.mKernels.push_back(std::move(kernel)); |
Yifan Hong | 9a8b1a7 | 2017-08-25 17:55:33 -0700 | [diff] [blame] | 339 | } |
Yifan Hong | e88e167 | 2017-08-24 14:42:54 -0700 | [diff] [blame] | 340 | } |
| 341 | return true; |
| 342 | } |
| 343 | |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 344 | bool setDeviceFcmVersion(HalManifest* manifest) { |
| 345 | size_t shippingApiLevel = getIntegerFlag("PRODUCT_SHIPPING_API_LEVEL"); |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 346 | |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 347 | if (manifest->level() != Level::UNSPECIFIED) { |
| 348 | return true; |
| 349 | } |
| 350 | if (!getBooleanFlag("PRODUCT_ENFORCE_VINTF_MANIFEST")) { |
| 351 | manifest->mLevel = Level::LEGACY; |
| 352 | return true; |
| 353 | } |
| 354 | // TODO(b/70628538): Do not infer from Shipping API level. |
| 355 | if (shippingApiLevel) { |
| 356 | std::cerr << "Warning: Shipping FCM Version is inferred from Shipping API level. " |
| 357 | << "Declare Shipping FCM Version in device manifest directly." << std::endl; |
Yifan Hong | afae198 | 2018-01-11 18:15:24 -0800 | [diff] [blame^] | 358 | manifest->mLevel = details::convertFromApiLevel(shippingApiLevel); |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 359 | if (manifest->mLevel == Level::UNSPECIFIED) { |
| 360 | std::cerr << "Error: Shipping FCM Version cannot be inferred from Shipping API " |
| 361 | << "level " << shippingApiLevel << "." |
| 362 | << "Declare Shipping FCM Version in device manifest directly." |
| 363 | << std::endl; |
| 364 | return false; |
| 365 | } |
| 366 | return true; |
| 367 | } |
| 368 | // TODO(b/69638851): should be an error if Shipping API level is not defined. |
| 369 | // For now, just leave it empty; when framework compatibility matrix is built, |
| 370 | // lowest FCM Version is assumed. |
| 371 | std::cerr << "Warning: Shipping FCM Version cannot be inferred, because:" << std::endl |
| 372 | << " (1) It is not explicitly declared in device manifest;" << std::endl |
| 373 | << " (2) PRODUCT_ENFORCE_VINTF_MANIFEST is set to true;" << std::endl |
| 374 | << " (3) PRODUCT_SHIPPING_API_LEVEL is undefined." << std::endl |
| 375 | << "Assuming 'unspecified' Shipping FCM Version. " << std::endl |
| 376 | << "To remove this warning, define 'level' attribute in device manifest." |
| 377 | << std::endl; |
| 378 | return true; |
| 379 | } |
| 380 | |
| 381 | Level getLowestFcmVersion(const CompatibilityMatrices& matrices) { |
| 382 | Level ret = Level::UNSPECIFIED; |
| 383 | for (const auto& e : matrices) { |
Yifan Hong | ffcaf99 | 2018-01-09 17:08:51 -0800 | [diff] [blame] | 384 | if (ret == Level::UNSPECIFIED || ret > e.object.level()) { |
| 385 | ret = e.object.level(); |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 386 | } |
| 387 | } |
| 388 | return ret; |
| 389 | } |
| 390 | |
| 391 | bool assembleCompatibilityMatrix(CompatibilityMatrices* matrices) { |
| 392 | std::string error; |
| 393 | CompatibilityMatrix* matrix = nullptr; |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 394 | std::unique_ptr<HalManifest> checkManifest; |
Yifan Hong | ffcaf99 | 2018-01-09 17:08:51 -0800 | [diff] [blame] | 395 | if (matrices->front().object.mType == SchemaType::DEVICE) { |
| 396 | matrix = &matrices->front().object; |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 397 | } |
| 398 | |
Yifan Hong | ffcaf99 | 2018-01-09 17:08:51 -0800 | [diff] [blame] | 399 | if (matrices->front().object.mType == SchemaType::FRAMEWORK) { |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 400 | Level deviceLevel = Level::UNSPECIFIED; |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 401 | if (mCheckFile != nullptr) { |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 402 | checkManifest = std::make_unique<HalManifest>(); |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 403 | if (!gHalManifestConverter(checkManifest.get(), read(*mCheckFile))) { |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 404 | std::cerr << "Cannot parse check file as a HAL manifest: " |
| 405 | << gHalManifestConverter.lastError() << std::endl; |
| 406 | return false; |
| 407 | } |
| 408 | deviceLevel = checkManifest->level(); |
| 409 | } |
| 410 | |
| 411 | if (deviceLevel == Level::UNSPECIFIED) { |
| 412 | // For GSI build, legacy devices that do not have a HAL manifest, |
| 413 | // and devices in development, merge all compatibility matrices. |
| 414 | deviceLevel = getLowestFcmVersion(*matrices); |
| 415 | } |
| 416 | |
Yifan Hong | ddae77e | 2017-12-18 16:57:07 -0800 | [diff] [blame] | 417 | if (deviceLevel == Level::UNSPECIFIED) { |
| 418 | // building empty.xml |
Yifan Hong | ffcaf99 | 2018-01-09 17:08:51 -0800 | [diff] [blame] | 419 | matrix = &matrices->front().object; |
Yifan Hong | ddae77e | 2017-12-18 16:57:07 -0800 | [diff] [blame] | 420 | } else { |
| 421 | matrix = CompatibilityMatrix::combine(deviceLevel, matrices, &error); |
| 422 | if (matrix == nullptr) { |
| 423 | std::cerr << error << std::endl; |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 424 | return false; |
| 425 | } |
| 426 | } |
| 427 | |
Yifan Hong | e88e167 | 2017-08-24 14:42:54 -0700 | [diff] [blame] | 428 | if (!assembleFrameworkCompatibilityMatrixKernels(matrix)) { |
| 429 | return false; |
Yifan Hong | 79efa8a | 2017-07-06 14:10:28 -0700 | [diff] [blame] | 430 | } |
Yifan Hong | e88e167 | 2017-08-24 14:42:54 -0700 | [diff] [blame] | 431 | |
Yifan Hong | f413501 | 2017-12-18 17:27:19 -0800 | [diff] [blame] | 432 | // set sepolicy.sepolicy-version to BOARD_SEPOLICY_VERS when none is specified. |
| 433 | std::vector<VersionRange>* sepolicyVrs = |
| 434 | &matrix->framework.mSepolicy.mSepolicyVersionRanges; |
| 435 | VersionRange sepolicyVr; |
| 436 | if (!sepolicyVrs->empty()) sepolicyVr = sepolicyVrs->front(); |
| 437 | if (getFlagIfUnset("BOARD_SEPOLICY_VERS", &sepolicyVr)) { |
| 438 | *sepolicyVrs = {{sepolicyVr}}; |
Yifan Hong | 7f6c00c | 2017-07-06 19:50:29 +0000 | [diff] [blame] | 439 | } |
Yifan Hong | f413501 | 2017-12-18 17:27:19 -0800 | [diff] [blame] | 440 | |
| 441 | getFlagIfUnset("POLICYVERS", &matrix->framework.mSepolicy.mKernelSepolicyVersion); |
| 442 | getFlagIfUnset("FRAMEWORK_VBMETA_VERSION", &matrix->framework.mAvbMetaVersion); |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 443 | |
| 444 | out() << "<!--" << std::endl; |
| 445 | out() << " Input:" << std::endl; |
Yifan Hong | ddae77e | 2017-12-18 16:57:07 -0800 | [diff] [blame] | 446 | for (const auto& e : *matrices) { |
Yifan Hong | ffcaf99 | 2018-01-09 17:08:51 -0800 | [diff] [blame] | 447 | if (!e.name.empty()) { |
Yifan Hong | 4f67f3b | 2018-01-11 17:05:47 -0800 | [diff] [blame] | 448 | out() << " " << base::Basename(e.name) << std::endl; |
Yifan Hong | ddae77e | 2017-12-18 16:57:07 -0800 | [diff] [blame] | 449 | } |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 450 | } |
| 451 | out() << "-->" << std::endl; |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 452 | } |
Yifan Hong | a2635c4 | 2017-12-12 13:20:33 -0800 | [diff] [blame] | 453 | out() << gCompatibilityMatrixConverter(*matrix, mSerializeFlags); |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 454 | out().flush(); |
| 455 | |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 456 | if (checkManifest != nullptr && getBooleanFlag("PRODUCT_ENFORCE_VINTF_MANIFEST") && |
| 457 | !checkManifest->checkCompatibility(*matrix, &error)) { |
| 458 | std::cerr << "Not compatible: " << error << std::endl; |
| 459 | return false; |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 460 | } |
| 461 | |
| 462 | return true; |
| 463 | } |
| 464 | |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 465 | enum AssembleStatus { SUCCESS, FAIL_AND_EXIT, TRY_NEXT }; |
| 466 | template <typename Schema, typename AssembleFunc> |
| 467 | AssembleStatus tryAssemble(const XmlConverter<Schema>& converter, const std::string& schemaName, |
| 468 | AssembleFunc assemble) { |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 469 | Schemas<Schema> schemas; |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 470 | Schema schema; |
Yifan Hong | aa219f5 | 2017-12-18 18:51:59 -0800 | [diff] [blame] | 471 | if (!converter(&schema, read(mInFiles.front().stream()))) { |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 472 | return TRY_NEXT; |
| 473 | } |
| 474 | auto firstType = schema.type(); |
Yifan Hong | aa219f5 | 2017-12-18 18:51:59 -0800 | [diff] [blame] | 475 | schemas.emplace_back(mInFiles.front().name(), std::move(schema)); |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 476 | |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 477 | for (auto it = mInFiles.begin() + 1; it != mInFiles.end(); ++it) { |
| 478 | Schema additionalSchema; |
Yifan Hong | aa219f5 | 2017-12-18 18:51:59 -0800 | [diff] [blame] | 479 | const std::string& fileName = it->name(); |
| 480 | if (!converter(&additionalSchema, read(it->stream()))) { |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 481 | std::cerr << "File \"" << fileName << "\" is not a valid " << firstType << " " |
| 482 | << schemaName << " (but the first file is a valid " << firstType << " " |
| 483 | << schemaName << "). Error: " << converter.lastError() << std::endl; |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 484 | return FAIL_AND_EXIT; |
| 485 | } |
| 486 | if (additionalSchema.type() != firstType) { |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 487 | std::cerr << "File \"" << fileName << "\" is a " << additionalSchema.type() << " " |
| 488 | << schemaName << " (but a " << firstType << " " << schemaName |
| 489 | << " is expected)." << std::endl; |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 490 | return FAIL_AND_EXIT; |
| 491 | } |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 492 | |
| 493 | schemas.emplace_back(fileName, std::move(additionalSchema)); |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 494 | } |
Yifan Hong | dbe9db3 | 2017-12-11 19:06:11 -0800 | [diff] [blame] | 495 | return assemble(&schemas) ? SUCCESS : FAIL_AND_EXIT; |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 496 | } |
| 497 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 498 | bool assemble() override { |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 499 | using std::placeholders::_1; |
| 500 | if (mInFiles.empty()) { |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 501 | std::cerr << "Missing input file." << std::endl; |
| 502 | return false; |
| 503 | } |
| 504 | |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 505 | auto status = tryAssemble(gHalManifestConverter, "manifest", |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 506 | std::bind(&AssembleVintfImpl::assembleHalManifest, this, _1)); |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 507 | if (status == SUCCESS) return true; |
| 508 | if (status == FAIL_AND_EXIT) return false; |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 509 | |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 510 | resetInFiles(); |
Yifan Hong | a59d256 | 2017-04-18 18:01:16 -0700 | [diff] [blame] | 511 | |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 512 | status = tryAssemble(gCompatibilityMatrixConverter, "compatibility matrix", |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 513 | std::bind(&AssembleVintfImpl::assembleCompatibilityMatrix, this, _1)); |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 514 | if (status == SUCCESS) return true; |
| 515 | if (status == FAIL_AND_EXIT) return false; |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 516 | |
Yifan Hong | 959ee1b | 2017-04-28 14:37:56 -0700 | [diff] [blame] | 517 | std::cerr << "Input file has unknown format." << std::endl |
| 518 | << "Error when attempting to convert to manifest: " |
| 519 | << gHalManifestConverter.lastError() << std::endl |
| 520 | << "Error when attempting to convert to compatibility matrix: " |
| 521 | << gCompatibilityMatrixConverter.lastError() << std::endl; |
| 522 | return false; |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 523 | } |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 524 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 525 | std::ostream& setOutputStream(Ostream&& out) override { |
| 526 | mOutRef = std::move(out); |
| 527 | return *mOutRef; |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 528 | } |
| 529 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 530 | std::istream& addInputStream(const std::string& name, Istream&& in) override { |
| 531 | auto it = mInFiles.emplace(mInFiles.end(), name, std::move(in)); |
| 532 | return it->stream(); |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 533 | } |
| 534 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 535 | std::istream& setCheckInputStream(Istream&& in) override { |
| 536 | mCheckFile = std::move(in); |
| 537 | return *mCheckFile; |
| 538 | } |
| 539 | |
| 540 | bool hasKernelVersion(const Version& kernelVer) const override { |
| 541 | return mKernels.find(kernelVer) != mKernels.end(); |
| 542 | } |
| 543 | |
| 544 | std::istream& addKernelConfigInputStream(const Version& kernelVer, const std::string& name, |
| 545 | Istream&& in) override { |
| 546 | auto&& kernel = mKernels[kernelVer]; |
| 547 | auto it = kernel.emplace(kernel.end(), name, std::move(in)); |
| 548 | return it->stream(); |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 549 | } |
| 550 | |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 551 | void resetInFiles() { |
| 552 | for (auto& inFile : mInFiles) { |
Yifan Hong | aa219f5 | 2017-12-18 18:51:59 -0800 | [diff] [blame] | 553 | inFile.stream().clear(); |
| 554 | inFile.stream().seekg(0); |
Yifan Hong | bfb3c1d | 2017-05-24 14:38:48 -0700 | [diff] [blame] | 555 | } |
| 556 | } |
| 557 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 558 | void setOutputMatrix() override { mOutputMatrix = true; } |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 559 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 560 | bool setHalsOnly() override { |
Yifan Hong | a2635c4 | 2017-12-12 13:20:33 -0800 | [diff] [blame] | 561 | if (mSerializeFlags) return false; |
| 562 | mSerializeFlags |= SerializeFlag::HALS_ONLY; |
| 563 | return true; |
| 564 | } |
| 565 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 566 | bool setNoHals() override { |
Yifan Hong | a2635c4 | 2017-12-12 13:20:33 -0800 | [diff] [blame] | 567 | if (mSerializeFlags) return false; |
| 568 | mSerializeFlags |= SerializeFlag::NO_HALS; |
| 569 | return true; |
| 570 | } |
| 571 | |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 572 | private: |
Yifan Hong | aa219f5 | 2017-12-18 18:51:59 -0800 | [diff] [blame] | 573 | std::vector<NamedIstream> mInFiles; |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 574 | Ostream mOutRef; |
| 575 | Istream mCheckFile; |
Yifan Hong | 9aa6370 | 2017-05-16 16:37:50 -0700 | [diff] [blame] | 576 | bool mOutputMatrix = false; |
Yifan Hong | a2635c4 | 2017-12-12 13:20:33 -0800 | [diff] [blame] | 577 | SerializeFlags mSerializeFlags = SerializeFlag::EVERYTHING; |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 578 | std::map<Version, std::vector<NamedIstream>> mKernels; |
| 579 | std::map<std::string, std::string> mFakeEnv; |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 580 | }; |
| 581 | |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 582 | bool AssembleVintf::openOutFile(const std::string& path) { |
| 583 | return static_cast<std::ofstream&>(setOutputStream(std::make_unique<std::ofstream>(path))) |
| 584 | .is_open(); |
| 585 | } |
| 586 | |
| 587 | bool AssembleVintf::openInFile(const std::string& path) { |
| 588 | return static_cast<std::ifstream&>(addInputStream(path, std::make_unique<std::ifstream>(path))) |
| 589 | .is_open(); |
| 590 | } |
| 591 | |
| 592 | bool AssembleVintf::openCheckFile(const std::string& path) { |
| 593 | return static_cast<std::ifstream&>(setCheckInputStream(std::make_unique<std::ifstream>(path))) |
| 594 | .is_open(); |
| 595 | } |
| 596 | |
| 597 | bool AssembleVintf::addKernel(const std::string& kernelArg) { |
Yifan Hong | b83e56b | 2018-01-09 14:36:30 -0800 | [diff] [blame] | 598 | auto tokens = base::Split(kernelArg, ":"); |
Yifan Hong | 8302cea | 2017-12-18 20:17:05 -0800 | [diff] [blame] | 599 | if (tokens.size() <= 1) { |
| 600 | std::cerr << "Unrecognized --kernel option '" << kernelArg << "'" << std::endl; |
| 601 | return false; |
| 602 | } |
| 603 | Version kernelVer; |
| 604 | if (!parse(tokens.front(), &kernelVer)) { |
| 605 | std::cerr << "Unrecognized kernel version '" << tokens.front() << "'" << std::endl; |
| 606 | return false; |
| 607 | } |
| 608 | if (hasKernelVersion(kernelVer)) { |
| 609 | std::cerr << "Multiple --kernel for " << kernelVer << " is specified." << std::endl; |
| 610 | return false; |
| 611 | } |
| 612 | for (auto it = tokens.begin() + 1; it != tokens.end(); ++it) { |
| 613 | bool opened = |
| 614 | static_cast<std::ifstream&>( |
| 615 | addKernelConfigInputStream(kernelVer, *it, std::make_unique<std::ifstream>(*it))) |
| 616 | .is_open(); |
| 617 | if (!opened) { |
| 618 | std::cerr << "Cannot open file '" << *it << "'." << std::endl; |
| 619 | return false; |
| 620 | } |
| 621 | } |
| 622 | return true; |
| 623 | } |
| 624 | |
| 625 | std::unique_ptr<AssembleVintf> AssembleVintf::newInstance() { |
| 626 | return std::make_unique<AssembleVintfImpl>(); |
| 627 | } |
| 628 | |
Yifan Hong | 4d18bcc | 2017-04-07 21:47:16 +0000 | [diff] [blame] | 629 | } // namespace vintf |
| 630 | } // namespace android |