]> git.saurik.com Git - android/aapt.git/commitdiff
Merge "Change an aapt "warning" from "*** " to "**** " (from three to four stars...
authorEd Heyl <edheyl@google.com>
Fri, 5 Mar 2010 19:59:58 +0000 (11:59 -0800)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Fri, 5 Mar 2010 19:59:58 +0000 (11:59 -0800)
AaptAssets.cpp
Resource.cpp

index 6e7a66da75ba69099591cf6f2262d92c84ff8db4..fc655a7abbb7e966d537fe1c56e9fe10d7146943 100644 (file)
@@ -820,7 +820,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 =
index ea021d82e4dad003b4675662fa32d56729e3fa02..b7580b33c723122ce3c4b8a80d29ad5c83ed430a 100644 (file)
@@ -447,7 +447,7 @@ static void checkForIds(const String8& path, ResXMLParser& parser)
 
 static bool applyFileOverlay(Bundle *bundle,
                              const sp<AaptAssets>& assets,
-                             const sp<ResourceTypeSet>& baseSet,
+                             sp<ResourceTypeSet> *baseSet,
                              const char *resType)
 {
     if (bundle->getVerbose()) {
@@ -475,13 +475,16 @@ static bool applyFileOverlay(Bundle *bundle,
                 if (bundle->getVerbose()) {
                     printf("trying overlaySet Key=%s\n",overlaySet->keyAt(overlayIndex).string());
                 }
-                size_t baseIndex = baseSet->indexOfKey(overlaySet->keyAt(overlayIndex));
+                size_t baseIndex = UNKNOWN_ERROR;
+                if (baseSet->get() != NULL) {
+                    baseIndex = (*baseSet)->indexOfKey(overlaySet->keyAt(overlayIndex));
+                }
                 if (baseIndex < UNKNOWN_ERROR) {
                     // look for same flavor.  For a given file (strings.xml, for example)
                     // there may be a locale specific or other flavors - we want to match
                     // the same flavor.
                     sp<AaptGroup> overlayGroup = overlaySet->valueAt(overlayIndex);
-                    sp<AaptGroup> baseGroup = baseSet->valueAt(baseIndex);
+                    sp<AaptGroup> baseGroup = (*baseSet)->valueAt(baseIndex);
 
                     DefaultKeyedVector<AaptGroupEntry, sp<AaptFile> > overlayFiles =
                             overlayGroup->getFiles();
@@ -520,8 +523,12 @@ static bool applyFileOverlay(Bundle *bundle,
                         assets->addGroupEntry(overlayFiles.keyAt(overlayGroupIndex));
                     }
                 } else {
+                    if (baseSet->get() == NULL) {
+                        *baseSet = new ResourceTypeSet();
+                        assets->getResources()->add(String8(resType), *baseSet);
+                    }
                     // this group doesn't exist (a file that's only in the overlay)
-                    baseSet->add(overlaySet->keyAt(overlayIndex),
+                    (*baseSet)->add(overlaySet->keyAt(overlayIndex),
                             overlaySet->valueAt(overlayIndex));
                     // make sure all flavors are defined in the resources.
                     sp<AaptGroup> overlayGroup = overlaySet->valueAt(overlayIndex);
@@ -751,13 +758,13 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
         current = current->getOverlay();
     }
     // apply the overlay files to the base set
-    if (!applyFileOverlay(bundle, assets, drawables, "drawable") ||
-            !applyFileOverlay(bundle, assets, layouts, "layout") ||
-            !applyFileOverlay(bundle, assets, anims, "anim") ||
-            !applyFileOverlay(bundle, assets, xmls, "xml") ||
-            !applyFileOverlay(bundle, assets, raws, "raw") ||
-            !applyFileOverlay(bundle, assets, colors, "color") ||
-            !applyFileOverlay(bundle, assets, menus, "menu")) {
+    if (!applyFileOverlay(bundle, assets, &drawables, "drawable") ||
+            !applyFileOverlay(bundle, assets, &layouts, "layout") ||
+            !applyFileOverlay(bundle, assets, &anims, "anim") ||
+            !applyFileOverlay(bundle, assets, &xmls, "xml") ||
+            !applyFileOverlay(bundle, assets, &raws, "raw") ||
+            !applyFileOverlay(bundle, assets, &colors, "color") ||
+            !applyFileOverlay(bundle, assets, &menus, "menu")) {
         return UNKNOWN_ERROR;
     }