summaryrefslogtreecommitdiff
path: root/tools/aapt/ResourceTable.cpp
AgeCommit message (Collapse)Author
2012-03-07Fix up getAttributeFlags() functionBen Gruver
In addition to a couple of minor clean-up items, this fixes an issue that can rarely cause incorrect parsing of attribute flag values, when there is a '|' character in the few bytes past the end of the attribute value being parsed. Change-Id: I6050b1c2db60720c7c0ab7df9eba8cfc629b320e
2012-02-17frameworks/base refactoring.Mathias Agopian
step 2: move libutils headers to their new home: androidfw Change-Id: I14624ba23db92a81f2cb929f104386e1fab293ef
2012-02-16Runtime resource overlay: clean-up.Mårten Kongstad
This is a combination of three minor clean-up tasks: - Generate correct idmap even if name lookup fails: Any resources following a resource with a spec but no actual values would receive an incorrect ID in the idmap due to an accumulating offset error. To combat this, a dummy value is inserted in the idmap whenever a resource with a spec but no values is encountered. - Optimize pruning of padding zeroes in idmaps: Earlier, trailing zeroes were iteratively popped from the end of each type block of an idmap. This commit instead tracks where to make the cut, and does so with a single function call. - aapt: warn about resources which lack values: The resource framework assumes every resource to have a value for at least one valid configuration. However, if multiple resource directories are used (several -S options to aapt), the list of configurations is limited by dpi (-c option to aapt) and a resource is only available in discarded dpi configurations, aapt will create a resource entry where each configuration lack an actual value. This commit lets aapt emit a warning whenever this has happened. Change-Id: Ic7451b7f4adfef5bfa6b0d7e64e057f317a2cdaa
2012-02-07Only generate private symbols that are needed.Dianne Hackborn
Change-Id: Icc4c86638db8429a387bf87c934cc712f807e213
2012-02-07Build overlay packages just like regular packages.Mårten Kongstad
Previously, building overlay packages required passing aapt its -o flag. This commit decouples the idmap generation code from the effects of the -o flag. Since this commit renders the -o flag obsolete, support for the flag was removed from aapt as well. Change-Id: Ied2e0ab8cb800e49623f0a2044b06cd4935473d5
2012-01-31aapt now sorts the strings in the resource string pool.Dianne Hackborn
In our current environment with very many translations, this can save a lot of RAM -- for example over 200K in Gmail just by sorting the strings in the Gmail .apk (not the framework). Also add a new aapt command to print the contents of the resource table string pool. Change-Id: I1da037b3e2c377b890833ff57ab158965314ac48
2011-10-16New aapt feature to do smarter filtering of configurations.Dianne Hackborn
This adds a --preferred-configurations flag that specifies the specific configurations you would like to have. It is smarter than "-c" because it will avoid stripping a configuration if that would result in there being no value for the resource. It is dumber than "-c" because it can't process as many kinds of resources. It is really only intended for bitmaps and use with density configs. This required re-arranging AaptAssets to group files together by config again, like they used to be. I think this hasn't broken anything. Hopefully. Change-Id: I4e9d12ff6e6dbd1abb8fd4cb1814c6674b19d0e5
2011-09-27Don't lose product variant strings that also vary between locales.Eric Fischer
Localized strings with product variants were not being included in the APK, apparently because the check to ensure that a different variation of the string had not already been included in the APK was matching the version of it from the default, untranslated configuration. Now check to make sure that the string not only exists but also exists in the correct configuration. Bug 5372711 Change-Id: I52975570b75e0f11827dc6bcf1cb4a987d0541aa
2011-06-10am c6adfed6: am f795e9a8: Okay *now* really enforce the limit on non-public ↵Dianne Hackborn
styles. * commit 'c6adfed6dcea8482e482db58bd396ea8de08426a': Okay *now* really enforce the limit on non-public styles.
2011-06-09am 820caf7b: am 8821ba86: Ummm... f*, stop breaking the build.Dianne Hackborn
* commit '820caf7b04f1e5c83599437e9e783e91322eb4f9': Ummm... f*, stop breaking the build.
2011-06-09Okay *now* really enforce the limit on non-public styles.Dianne Hackborn
Change-Id: Ie8df6acf7cc3dec00f615b2fa9a5122ec79a0aae
2011-06-09Ummm... f*, stop breaking the build.Dianne Hackborn
Change-Id: I6a42cb60e7cebda6d17222e6af1f327889323c40
2011-06-09am a8d7ea06: am 220cd77d: Merge "Enforce public resource restriction on bag ↵Dianne Hackborn
parents." into honeycomb-mr2 * commit 'a8d7ea067cf22baeee2ff0a33e5a8c5a35936942': Enforce public resource restriction on bag parents.
2011-06-09Enforce public resource restriction on bag parents.Dianne Hackborn
Need to put some more styles in the SDK to avoid breaking apps. Also, welcome Android 3.2. Change-Id: Ia31d07c9b1b91ad868d8630437fdc1b5ae24f37d
2011-05-19am c851ea56: am 69cb8757: Add new "-swNNNdp" resource qualifier.Dianne Hackborn
* commit 'c851ea5672f6e042c2e89b2a2ce4a2467e1fcd2a': Add new "-swNNNdp" resource qualifier.
2011-05-19Add new "-swNNNdp" resource qualifier.Dianne Hackborn
Change-Id: I0101e88ca9d8d44138bdcaf571f24b0352f4f6ce
2011-05-13am 46a282f3: am 0ed2e845: Merge "DO NOT MERGE. Integrate add new screen ↵Dianne Hackborn
width/height in "dp" configs." into honeycomb-mr2 * commit '46a282f323bc05606e4fe1eba795bd9ac7c99819': DO NOT MERGE. Integrate add new screen width/height in "dp" configs.
2011-05-12DO NOT MERGE. Integrate add new screen width/height in "dp" configs.Dianne Hackborn
You can now specify resource configuration variants "wNNNdp" and "hNNNdp". These are the minimum screen width/height in "dp" units. This allows you to do things like have your app adjust its layout based only on the about of horizontal space available. This introduces a new configuration change flag for screen size. Note that this configuration change happens each time the orientation changes. Applications often say they handle the orientation change to avoid being restarted at a screen rotation, and this will now cause them to be restarted. To address this, we assume the app can handle this new config change if its target SDK version is < ICS. Change-Id: I4acb73d82677b74092c1da9e4046a4951921f9f4
2011-04-12resolved conflicts for merge of 87b3c0dc to honeycomb-plus-aospKenny Root
Change-Id: Ia1a0024aabf531438203eb9fea3a10dd15eabe53
2011-04-01Runtime resource overlay, iteration 1.Mårten Kongstad
Runtime resource overlay allows unmodified applications to appear as if they had been compiled with additional resources defined. See libs/utils/README for more information. This commit is the first iteration of runtime resource overlay. It provides the actual overlay modifications and loading of trusted overlay packages (ie residing in /vendor) targeting framework-res.apk. This commit loads exactly one overlay package. The overlay, if present, must target framework-res.apk and be located at /vendor/overlay/framework/framework-res.apk. Change-Id: If26ee7754813004a96c043dba37fbe99fa3919db
2011-01-23aapt: Allow raw "%" in unformatted string-arraysJosh Stone
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
2011-01-22aapt: Allow raw "%" in unformatted string-arraysJosh Stone
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
2010-11-22Add knowledge of mipmap to aaptKenny Root
New mipmap drawable type that does not get filtered according to configuration. Useful for things that get built as part of the system. Change-Id: I556033d065e504079271dce79c23c90d3c387ce4
2010-11-06am 3442611e: am 5580e44c: Merge "Support changing style parent in overlays"Jean-Baptiste Queru
* commit '3442611ee11b2987c83054fe3c7ed5521f27f052': Support changing style parent in overlays
2010-11-05am 5580e44c: Merge "Support changing style parent in overlays"Jean-Baptiste Queru
* commit '5580e44c250944f5cd011b2682eea5cc2de9706c': Support changing style parent in overlays
2010-10-04resolved conflicts for merge of 10d5b096 to masterDianne Hackborn
Change-Id: Id5c6ba651f72b48f0d70ee2ca64a6c9adf5e74f7
2010-10-04Add new API to find out whether external storage is removable.Dianne Hackborn
This is implemented based on whether we are using the "nosdcard" product. Needed to tweak aapt to allow use of the product attribute with other resource definition tags besides strings. Change-Id: I49922d23b52a34183a8e2f4d2515adaf1fc9149a
2010-09-23am 9c708358: am 37cedce1: Merge "Add an aapt option to allow string ↵Eric Fischer
variations for different devices." into gingerbread Merge commit '9c70835896b6c078ac4c8b2e30cb6cfba70bb9d7' * commit '9c70835896b6c078ac4c8b2e30cb6cfba70bb9d7': Add an aapt option to allow string variations for different devices.
2010-09-23Add an aapt option to allow string variations for different devices.Eric Fischer
The --product option to aapt is a comma-separated list of characteristics of the device being built for. For example, --product nosdcard,grayscale for a device with no SD card and a grayscale screen. Strings can specify a product="characteristic" option to cause that version of the string to be used only for that type of device. All such strings should also specify, at the end of the block, product="default", which will be used if none of the variations match. For example: <string name="choose" product="bw">Choose black or white</string> <string name="choose" product="grayscale">Choose a shade of gray</string> <string name="choose" product="default">Choose a color</string> The default characteristic will also be used when no --product option is specified. Change-Id: Ie6c1505599e02e15b7818e8be6ec47bc6ce71aaa
2010-08-17Support changing style parent in overlaysMartin Nordholts
Package overlays makes it possible for vendors to tweak the look of the platform and the applications without touching any platform or application code directly. This makes package overlays an important mechanism in the Android build system. There is currently a limitation that forbids changing the parent of a style. If vendors could change the parent of e.g. ‘CalendarTheme’ from Android’s vanilla ‘Theme’ to ‘VendorTheme’, then vendor specific adjustments could be done without changing any code directly. From looking at the code it can be seen that the parent value of a style is stored temporarily in ResourceTable::Entry::mParent while overlays are gone through in buildResources(), and processed (in ResourceTable::Entry::assignResourceIds()) at first after all overlays have been handled, so there aren’t any obvious reasons why changing parent in an overlay should be forbidden. Change-Id: I5969bb8aab90df437e1967fc504cc0da79107d13
2010-06-25Fixes a few minor problems with AAPTSteve Block
- Fixes casting problems with stricter compilers - Adds a couple of missing ifdef guards This is a first step toward being able to generate APKs on the fly on the device. Bug: 2766918 Change-Id: Icaaee5a4032afa313256add321b447443861dd85
2010-06-03Add error checking for translatable stringsKenny Root
Translatable strings that have multiple substitutions should use positional String.format() substitutions. This change makes it an error not to use that format on translatable strings that have more than one substitution in its text. Change-Id: I3a19707f3804aa24e8568dc1653a11576cac5916
2010-03-24Use correct API version for UTF-8 checkingKenny Root
Use the constant for checking the API version in aapt instead of a bare number. Bug: 2541326 Change-Id: Ice7af7b393363a00f1832dd84753b8138d057fb4
2010-03-18Fix minSdkVersion scanning to not throw warningsKenny Root
For the UTF8/UTF16 switch code, we needed to know what was the minSdkVersion specified as early as possible. Unfortunately, this threw warnings when the SDK was compiling since we always set this field in the Bundle. This splits out the field used by the initial AndroidManifest.xml scan to a separate one that we won't attempt to re-insert into the AndroidManifest.xml This also switches the logic to better reflect the preference of UTF-8 over UTF-16; previously UTF-16 was the default. Change-Id: Ia81f6b21047043ebb711eb24c2c3718534979ef6
2010-03-10Revert "Dedupe resource config pointers"Kenny Root
This reverts commit 7b467d8b44c00d14590c021928b6a9ad5a36348e.
2010-03-09Dedupe resource config pointersKenny Root
When there are two configs in a StringPool that would match a string ID only keep the more generic entry to save some space. This means that if you have both "es" and "es_US" translations that have the same translation, the string entry would be removed from the "es_US" config. Change-Id: I4d619942d35ddb477e2eabe4437b7f02697c24de
2010-03-09Add ability for some manifest attributes to reference resources.Dianne Hackborn
This loosens our restriction on many manifest attributes requiring literal string values, to allow various ones to use values from resources. This is only allowed if the resource value does not change from configuration changes, and the restriction is still in place for attributes that are core to security (requesting permissions) or market operation (used libraries and features etc). Change-Id: I4da02f6a5196cb6a7dbcff9ac25403904c42c2c8
2010-03-05Change an aapt "warning" from "*** " to "**** " (from three to four stars).Ed Heyl
"*** " (three stars and a space) is the 'magic make error string'; so this change makes it easier to find the real issues/errors in build logs. Besides, other aapt messages are "**** ".
2010-02-18Change buf size holding integer in ResourceTableKenny Root
A 32-bit integer can be 10 characters long plus a byte for \0 at the end. Change-Id: I58040fe6e1674e78bcc6e07463ff36fb26e280f4
2010-02-11Introduce special UI modes for night and car usage.Tobias Haamel
The device mode is now called ui mode. Furthermore is the order of precedence for the resources now in such a way that the ui mode needs to be specified after the orientation and before the density. The ui mode can be set, like it is done for the locale, as follows: IActivityManager am = ActivityManagerNative.getDefault(); Configuration config = am.getConfiguration(); config.uiMode = Configuration.UI_MODE_TYPE_CAR | Configuration.UI_MODE_NIGHT_ANY; am.updateConfiguration(config); To allow users to disable the car mode and set the night mode the IUiModeManager interface is used. The automatic night mode switching will be added in a separate change.
2010-02-04Add --auto-add-overlay option to aapt.Xavier Ducrohet
This option allows resources only present in overlays to be added automatically instead of being declared through <add-resource> Change-Id: Iff782311056f6a045193e57d204f7d3413e11b26
2009-12-07Optional use of UTF-8 strings in resource bundlesKenny Root
Allows the use of UTF-8 for packing resources instead of the default of UTF-16 for Java. When strings are extracted from the ResStringPool, they are converted to UTF-16 and the result is cached for subsequent calls. When using aapt to package, add in the "-8" switch to pack the resources using UTF-8. This will result in the value, key, and type strings as well as the compiled XML string values taking significantly less space in the final application package in most scenarios. Change-Id: I129483f8b3d3b1c5869dced05cb525e494a6c83a
2009-11-03doc change: fix broken R.styleable formatting (caused by missing periods). ↵Dirk Dougherty
Adjust table markup. Bug: 2230588 Change-Id: I54545dfd9d26acef567e586cfc916f6b883a4de7
2009-09-02Fix compilation of add-resource tag.Robert Greenwalt
It used the wrong tag-type to find the end of itself.
2009-09-01Make it an error to use a bare apostrophe in aapt, and adjust warnings/errors.Eric Fischer
In practice, no one ever writes an apostrophe in an aapt string with the intent of using it to quote whitespace -- they always mean to include a literal apostrophe in the string and then are surprised when they find the apostrophe missing. Make this an error so that it is discovered right away instead of waiting until late in QA or after the strings have already been sent for translation. (And fix a recently-introduced string that has exactly this problem.) Silence the warning about an empty span in a string, since this seems to annoy people instead of finding any real problems. Make the error about having a translated string with no base string into a warning, since this is a big pain when making changes to an application that has already had some translations done, and the dead translations should be removed by a later translation import anyway.
2009-08-13Allow overlays to add resources.Dianne Hackborn
2009-07-13Format aapt warnings the same way as other compiler warningsMarco Nelissen
('warning: ' instead of 'WARNING: ' or 'WARNING ')
2009-06-09Make aapt Error out when an overlay adds a string.Robert Greenwalt
Final added check (I think) for 1585775 - not letting overlays add resources. modified: ResourceTable.cpp modified: ResourceTable.h
2009-06-05Add per-named-item overlay ability in res xml.Robert Greenwalt
Fixes 1899451. Also errors out if you add a bag via an overlay (which would renumber resources). Note that you can still add elements within the bag as they are not issued resource IDs. So for example you can now modify the framework themes.xml file without copying the entire file. All bag types are now modifable except non-named bag types (how would you address which element to replace?): array string_array integer_array
2009-05-20Add padding to public.xml to avoid breaking from auto-merges.Dianne Hackborn