]> git.saurik.com Git - android/aapt.git/blobdiff - AaptAssets.cpp
Implement issue #3116702: New manifest tags for supported screen sizes
[android/aapt.git] / AaptAssets.cpp
index 6e7a66da75ba69099591cf6f2262d92c84ff8db4..e4f447e72642670b38a82fd883f78ba9211a0482 100644 (file)
@@ -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++;
@@ -1815,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) {