History log of /frameworks/base/libs/androidfw/ResourceTypes.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
cd6f00c3a05717862a88b7409d11176ae53fd9a9 17-Nov-2014 Adam Lesinski <adamlesinski@google.com> Merge "Implement back-tracking when searching for attributes in XML or resource bag" into lmp-mr1-dev
a7d1d73a477fe512d9ea69ee2883084630ec24c4 02-Oct-2014 Adam Lesinski <adamlesinski@google.com> Implement back-tracking when searching for attributes in XML or resource bag

Shared libraries have their package ID assigned at run-time, so some
of the guarantees we used to have about sort order of attributes in
bags or XML elements no longer hold.

This CL adds back-tracking and can jump to the nearest attribute with the
same package ID and continue searching.

This means that attributes with the same package ID must be sorted by increasing
resource ID, as was the case before.

Attributes with the same package ID must be grouped together, but the groups can
be in any order. Ex: 0x02010001, 0x02010002, 0x01010000, 0x01010010, 0x7f010032

Bug:17666947
Change-Id: I9c198bbb6ca788849aac85b6323606ea5d9550d6
/frameworks/base/libs/androidfw/ResourceTypes.cpp
de7de47fef1dcaa26d553665d89e4d3792325c3f 03-Nov-2014 Adam Lesinski <adamlesinski@google.com> Add error checking to aapt for split generation

Change-Id: Ica627db6a671f6a6c35f98bfd9c03598ffe103ce
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
f2969405020a72e282c348a6ea201d56e9f8d4ba 30-Oct-2014 Alan Viverette <alanv@google.com> Distinguish unspecified and explicit null values in resources

BUG: 17919345
Change-Id: Ic4f04f7dd0f986f58a749b5950d80c1cfdb074ea
/frameworks/base/libs/androidfw/ResourceTypes.cpp
e60a87f5529b2867ba3f4e60b39d7b47b67f8ca3 09-Oct-2014 Adam Lesinski <adamlesinski@google.com> Search all packages for a given type string when looking up resources by name

Previously we would stop at the first match when looking for a type string,
but we should search all packages in case a feature Split added a type
with the same name.

Bug:17924027

Change-Id: I6bc7ef073324db99448538cd8bdf566658f066ff
/frameworks/base/libs/androidfw/ResourceTypes.cpp
908c748096d855d47da2f5e20fd4d9d31d1e603c 01-Oct-2014 Adam Powell <adamp@google.com> Revert "Fix issue with using locally defined attrs in a shared lib"

This reverts commit 5069dd69898bd0d9c69ba2bbd37239ec8d1c9dc6.

The reverted commit caused issues loading resources supplied by static libraries.

Bug 17748356

Change-Id: I860a4f31451ee7c03c02974826472a67226b029f
/frameworks/base/libs/androidfw/ResourceTypes.cpp
5069dd69898bd0d9c69ba2bbd37239ec8d1c9dc6 01-Oct-2014 Adam Lesinski <adamlesinski@google.com> Fix issue with using locally defined attrs in a shared lib

The attribute name resource IDs were never fixed up with
the runtime package ID so we weren't finding attributes
whenever the runtime package ID was different than the build
time one, which happened to be when a shared lib referenced itself
(0x00 vs 0x02).

Bug:17666947
Change-Id: Icf3e874bcea0e27eebe42d60fbed626a34bf9266
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
a9aa9f045836ca03b378653728476f9a298f5260 29-Aug-2014 Adam Lesinski <adamlesinski@google.com> Merge "Fix memory leak in ResTable" into lmp-dev
7f668d03ceec1ce1732f51cfe9828e6376bbecbc 29-Aug-2014 Adam Lesinski <adamlesinski@google.com> Fix memory leak in ResTable

We were basically never cleaning any of the
cached bags... oops :S

Bug:16683269
Change-Id: Ic0a44218f660e16fbaac8df1d61ce6f1fdb0018b
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
2cb761e3ddb9d68ab430013e9cd15ecaab9fbc62 15-Aug-2014 Adam Lesinski <adamlesinski@google.com> Fix assumption about DynamicRefTable in aapt

Packages without any resources should not expect to have
a DynamicRefTable.

Bug:16895517
Bug:17056720
Change-Id: Id006f6bdbf08f30505f6ba5982bc9d1b09db0f0a
/frameworks/base/libs/androidfw/ResourceTypes.cpp
89147ed84b140d83e144ad9eaa568cc9c6fb514c 15-Aug-2014 Adam Lesinski <adamlesinski@google.com> Merge "Revert "Fix aapt dump for APKs with no resources"" into lmp-dev
18560886cbb7825c1bb034c96e5d0cd4dbdbb8ee 15-Aug-2014 Adam Lesinski <adamlesinski@google.com> Revert "Fix aapt dump for APKs with no resources"

This reverts commit 0e475302cd196f45a01a525c49089018b238d4ba.

I'll re-upload this CL with the correct fix in LoadedApk.

Change-Id: I17c6381f8e5907dab9f996f89c5d435b9c08a13a
/frameworks/base/libs/androidfw/ResourceTypes.cpp
4b2d0f20db2e0f9395a0c12ed5d4b6020eb272cb 15-Aug-2014 Adam Lesinski <adamlesinski@google.com> Fix crash in ResStringPool

When a String isn't found in the StringPool,
we should not try to construct a String8 object
from the NULL string.

Bug:15163956
Change-Id: I51e701918b10a72c18a860b8a36dce2afd9c0b82
/frameworks/base/libs/androidfw/ResourceTypes.cpp
e23a91e2bdab06e3c0c64201e88e50ab76c6b74b 14-Aug-2014 Adam Lesinski <adamlesinski@google.com> Fix aapt dump for APKs with no resources

All APKs are expected to have at least one resource table (even if
it is empty). We were missing the creation of an empty DynamicRefTable.

Bug:16895517
Change-Id: I6a6e887f91b3b4bbcc52b3fd2741ef3d05fab1fd
/frameworks/base/libs/androidfw/ResourceTypes.cpp
d7df9d7b38064b81e1b035893001499e79fc3cc0 15-Aug-2014 Adam Lesinski <adamlesinski@google.com> Merge "Fix aapt dump for APKs with no resources" into lmp-dev
8d5667d2a283bc9e35cfe8a7e77c9143c8957004 14-Aug-2014 Adam Lesinski <adamlesinski@google.com> Print xxxhdpi from ResTable_config::toString

Change-Id: I2e1a07649cb498c12023b198d8e50534f9d91840
/frameworks/base/libs/androidfw/ResourceTypes.cpp
ccf25c7bf69eb8c04246e3f79da31b52c2922a80 09-Aug-2014 Adam Lesinski <adamlesinski@google.com> Fix shared library bug in bag attributes

A ResTable_map entry has a name attribute, which
could be a dynamic reference if it comes from
a shared library. It was not being patched with
the correct package id.

Bug:16795890
Change-Id: Ia8df6a943269b2fefb2132c3ed74eb1997d7701b
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
f28d505dc5f72d82cd791a5b9c7be3775eab75e5 26-Jul-2014 Adam Lesinski <adamlesinski@google.com> Ensure the ResTable data is at least the size of a ResTable_header

Change-Id: Ib8d5574bd6a125797a582837987332e66721e84d
/frameworks/base/libs/androidfw/ResourceTypes.cpp
c7400b0ce66e916cf8be239c26cd5acbd15ef745 01-Jul-2014 Narayan Kamath <narayan@google.com> am 8c1c0a68: am 7f319c47: am 1dc550fa: Merge "Fix packing of values at offset 16."

* commit '8c1c0a6881b1507f9ae25d753b64de185a7615b2':
Fix packing of values at offset 16.
8c1c0a6881b1507f9ae25d753b64de185a7615b2 01-Jul-2014 Narayan Kamath <narayan@google.com> am 7f319c47: am 1dc550fa: Merge "Fix packing of values at offset 16."

* commit '7f319c47c8f5e947638eb1e5e73789ff83123bba':
Fix packing of values at offset 16.
b2975916224caecfc2fbb84e71ebd625ce6eeb1c 30-Jun-2014 Narayan Kamath <narayan@google.com> Fix packing of values at offset 16.

Our bitmask for setting the highest bit to 0 for
0b11100000 (0xef) instead of 0b01111111 (0x7f) so
we would end up setting bit 5 of each offset to
zero. Fix this and expand test coverage by adding
a fake language (tgp) that has this bit set in both
its bytes.

This issue was discovered while adding CTS tests for
"tgl".

Change-Id: Ibb6de03000951c907c252049771039ab7466187a
/frameworks/base/libs/androidfw/ResourceTypes.cpp
70bf06986a90c21137fc4836aa0e56d68a2ab588 24-Jun-2014 Narayan Kamath <narayan@google.com> am b20b0629: am 71dfc7e9: Merge "Memory leak in parsePackage"

* commit 'b20b0629c2ea6a8e1f7bebd0791dd21e545a4605':
Memory leak in parsePackage
5f7ce10c937abf7da6d547ae91bda495dfbc414d 18-Jun-2014 Henrik Baard <henrik.baard@sonymobile.com> Memory leak in parsePackage

The method parsePackage failes to delete some resources
in case of failures.

Added delete of "package" in the cases that was previously
missed.

Change-Id: I183e9ec5864c5ed18bb48410ab41317cb3d96bda
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
961dda77965203da05df2c865d42a1968d622343 10-Jun-2014 Adam Lesinski <adamlesinski@google.com> Creating an empty package should be succesfull

Bug: 15473436
Change-Id: I788deb21a1298281c508429bab635aa713803984
/frameworks/base/libs/androidfw/ResourceTypes.cpp
7322ea7b73000ef50be18d72750624bb1832dec4 14-May-2014 Adam Lesinski <adamlesinski@google.com> Fix potential crash in libandroidfw

A malformed APK may cause a crash if it
encodes its chunk size as a signed number
(MSB set to 1).

Bug:14898892
Change-Id: I342853c2b0859e5be15d712d451323afc367d329
/frameworks/base/libs/androidfw/ResourceTypes.cpp
fab50875b98e8274ac8ee44b38ba42521bbbf1f9 16-Apr-2014 Adam Lesinski <adamlesinski@google.com> Add support for building split APKs

Build multiple APKs, each containing a disjoint subset
of configurations. These can then be loaded into the device
AssetManager and should operate as if they were never split.

Use the idea of building multiple sets of files, where each
set represents an APK. An ApkBuilder can place files
in a set based on its configuration, but you can actually
add directly to a set, in the case of the resources.arsc and
generated AndroidManifest.xml for splits.

Change-Id: Ic65d3f0ac1bbd290185695b9971d425c85ab1de3
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
ecd072161ec57ba8dfb26659511c0f6605601560 27-Mar-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of 22d07464 to master

Change-Id: Ic037261eedd6e224938c960d2b4597590c81ed9d
f5df700e6ce056ebfa322314d970e52d6facc35a 25-Mar-2014 Ashok Bhat <ashok.bhat@arm.com> AArch64: Make frameworks/base code more portable

Changes in this patch include

[x] Use %zu for size_t, %zd for ssize_t

[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)

Change-Id: Id1aaa7894a7d0b85ac7ecd7b2bfd8cc40374261f
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
00adb8685ee996f9d2650d617c8c0e98f13ef406 19-Mar-2014 Mark Salyzyn <salyzyn@google.com> androidfw: resolve 64-bit build issues

- uid_t/gid_t cast to unsigned long
- unused argument warnings
- tab and space requirements

Change-Id: Ib446d8165b9082be02edb55e6b71fd1a03ea3431
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
443dd9313f06ec61abc9fee908f6e693d1091590 12-Feb-2014 Patrik Bannura <patrik.bannura@sonymobile.com> libandroidfw: fix build error for 64-bit

Fixed casting int to pointer in logging code.
Previously ints where printed as pointers and
the %p format specifier was used for convenience
to get hex output. This change uses %x and also
gets rid of the casts.

Change-Id: Ia2539769d245f50c0f3884119f80682defe69d61
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
1f5762e646bed2290934280464832782766ee68e 07-May-2013 Mathias Agopian <mathias@google.com> libutils clean-up

Change-Id: I11ee943da23a66828455a9770fc3c5ceb4bbcaa9
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
81cfb63e9fc6ef72e5b488225fe9b7a43551fc9e 04-Jan-2013 Elliott Hughes <enh@google.com> am d13b23a4: Merge "Revert "fix potential memory leak""

* commit 'd13b23a436075262cc83f7502f7159de24546003':
Revert "fix potential memory leak"
767e1c010c0664fa4bf7e7e32b840af4bbe0b0cf 04-Jan-2013 Elliott Hughes <enh@google.com> am 9aac0c1b: Merge "fix potential memory leak"

* commit '9aac0c1b35ec666a18f320be99e6aa37d0bcf202':
fix potential memory leak
957efcdc7331957df415faf9ab40f8bc08f5bd99 04-Jan-2013 Elliott Hughes <enh@google.com> Revert "fix potential memory leak"

This reverts commit bc268b9014f211910e412a7fda96b6394ff2badc

Change-Id: I07f49bd0cfecc43bc761d2b0635c9915a8e30272
/frameworks/base/libs/androidfw/ResourceTypes.cpp
bc268b9014f211910e412a7fda96b6394ff2badc 21-Dec-2012 Sungmin Choi <sungmin.choi@lge.com> fix potential memory leak

use delete before return

Change-Id: I5449ad90bb6910f057bd825b722c9803a7343c34
/frameworks/base/libs/androidfw/ResourceTypes.cpp
5780e196806b3741786b212866435593990f97ee 13-Dec-2012 Fabrice Di Meglio <fdimeglio@google.com> am 5c0d6f99: am 9de88dad: Merge "Fix bug #7724071 ImageView drawable is not loaded correctly when changing Locale" into jb-mr1.1-dev

* commit '5c0d6f9980ed4684cbeefc28036dd9eeac474375':
Fix bug #7724071 ImageView drawable is not loaded correctly when changing Locale
350993591974a8c7a2eca665f96304d296104789 12-Dec-2012 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #7724071 ImageView drawable is not loaded correctly when changing Locale

aapt is not generating the correct CONFIG_LAYOUTDIR bit when a Drawable has a
LTR and RTL version. It was generating instead the wrong CONFIG_SCREEN_LAYOUT bit.

This was linked to the fact that the layout direction bits are contained into the
screen layout bit.

So now make sure that we are generating the correct CONFIG_LAYOUTDIR bit.

Change-Id: If17c84d31e6c128721ed97ee6711660b131bf941
/frameworks/base/libs/androidfw/ResourceTypes.cpp
be37b5fa2473fd6ee5c1223472b29f212067761d 14-Nov-2012 Kenny Root <kroot@android.com> Merge "Free resources in correct order in ResStringPool::uninit"
58b99bf1d8d203d91a63619a99a8f29911ba58bc 13-Oct-2012 Kenny Root <kroot@google.com> am 82634313: Merge "Reject bad ResXMLTree::setTo calls"

* commit '826343138dfd8666d2263dd82bfdbf657fc1881e':
Reject bad ResXMLTree::setTo calls
32d6aef11abd4660fc764ffa53bd88c7589f2d35 10-Oct-2012 Kenny Root <kroot@google.com> Reject bad ResXMLTree::setTo calls

Bug: http://code.google.com/p/android/issues/detail?id=21838
Change-Id: I1092499906f0cafe5a3c42ab2579edf3763cedb7
/frameworks/base/libs/androidfw/ResourceTypes.cpp
a1d82ff39315c962fbd6839f7a581ffaafe675e4 08-Oct-2012 Chris Dearman <chris@mips.com> Free resources in correct order in ResStringPool::uninit

mOwnedData contains the mHeader data structure

Change-Id: I0ae9ba3a0d18fc3f368c629501fadebce8807198
/frameworks/base/libs/androidfw/ResourceTypes.cpp
8a802dbdabdfd27692c2e38b2c3adafe95566106 05-Sep-2012 Fabrice Di Meglio <fdimeglio@google.com> Use "ldrtl" and "ldltr" config qualifiers for RTL / LTR resources

- we cannot use "rtl" / "ltr" qualifiers as they can conflict with ISO-639 Alpha-3
codespace which uses 3 letters for identifying a language code (and could use either
"rtl" or "ltr" strings for defining a language in the future).

- we are using instead "ldrtl" for RTL and "ldltr" for LTR resources. Those qualifiers
are defined by more than 3 chars and outside of what is defined into ISO-639. They
are also more understandable as "ld" prefix is for "layoutdirection"

Change-Id: Id43e948103707e09bef63ebd54ac1779dde58e72
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
3e2d59146df9e9e325dcc65018bb130b03242bbc 01-May-2012 Jean-Baptiste Queru <jbq@google.com> resolved conflicts for merge of 13c04786 to jb-dev-plus-aosp

Change-Id: Ib7aa5a768f4606beb2a4387811cfed7c00cbc111
39b58ba2b299e1c97e13535aae9add530d942c7b 01-May-2012 Jean-Baptiste Queru <jbq@google.com> resolved conflicts for merge of bc2fb7b9 to jb-dev-plus-aosp

Change-Id: I5386585e473201268c6ed8b05e0a16569d434ea2
5c6dfeb1fb47102ffce415ea7898b33dd1290d54 09-Mar-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6054627: resource matching issue of size qualifiers

Resource matching would incorrectly identify two configs with the
same value as better than.

Change-Id: I7297dcf58fd5a43f1a5ff53bb093eeeb2cad090f
/frameworks/base/libs/androidfw/ResourceTypes.cpp
83c64e6b624a876436d2ef5d2f173b10407e27b4 21-Feb-2012 Mathias Agopian <mathias@google.com> frameworks/base refactoring

create the new libandroidfw from parts of libui and libutils

Change-Id: I1584995616fff5d527a2aba63921b682a6194d58
/frameworks/base/libs/androidfw/ResourceTypes.cpp