diff options
author | 2017-03-21 03:53:43 +0000 | |
---|---|---|
committer | 2017-03-21 03:53:43 +0000 | |
commit | 8c2df71739808d6f1aec4277fb47c191e7031164 (patch) | |
tree | fcd72bd33919422f7c4810c2f71731f76d238806 | |
parent | c7614e5d1e8f9139cccf6ab9b78dda16b98f7656 (diff) |
Revert "AAPT: Version <adaptive-icon> to v26"
Bug: 36462965
Bug: 35908647
This reverts commit c7614e5d1e8f9139cccf6ab9b78dda16b98f7656.
Change-Id: I25279e7c53823dad0703c7e2ea8ff91bdbc1a0f2
-rw-r--r-- | tools/aapt/AaptAssets.cpp | 1 | ||||
-rw-r--r-- | tools/aapt/Command.cpp | 13 | ||||
-rw-r--r-- | tools/aapt/Resource.cpp | 7 | ||||
-rw-r--r-- | tools/aapt/ResourceTable.cpp | 78 | ||||
-rw-r--r-- | tools/aapt/ResourceTable.h | 7 |
5 files changed, 7 insertions, 99 deletions
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp index 13ae24b7d29e..3c3edda85e4f 100644 --- a/tools/aapt/AaptAssets.cpp +++ b/tools/aapt/AaptAssets.cpp @@ -964,6 +964,7 @@ void AaptAssets::addResource(const String8& leafName, const String8& path, subdir->addFile(leafName, grr); } + ssize_t AaptAssets::slurpFromArgs(Bundle* bundle) { int count; diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index fdcc7aa03775..15648bdd1b3b 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -2501,21 +2501,14 @@ static status_t addResourcesToBuilder(const sp<AaptDir>& dir, const sp<ApkBuilde const size_t numConfigs = gp->getFiles().size(); for (size_t j = 0; j < numConfigs; j++) { status_t err = NO_ERROR; - const sp<AaptFile>& file = gp->getFiles().valueAt(j); - if (!file->hasData()) { - // Empty files do not get written. - continue; - } - if (ignoreConfig) { - err = builder->getBaseSplit()->addEntry(gp->getPath(), file); + err = builder->getBaseSplit()->addEntry(gp->getPath(), gp->getFiles().valueAt(j)); } else { - err = builder->addEntry(gp->getPath(), file); + err = builder->addEntry(gp->getPath(), gp->getFiles().valueAt(j)); } - if (err != NO_ERROR) { fprintf(stderr, "Failed to add %s (%s) to builder.\n", - gp->getPath().string(), file->getPrintableSource().string()); + gp->getPath().string(), gp->getFiles()[j]->getPrintableSource().string()); return err; } } diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 2bf52066b618..3330b1a78c1e 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -1403,8 +1403,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil String8 src = it.getFile()->getPrintableSource(); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); - // Only verify IDs if there was no error and the file is non-empty. - if (err == NO_ERROR && it.getFile()->hasData()) { + if (err == NO_ERROR) { ResXMLTree block; block.setTo(it.getFile()->getData(), it.getFile()->getSize(), true); checkForIds(src, block); @@ -1551,7 +1550,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil String8 src = it.getFile()->getPrintableSource(); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); - if (err == NO_ERROR && it.getFile()->hasData()) { + if (err == NO_ERROR) { ResXMLTree block; block.setTo(it.getFile()->getData(), it.getFile()->getSize(), true); checkForIds(src, block); @@ -1599,7 +1598,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil err = compileXmlFile(bundle, assets, workItem.resourceName, workItem.xmlRoot, workItem.file, &table, xmlCompilationFlags); - if (err == NO_ERROR && workItem.file->hasData()) { + if (err == NO_ERROR) { assets->addResource(workItem.resPath.getPathLeaf(), workItem.resPath, workItem.file, diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp index 619ae6228318..60f0d56e09bf 100644 --- a/tools/aapt/ResourceTable.cpp +++ b/tools/aapt/ResourceTable.cpp @@ -78,13 +78,6 @@ status_t compileXmlFile(const Bundle* bundle, ResourceTable* table, int options) { - if (table->versionForCompat(bundle, resourceName, target, root)) { - // The file was versioned, so stop processing here. - // The resource entry has already been removed and the new one added. - // The `target` file will be empty, but empty files do not get written to the APK. - return NO_ERROR; - } - if ((options&XML_COMPILE_STRIP_WHITESPACE) != 0) { root->removeWhitespace(true, NULL); } else if ((options&XML_COMPILE_COMPACT_WHITESPACE) != 0) { @@ -4765,77 +4758,6 @@ static bool IsTransitionElement(const String16& name) { return false; } -bool ResourceTable::versionForCompat(const Bundle* bundle, const String16& resourceName, - const sp<AaptFile>& target, const sp<XMLNode>& root) { - XMLNode* node = root.get(); - while (node->getType() != XMLNode::TYPE_ELEMENT) { - // We're assuming the root element is what we're looking for, which can only be under a - // bunch of namespace declarations. - if (node->getChildren().size() != 1) { - // Not sure what to do, bail. - return false; - } - node = node->getChildren().itemAt(0).get(); - } - - if (node->getElementNamespace().size() != 0) { - // Not something we care about. - return false; - } - - int versionedSdk = 0; - if (node->getElementName() == String16("adaptive-icon")) { - versionedSdk = SDK_O; - } - - const int minSdkVersion = getMinSdkVersion(bundle); - const ConfigDescription config(target->getGroupEntry().toParams()); - if (versionedSdk <= minSdkVersion || versionedSdk <= config.sdkVersion) { - return false; - } - - sp<ConfigList> cl = getConfigList(String16(mAssets->getPackage()), - String16(target->getResourceType()), resourceName); - if (!shouldGenerateVersionedResource(cl, config, versionedSdk)) { - return false; - } - - // Remove the original entry. - cl->removeEntry(config); - - // We need to wholesale version this file. - ConfigDescription newConfig(config); - newConfig.sdkVersion = versionedSdk; - sp<AaptFile> newFile = new AaptFile(target->getSourceFile(), - AaptGroupEntry(newConfig), target->getResourceType()); - String8 resPath = String8::format("res/%s/%s.xml", - newFile->getGroupEntry().toDirName(target->getResourceType()).string(), - String8(resourceName).string()); - resPath.convertToResPath(); - - // Add a resource table entry. - addEntry(SourcePos(), - String16(mAssets->getPackage()), - String16(target->getResourceType()), - resourceName, - String16(resPath), - NULL, - &newConfig); - - // Schedule this to be compiled. - CompileResourceWorkItem item; - item.resourceName = resourceName; - item.resPath = resPath; - item.file = newFile; - item.xmlRoot = root->clone(); - item.needsCompiling = false; // This step occurs after we parse/assign, so we don't need - // to do it again. - mWorkQueue.push(item); - - // Now mark the old entry as deleted. - return true; -} - status_t ResourceTable::modifyForCompat(const Bundle* bundle, const String16& resourceName, const sp<AaptFile>& target, diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h index aff22d4d1364..cf1e992ec330 100644 --- a/tools/aapt/ResourceTable.h +++ b/tools/aapt/ResourceTable.h @@ -203,9 +203,6 @@ public: size_t numLocalResources() const; bool hasResources() const; - bool versionForCompat(const Bundle* bundle, const String16& resourceName, - const sp<AaptFile>& file, const sp<XMLNode>& root); - status_t modifyForCompat(const Bundle* bundle); status_t modifyForCompat(const Bundle* bundle, const String16& resourceName, @@ -434,10 +431,6 @@ public: mEntries.add(config, entry); } - void removeEntry(const ResTable_config& config) { - mEntries.removeItem(config); - } - const DefaultKeyedVector<ConfigDescription, sp<Entry> >& getEntries() const { return mEntries; } private: const String16 mName; |