48 Commits

Author SHA1 Message Date
Dianne Hackborn
06a8ceacb0 am c851ea56: am 69cb8757: Add new "-swNNNdp" resource qualifier.
* commit 'c851ea5672f6e042c2e89b2a2ce4a2467e1fcd2a':
  Add new "-swNNNdp" resource qualifier.
2011-05-19 19:34:21 -07:00
Dianne Hackborn
69cb87576b Add new "-swNNNdp" resource qualifier.
Change-Id: I0101e88ca9d8d44138bdcaf571f24b0352f4f6ce
2011-05-19 18:23:29 -07:00
Dianne Hackborn
2e4a3236a7 am 46a282f3: am 0ed2e845: Merge "DO NOT MERGE. Integrate add new screen width/height in "dp" configs." into honeycomb-mr2
* commit '46a282f323bc05606e4fe1eba795bd9ac7c99819':
  DO NOT MERGE.  Integrate add new screen width/height in "dp" configs.
2011-05-13 11:21:26 -07:00
Dianne Hackborn
ebff8f92f1 DO NOT MERGE. Integrate add new screen width/height in "dp" configs.
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-05-12 18:39:51 -07:00
Kenny Root
18490fb93e resolved conflicts for merge of 87b3c0dc to honeycomb-plus-aosp
Change-Id: Ia1a0024aabf531438203eb9fea3a10dd15eabe53
2011-04-12 10:27:15 -07:00
Mårten Kongstad
57f4b77c89 Runtime resource overlay, iteration 1.
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-04-01 14:12:10 +02:00
Josh Stone
02feeb4b2b 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
2011-01-23 16:00:36 -08:00
Josh Stone
bf50322a24 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
2011-01-22 21:13:12 -08:00
Kenny Root
7c71023b7f Add knowledge of mipmap to aapt
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-22 22:28:44 -08:00
Jean-Baptiste Queru
82849afd71 am 3442611e: am 5580e44c: Merge "Support changing style parent in overlays"
* commit '3442611ee11b2987c83054fe3c7ed5521f27f052':
  Support changing style parent in overlays
2010-11-06 16:25:03 -07:00
Jean-Baptiste Queru
3442611ee1 am 5580e44c: Merge "Support changing style parent in overlays"
* commit '5580e44c250944f5cd011b2682eea5cc2de9706c':
  Support changing style parent in overlays
2010-11-05 14:05:41 -07:00
Dianne Hackborn
58520b24d4 resolved conflicts for merge of 10d5b096 to master
Change-Id: Id5c6ba651f72b48f0d70ee2ca64a6c9adf5e74f7
2010-10-04 14:54:59 -07:00
Dianne Hackborn
407f625a9b Add new API to find out whether external storage is removable.
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-10-04 13:58:56 -07:00
Eric Fischer
6f27ab8bd4 am 9c708358: am 37cedce1: Merge "Add an aapt option to allow string variations for different devices." into gingerbread
Merge commit '9c70835896b6c078ac4c8b2e30cb6cfba70bb9d7'

* commit '9c70835896b6c078ac4c8b2e30cb6cfba70bb9d7':
  Add an aapt option to allow string variations for different devices.
2010-09-23 13:52:00 -07:00
Eric Fischer
90964040ca Add an aapt option to allow string variations for different devices.
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-09-23 10:32:47 -07:00
Martin Nordholts
2fda9f4562 Support changing style parent in overlays
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-08-17 13:18:59 +02:00
Steve Block
f1ff21ac62 Fixes a few minor problems with AAPT
- 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-25 11:02:15 +01:00
Kenny Root
15fe2cb73b Add error checking for translatable strings
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-06-03 09:33:43 -07:00
Kenny Root
c9f3088036 Use correct API version for UTF-8 checking
Use the constant for checking the API version in aapt instead of a bare
number.

Bug: 2541326
Change-Id: Ice7af7b393363a00f1832dd84753b8138d057fb4
2010-03-24 12:05:24 -07:00
Kenny Root
1741cd4904 Fix minSdkVersion scanning to not throw warnings
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-18 12:12:11 -07:00
Kenny Root
774562275f Revert "Dedupe resource config pointers"
This reverts commit 7b467d8b44c00d14590c021928b6a9ad5a36348e.
2010-03-10 11:38:05 -08:00
Kenny Root
7b467d8b44 Dedupe resource config pointers
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-09 20:56:41 -08:00
Dianne Hackborn
cf244ada58 Add ability for some manifest attributes to reference resources.
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-09 17:18:05 -08:00
Ed Heyl
65e185b51e Change an aapt "warning" from "*** " to "**** " (from three to four stars).
"*** " (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-03-05 11:24:35 -08:00
Kenny Root
f5a7c121dd Change buf size holding integer in ResourceTable
A 32-bit integer can be 10 characters long plus a byte for \0 at the
end.

Change-Id: I58040fe6e1674e78bcc6e07463ff36fb26e280f4
2010-02-18 09:44:35 -08:00
Tobias Haamel
27b28b3f62 Introduce special UI modes for night and car usage.
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-11 21:25:58 +01:00
Xavier Ducrohet
99080c7d9a Add --auto-add-overlay option to aapt.
This option allows resources only present in overlays to be
added automatically instead of being declared through <add-resource>

Change-Id: Iff782311056f6a045193e57d204f7d3413e11b26
2010-02-04 18:53:14 -08:00
Kenny Root
19138468ca Optional use of UTF-8 strings in resource bundles
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-12-07 15:14:15 -08:00
Dirk Dougherty
59ad275e93 doc change: fix broken R.styleable formatting (caused by missing periods). Adjust table markup.
Bug: 2230588
Change-Id: I54545dfd9d26acef567e586cfc916f6b883a4de7
2009-11-03 15:33:37 -08:00
Robert Greenwalt
93d7251699 Fix compilation of add-resource tag.
It used the wrong tag-type to find the end of itself.
2009-09-02 18:23:57 -07:00
Eric Fischer
c87d25215c Make it an error to use a bare apostrophe in aapt, and adjust warnings/errors.
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-09-01 15:20:30 -07:00
Dianne Hackborn
58c27a0a03 Allow overlays to add resources. 2009-08-13 13:36:00 -07:00
Marco Nelissen
dd93186420 Format aapt warnings the same way as other compiler warnings
('warning: ' instead of 'WARNING: ' or 'WARNING ')
2009-07-13 14:14:01 -07:00
Robert Greenwalt
f878e2d80c Make aapt Error out when an overlay adds a string.
Final added check (I think) for 1585775 - not letting overlays add
resources.

	modified:   ResourceTable.cpp
	modified:   ResourceTable.h
2009-06-09 16:23:35 -07:00
Robert Greenwalt
1aa8170e6a Add per-named-item overlay ability in res xml.
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-06-05 16:09:24 -07:00
Dianne Hackborn
f479aa0900 Add padding to public.xml to avoid breaking from auto-merges. 2009-05-20 16:30:59 -07:00
Dianne Hackborn
a96cbb435d Implement compatibility support for WRITE_SDCARD permission.
Now old applications will automatically be granted it.  Also renamed it from
SDCARD_WRITE to WRITE_SDCARD to be consistent with our other permissions,
and re-arranged how we do targetSdkVersion to actually be usuable for this
kind of stuff.

Note that right now this results in basically all apps being given the
WRITE_SDCARD permission, because their targetSdkVersion is not set.  I will
be dealing with that in a future change.
2009-05-15 18:02:47 -07:00
Robert Greenwalt
32c2c90220 Fix 1840639 to support overlays with zz_ZZ.
Everything but strings worked fine before but a new default string would generate a build error.
2009-05-08 11:45:37 -07:00
Robert Greenwalt
9411a39866 AI 144547: Fix change 144342 by making it active only during overlay processing.
BUG=1754390

Automated import of CL 144547
2009-04-03 16:44:30 -07:00
Robert Greenwalt
4b4f4a9088 AI 144342: Fix bag (string-array,etc) behavior with overlays.
We used to replace elements in the default with elements from
  the overlay.  This change causes us to empty the array first
  so if the overlay array is smaller we don't end up with elements
  from the default array showing through at the end of the array.
  Ex: [A,B,C] and overlay [D] should give [D] but used to give
  [D,B,C].
  BUG=1754390

Automated import of CL 144342
2009-04-02 16:55:50 -07:00
The Android Open Source Project
9066cfe988 auto import from //depot/cupcake/@135843 2009-03-03 19:31:44 -08:00
The Android Open Source Project
d83a98f4ce auto import from //depot/cupcake/@135843 2009-03-03 18:28:45 -08:00
The Android Open Source Project
d24b8183b9 auto import from //branches/cupcake/...@130745 2009-02-10 15:44:00 -08:00
The Android Open Source Project
22f7dfd234 auto import from //branches/cupcake/...@127101 2009-01-20 14:03:58 -08:00
The Android Open Source Project
9266c558bf auto import from //branches/cupcake/...@126645 2009-01-15 16:12:10 -08:00
The Android Open Source Project
b798689749 auto import from //branches/cupcake/...@125939 2009-01-09 17:51:23 -08:00
The Android Open Source Project
f013e1afd1 Code drop from //branches/cupcake/...@124589 2008-12-17 18:05:43 -08:00
The Android Open Source Project
54b6cfa9a9 Initial Contribution 2008-10-21 07:00:00 -07:00