X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/2ca01a3759d4a7f39856ff90541b5f267d2c6c13..26bee7e6258deed92e270ab95d7de54cc55edb85:/AaptAssets.cpp diff --git a/AaptAssets.cpp b/AaptAssets.cpp index 663a33a..e4f447e 100644 --- a/AaptAssets.cpp +++ b/AaptAssets.cpp @@ -766,6 +766,11 @@ bool AaptGroupEntry::getScreenLayoutSizeName(const char* name, (out->screenLayout&~ResTable_config::MASK_SCREENSIZE) | ResTable_config::SCREENSIZE_LARGE; return true; + } else if (strcmp(name, "xlarge") == 0) { + if (out) out->screenLayout = + (out->screenLayout&~ResTable_config::MASK_SCREENSIZE) + | ResTable_config::SCREENSIZE_XLARGE; + return true; } return false; @@ -820,7 +825,12 @@ bool AaptGroupEntry::getUiModeTypeName(const char* name, if (strcmp(name, kWildcardName) == 0) { if (out) out->uiMode = (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE) - | ResTable_config::UI_MODE_TYPE_NORMAL; + | ResTable_config::UI_MODE_TYPE_ANY; + return true; + } else if (strcmp(name, "desk") == 0) { + if (out) out->uiMode = + (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE) + | ResTable_config::UI_MODE_TYPE_DESK; return true; } else if (strcmp(name, "car") == 0) { if (out) out->uiMode = @@ -883,6 +893,11 @@ bool AaptGroupEntry::getDensityName(const char* name, return true; } + if (strcmp(name, "xhdpi") == 0) { + if (out) out->density = ResTable_config::DENSITY_MEDIUM*2; + return true; + } + char* c = (char*)name; while (*c >= '0' && *c <= '9') { c++; @@ -938,17 +953,17 @@ bool AaptGroupEntry::getKeysHiddenName(const char* name, uint8_t mask = 0; uint8_t value = 0; if (strcmp(name, kWildcardName) == 0) { - mask = out->MASK_KEYSHIDDEN; - value = out->KEYSHIDDEN_ANY; + mask = ResTable_config::MASK_KEYSHIDDEN; + value = ResTable_config::KEYSHIDDEN_ANY; } else if (strcmp(name, "keysexposed") == 0) { - mask = out->MASK_KEYSHIDDEN; - value = out->KEYSHIDDEN_NO; + mask = ResTable_config::MASK_KEYSHIDDEN; + value = ResTable_config::KEYSHIDDEN_NO; } else if (strcmp(name, "keyshidden") == 0) { - mask = out->MASK_KEYSHIDDEN; - value = out->KEYSHIDDEN_YES; + mask = ResTable_config::MASK_KEYSHIDDEN; + value = ResTable_config::KEYSHIDDEN_YES; } else if (strcmp(name, "keyssoft") == 0) { - mask = out->MASK_KEYSHIDDEN; - value = out->KEYSHIDDEN_SOFT; + mask = ResTable_config::MASK_KEYSHIDDEN; + value = ResTable_config::KEYSHIDDEN_SOFT; } if (mask != 0) { @@ -985,14 +1000,14 @@ bool AaptGroupEntry::getNavHiddenName(const char* name, uint8_t mask = 0; uint8_t value = 0; if (strcmp(name, kWildcardName) == 0) { - mask = out->MASK_NAVHIDDEN; - value = out->NAVHIDDEN_ANY; + mask = ResTable_config::MASK_NAVHIDDEN; + value = ResTable_config::NAVHIDDEN_ANY; } else if (strcmp(name, "navexposed") == 0) { - mask = out->MASK_NAVHIDDEN; - value = out->NAVHIDDEN_NO; + mask = ResTable_config::MASK_NAVHIDDEN; + value = ResTable_config::NAVHIDDEN_NO; } else if (strcmp(name, "navhidden") == 0) { - mask = out->MASK_NAVHIDDEN; - value = out->NAVHIDDEN_YES; + mask = ResTable_config::MASK_NAVHIDDEN; + value = ResTable_config::NAVHIDDEN_YES; } if (mask != 0) { @@ -1133,6 +1148,26 @@ ResTable_config AaptGroupEntry::toParams() const getNavigationName(navigation.string(), ¶ms); getScreenSizeName(screenSize.string(), ¶ms); getVersionName(version.string(), ¶ms); + + // Fix up version number based on specified parameters. + int minSdk = 0; + if ((params.uiMode&ResTable_config::MASK_UI_MODE_TYPE) + != ResTable_config::UI_MODE_TYPE_ANY + || (params.uiMode&ResTable_config::MASK_UI_MODE_NIGHT) + != ResTable_config::UI_MODE_NIGHT_ANY) { + minSdk = SDK_FROYO; + } else if ((params.screenLayout&ResTable_config::MASK_SCREENSIZE) + != ResTable_config::SCREENSIZE_ANY + || (params.screenLayout&ResTable_config::MASK_SCREENLONG) + != ResTable_config::SCREENLONG_ANY + || params.density != ResTable_config::DENSITY_DEFAULT) { + minSdk = SDK_DONUT; + } + + if (minSdk > params.sdkVersion) { + params.sdkVersion = minSdk; + } + return params; } @@ -1795,6 +1830,16 @@ ssize_t AaptAssets::slurpResourceTree(Bundle* bundle, const String8& srcDir) continue; } + if (bundle->getMaxResVersion() != NULL && group.version.length() != 0) { + int maxResInt = atoi(bundle->getMaxResVersion()); + const char *verString = group.version.string(); + int dirVersionInt = atoi(verString + 1); // skip 'v' in version name + if (dirVersionInt > maxResInt) { + fprintf(stderr, "max res %d, skipping %s\n", maxResInt, entry->d_name); + continue; + } + } + FileType type = getFileType(subdirName.string()); if (type == kFileTypeDirectory) {