diff options
Diffstat (limited to 'tools/aapt/Resource.cpp')
-rw-r--r-- | tools/aapt/Resource.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 5d20815..c636c28 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -221,6 +221,24 @@ bool isValidResourceType(const String8& type) || type == "color" || type == "menu" || type == "mipmap"; } +sp<AaptFile> getResourceFile(const sp<AaptAssets>& assets, bool makeIfNecessary) +{ + sp<AaptGroup> group = assets->getFiles().valueFor(String8("resources.arsc")); + sp<AaptFile> file; + if (group != NULL) { + file = group->getFiles().valueFor(AaptGroupEntry()); + if (file != NULL) { + return file; + } + } + + if (!makeIfNecessary) { + return NULL; + } + return assets->addFile(String8("resources.arsc"), AaptGroupEntry(), String8(), + NULL, String8()); +} + static status_t parsePackage(Bundle* bundle, const sp<AaptAssets>& assets, const sp<AaptGroup>& grp) { @@ -1170,7 +1188,9 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil packageType = ResourceTable::AppFeature; } - ResourceTable table(bundle, String16(assets->getPackage()), packageType); + int extendedPackageId = bundle->getExtendedPackageId(); + + ResourceTable table(bundle, String16(assets->getPackage()), packageType, extendedPackageId); err = table.addIncludedResources(bundle, assets); if (err != NO_ERROR) { return err; @@ -1252,7 +1272,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil bool hasErrors = false; if (drawables != NULL) { - if (bundle->getOutputAPKFile() != NULL) { + if (bundle->getOutputAPKFile() != NULL || bundle->getOutputResApk()) { err = preProcessImages(bundle, assets, drawables, "drawable"); } if (err == NO_ERROR) { |