diff options
author | Adam Lesinski <adamlesinski@google.com> | 2015-10-28 15:44:27 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2015-11-24 15:38:40 -0800 |
commit | 9d0f7d44d5cc5322415f52f7ce03cc37a478b350 (patch) | |
tree | 1882cbfd2f9867e865444c95da0d79028d79ae60 /tools/aapt/Resource.cpp | |
parent | 1cffc196610891f6669c33404f3ff5b0232b7059 (diff) |
Implement AAPT Bundle format
AAPT will scan XML files looking for the <aapt:attr> XML tag.
<!-- @layout/bundle.xml -->
<ImageView xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:src">
<vector android:pathData="..." ...>
</vector>
</aapt:attr>
</ImageView>
The SINGLE child element of the <aapt:attr> tag is extracted into its own top
level resource. It is given a generated name.
The parent element of <aapt:attr> is then given the resource attribute that was assigned
to the `name' attribute. The value is set to a reference to the generated resource.
<!-- @layout/bundle.xml -->
<ImageView android:src="@drawable/bundle_1.xml">
</ImageView>
<!-- @layout/bundle_1.xml -->
<vector android:pathData="..." ...>
</vector>
Bug:22627686
Change-Id: I31bc96aae30d38bfd0b16508d0f585de5fd88a07
Diffstat (limited to 'tools/aapt/Resource.cpp')
-rw-r--r-- | tools/aapt/Resource.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index e22e76de66c2..f1a8f1c5f170 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -1537,7 +1537,14 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil std::queue<CompileResourceWorkItem>& workQueue = table.getWorkQueue(); while (!workQueue.empty()) { CompileResourceWorkItem& workItem = workQueue.front(); - err = compileXmlFile(bundle, assets, workItem.resourceName, workItem.file, &table, xmlFlags); + if (workItem.xmlRoot != NULL) { + err = compileXmlFile(bundle, assets, workItem.resourceName, workItem.xmlRoot, + workItem.file, &table, xmlFlags); + } else { + err = compileXmlFile(bundle, assets, workItem.resourceName, workItem.file, + &table, xmlFlags); + } + if (err == NO_ERROR) { assets->addResource(workItem.resPath.getPathLeaf(), workItem.resPath, |