X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/8be9f9e93371403dc056f1b13f8b93ff3863eaad..3b8c05ce0707be71abb209f7dbae564088426d87:/AaptAssets.cpp diff --git a/AaptAssets.cpp b/AaptAssets.cpp index 7d735ad..46b8a27 100644 --- a/AaptAssets.cpp +++ b/AaptAssets.cpp @@ -58,7 +58,7 @@ static bool validateFileName(const char* fileName) // The default to use if no other ignore pattern is defined. const char * const gDefaultIgnoreAssets = - "!.svn:!.git:.*:_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"; + "!.svn:!.git:!.ds_store:!*.scc:.*:_*:!CVS:!thumbs.db:!picasa.ini:!*~"; // The ignore pattern that can be passed via --ignore-assets in Main.cpp const char * gUserIgnoreAssets = NULL; @@ -1057,6 +1057,11 @@ bool AaptGroupEntry::getUiModeTypeName(const char* name, (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE) | ResTable_config::UI_MODE_TYPE_TELEVISION; return true; + } else if (strcmp(name, "appliance") == 0) { + if (out) out->uiMode = + (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE) + | ResTable_config::UI_MODE_TYPE_APPLIANCE; + return true; } return false; @@ -1117,12 +1122,17 @@ bool AaptGroupEntry::getDensityName(const char* name, if (out) out->density = ResTable_config::DENSITY_HIGH; return true; } - + if (strcmp(name, "xhdpi") == 0) { - if (out) out->density = ResTable_config::DENSITY_MEDIUM*2; + if (out) out->density = ResTable_config::DENSITY_XHIGH; return true; } - + + if (strcmp(name, "xxhdpi") == 0) { + if (out) out->density = ResTable_config::DENSITY_XXHIGH; + return true; + } + char* c = (char*)name; while (*c >= '0' && *c <= '9') { c++; @@ -1865,6 +1875,49 @@ String8 AaptDir::getPrintableSource() const // ========================================================================= // ========================================================================= +status_t AaptSymbols::applyJavaSymbols(const sp& javaSymbols) +{ + status_t err = NO_ERROR; + size_t N = javaSymbols->mSymbols.size(); + for (size_t i=0; imSymbols.keyAt(i); + const AaptSymbolEntry& entry = javaSymbols->mSymbols.valueAt(i); + ssize_t pos = mSymbols.indexOfKey(name); + if (pos < 0) { + entry.sourcePos.error("Symbol '%s' declared with not defined\n", name.string()); + err = UNKNOWN_ERROR; + continue; + } + //printf("**** setting symbol #%d/%d %s to isJavaSymbol=%d\n", + // i, N, name.string(), entry.isJavaSymbol ? 1 : 0); + mSymbols.editValueAt(pos).isJavaSymbol = entry.isJavaSymbol; + } + + N = javaSymbols->mNestedSymbols.size(); + for (size_t i=0; imNestedSymbols.keyAt(i); + const sp& symbols = javaSymbols->mNestedSymbols.valueAt(i); + ssize_t pos = mNestedSymbols.indexOfKey(name); + if (pos < 0) { + SourcePos pos; + pos.error("Java symbol dir %s not defined\n", name.string()); + err = UNKNOWN_ERROR; + continue; + } + //printf("**** applying java symbols in dir %s\n", name.string()); + status_t myerr = mNestedSymbols.valueAt(pos)->applyJavaSymbols(symbols); + if (myerr != NO_ERROR) { + err = myerr; + } + } + + return err; +} + +// ========================================================================= +// ========================================================================= +// ========================================================================= + AaptAssets::AaptAssets() : AaptDir(String8(), String8()), mChanged(false), mHaveIncludedAssets(false), mRes(NULL) @@ -2432,6 +2485,48 @@ sp AaptAssets::getSymbolsFor(const String8& name) return sym; } +sp AaptAssets::getJavaSymbolsFor(const String8& name) +{ + sp sym = mJavaSymbols.valueFor(name); + if (sym == NULL) { + sym = new AaptSymbols(); + mJavaSymbols.add(name, sym); + } + return sym; +} + +status_t AaptAssets::applyJavaSymbols() +{ + size_t N = mJavaSymbols.size(); + for (size_t i=0; i& symbols = mJavaSymbols.valueAt(i); + ssize_t pos = mSymbols.indexOfKey(name); + if (pos < 0) { + SourcePos pos; + pos.error("Java symbol dir %s not defined\n", name.string()); + return UNKNOWN_ERROR; + } + //printf("**** applying java symbols in dir %s\n", name.string()); + status_t err = mSymbols.valueAt(pos)->applyJavaSymbols(symbols); + if (err != NO_ERROR) { + return err; + } + } + + return NO_ERROR; +} + +bool AaptAssets::isJavaSymbol(const AaptSymbolEntry& sym, bool includePrivate) const { + //printf("isJavaSymbol %s: public=%d, includePrivate=%d, isJavaSymbol=%d\n", + // sym.name.string(), sym.isPublic ? 1 : 0, includePrivate ? 1 : 0, + // sym.isJavaSymbol ? 1 : 0); + if (!mHavePrivateSymbols) return true; + if (sym.isPublic) return true; + if (includePrivate && sym.isJavaSymbol) return true; + return false; +} + status_t AaptAssets::buildIncludedResources(Bundle* bundle) { if (!mHaveIncludedAssets) {