MCPcopy Create free account
hub / github.com/CyanogenMod/android_frameworks_base / massageManifest

Function massageManifest

tools/aapt/Resource.cpp:741–845  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

739}
740
741status_t massageManifest(Bundle* bundle, sp<XMLNode> root)
742{
743 root = root->searchElement(String16(), String16("manifest"));
744 if (root == NULL) {
745 fprintf(stderr, "No <manifest> tag.\n");
746 return UNKNOWN_ERROR;
747 }
748
749 bool errorOnFailedInsert = bundle->getErrorOnFailedInsert();
750
751 if (!addTagAttribute(root, RESOURCES_ANDROID_NAMESPACE, "versionCode",
752 bundle->getVersionCode(), errorOnFailedInsert)) {
753 return UNKNOWN_ERROR;
754 }
755 if (!addTagAttribute(root, RESOURCES_ANDROID_NAMESPACE, "versionName",
756 bundle->getVersionName(), errorOnFailedInsert)) {
757 return UNKNOWN_ERROR;
758 }
759
760 if (bundle->getMinSdkVersion() != NULL
761 || bundle->getTargetSdkVersion() != NULL
762 || bundle->getMaxSdkVersion() != NULL) {
763 sp<XMLNode> vers = root->getChildElement(String16(), String16("uses-sdk"));
764 if (vers == NULL) {
765 vers = XMLNode::newElement(root->getFilename(), String16(), String16("uses-sdk"));
766 root->insertChildAt(vers, 0);
767 }
768
769 if (!addTagAttribute(vers, RESOURCES_ANDROID_NAMESPACE, "minSdkVersion",
770 bundle->getMinSdkVersion(), errorOnFailedInsert)) {
771 return UNKNOWN_ERROR;
772 }
773 if (!addTagAttribute(vers, RESOURCES_ANDROID_NAMESPACE, "targetSdkVersion",
774 bundle->getTargetSdkVersion(), errorOnFailedInsert)) {
775 return UNKNOWN_ERROR;
776 }
777 if (!addTagAttribute(vers, RESOURCES_ANDROID_NAMESPACE, "maxSdkVersion",
778 bundle->getMaxSdkVersion(), errorOnFailedInsert)) {
779 return UNKNOWN_ERROR;
780 }
781 }
782
783 if (bundle->getDebugMode()) {
784 sp<XMLNode> application = root->getChildElement(String16(), String16("application"));
785 if (application != NULL) {
786 if (!addTagAttribute(application, RESOURCES_ANDROID_NAMESPACE, "debuggable", "true",
787 errorOnFailedInsert)) {
788 return UNKNOWN_ERROR;
789 }
790 }
791 }
792
793 // Deal with manifest package name overrides
794 const char* manifestPackageNameOverride = bundle->getManifestPackageNameOverride();
795 if (manifestPackageNameOverride != NULL) {
796 // Update the actual package name
797 XMLNode::attribute_entry* attr = root->editAttribute(String16(), String16("package"));
798 if (attr == NULL) {

Callers 1

buildResourcesFunction · 0.85

Calls 15

addTagAttributeFunction · 0.85
fullyQualifyClassNameFunction · 0.85
searchElementMethod · 0.80
getVersionCodeMethod · 0.80
getMinSdkVersionMethod · 0.80
getTargetSdkVersionMethod · 0.80
getMaxSdkVersionMethod · 0.80
getChildElementMethod · 0.80
insertChildAtMethod · 0.80
getDebugModeMethod · 0.80

Tested by

no test coverage detected