]> git.saurik.com Git - android/aapt.git/blobdiff - Resource.cpp
Fix minSdkVersion scanning to not throw warnings
[android/aapt.git] / Resource.cpp
index c0ebb5963328e0013c7f4edf33810410ace10e4c..87f242047a733e541058884e05bc971675c0d4cb 100644 (file)
@@ -226,7 +226,7 @@ static status_t parsePackage(Bundle* bundle, const sp<AaptAssets>& assets,
                 if (minSdkIndex >= 0) {
                     const uint16_t* minSdk16 = block.getAttributeStringValue(minSdkIndex, &len);
                     const char* minSdk8 = strdup(String8(minSdk16).string());
-                    bundle->setMinSdkVersion(minSdk8);
+                    bundle->setManifestMinSdkVersion(minSdk8);
                 }
             }
         }
@@ -768,7 +768,13 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
 
     // Standard flags for compiled XML and optional UTF-8 encoding
     int xmlFlags = XML_COMPILE_STANDARD_RESOURCE;
-    if (bundle->getUTF8()) {
+
+    /* Only enable UTF-8 if the caller of aapt didn't specifically
+     * request UTF-16 encoding and the parameters of this package
+     * allow UTF-8 to be used.
+     */
+    if (!bundle->getWantUTF16()
+            && bundle->isUTF8Available()) {
         xmlFlags |= XML_COMPILE_UTF8;
     }