History log of /frameworks/base/include/androidfw/ResourceTypes.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
76da37e1cf5c1381d9ccbaca86463fca52bd40f5 20-May-2016 Adam Lesinski <adamlesinski@google.com> Performance improvements in AssetManager

Change the implementation of getLocales() to iterate the set of
configurations using a templated method, instead of using the result
of getConfigurations().

Also remove the check for AndroidManifest.xml when adding an asset path.
This is unneccessary.

Bug:28625993
Change-Id: I16de5da598d0c371421d1dc8eee054dce9baf53a
/frameworks/base/include/androidfw/ResourceTypes.h
8ac51d14b614ba6a12df2ba90d50a01f50d548aa 10-May-2016 Adam Lesinski <adamlesinski@google.com> Resource shared libraries: fix theme references

Theme values that would reference other theme values would not work
if they were declared in a shared library.

We now introduce a parallel resource type to TYPE_DYNAMIC_REFERENCE,
TYPE_DYNAMIC_ATTRIBUTE, which allows us to lookup and resolve
theme value references from shared libraries.

Bug:28687378
Change-Id: I4f2364e3e8b567679f90784fcaaea12b6b05e926
/frameworks/base/include/androidfw/ResourceTypes.h
ff5808d223d6359448afc532717b8ccfdc5182d8 24-Feb-2016 Adam Lesinski <adamlesinski@google.com> AssetManager: Cache a pre-filtered list of configurations

When we set the parameters for a ResTable, we can pre-filter which
resources match and only look at that smaller list when getting entries.
This helps A LOT with types that have many configurations, like strings
and all their various locales.

We must store the cached entries in a parallel data structure because parts
of the main Type object are shared with other ResTables, causing data races.

Bug:25499111
Change-Id: I63e37dcbd683fc9f1e7d0f3a6ed4c1c01e0fc575
/frameworks/base/include/androidfw/ResourceTypes.h
53185a50d18239088f5a2f3cf9a11a6da7a286fb 07-Mar-2016 Adam Lesinski <adamlesinski@google.com> Merge "Revert "AssetManager: Cache a pre-filtered list of configurations"" into nyc-dev
fa7d78ae872b8b96ac4a6f945da0627707b00798 07-Mar-2016 Adam Lesinski <adamlesinski@google.com> Revert "AssetManager: Cache a pre-filtered list of configurations"

There is a race due to the modification of shared data structures in the framework ResTable.

See b/27499488

This reverts commit d4b169173ad7805369204277580d3942cb08174a.

Change-Id: I3f400a2ad3b5ffc652b84dd5fe777f7cf34b5548
/frameworks/base/include/androidfw/ResourceTypes.h
7960898f6f886aadda1dd3d7a89106dde9f44217 04-Mar-2016 Roozbeh Pournader <roozbeh@google.com> Fix script-related parts of locale resource matching

Previously, a bit was kept to find if the script of a locale was
explicitly "provided" in a resource. This was not backward
compatible, and failed in some edge cases when the package was
created with older versions of AAPT that did not set the bit.

The cases would happen when the old resource had an explicit script
specified in its locale, but since the "provided" bit was not set in
the package, we would assume that the script was computed by us.

This CL replaces the "provided" bit with a "computed" bit, so the
default value of the bit (set to "false" for old packages) would be
correct.

Bug: 27156990
Change-Id: I99e7f1ad8f70c90e25ab3640ed34cc1a6f8d1d64
/frameworks/base/include/androidfw/ResourceTypes.h
d4b169173ad7805369204277580d3942cb08174a 24-Feb-2016 Adam Lesinski <adamlesinski@google.com> AssetManager: Cache a pre-filtered list of configurations

When we set the parameters for a ResTable, we can pre-filter which
resources match and only look at that smaller list when getting entries.
This helps A LOT with types that have many configurations, like strings
and all their various locales.

Bug:25499111
Change-Id: Ie6894c44bc67e16a10dbe028c8f3e119e5c29ac7
/frameworks/base/include/androidfw/ResourceTypes.h
7cdb3e3e2dad1d48d666fe44e37e724341a2c507 22-Jan-2016 Roozbeh Pournader <roozbeh@google.com> Move localeScriptWasProvided to end of ResTable_config

This is to try and be safer with different versions potentially
interpreting the data differently.

Change-Id: I599b6a20d908e8379727a5b06cc6631f1954bcff
/frameworks/base/include/androidfw/ResourceTypes.h
b927c559e1ef8530b08712507f320502627db298 15-Jan-2016 Roozbeh Pournader <roozbeh@google.com> Implement smarter locale resource selection

* Add support for determining script from language and region.
* Add support for determining special parents of locales.
* Add support for smart comparison of locales with only a difference
in region, using the locale parentage tree.
* Fix LocaleData.matchScore() to not fallback to old locale matching
behavior if we can't determine a script.
* Allow four-character variant codes. (Previously, only five- to
eight-character variant codes were allowed.)

Bug: 7296673
Bug: 26589793
Change-Id: Ibde0a48c0564ff383b41068095a5cbacfe7b94bc
/frameworks/base/include/androidfw/ResourceTypes.h
1c686f2ce6cbfa3fdb598f452aa31d38f3eb2320 18-Dec-2015 Roozbeh Pournader <roozbeh@google.com> Avoid matching system locales in locale negotiation

Also:
1. Add AssetManager method for finding non-system locales: This is
used in per-app locale negotiation. (Normally,
AssetManager#getLocales() returns both system and non-system
locales.)

2. Match pseudolocales correctly in locale negotiation.

Bug: 25800576
Bug: 26236938
Change-Id: I116caf3a91c290deb4ad68b291c65b7035b18dd4
/frameworks/base/include/androidfw/ResourceTypes.h
a6d7e3fb9c9233b9ae46b702d17433854c43d6a0 02-Sep-2015 Tao Bai <michaelbai@google.com> Load app resource as shared library.

- Added aapt command line flag --app-as-shared-lib to build app resources
that could be loaded as shared lib at runtime.
- Added new method AssetManager.addAssetPathAsSharedLibrary() to load an
app resource as shared library.

Bug 22487604

Change-Id: Ib9b33c35f9c2b7129f3ba205de03d4564623ea39
/frameworks/base/include/androidfw/ResourceTypes.h
2349332f9f69189d7889692b9aafd6f80070e352 30-Jul-2015 Filip Gruszczynski <gruszczy@google.com> Only relaunch activity on significant size configuration changes.

Currently if the configuration width/height/smallest width changes, we
relaunch the activity or invoke onConfigurationChanged callback. When it
comes to size based configuration changes it might not be necessary: if
the size change doesn't pass one of the threshold defined by the
resources, it means there is no need to relaunch the activity.

In this CL the ActivityManager will receive the thresholds from the
application and use them to decide, whether to relaunch the activity.
The application reads the thresholds from the resources, specifically
from resource qualifiers used by the app.

Change-Id: Ie3cf0a172dc1ba0b865cf30c2962e7cfd9ad8436
/frameworks/base/include/androidfw/ResourceTypes.h
2738c96d998dedfae5b4670d588d0cd299c4ca0f 14-May-2015 Adam Lesinski <adamlesinski@google.com> Add -round and -notround qualifier to android runtime/aapt

The round qualifier denotes a device with a screen shape that
is round. The qualifier shows up after the 'long/notlong' qualifier
and before the orientation 'port/land/square' qualifiers.

Change-Id: I3044258b2703a9165694b79725bade770fa6cea1
/frameworks/base/include/androidfw/ResourceTypes.h
e54d245b993e1347cb32c23a6bdc907a45fab324 06-May-2015 Alan Viverette <alanv@google.com> Improve keying for theme caches, rebase system theme on config change

Themes now use an array of applied styles rather than a String to store
their history. They are keyed based on a hash code computed from the
history of applied styles. The themed drawable cache has been abstracted
out into its own class.

Also updates system context to use DayNight as the default and ensures
that GlobalActions uses the correct context, which exercises the change.

CTS tests have been added in another CL.

Bug: 20421157
Change-Id: I9eb4b7dffd198ad24d02f656eaf0839570b59caa
/frameworks/base/include/androidfw/ResourceTypes.h
c1d527926e1c82828e42bdc0c7abf50f6decc0a7 05-May-2015 Alan Viverette <alanv@google.com> Add API for obtaining changing configurations bitmask from Theme

Required to know when to reload the system context's theme in response
to configuration changes, and thus needed to support the DayNight theme.

Bug: 20267825
Change-Id: I7df5e28b7a6d8b611ea030032544cf4800788514
/frameworks/base/include/androidfw/ResourceTypes.h
39606e9f78a1b2aa4e82b47e978471cd1158d1df 15-Apr-2015 Dan Albert <danalbert@google.com> am 7b09e7a9: am 44d7989a: am 571c5a26: Merge "Fix UB in ResourceTable::stringToInt."

* commit '7b09e7a9f3ef804e9cd159023b64eac1ef8b7931':
Fix UB in ResourceTable::stringToInt.
571c5a26f767f67118f34ca0d426aeeb4a287b2c 15-Apr-2015 Dan Albert <danalbert@google.com> Merge "Fix UB in ResourceTable::stringToInt."
f04046dfb0696113c8c1a3cf7425b7d6d85378b3 09-Apr-2015 Dan Albert <danalbert@google.com> am e24d36b7: am 1f799a6b: am d9f32b16: Merge "Ensure alignment of Res_png_9patch."

* commit 'e24d36b7b744540ccd3401609248ed9d48be4cc9':
Ensure alignment of Res_png_9patch.
a18cee52d953196ce12550df2ac5a14fbf359802 08-Apr-2015 Dan Albert <danalbert@google.com> Ensure alignment of Res_png_9patch.

This doesn't alter the alignment of the data within the struct, but
enforces that this structure will be appropriately aligned when used.

The image_info struct has this struct preceded by a bool, which causes
odd alignment for the members of this struct.

Change-Id: Ia2ef5c81b2f961c0f61858a10a7821d82f600919
/frameworks/base/include/androidfw/ResourceTypes.h
1b4f316651096f0ef9301b4ffde4816a08a54ab5 08-Apr-2015 Dan Albert <danalbert@google.com> Fix UB in ResourceTable::stringToInt.

Was here because UBsan found integer overflow in the parsing for hex
numbers, since hex numbers here are actually unsigned but assigned to
a signed integer.

Also fixes a number of missing error conditions.

Change-Id: Iaea576daedfc6c75521cde02de3fe9dd0198a3b7
/frameworks/base/include/androidfw/ResourceTypes.h
6f6ceb7e1456698b1f33e04536bfb3227f9fcfcb 14-Nov-2014 Adam Lesinski <adamlesinski@google.com> AAPT2

First checking of AAPT2. The individual phases of AAPT2 work, but there
are some missing pieces.

For early testing we are missing:
- Need to properly mark file references and include them in package
- Need to package into zip

Final AAPT for apps we are missing:
- Need to crush PNGs
- Need to parse 9-patches
- Need to validate all of AndroidManifest.xml
- Need to write align method to align resource tables for splits.

Final AAPT for apps + system we are missing:
- Need to handle overlays
- Need to store comments for R file
- Need to handle --shared-lib (dynamic references too).

New AAPT features coming:
- Need to import compiled libraries
- Name mangling
- R file generation for library code

Change-Id: I95f8a63581b81a1f424ae6fb2c373c883b72c18d
/frameworks/base/include/androidfw/ResourceTypes.h
8a9355a98ece3d7fc9d022e759d05378060c86e2 11-Mar-2015 Adam Lesinski <adamlesinski@google.com> Output modified bcp47 tag in ResTable_config::toString()

We expect to be able to parse the output of ResTable_config::toString(),
so it should use modified bcp47 (b+en+Latn+US).

Change-Id: I597a1779a1fa5cff171c473e6a0368d93b9c7722
/frameworks/base/include/androidfw/ResourceTypes.h
847514499f5920d073f5cd402dd0d3bbd19ac2c1 27-Jan-2015 Leon Scroggins III <scroggo@google.com> am 3523e4fc: am efe085ff: Merge "Handle bad ninepatch data." into lmp-mr1-dev

* commit '3523e4fcb3c74a5dee2f4497e2b8ec7b9e2b5e57':
Handle bad ninepatch data.
a730ef3f77fc495bc90199b4d45efab26d609782 27-Jan-2015 Leon Scroggins III <scroggo@google.com> Handle bad ninepatch data.

Changes proposed by Ben Hawkes of Google Project Zero.

NinePatchPeeker.cpp:
Instead of asserting, return false for bad data.

ResourceTypes.h:
Store ninepatch values as unsigned.

BUG:19151999
Change-Id: Ibe35e7569f632c6bb8a34a7701e26bb6ed547ec2
/frameworks/base/include/androidfw/ResourceTypes.h
d9bd08864eaf9d8847d974eadb81806b9e086a2d 20-Jan-2015 Adam Lesinski <adamlesinski@google.com> am aee7225e: Merge "Process base APK" into lmp-mr1-dev
automerge: 554a6f5

* commit '554a6f5278ec05077d8252249afc911897fbfe76':
Process base APK
42eea270a0a2bc54f454312817c41ac357e3a884 16-Jan-2015 Adam Lesinski <adamlesinski@google.com> Process base APK

The base APK may have resources with configurations that compete
against some splits. The base APK must be involved in the selection
of splits.

Bug:18982001
Change-Id: Ieb29b5a36cf2c68e7831484d98a9fd275acd97e8
/frameworks/base/include/androidfw/ResourceTypes.h
e97908d32ee8ea80138d085260a0eac93841c722 05-Dec-2014 Adam Lesinski <adamlesinski@google.com> Merge commit '0953ab27' into manualmerge

Change-Id: I36dea45f7571096136ea7bda5e2680bd85a0df32
9b624c186cb6059dfb3ec24bfb6386a0fc17b88c 20-Nov-2014 Adam Lesinski <adamlesinski@google.com> AAPT: Move private attrs to new type for framework

Private attributes are typically placed after public
attributes in the resource table. Each time a new version
of the Android framework is released, new public attributes
take the place of the private attributes, and the private
attributes are shifted after the new public ones.

This means that any apps built against the newer SDK
may inadvertently be using private attributes on older
devices.

This change moves all private attributes to a completely
different type ID, so there will never be collisions across
versions.

These private attributes are automatically moved to a synthesized
type only for the system resources.

Bug:18263655

Change-Id: I7a850512953fadcc9f3524d509cea30249782db8
/frameworks/base/include/androidfw/ResourceTypes.h
5bf0c65eef972e743ca02e93f8d5ad7df5097931 08-Nov-2014 Andreas Gampe <agampe@google.com> am f89a2fda: Merge "Frameworks/base: Fix two warnings in cmds"

* commit 'f89a2fdacb2ba907f180188dc79f9de81e3eb254':
Frameworks/base: Fix two warnings in cmds
ebee1379eaf4306eb2de9437844009aa7eb18c28 08-Nov-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Fix two warnings in cmds

Change-Id: Ifb9c7fb7a2d28c13010ddc186bea5f5f0daefb4a
/frameworks/base/include/androidfw/ResourceTypes.h
dc9c109af815100d497184e6dadebceed7f3bf1d 08-Nov-2014 Andreas Gampe <agampe@google.com> resolved conflicts for merge of 487ae9b8 to lmp-mr1-dev-plus-aosp

Change-Id: I395f184d885a7ef30aa113ab01fcaacc94243008
2204f0bf56af53b588a01701b8cf9cd05b1b3ff9 22-Oct-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Wall Werror in libs/androidfw

Turn on -Wall -Werror in libs/androidfw. Fix warnings. Refactor
some code.

Change-Id: I66fe54ace433c15dee5de328b149ca142f74b2dd
/frameworks/base/include/androidfw/ResourceTypes.h
668f0a356cba44c22d8ca0c9f4711613885d46a9 04-Nov-2014 Adam Lesinski <adamlesinski@google.com> Merge "Fix issues that will be present in C++11" into lmp-mr1-dev
4bf58108d442b37ab4adf5ce3a4ecd63472ce254 03-Nov-2014 Adam Lesinski <adamlesinski@google.com> Fix issues that will be present in C++11

- char16_t is a distinct type, so stay consistent
with it throughout the code base.
- char16_t is defined as minimum size of 16 bits.
Since we mmap and cast data structures onto raw memory,
we need a precise definition (uint16_t), so we cast between
that (and static_assert that they are the same size).

Change-Id: I869c32637543bbcfb39d2643e7d9df10d33acd3c
/frameworks/base/include/androidfw/ResourceTypes.h
f2969405020a72e282c348a6ea201d56e9f8d4ba 30-Oct-2014 Alan Viverette <alanv@google.com> Distinguish unspecified and explicit null values in resources

BUG: 17919345
Change-Id: Ic4f04f7dd0f986f58a749b5950d80c1cfdb074ea
/frameworks/base/include/androidfw/ResourceTypes.h
8d2556f0de2786367babaafbf1c34b24926e48ca 19-Sep-2014 Adam Lesinski <adamlesinski@google.com> am 8bdb265f: am 19f9d54f: Merge "Fix backwards compat problem with AAPT public attrs" into lmp-dev

* commit '8bdb265f0a73bc6f2114ca70f141c214a23696c7':
Fix backwards compat problem with AAPT public attrs
82a2dd8efe48d3a4e04655f01329da857ace4b7d 18-Sep-2014 Adam Lesinski <adamlesinski@google.com> Fix backwards compat problem with AAPT public attrs

AAPT has traditionally assigned resource IDs to public attributes,
and then followed those public definitions with private attributes.

--- PUBLIC ---
| 0x01010234 | attr/color
| 0x01010235 | attr/background

--- PRIVATE ---
| 0x01010236 | attr/secret
| 0x01010237 | attr/shhh

Each release, when attributes are added, they take the place of the private
attributes and the private attributes are shifted down again.

--- PUBLIC ---
| 0x01010234 | attr/color
| 0x01010235 | attr/background
| 0x01010236 | attr/shinyNewAttr
| 0x01010237 | attr/highlyValuedFeature

--- PRIVATE ---
| 0x01010238 | attr/secret
| 0x01010239 | attr/shhh

Platform code may look for private attributes set in a theme. If an app
compiled against a newer version of the platform uses a new public
attribute that happens to have the same ID as the private attribute
the older platform is expecting, then the behavior is undefined.

We get around this by detecting any newly defined attributes (in L),
copy the resource into a -v21 qualified resource, and delete the
attribute from the original resource. This ensures that older platforms
don't see the new attribute, but when running on L+ platforms, the
attribute will be respected.

We still need to address this problem in the platform moving forward,
as this will only help us in the transition from pre L to L.

Bug:17520380
Change-Id: Ia2a985798b50006c21c7c3431d30d9598f27cd91
/frameworks/base/include/androidfw/ResourceTypes.h
20ec4fa2294a91e5ff87839280904aba4a050cf6 09-Sep-2014 Dan Albert <danalbert@google.com> resolved conflicts for merge of 6c585756 to lmp-dev-plus-aosp

Change-Id: I5a25f2bac44ac5efcd7462af91005e09680a1d96
f348c15ecf78e9d58b8238ffcf1d78a279e3a862 09-Sep-2014 Dan Albert <danalbert@google.com> Use char16_t for char things.

When compiling in C++ mode, the compiler will complain about conversions
from uint16_t to char16_t. Be consistent in using char16_t for strings.

Change-Id: I052b6176ced635162920b31560052d9a64f92764
/frameworks/base/include/androidfw/ResourceTypes.h
ad2d07d2d98a46babb2a9472413fe9ce5080ca76 28-Aug-2014 Adam Lesinski <adamlesinski@google.com> Stamp platform version code into app Apks

The versionCode of theframework resources that an app is built against
gets stamped inside an app's AndroidManifest.xml in the <manifest>
tag as "platformBuildVersionCode" and "platformBuildVersionName"
attributes.

Bug:17207635
Change-Id: Id573c3dffcbca38eec9c0eb3e89f4a547e3361d3
/frameworks/base/include/androidfw/ResourceTypes.h
31245b4f06003f1c8cd44c31b387c96ab4e282f9 23-Aug-2014 Adam Lesinski <adamlesinski@google.com> Introduce anydpi density resource qualifier

This is meant to be used with scaleable vector
drawables, and are chosen as the best match unless
there is a configuration that matches the density
requested exactly.

Bug:17007265
Change-Id: Ic3288d0236fe0bff20bb1599aba2582c25b0db32
/frameworks/base/include/androidfw/ResourceTypes.h
6022debdbcc4498736580640c6287b57872617a2 20-Aug-2014 Adam Lesinski <adamlesinski@google.com> AAPT: Fix regression generating dynamic ref table for shared libraries

AAPT stopped generating dynamic reference tables for shared libraries.

Change-Id: Ib0025811bdca1a4756eb21080dd6b6bb3fc1ca3d
/frameworks/base/include/androidfw/ResourceTypes.h
833f3ccbc8f4dd1ec8abb9121988b99ff34ec4c1 19-Jun-2014 Adam Lesinski <adamlesinski@google.com> AAPT support for feature splits

This change allows the developer to add a base package for
which to build a feature split. The generated resource types
will begin after the base APK's defined types so as not
to collide or override resources.

Multiple features can be generated by first choosing an
arbitrary order for the features. Then for each feature,
the base APK and any preceding features are specified
with the --feature-of flags.

So with a base APK 'A' and features, 'B', and 'C',
'B' would be built with

aapt package [...] --feature-of A [...]

and 'C' would be built with

aapt package [...] --feature-of A --feature-of B [...]

Change-Id: I1be66e3f8df9a737b21c71f8a93685376c7e6780
/frameworks/base/include/androidfw/ResourceTypes.h
f90f2f8dc36e7243b85e0b6a7fd5a590893c827e 06-Jun-2014 Adam Lesinski <adamlesinski@google.com> Support multiple resource tables with same package

In order to support APK split features, the resource
table needs to support loading multiple resource
tables with the same package but potentially new set
of type IDs.

This adds some complexity as the type ID space changes
from dense and ordered to potentially sparse.

A ByteBucketArray is used to store the type IDs in
a memory efficient way that allows for fast retrieval.

In addition, the IDMAP format has changed. We no longer
need random access to the type data, since we store the
types differently. However, random access to entries of
a given type is still required.

Change-Id: If6f5be680b405b368941d9c1f2b5d2ddca964160
/frameworks/base/include/androidfw/ResourceTypes.h
0a0454fdcc7aeac6e57f9466da8f39bcf5f3f6ec 04-Apr-2014 John Spurlock <jspurlock@google.com> am 642421aa: am 5c31e487: Merge "Introduce new UI_MODE_TYPE_WATCH and qualifier." into klp-modular-dev

* commit '642421aa7f284817cc1a972a7f9c7a64696a0116':
Introduce new UI_MODE_TYPE_WATCH and qualifier.
642421aa7f284817cc1a972a7f9c7a64696a0116 04-Apr-2014 John Spurlock <jspurlock@google.com> am 5c31e487: Merge "Introduce new UI_MODE_TYPE_WATCH and qualifier." into klp-modular-dev

* commit '5c31e487c4577e1c47ee7c949325d6a13f0d462e':
Introduce new UI_MODE_TYPE_WATCH and qualifier.
6c191299a73388cd593809c0b66bafbd08fd2982 03-Apr-2014 John Spurlock <jspurlock@google.com> Introduce new UI_MODE_TYPE_WATCH and qualifier.

Default ui mode to watch if we have FEATURE_WATCH.

Bug:13395758
Change-Id: Ie5ff95de60e69e91ad3612c7d2f1fca7f49061bd
/frameworks/base/include/androidfw/ResourceTypes.h
de898ff42912bd7ca1bfb099cd439562496765a4 30-Jan-2014 Adam Lesinski <adamlesinski@google.com> Shared library resource support

Shared libraries can now export resources for applications
to use.

Exporting resources works the same way the framework exports
resources, by defining the public symbols in res/values/public.xml.

Building a shared library requires aapt to be invoked with the
--shared-lib option. Shared libraries will be assigned a package
ID of 0x00 at build-time. At runtime, all loaded shared libraries
will be assigned a new package ID.

Currently, shared libraries should not import other shared libraries,
as those dependencies will not be loaded at runtime.

At runtime, reflection is used to update the package ID of resource
symbols in the shared library's R class file. The package name of
the R class file is assumed to be the same as the shared library's
package name declared in its manifest. This will be customizable in
a future commit.

See /tests/SharedLibrary/ for examples of a shared library and its
client.

Bug:12724178
Change-Id: I60c0cb8ab87849f8f8a1a13431562fe8603020a7
/frameworks/base/include/androidfw/ResourceTypes.h
6381dd4ff212a95be30d2b445d40ff419ab076b4 03-Mar-2014 Narayan Kamath <narayan@google.com> LP64: Make 9 patches architecture agnostic.

The Res_png_9patch struct had several pointer members
whose size differed between 32 and 64 bit platforms.

These members have been replaced by uint32_t offsets
to serialized data. The serialized form for 9patches
places a Res_png_9patch object at the beginning of
serialized data, followed by int32_t arrays of xDivs,
yDivs and colors.

Note that these offsets are not strictly required,
since they can be computed from the values of numXDivs,
numYDivs & numColors, however they are called in tight
loops so having them computed once is a beneficial.

This change also removed the unused patch_equals function
from aapt's Image.cpp.

Change-Id: I3b9ac8ae5c05510d41377cae4dff1c69b40c2531
/frameworks/base/include/androidfw/ResourceTypes.h
788fa41482b9d398591b7db8b0b01839029611ad 21-Jan-2014 Narayan Kamath <narayan@google.com> Extended locales in AAPT / AssetManager.

Support 3 letter language codes, script codes &
variants. The bulk of the changes are related to
the implementation of command line filtering of
locales etc. The previous code assumed that the
value of each "axis" (locale, density, size etc.)
could be represented by a 4 byte type. This is
no longer the case.

This change introduces a new class, AaptLocaleValue
which holds a (normalized) locale parsed from a
directory name or a filter string. This class takes
responsibility for parsing locales as well as
writing them to ResTable_config structures, which is
their representation in the resource table.

This includes minor changes at the java / JNI level
for AssetManager. We now call locale.toLanguageTag()
to give the native layer a well formed BCP-47 tag.
I've removed some duplicated parsing code in
AssetManager.cpp and replaced them with functions on
ResTable_config. The native getLocales function has
been changed to return well formed BCP-47 locales as
well, so that the corresponding java function can use
Locale.forLanguageTag to construct a Locale object
out of it.

Finally, this change introduces default and copy
constructors for ResTable_config to prevent having
to memset() the associated memory to 0 on every
stack allocation.

(cherry-picked from commit 91447d88f2bdf9c2bf8d1a53570efef6172fba74)

Change-Id: I1b43086860661012f949fb8e5deb7df44519b854
/frameworks/base/include/androidfw/ResourceTypes.h
48620f1d1b03e1cb4e0dce4999e0a4c2daf3a1b2 20-Jan-2014 Narayan Kamath <narayan@google.com> AssetManager support for 3 letter lang/country codes.

- 3 letter codes are packed into the existing 32 bit locale
field in ResTable_config
- We introduce new fields for script / variant information.

Note that we define a "match" between two ResTable_config
structures to be purely on the basis of their language &
country (disregarding the script and the variant). However,
configs with scripts and variants are considered to be more
specific than those without.

(cherry picked from commit 378c6775a62d9c461cde51f06c1b14bb014c78fd)

Change-Id: I7dce82a3fe2412834252723f458826ae41535a78
/frameworks/base/include/androidfw/ResourceTypes.h
4385d37813897be979ff13262bc464979c74e3dd 11-Feb-2014 Dianne Hackborn <hackbod@google.com> Fix build.

At least part of what is broken. Other stuff still seems to be.

(cherry picked from 32bb5fae353b5bb6275e75952e89c514c7369cee)

Change-Id: I280376645166fe772ff7a31ff2e8494dce2adbf8
/frameworks/base/include/androidfw/ResourceTypes.h
48d22323ce39f9aab003dce74456889b6414af55 31-Jan-2014 Mårten Kongstad <marten.kongstad@sonymobile.com> Runtime resource overlay, iteration 2

Support any number of overlay packages. Support any target package.

UPDATED PACKAGE MATCHING
------------------------
In Runtime resource overlay, iteration 1, only a single overlay package
was considered. Package matching was based on file paths:
/vendor/overlay/system/framework-res.apk corresponded to
/system/framework-res.apk. Introduce a more flexible matching scheme
where any package is an overlay package if its manifest includes

<overlay targetPackage="com.target.package"/>

For security reasons, an overlay package must fulfill certain criteria
to take effect: see below.

THE IDMAP TOOL AND IDMAP FILES
------------------------------
Idmap files are created by the 'idmap' binary; idmap files must be
present when loading packages. For the Android system, Zygote calls
'idmap' as part of the resource pre-loading. For application packages,
'idmap' is invoked via 'installd' during package installation (similar
to 'dexopt').

UPDATED FLOW
------------
The following is an outline of the start-up sequences for the Android
system and Android apps. Steps marked with '+' are introduced by this
commit.

Zygote initialization
Initial AssetManager object created
+ idmap --scan creates idmaps for overlays targeting 'android', \
stores list of overlays in /data/resource-cache/overlays.list
AssetManager caches framework-res.apk
+ AssetManager caches overlay packages listed in overlays.list

Android boot
New AssetManager's ResTable acquired
AssetManager re-uses cached framework-res.apk
+ AssetManager re-uses cached 'android' overlays (if any)

App boot
ActivityThread prepares AssetManager to load app.apk
+ ActivityThread prepares AssetManager to load app overlays (if any)
New AssetManager's ResTable acquired as per Android boot

SECURITY
--------
Overlay packages are required to be pre-loaded (in /vendor/overlay).
These packages are trusted by definition. A future iteration of runtime
resource overlay may add support for downloaded overlays, which would
likely require target and overlay signatures match for the overlay to
be trusted.

LOOKUP PRIORITY
---------------
During resource lookup, packages are sequentially queried to provide a
best match, given the constraints of the current configuration. If any
package provide a better match than what has been found so far, it
replaces the previous match. The target package is always queried last.

When loading a package with more than one overlay, the order in which
the overlays are added become significant if several packages overlay
the same resource.

Had downloaded overlays been supported, the install time could have been
used to determine the load order. Regardless, for pre-installed
overlays, the install time is randomly determined by the order in which
the Package Manager locates the packages during initial boot. To support
a well-defined order, pre-installed overlay packages are expected to
define an additional 'priority' attribute in their <overlay> tags:

<overlay targetPackage="com.target.package" priority="1234"/>

Pre-installed overlays are loaded in order of their priority attributes,
sorted in ascending order.

Assigning the same priority to several overlays targeting the same base
package leads to undefined behaviour. It is the responsibility of the
vendor to avoid this.

The following example shows the ResTable and PackageGroups after loading
an application and two overlays. The resource lookup framework will
query the packages in the order C, B, A.

+------+------+- -+------+------+
| 0x01 | | ... | | 0x7f |
+------+------+- -+------+------+
| |
"android" Target package A
|
Pre-installed overlay B (priority 1)
|
Pre-installed overlay C (priority 2)

Change-Id: If49c963149369b1957f7d2303b3dd27f669ed24e
/frameworks/base/include/androidfw/ResourceTypes.h
65a05fd56dbc9fd9c2511a97f49c445a748fb3c5 31-Jan-2014 Mårten Kongstad <marten.kongstad@sonymobile.com> New command line tool 'idmap'

Introduce a new tool 'idmap' to handle generation and verification of
idmap files. The tool is modelled on 'dexopt', and is intended to be
used similarly, notably by 'installd'.
See cmds/idmap/idmap.cpp for further documentation on 'idmap'.

Note: this commit is interdependent on a commit in project build/ to add
'idmap' to PRODUCT_PACKAGES.

Note: the changes to androidfw are only stubs. The actual implementation
will be provided in Runtime resource overlay, iteration 2.

Change-Id: I7131b74ece1e46c8a9c0a31d103e686aa07da2bb
/frameworks/base/include/androidfw/ResourceTypes.h
7c4887f66bfa3dad16f8b03dc825ade96d7de130 27-Jan-2014 Narayan Kamath <narayan@google.com> Change ResourceType cookies to int32_t.

Also change the order of parameters in ResTable constructors
to avoid ambiguity.

(cherry picked from commit 00b314436f4fdfada4bbf1e79ec12e9fa38aeaf1)

Change-Id: I874c5d03c134dc3c331fba423b5280366296287c
/frameworks/base/include/androidfw/ResourceTypes.h
4482e7cb67c516453a67d73e98a085a5f3576953 26-Nov-2013 Mårten Kongstad <marten.kongstad@sonymobile.com> Fix ResTable_config::CONFIG_* typo (MCC vs MNC)

In commit 08d5b8f, the ResTable_config::CONFIG_* enum was incorrectly
changed to assign the same value to both CONFIG_MCC and CONFIG_MNC:
- CONFIG_MCC = 0x0001,
- CONFIG_MNC = 0x0002,
+ CONFIG_MCC = ACONFIGURATION_MCC,
+ CONFIG_MNC = ACONFIGURATION_MCC,

This commit assigns CONFIG_MNC the value ACONFIGURATION_MNC, as
intended.

Change-Id: I3b8799914a55debdb3ff30a82ada7ad990c49970
/frameworks/base/include/androidfw/ResourceTypes.h
d45c68dd24fe3dd510af5a9591b5e2f509b56772 31-Jul-2013 Dianne Hackborn <hackbod@google.com> Resource memory optimization.

Don't ever need the cached UTF-16 string conversions on the
device. Don't need to create those strings, and don't need
to create the lookup array for them at all. This requires
fixing all of the remaining places in the platform where we
interacted with the resources with the blind assumption that
the strings are UTF-16.

Change-Id: Ia0e5a150499837471e494e85b23b05fa06e0cf1d
/frameworks/base/include/androidfw/ResourceTypes.h
9d3b1a424c5c61e24e9659d15fb353026a00d925 02-Jul-2013 Jeff Brown <jeffbrown@google.com> Move input library code to frameworks/native.

No longer compile libandroidfw as a static library on the device
since it already exists as a shared library. Keeping the static
library would force us to provide a static library version of
libinput for the device as well which doesn't make sense.

Change-Id: I3517881b87b47dcc209d80dbd0ac6b5cf29a766f
/frameworks/base/include/androidfw/ResourceTypes.h
fb903a45d7b924c1dfacadaa99ebdf93fd8a1de4 18-Mar-2013 Bjorn Bringert <bringert@android.com> Allow compiling aapt for the device

Changes:

- The static device version of libandroidfw now includes
the extra functions needed by aapt. I could only find
a few host tools that use the static library, so this is
hopefully not a problem.

- The pseudolocalization code is moved into aapt.
It was previously in libhost, but only used by aapt.

Change-Id: Ib393ebb7dcebee8abbb628cbe5255ea1679674ac
/frameworks/base/include/androidfw/ResourceTypes.h
56a2301c7a1169a0692cadaeb48b9a6385d700f5 13-Feb-2013 Dianne Hackborn <hackbod@google.com> Implement issue #6646859: 4K!!!! 4K!!!! 4K!!!!

Change-Id: Ib05a2eb6a03db50074805a437a3639a7d10684a0
/frameworks/base/include/androidfw/ResourceTypes.h
5f7979993979466c79ab4f38d83c6f2aca361662 16-Jun-2012 Fabrice Di Meglio <fdimeglio@google.com> Add support for "-rtl" in resources

- fix bug #7035019 Need to have "-rtl" support for Resource

Change-Id: Ic82145c2ac672729d8a6c695a5f343276a1a0a2c
/frameworks/base/include/androidfw/ResourceTypes.h
b13b9bdad2baf6ad1ec2e56b6b7598fa20f55fc4 18-Feb-2012 Mathias Agopian <mathias@google.com> frameworks/base refactoring.

step 2: move libutils headers to their new home: androidfw

Change-Id: I14624ba23db92a81f2cb929f104386e1fab293ef
/frameworks/base/include/androidfw/ResourceTypes.h