X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/3c80e5c0dc993f14ed11bca00e023ce8c073a7f4..1423619ab908d03f8fcff4d4dd8ee359c4f2dddf:/Package.cpp?ds=inline diff --git a/Package.cpp b/Package.cpp index 0df4606..999a5cf 100644 --- a/Package.cpp +++ b/Package.cpp @@ -5,9 +5,12 @@ // #include "Main.h" #include "AaptAssets.h" +#include "ResourceTable.h" -#include <utils.h> -#include <utils/ZipFile.h> +#include <utils/Log.h> +#include <utils/threads.h> +#include <utils/List.h> +#include <utils/Errors.h> #include <sys/types.h> #include <dirent.h> @@ -22,7 +25,7 @@ static const char* kExcludeExtension = ".EXCLUDE"; static const char* kNoCompressExt[] = { ".jpg", ".jpeg", ".png", ".gif", ".wav", ".mp2", ".mp3", ".ogg", ".aac", - ".mpg", ".mpeg", ".mid", ".midi", ".smf", + ".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet", ".rtttl", ".imy", ".xmf", ".mp4", ".m4a", ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2", ".amr", ".awb", ".wma", ".wmv" @@ -165,7 +168,7 @@ status_t writeAPK(Bundle* bundle, const sp<AaptAssets>& assets, delete zip; // close the file so we can remove it in Win32 zip = NULL; if (unlink(outputFile.string()) != 0) { - fprintf(stderr, "WARNING: could not unlink '%s'\n", outputFile.string()); + fprintf(stderr, "warning: could not unlink '%s'\n", outputFile.string()); } } @@ -178,7 +181,7 @@ bail: printf("Removing %s due to earlier failures\n", outputFile.string()); } if (unlink(outputFile.string()) != 0) { - fprintf(stderr, "WARNING: could not unlink '%s'\n", outputFile.string()); + fprintf(stderr, "warning: could not unlink '%s'\n", outputFile.string()); } } @@ -190,11 +193,20 @@ bail: ssize_t processAssets(Bundle* bundle, ZipFile* zip, const sp<AaptAssets>& assets) { + ResourceFilter filter; + status_t status = filter.parse(bundle->getConfigurations()); + if (status != NO_ERROR) { + return -1; + } + ssize_t count = 0; const size_t N = assets->getGroupEntries().size(); for (size_t i=0; i<N; i++) { const AaptGroupEntry& ge = assets->getGroupEntries()[i]; + if (!filter.match(ge.toParams())) { + continue; + } ssize_t res = processAssets(bundle, zip, assets, ge); if (res < 0) { return res; @@ -271,7 +283,7 @@ bool processFile(Bundle* bundle, ZipFile* zip, if (fileNameLen > excludeExtensionLen && (0 == strcmp(storageName.string() + (fileNameLen - excludeExtensionLen), kExcludeExtension))) { - fprintf(stderr, "WARNING: '%s' not added to Zip\n", storageName.string()); + fprintf(stderr, "warning: '%s' not added to Zip\n", storageName.string()); return true; }