X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/d474f7cf432f15982f36835ca8023935e2872d40..6847fbceadc542f882adec4b3a04b760d204a179:/AaptAssets.cpp diff --git a/AaptAssets.cpp b/AaptAssets.cpp index dbcef6d..c346b90 100644 --- a/AaptAssets.cpp +++ b/AaptAssets.cpp @@ -55,6 +55,7 @@ static bool validateFileName(const char* fileName) static bool isHidden(const char *root, const char *path) { + const char *ext = NULL; const char *type = NULL; // Skip all hidden files. @@ -83,6 +84,9 @@ static bool isHidden(const char *root, const char *path) } else if (path[strlen(path)-1] == '~') { // Skip suspected emacs backup files. type = "backup"; + } else if ((ext = strrchr(path, '.')) != NULL && strcmp(ext, ".scc") == 0) { + // Skip VisualSourceSafe files and don't chatter about it + return true; } else { // Let everything else through. return false; @@ -187,6 +191,13 @@ AaptGroupEntry::parseNamePart(const String8& part, int* axis, uint32_t* value) return 0; } + // navigation hidden + if (getNavHiddenName(part.string(), &config)) { + *axis = AXIS_NAVHIDDEN; + *value = config.inputFlags; + return 0; + } + // navigation if (getNavigationName(part.string(), &config)) { *axis = AXIS_NAVIGATION; @@ -217,7 +228,7 @@ AaptGroupEntry::initFromDirName(const char* dir, String8* resType) Vector parts; String8 mcc, mnc, loc, layoutsize, layoutlong, orient, den; - String8 touch, key, keysHidden, nav, size, vers; + String8 touch, key, keysHidden, nav, navHidden, size, vers; const char *p = dir; const char *q; @@ -393,6 +404,19 @@ AaptGroupEntry::initFromDirName(const char* dir, String8* resType) //printf("not keyboard: %s\n", part.string()); } + // navigation hidden + if (getNavHiddenName(part.string())) { + navHidden = part; + + index++; + if (index == N) { + goto success; + } + part = parts[index]; + } else { + //printf("not navHidden: %s\n", part.string()); + } + if (getNavigationName(part.string())) { nav = part; @@ -443,6 +467,7 @@ success: this->touchscreen = touch; this->keysHidden = keysHidden; this->keyboard = key; + this->navHidden = navHidden; this->navigation = nav; this->screenSize = size; this->version = vers; @@ -476,6 +501,8 @@ AaptGroupEntry::toString() const s += ","; s += keyboard; s += ","; + s += navHidden; + s += ","; s += navigation; s += ","; s += screenSize; @@ -528,6 +555,10 @@ AaptGroupEntry::toDirName(const String8& resType) const s += "-"; s += keyboard; } + if (this->navHidden != "") { + s += "-"; + s += navHidden; + } if (this->navigation != "") { s += "-"; s += navigation; @@ -852,6 +883,30 @@ bool AaptGroupEntry::getKeyboardName(const char* name, return false; } +bool AaptGroupEntry::getNavHiddenName(const char* name, + ResTable_config* out) +{ + uint8_t mask = 0; + uint8_t value = 0; + if (strcmp(name, kWildcardName) == 0) { + mask = out->MASK_NAVHIDDEN; + value = out->NAVHIDDEN_ANY; + } else if (strcmp(name, "navexposed") == 0) { + mask = out->MASK_NAVHIDDEN; + value = out->NAVHIDDEN_NO; + } else if (strcmp(name, "navhidden") == 0) { + mask = out->MASK_NAVHIDDEN; + value = out->NAVHIDDEN_YES; + } + + if (mask != 0) { + if (out) out->inputFlags = (out->inputFlags&~mask) | value; + return true; + } + + return false; +} + bool AaptGroupEntry::getNavigationName(const char* name, ResTable_config* out) { @@ -953,6 +1008,7 @@ int AaptGroupEntry::compare(const AaptGroupEntry& o) const if (v == 0) v = touchscreen.compare(o.touchscreen); if (v == 0) v = keysHidden.compare(o.keysHidden); if (v == 0) v = keyboard.compare(o.keyboard); + if (v == 0) v = navHidden.compare(o.navHidden); if (v == 0) v = navigation.compare(o.navigation); if (v == 0) v = screenSize.compare(o.screenSize); if (v == 0) v = version.compare(o.version); @@ -973,6 +1029,7 @@ ResTable_config AaptGroupEntry::toParams() const getTouchscreenName(touchscreen.string(), ¶ms); getKeysHiddenName(keysHidden.string(), ¶ms); getKeyboardName(keyboard.string(), ¶ms); + getNavHiddenName(navHidden.string(), ¶ms); getNavigationName(navigation.string(), ¶ms); getScreenSizeName(screenSize.string(), ¶ms); getVersionName(version.string(), ¶ms); @@ -1819,6 +1876,19 @@ void AaptAssets::print() const AaptDir::print(); } +sp AaptAssets::resDir(const String8& name) +{ + const Vector >& dirs = mDirs; + const size_t N = dirs.size(); + for (size_t i=0; i& d = dirs.itemAt(i); + if (d->getLeaf() == name) { + return d; + } + } + return NULL; +} + bool valid_symbol_name(const String8& symbol) {