summaryrefslogtreecommitdiffstats
path: root/tools/aapt/ResourceTable.cpp
diff options
context:
space:
mode:
authorJosh Stone <cuviper@gmail.com>2011-01-17 18:34:11 -0800
committerDianne Hackborn <hackbod@google.com>2011-01-23 16:00:36 -0800
commit02feeb4b2bb6515491cf3dd7ae2b204caac81bae (patch)
treea9da1ef9057f38d262425ba2a8b83164c25d156b /tools/aapt/ResourceTable.cpp
parent9d97b63d0e0c7c9deb2d140c1dd579b51f52c1af (diff)
downloadframeworks_base-02feeb4b2bb6515491cf3dd7ae2b204caac81bae.zip
frameworks_base-02feeb4b2bb6515491cf3dd7ae2b204caac81bae.tar.gz
frameworks_base-02feeb4b2bb6515491cf3dd7ae2b204caac81bae.tar.bz2
aapt: Allow raw "%" in unformatted string-arrays
Commit 15fe2cb added format checking for translatable strings, enforcing the use of positional args. This check can be disabled on <string> values with translatable="false" or formatted="false". But they didn't check for those attributes on <string-array>, so some of CM's strings fail when they're not really format strings, just because they contain percent signs. (e.g. brightness widget's "Auto/Dim/40%/100%") So now the formatted/translatable attributes are checked in string-array too, and we can restore our proper percent signs. Change-Id: I3478ab7e0b939e61fe0cec20201ac55096264080
Diffstat (limited to 'tools/aapt/ResourceTable.cpp')
-rw-r--r--tools/aapt/ResourceTable.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 196b06c..5339566 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -1322,6 +1322,22 @@ status_t compileResourceFile(Bundle* bundle,
}
}
} else if (strcmp16(block.getElementName(&len), string_array16.string()) == 0) {
+ // Check whether these strings need valid formats.
+ // (simplified form of what string16 does above)
+ size_t n = block.getAttributeCount();
+ for (size_t i = 0; i < n; i++) {
+ size_t length;
+ const uint16_t* attr = block.getAttributeName(i, &length);
+ if (strcmp16(attr, translatable16.string()) == 0
+ || strcmp16(attr, formatted16.string()) == 0) {
+ const uint16_t* value = block.getAttributeStringValue(i, &length);
+ if (strcmp16(value, false16.string()) == 0) {
+ curIsFormatted = false;
+ break;
+ }
+ }
+ }
+
curTag = &string_array16;
curType = array16;
curFormat = ResTable_map::TYPE_REFERENCE|ResTable_map::TYPE_STRING;