Merge "Use correct API version for UTF-8 checking"

This commit is contained in:
Kenny Root
2010-03-24 13:20:21 -07:00
committed by Android (Google) Code Review
3 changed files with 7 additions and 6 deletions

View File

@@ -162,10 +162,11 @@ public:
void setPackageCount(int val) { mPackageCount = val; }
#endif
/* UTF-8 is only available on APIs 7 or above or
* SDK levels that have code names.
/* Certain features may only be available on a specific SDK level or
* above. SDK levels that have a non-numeric identifier are assumed
* to be newer than any SDK level that has a number designated.
*/
bool isUTF8Available() {
bool isMinSdkAtLeast(int desired) {
/* If the application specifies a minSdkVersion in the manifest
* then use that. Otherwise, check what the user specified on
* the command line. If neither, it's not available since
@@ -183,7 +184,7 @@ public:
char *end;
int minSdkNum = (int)strtol(minVer, &end, 0);
if (*end == '\0') {
if (minSdkNum < 7) {
if (minSdkNum < desired) {
return false;
}
}

View File

@@ -775,7 +775,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
* allow UTF-8 to be used.
*/
if (!bundle->getWantUTF16()
&& bundle->isUTF8Available()) {
&& bundle->isMinSdkAtLeast(SDK_FROYO)) {
xmlFlags |= XML_COMPILE_UTF8;
}

View File

@@ -2527,7 +2527,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest)
const size_t N = mOrderedPackages.size();
size_t pi;
bool useUTF8 = !bundle->getWantUTF16() && bundle->isUTF8Available();
bool useUTF8 = !bundle->getWantUTF16() && bundle->isMinSdkAtLeast(SDK_FROYO);
// Iterate through all data, collecting all values (strings,
// references, etc).