X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/a539f228b523c712fb9e61d4e5e4799a185b64ff..54f200b09c1a7a5e0ea5fe5d8f0601002b6040c9:/Resource.cpp diff --git a/Resource.cpp b/Resource.cpp index 9c5fcda..0a4f24f 100644 --- a/Resource.cpp +++ b/Resource.cpp @@ -835,7 +835,9 @@ status_t buildResources(Bundle* bundle, const sp& assets) bool hasErrors = false; if (drawables != NULL) { - err = preProcessImages(bundle, assets, drawables); + if (bundle->getOutputAPKFile() != NULL) { + err = preProcessImages(bundle, assets, drawables); + } if (err == NO_ERROR) { err = makeFileResources(bundle, assets, &table, drawables, "drawable"); if (err != NO_ERROR) { @@ -1653,7 +1655,8 @@ static status_t writeLayoutClasses( static status_t writeSymbolClass( FILE* fp, const sp& assets, bool includePrivate, - const sp& symbols, const String8& className, int indent) + const sp& symbols, const String8& className, int indent, + bool nonConstantId) { fprintf(fp, "%spublic %sfinal class %s {\n", getIndentSpace(indent), @@ -1663,6 +1666,10 @@ static status_t writeSymbolClass( size_t i; status_t err = NO_ERROR; + const char * id_format = nonConstantId ? + "%spublic static int %s=0x%08x;\n" : + "%spublic static final int %s=0x%08x;\n"; + size_t N = symbols->getSymbols().size(); for (i=0; igetSymbols().valueAt(i); @@ -1715,7 +1722,7 @@ static status_t writeSymbolClass( if (deprecated) { fprintf(fp, "%s@Deprecated\n", getIndentSpace(indent)); } - fprintf(fp, "%spublic static final int %s=0x%08x;\n", + fprintf(fp, id_format, getIndentSpace(indent), String8(name).string(), (int)sym.int32Val); } @@ -1766,7 +1773,7 @@ static status_t writeSymbolClass( if (nclassName == "styleable") { styleableSymbols = nsymbols; } else { - err = writeSymbolClass(fp, assets, includePrivate, nsymbols, nclassName, indent); + err = writeSymbolClass(fp, assets, includePrivate, nsymbols, nclassName, indent, nonConstantId); } if (err != NO_ERROR) { return err; @@ -1837,7 +1844,7 @@ status_t writeResourceSymbols(Bundle* bundle, const sp& assets, "\n" "package %s;\n\n", package.string()); - status_t err = writeSymbolClass(fp, assets, includePrivate, symbols, className, 0); + status_t err = writeSymbolClass(fp, assets, includePrivate, symbols, className, 0, bundle->getNonConstantId()); if (err != NO_ERROR) { return err; }