1 #define LOG_TAG "com.android.art" 2 #include "com_android_art.h" 3 4 #include <assert.h> 5 #ifndef __BIONIC__ 6 #define __assert2(f,n,fun,e) do { fprintf(stderr, "%s:%d: %s: Assertion `%s' failed", (f), (n), (fun), (e)); abort(); } while (false) 7 #endif 8 #define _xsdc_assert(e) do if (!(e)) __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, #e); while (false) 9 10 namespace com { 11 namespace android { 12 namespace art { getXmlAttribute(const tinyxml2::XMLElement * cur,const char * attribute)13 static std::string getXmlAttribute(const tinyxml2::XMLElement *cur, const char *attribute) { 14 auto attrValue = cur->Attribute(attribute); 15 if(attrValue == nullptr) { 16 return ""; 17 } 18 return std::string(attrValue); 19 } 20 read(const char * configFile)21 std::optional<CacheInfo> read(const char* configFile) { 22 tinyxml2::XMLDocument doc; 23 if (doc.LoadFile(configFile) != tinyxml2::XML_SUCCESS) { 24 return std::nullopt; 25 } 26 auto _child = doc.FirstChildElement(); 27 if (_child == nullptr) { 28 return std::nullopt; 29 } 30 31 if (strcmp(_child->Name(), "cacheInfo") == 0) { 32 CacheInfo _value = CacheInfo::read(_child); 33 return _value; 34 } 35 return std::nullopt; 36 } 37 parse(const char * xml)38 std::optional<CacheInfo> parse(const char* xml) { 39 tinyxml2::XMLDocument doc; 40 if (doc.Parse(xml) != tinyxml2::XML_SUCCESS) { 41 return std::nullopt; 42 } 43 auto _child = doc.FirstChildElement(); 44 if (_child == nullptr) { 45 return std::nullopt; 46 } 47 48 if (strcmp(_child->Name(), "cacheInfo") == 0) { 49 CacheInfo _value = CacheInfo::read(_child); 50 return _value; 51 } 52 return std::nullopt; 53 } 54 write(std::ostream & _out,const CacheInfo & cacheInfo)55 void write(std::ostream& _out, const CacheInfo& cacheInfo) { 56 _out << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; 57 cacheInfo.write(_out, "cacheInfo"); 58 } 59 60 static int indentIndex = 0; printIndent()61 std::string printIndent() { 62 std::string s = ""; 63 for (int index = 0; index < indentIndex; ++index) { 64 s += " "; 65 } 66 return s; 67 } 68 69 KeyValuePairList(std::vector<KeyValuePair> item)70 KeyValuePairList::KeyValuePairList(std::vector<KeyValuePair> item) : item_(std::move(item)) { 71 } 72 getItem() const73 const std::vector<KeyValuePair>& KeyValuePairList::getItem() const { 74 return item_; 75 } 76 hasItem() const77 bool KeyValuePairList::hasItem() const { 78 return !(item_.empty()); 79 } 80 getFirstItem() const81 const KeyValuePair* KeyValuePairList::getFirstItem() const { 82 if (item_.empty()) { 83 return nullptr; 84 } 85 return &item_[0]; 86 } 87 read(tinyxml2::XMLElement * root)88 KeyValuePairList KeyValuePairList::read(tinyxml2::XMLElement *root) { 89 std::string _raw; 90 std::vector<KeyValuePair> item; 91 for (auto *_child = root->FirstChildElement(); _child != nullptr; _child = _child->NextSiblingElement()) { 92 if (!strcmp(_child->Name(), "item")) { 93 KeyValuePair _value = KeyValuePair::read(_child); 94 item.push_back(std::move(_value)); 95 } 96 } 97 KeyValuePairList instance(item); 98 return instance; 99 } 100 write(std::ostream & _out,const std::string & _name) const101 void KeyValuePairList::write(std::ostream& _out, const std::string& _name) const { 102 _out << printIndent() << "<" << _name; 103 _out << ">" << std::endl; 104 ++indentIndex; 105 for (auto& _value : getItem()) { 106 _value.write(_out, "item"); 107 } 108 --indentIndex; 109 _out << printIndent() << "</" << _name << ">" << std::endl; 110 } 111 KeyValuePair(std::string k,std::string v)112 KeyValuePair::KeyValuePair(std::string k, std::string v) : k_(std::move(k)), v_(std::move(v)) { 113 } 114 getK() const115 const std::string& KeyValuePair::getK() const { 116 return k_; 117 } 118 hasK() const119 bool KeyValuePair::hasK() const { 120 return true; 121 } 122 getV() const123 const std::string& KeyValuePair::getV() const { 124 return v_; 125 } 126 hasV() const127 bool KeyValuePair::hasV() const { 128 return true; 129 } 130 read(tinyxml2::XMLElement * root)131 KeyValuePair KeyValuePair::read(tinyxml2::XMLElement *root) { 132 std::string _raw; 133 _raw = getXmlAttribute(root, "k"); 134 std::string k{}; 135 if (_raw != "") { 136 std::string &_value = _raw; 137 k = _value; 138 } 139 _raw = getXmlAttribute(root, "v"); 140 std::string v{}; 141 if (_raw != "") { 142 std::string &_value = _raw; 143 v = _value; 144 } 145 KeyValuePair instance(k, v); 146 return instance; 147 } 148 write(std::ostream & _out,const std::string & _name) const149 void KeyValuePair::write(std::ostream& _out, const std::string& _name) const { 150 _out << printIndent() << "<" << _name; 151 if (hasK()) { 152 _out << " k=\""; 153 _out << getK(); 154 _out << "\""; 155 } 156 if (hasV()) { 157 _out << " v=\""; 158 _out << getV(); 159 _out << "\""; 160 } 161 _out << ">" << std::endl; 162 ++indentIndex; 163 --indentIndex; 164 _out << printIndent() << "</" << _name << ">" << std::endl; 165 } 166 ModuleInfoList(std::vector<ModuleInfo> moduleInfo)167 ModuleInfoList::ModuleInfoList(std::vector<ModuleInfo> moduleInfo) : moduleInfo_(std::move(moduleInfo)) { 168 } 169 getModuleInfo() const170 const std::vector<ModuleInfo>& ModuleInfoList::getModuleInfo() const { 171 return moduleInfo_; 172 } 173 hasModuleInfo() const174 bool ModuleInfoList::hasModuleInfo() const { 175 return !(moduleInfo_.empty()); 176 } 177 getFirstModuleInfo() const178 const ModuleInfo* ModuleInfoList::getFirstModuleInfo() const { 179 if (moduleInfo_.empty()) { 180 return nullptr; 181 } 182 return &moduleInfo_[0]; 183 } 184 read(tinyxml2::XMLElement * root)185 ModuleInfoList ModuleInfoList::read(tinyxml2::XMLElement *root) { 186 std::string _raw; 187 std::vector<ModuleInfo> moduleInfo; 188 for (auto *_child = root->FirstChildElement(); _child != nullptr; _child = _child->NextSiblingElement()) { 189 if (!strcmp(_child->Name(), "moduleInfo")) { 190 ModuleInfo _value = ModuleInfo::read(_child); 191 moduleInfo.push_back(std::move(_value)); 192 } 193 } 194 ModuleInfoList instance(moduleInfo); 195 return instance; 196 } 197 write(std::ostream & _out,const std::string & _name) const198 void ModuleInfoList::write(std::ostream& _out, const std::string& _name) const { 199 _out << printIndent() << "<" << _name; 200 _out << ">" << std::endl; 201 ++indentIndex; 202 for (auto& _value : getModuleInfo()) { 203 _value.write(_out, "moduleInfo"); 204 } 205 --indentIndex; 206 _out << printIndent() << "</" << _name << ">" << std::endl; 207 } 208 ModuleInfo(std::string name,int64_t versionCode,std::string versionName,int64_t lastUpdateMillis)209 ModuleInfo::ModuleInfo(std::string name, int64_t versionCode, std::string versionName, int64_t lastUpdateMillis) : name_(std::move(name)), versionCode_(versionCode), versionName_(std::move(versionName)), lastUpdateMillis_(lastUpdateMillis) { 210 } 211 getName() const212 const std::string& ModuleInfo::getName() const { 213 return name_; 214 } 215 hasName() const216 bool ModuleInfo::hasName() const { 217 return true; 218 } 219 getVersionCode() const220 const int64_t& ModuleInfo::getVersionCode() const { 221 return versionCode_; 222 } 223 hasVersionCode() const224 bool ModuleInfo::hasVersionCode() const { 225 return true; 226 } 227 getVersionName() const228 const std::string& ModuleInfo::getVersionName() const { 229 return versionName_; 230 } 231 hasVersionName() const232 bool ModuleInfo::hasVersionName() const { 233 return true; 234 } 235 getLastUpdateMillis() const236 const int64_t& ModuleInfo::getLastUpdateMillis() const { 237 return lastUpdateMillis_; 238 } 239 hasLastUpdateMillis() const240 bool ModuleInfo::hasLastUpdateMillis() const { 241 return true; 242 } 243 read(tinyxml2::XMLElement * root)244 ModuleInfo ModuleInfo::read(tinyxml2::XMLElement *root) { 245 std::string _raw; 246 _raw = getXmlAttribute(root, "name"); 247 std::string name{}; 248 if (_raw != "") { 249 std::string &_value = _raw; 250 name = _value; 251 } 252 _raw = getXmlAttribute(root, "versionCode"); 253 int64_t versionCode{}; 254 if (_raw != "") { 255 int64_t _value = std::stoll(_raw); 256 versionCode = _value; 257 } 258 _raw = getXmlAttribute(root, "versionName"); 259 std::string versionName{}; 260 if (_raw != "") { 261 std::string &_value = _raw; 262 versionName = _value; 263 } 264 _raw = getXmlAttribute(root, "lastUpdateMillis"); 265 int64_t lastUpdateMillis{}; 266 if (_raw != "") { 267 int64_t _value = std::stoll(_raw); 268 lastUpdateMillis = _value; 269 } 270 ModuleInfo instance(name, versionCode, versionName, lastUpdateMillis); 271 return instance; 272 } 273 write(std::ostream & _out,const std::string & _name) const274 void ModuleInfo::write(std::ostream& _out, const std::string& _name) const { 275 _out << printIndent() << "<" << _name; 276 if (hasName()) { 277 _out << " name=\""; 278 _out << getName(); 279 _out << "\""; 280 } 281 if (hasVersionCode()) { 282 _out << " versionCode=\""; 283 _out << getVersionCode(); 284 _out << "\""; 285 } 286 if (hasVersionName()) { 287 _out << " versionName=\""; 288 _out << getVersionName(); 289 _out << "\""; 290 } 291 if (hasLastUpdateMillis()) { 292 _out << " lastUpdateMillis=\""; 293 _out << getLastUpdateMillis(); 294 _out << "\""; 295 } 296 _out << ">" << std::endl; 297 ++indentIndex; 298 --indentIndex; 299 _out << printIndent() << "</" << _name << ">" << std::endl; 300 } 301 Classpath(std::vector<Component> component)302 Classpath::Classpath(std::vector<Component> component) : component_(std::move(component)) { 303 } 304 getComponent() const305 const std::vector<Component>& Classpath::getComponent() const { 306 return component_; 307 } 308 hasComponent() const309 bool Classpath::hasComponent() const { 310 return !(component_.empty()); 311 } 312 getFirstComponent() const313 const Component* Classpath::getFirstComponent() const { 314 if (component_.empty()) { 315 return nullptr; 316 } 317 return &component_[0]; 318 } 319 read(tinyxml2::XMLElement * root)320 Classpath Classpath::read(tinyxml2::XMLElement *root) { 321 std::string _raw; 322 std::vector<Component> component; 323 for (auto *_child = root->FirstChildElement(); _child != nullptr; _child = _child->NextSiblingElement()) { 324 if (!strcmp(_child->Name(), "component")) { 325 Component _value = Component::read(_child); 326 component.push_back(std::move(_value)); 327 } 328 } 329 Classpath instance(component); 330 return instance; 331 } 332 write(std::ostream & _out,const std::string & _name) const333 void Classpath::write(std::ostream& _out, const std::string& _name) const { 334 _out << printIndent() << "<" << _name; 335 _out << ">" << std::endl; 336 ++indentIndex; 337 for (auto& _value : getComponent()) { 338 _value.write(_out, "component"); 339 } 340 --indentIndex; 341 _out << printIndent() << "</" << _name << ">" << std::endl; 342 } 343 Component(std::string file,uint64_t size,std::string checksums)344 Component::Component(std::string file, uint64_t size, std::string checksums) : file_(std::move(file)), size_(size), checksums_(std::move(checksums)) { 345 } 346 getFile() const347 const std::string& Component::getFile() const { 348 return file_; 349 } 350 hasFile() const351 bool Component::hasFile() const { 352 return true; 353 } 354 getSize() const355 const uint64_t& Component::getSize() const { 356 return size_; 357 } 358 hasSize() const359 bool Component::hasSize() const { 360 return true; 361 } 362 getChecksums() const363 const std::string& Component::getChecksums() const { 364 return checksums_; 365 } 366 hasChecksums() const367 bool Component::hasChecksums() const { 368 return true; 369 } 370 read(tinyxml2::XMLElement * root)371 Component Component::read(tinyxml2::XMLElement *root) { 372 std::string _raw; 373 _raw = getXmlAttribute(root, "file"); 374 std::string file{}; 375 if (_raw != "") { 376 std::string &_value = _raw; 377 file = _value; 378 } 379 _raw = getXmlAttribute(root, "size"); 380 uint64_t size{}; 381 if (_raw != "") { 382 uint64_t _value = std::stoull(_raw); 383 size = _value; 384 } 385 _raw = getXmlAttribute(root, "checksums"); 386 std::string checksums{}; 387 if (_raw != "") { 388 std::string &_value = _raw; 389 checksums = _value; 390 } 391 Component instance(file, size, checksums); 392 return instance; 393 } 394 write(std::ostream & _out,const std::string & _name) const395 void Component::write(std::ostream& _out, const std::string& _name) const { 396 _out << printIndent() << "<" << _name; 397 if (hasFile()) { 398 _out << " file=\""; 399 _out << getFile(); 400 _out << "\""; 401 } 402 if (hasSize()) { 403 _out << " size=\""; 404 _out << getSize(); 405 _out << "\""; 406 } 407 if (hasChecksums()) { 408 _out << " checksums=\""; 409 _out << getChecksums(); 410 _out << "\""; 411 } 412 _out << ">" << std::endl; 413 ++indentIndex; 414 --indentIndex; 415 _out << printIndent() << "</" << _name << ">" << std::endl; 416 } 417 SystemServerComponents(std::vector<SystemServerComponent> component)418 SystemServerComponents::SystemServerComponents(std::vector<SystemServerComponent> component) : component_(std::move(component)) { 419 } 420 getComponent() const421 const std::vector<SystemServerComponent>& SystemServerComponents::getComponent() const { 422 return component_; 423 } 424 hasComponent() const425 bool SystemServerComponents::hasComponent() const { 426 return !(component_.empty()); 427 } 428 getFirstComponent() const429 const SystemServerComponent* SystemServerComponents::getFirstComponent() const { 430 if (component_.empty()) { 431 return nullptr; 432 } 433 return &component_[0]; 434 } 435 read(tinyxml2::XMLElement * root)436 SystemServerComponents SystemServerComponents::read(tinyxml2::XMLElement *root) { 437 std::string _raw; 438 std::vector<SystemServerComponent> component; 439 for (auto *_child = root->FirstChildElement(); _child != nullptr; _child = _child->NextSiblingElement()) { 440 if (!strcmp(_child->Name(), "component")) { 441 SystemServerComponent _value = SystemServerComponent::read(_child); 442 component.push_back(std::move(_value)); 443 } 444 } 445 SystemServerComponents instance(component); 446 return instance; 447 } 448 write(std::ostream & _out,const std::string & _name) const449 void SystemServerComponents::write(std::ostream& _out, const std::string& _name) const { 450 _out << printIndent() << "<" << _name; 451 _out << ">" << std::endl; 452 ++indentIndex; 453 for (auto& _value : getComponent()) { 454 _value.write(_out, "component"); 455 } 456 --indentIndex; 457 _out << printIndent() << "</" << _name << ">" << std::endl; 458 } 459 SystemServerComponent(std::string file,uint64_t size,std::string checksums,bool isInClasspath)460 SystemServerComponent::SystemServerComponent(std::string file, uint64_t size, std::string checksums, bool isInClasspath) : Component(file, size, checksums), isInClasspath_(isInClasspath) { 461 } 462 getIsInClasspath() const463 const bool& SystemServerComponent::getIsInClasspath() const { 464 return isInClasspath_; 465 } 466 hasIsInClasspath() const467 bool SystemServerComponent::hasIsInClasspath() const { 468 return true; 469 } 470 read(tinyxml2::XMLElement * root)471 SystemServerComponent SystemServerComponent::read(tinyxml2::XMLElement *root) { 472 std::string _raw; 473 _raw = getXmlAttribute(root, "file"); 474 std::string file{}; 475 if (_raw != "") { 476 std::string &_value = _raw; 477 file = _value; 478 } 479 _raw = getXmlAttribute(root, "size"); 480 uint64_t size{}; 481 if (_raw != "") { 482 uint64_t _value = std::stoull(_raw); 483 size = _value; 484 } 485 _raw = getXmlAttribute(root, "checksums"); 486 std::string checksums{}; 487 if (_raw != "") { 488 std::string &_value = _raw; 489 checksums = _value; 490 } 491 _raw = getXmlAttribute(root, "isInClasspath"); 492 bool isInClasspath{}; 493 if (_raw != "") { 494 bool _value = _raw == "true"; 495 isInClasspath = _value; 496 } 497 SystemServerComponent instance(file, size, checksums, isInClasspath); 498 return instance; 499 } 500 write(std::ostream & _out,const std::string & _name) const501 void SystemServerComponent::write(std::ostream& _out, const std::string& _name) const { 502 _out << printIndent() << "<" << _name; 503 if (hasFile()) { 504 _out << " file=\""; 505 _out << getFile(); 506 _out << "\""; 507 } 508 if (hasSize()) { 509 _out << " size=\""; 510 _out << getSize(); 511 _out << "\""; 512 } 513 if (hasChecksums()) { 514 _out << " checksums=\""; 515 _out << getChecksums(); 516 _out << "\""; 517 } 518 if (hasIsInClasspath()) { 519 _out << " isInClasspath=\""; 520 _out << (getIsInClasspath() ? "true" : "false"); 521 _out << "\""; 522 } 523 _out << ">" << std::endl; 524 ++indentIndex; 525 --indentIndex; 526 _out << printIndent() << "</" << _name << ">" << std::endl; 527 } 528 CacheInfo(std::vector<KeyValuePairList> systemProperties,std::vector<ModuleInfo> artModuleInfo,std::vector<ModuleInfoList> moduleInfoList,std::vector<Classpath> bootClasspath,std::vector<Classpath> dex2oatBootClasspath,std::vector<SystemServerComponents> systemServerComponents,std::optional<bool> compilationOsMode)529 CacheInfo::CacheInfo(std::vector<KeyValuePairList> systemProperties, std::vector<ModuleInfo> artModuleInfo, std::vector<ModuleInfoList> moduleInfoList, std::vector<Classpath> bootClasspath, std::vector<Classpath> dex2oatBootClasspath, std::vector<SystemServerComponents> systemServerComponents, std::optional<bool> compilationOsMode) : systemProperties_(std::move(systemProperties)), artModuleInfo_(std::move(artModuleInfo)), moduleInfoList_(std::move(moduleInfoList)), bootClasspath_(std::move(bootClasspath)), dex2oatBootClasspath_(std::move(dex2oatBootClasspath)), systemServerComponents_(std::move(systemServerComponents)), compilationOsMode_(compilationOsMode) { 530 } 531 getSystemProperties() const532 const std::vector<KeyValuePairList>& CacheInfo::getSystemProperties() const { 533 return systemProperties_; 534 } 535 hasSystemProperties() const536 bool CacheInfo::hasSystemProperties() const { 537 return !(systemProperties_.empty()); 538 } 539 getFirstSystemProperties() const540 const KeyValuePairList* CacheInfo::getFirstSystemProperties() const { 541 if (systemProperties_.empty()) { 542 return nullptr; 543 } 544 return &systemProperties_[0]; 545 } 546 getArtModuleInfo() const547 const std::vector<ModuleInfo>& CacheInfo::getArtModuleInfo() const { 548 return artModuleInfo_; 549 } 550 hasArtModuleInfo() const551 bool CacheInfo::hasArtModuleInfo() const { 552 return !(artModuleInfo_.empty()); 553 } 554 getFirstArtModuleInfo() const555 const ModuleInfo* CacheInfo::getFirstArtModuleInfo() const { 556 if (artModuleInfo_.empty()) { 557 return nullptr; 558 } 559 return &artModuleInfo_[0]; 560 } 561 getModuleInfoList() const562 const std::vector<ModuleInfoList>& CacheInfo::getModuleInfoList() const { 563 return moduleInfoList_; 564 } 565 hasModuleInfoList() const566 bool CacheInfo::hasModuleInfoList() const { 567 return !(moduleInfoList_.empty()); 568 } 569 getFirstModuleInfoList() const570 const ModuleInfoList* CacheInfo::getFirstModuleInfoList() const { 571 if (moduleInfoList_.empty()) { 572 return nullptr; 573 } 574 return &moduleInfoList_[0]; 575 } 576 getBootClasspath() const577 const std::vector<Classpath>& CacheInfo::getBootClasspath() const { 578 return bootClasspath_; 579 } 580 hasBootClasspath() const581 bool CacheInfo::hasBootClasspath() const { 582 return !(bootClasspath_.empty()); 583 } 584 getFirstBootClasspath() const585 const Classpath* CacheInfo::getFirstBootClasspath() const { 586 if (bootClasspath_.empty()) { 587 return nullptr; 588 } 589 return &bootClasspath_[0]; 590 } 591 getDex2oatBootClasspath() const592 const std::vector<Classpath>& CacheInfo::getDex2oatBootClasspath() const { 593 return dex2oatBootClasspath_; 594 } 595 hasDex2oatBootClasspath() const596 bool CacheInfo::hasDex2oatBootClasspath() const { 597 return !(dex2oatBootClasspath_.empty()); 598 } 599 getFirstDex2oatBootClasspath() const600 const Classpath* CacheInfo::getFirstDex2oatBootClasspath() const { 601 if (dex2oatBootClasspath_.empty()) { 602 return nullptr; 603 } 604 return &dex2oatBootClasspath_[0]; 605 } 606 getSystemServerComponents() const607 const std::vector<SystemServerComponents>& CacheInfo::getSystemServerComponents() const { 608 return systemServerComponents_; 609 } 610 hasSystemServerComponents() const611 bool CacheInfo::hasSystemServerComponents() const { 612 return !(systemServerComponents_.empty()); 613 } 614 getFirstSystemServerComponents() const615 const SystemServerComponents* CacheInfo::getFirstSystemServerComponents() const { 616 if (systemServerComponents_.empty()) { 617 return nullptr; 618 } 619 return &systemServerComponents_[0]; 620 } 621 getCompilationOsMode() const622 const bool& CacheInfo::getCompilationOsMode() const { 623 _xsdc_assert(hasCompilationOsMode()); 624 return compilationOsMode_.value(); 625 } 626 hasCompilationOsMode() const627 bool CacheInfo::hasCompilationOsMode() const { 628 return compilationOsMode_.has_value(); 629 } 630 read(tinyxml2::XMLElement * root)631 CacheInfo CacheInfo::read(tinyxml2::XMLElement *root) { 632 std::string _raw; 633 _raw = getXmlAttribute(root, "compilationOsMode"); 634 std::optional<bool> compilationOsMode = std::nullopt; 635 if (_raw != "") { 636 bool _value = _raw == "true"; 637 compilationOsMode = _value; 638 } 639 std::vector<KeyValuePairList> systemProperties; 640 std::vector<ModuleInfo> artModuleInfo; 641 std::vector<ModuleInfoList> moduleInfoList; 642 std::vector<Classpath> bootClasspath; 643 std::vector<Classpath> dex2oatBootClasspath; 644 std::vector<SystemServerComponents> systemServerComponents; 645 for (auto *_child = root->FirstChildElement(); _child != nullptr; _child = _child->NextSiblingElement()) { 646 if (!strcmp(_child->Name(), "systemProperties")) { 647 KeyValuePairList _value = KeyValuePairList::read(_child); 648 systemProperties.push_back(std::move(_value)); 649 } else if (!strcmp(_child->Name(), "artModuleInfo")) { 650 ModuleInfo _value = ModuleInfo::read(_child); 651 artModuleInfo.push_back(std::move(_value)); 652 } else if (!strcmp(_child->Name(), "moduleInfoList")) { 653 ModuleInfoList _value = ModuleInfoList::read(_child); 654 moduleInfoList.push_back(std::move(_value)); 655 } else if (!strcmp(_child->Name(), "bootClasspath")) { 656 Classpath _value = Classpath::read(_child); 657 bootClasspath.push_back(std::move(_value)); 658 } else if (!strcmp(_child->Name(), "dex2oatBootClasspath")) { 659 Classpath _value = Classpath::read(_child); 660 dex2oatBootClasspath.push_back(std::move(_value)); 661 } else if (!strcmp(_child->Name(), "systemServerComponents")) { 662 SystemServerComponents _value = SystemServerComponents::read(_child); 663 systemServerComponents.push_back(std::move(_value)); 664 } 665 } 666 CacheInfo instance(systemProperties, artModuleInfo, moduleInfoList, bootClasspath, dex2oatBootClasspath, systemServerComponents, compilationOsMode); 667 return instance; 668 } 669 write(std::ostream & _out,const std::string & _name) const670 void CacheInfo::write(std::ostream& _out, const std::string& _name) const { 671 _out << printIndent() << "<" << _name; 672 if (hasCompilationOsMode()) { 673 _out << " compilationOsMode=\""; 674 _out << (getCompilationOsMode() ? "true" : "false"); 675 _out << "\""; 676 } 677 _out << ">" << std::endl; 678 ++indentIndex; 679 for (auto& _value : getSystemProperties()) { 680 _value.write(_out, "systemProperties"); 681 } 682 for (auto& _value : getArtModuleInfo()) { 683 _value.write(_out, "artModuleInfo"); 684 } 685 for (auto& _value : getModuleInfoList()) { 686 _value.write(_out, "moduleInfoList"); 687 } 688 for (auto& _value : getBootClasspath()) { 689 _value.write(_out, "bootClasspath"); 690 } 691 for (auto& _value : getDex2oatBootClasspath()) { 692 _value.write(_out, "dex2oatBootClasspath"); 693 } 694 for (auto& _value : getSystemServerComponents()) { 695 _value.write(_out, "systemServerComponents"); 696 } 697 --indentIndex; 698 _out << printIndent() << "</" << _name << ">" << std::endl; 699 } 700 } // art 701 } // android 702 } // com 703