History log of /frameworks/base/libs/androidfw/ResourceTypes.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
25f48886b2bc2f4edc65d80ff836561853b7ed50 14-Jun-2016 Adam Lesinski <adamlesinski@google.com> ResourcesManager: Allow managed addition of library asset paths

This allows WebView to add itself to the ResourcesManager and
remain their even after configuration changes and multi-window
changes.

Bug:29112218
Change-Id: I2cb131ae2c61fb58c48babafdd46c1882be96aa9
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
666b6fbba15dec2a29a40c11ddb3aa590eb9d1b0 21-Apr-2016 Adam Lesinski <adamlesinski@google.com> Fix order of operation issue with ResStringPool

Due to ! taking precedence over bitwise &, the condition for
checking non-null terminated string blocks is incorrect.

Adds parentheses for the correct behavior.

Bug:28288210
Change-Id: Ie31fa239e5f869e6bb28deb6ae190f41f1aa4d92
/frameworks/base/libs/androidfw/ResourceTypes.cpp
b7e1ce07756aaca829828c2053eca0d66dd4d440 12-Apr-2016 Adam Lesinski <adamlesinski@google.com> Optimize ResTable::getLocales() to improve bindApplication performance

Change from linear searching for uniqueness to binary search.

Bug:27198799
Change-Id: I1ccb6e93cc213810848f07d631d9d8de7c719803
/frameworks/base/libs/androidfw/ResourceTypes.cpp
98e80076c6c4e31f04c580c8774eeea4036d32c1 15-Apr-2016 Tim Murray <timmurray@google.com> Revert "Optimize ResTable::getLocales() to improve bindApplication performance"

This reverts commit 5520581b5f043fb858b5b2044ff33ad8545a6d38.

bug 28189634

Change-Id: I2d2b859f6d9bd44434fa901cce990583f514980c
/frameworks/base/libs/androidfw/ResourceTypes.cpp
5520581b5f043fb858b5b2044ff33ad8545a6d38 12-Apr-2016 Adam Lesinski <adamlesinski@google.com> Optimize ResTable::getLocales() to improve bindApplication performance

Change from linear searching for uniqueness to binary search.

Bug:27198799
Change-Id: Ifa4672929df286c4693ab1f77716f08945941b0c
/frameworks/base/libs/androidfw/ResourceTypes.cpp
1d7172e598d428581d6fc38b57a454cec66eda5a 31-Mar-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Suppress warnings from libandroidfw when built for host

Certain error cases are expected (like not finding a package) when
using libandroidfw on the host side for AAPT2. Suppress those warnings
and let AAPT2 handle error cases.

Change-Id: I3de97128686c03c89c5b99559bf46d4f2f1dfe4d
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
4de4596ac1175908657f29cdc2a56529f2ca4b25 12-Feb-2016 Roozbeh Pournader <roozbeh@google.com> Fix locale matching algorithm for resources

We get ResTables two different ways: one is from AAPT, another from
settings-based requests from the Java side. In the settings-based
requests, localeScript will be autocomputed, but for AAPT-filled
tables (especially if they come from older versions of AAPT), we need
to compute the script.

Previously, locales that came from packages were incorrectly assumed
to have "undeterminable" scripts, rather than "undetermined" scripts.
This led to us mistakenly falling back to the old logic of requiring
the locales' countries to match, rather than just looking at computed
scripts.

Bug: 27157452

Change-Id: Id7e346d3ecfb17273ffb63de5bcb4849a6eafbbd
/frameworks/base/libs/androidfw/ResourceTypes.cpp
27953c349fa1c46698f57ae5f26339560c21adac 01-Feb-2016 Roozbeh Pournader <roozbeh@google.com> Make default resources a better match for en-US requests

When locale fallback landed, resources which specified an 'English'
locale started to be considered a better match for en-US, even though
traditionally, apps tend to ship US English resources under their
default locale.

This fixes that, and makes en-US requests match default locales.

Bug: 26756573
Bug: 26789680
Bug: 26803868
Change-Id: I460c276bfc6ddba0439dcdf87497a0aece0fa05d
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
4c807349bdd46ff818edfed63e9193a1a5b67a9f 13-Aug-2015 Elliott Hughes <enh@google.com> am 344d347a: am 39669d7f: am 6fdc6333: Merge "Lose HAVE_ANDROID_OS from frameworks/base."

* commit '344d347af22705aa2fa80602d27a5682a72b5f69':
Lose HAVE_ANDROID_OS from frameworks/base.
344d347af22705aa2fa80602d27a5682a72b5f69 13-Aug-2015 Elliott Hughes <enh@google.com> am 39669d7f: am 6fdc6333: Merge "Lose HAVE_ANDROID_OS from frameworks/base."

* commit '39669d7f6b8fedef3468ab3d417c93a21df528af':
Lose HAVE_ANDROID_OS from frameworks/base.
ba3fe56edc1da4dad0d831a1892e7b1c3c20c437 12-Aug-2015 Elliott Hughes <enh@google.com> Lose HAVE_ANDROID_OS from frameworks/base.

Change-Id: I713881fdbaec7cbbb5e7f2f4be6f9b8be3d2ca4e
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
1db1b5821f6819a602f2dda5950d12b6f6183c36 30-Jul-2015 Elliott Hughes <enh@google.com> am 204b4157: am f8a6a2f6: Merge "Use _WIN32 rather than HAVE_WINSOCK."

* commit '204b4157b3fdbeea8859c4ad0e29be18d74e6f5f':
Use _WIN32 rather than HAVE_WINSOCK.
59cbe8d10750a0577c3ea999b2dd90bf0a05ffe6 30-Jul-2015 Elliott Hughes <enh@google.com> Use _WIN32 rather than HAVE_WINSOCK.

Change-Id: I0821d2af8473c359e8b73aec455000cb7c42f690
/frameworks/base/libs/androidfw/ResourceTypes.cpp
5b0f1be0a23011416697efaa7e9c050e466c44f5 28-Jul-2015 Adam Lesinski <adamlesinski@google.com> AAPT: Fix printing of resource configurations

Print out proper, copied configuration. We add fields to ResTable_config
and if we don't copy and fill in defaults when reading old configurations,
we end up with garbage values. This can potentially cause a crash as well.

Bug:22773426
Change-Id: I64f5ebe73ee72453bcdad3a19e48f8e7ad58e9c2
/frameworks/base/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
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.
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/libs/androidfw/ResourceTypes.cpp
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/libs/androidfw/ResourceTypes.cpp
6521a1b7430e7b3298633236645e2c0b5fd56c00 12-Mar-2015 Vishwath Mohan <vishwath@google.com> Enforce null-termination in ResStringPool::stringAt

Rejects any non null-terminated string that a caller asks
ResStringPool::stringAt for, returning NULL instead.

The rationale for returning NULL rather than amending the string to add
a null-terminator is that conformant APK files will have all their
strings null-terminated anyway, and that this is a possible signal of a
malformed package.

Bug: 15288069
Change-Id: I370937b92f2cadf67fbd54203cbc7d1494be969f
/frameworks/base/libs/androidfw/ResourceTypes.cpp
6a2c23dc1bb17b3a2819a33dc6af77b293de1aae 10-Mar-2015 Vishwath Mohan <vishwath@google.com> Prevent integer overflow in ResourceTypes

Adds checks to 2 malloc() calls to ensure that the finally allocated
buffer size is not vulnerable to integer overflows. Also includes a
sanity check on the upper bound for type_info.numEntries before each
call.

Bug: 15171384
Change-Id: Ifdf0276bcca7e3d93da7c3577b9486d3c03a9d03
/frameworks/base/libs/androidfw/ResourceTypes.cpp
43a88535df62b8507717f796df6e46103c4bff95 20-Jan-2015 Adam Lesinski <adamlesinski@google.com> am d9bd0886: am aee7225e: Merge "Process base APK" into lmp-mr1-dev automerge: 554a6f5

* commit 'd9bd08864eaf9d8847d974eadb81806b9e086a2d':
Process base APK
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/libs/androidfw/ResourceTypes.cpp
7e74da3172cb175dd1fe4e1ffb48d8f7914225ca 05-Dec-2014 Adam Lesinski <adamlesinski@google.com> am e97908d3: Merge commit \'0953ab27\' into manualmerge

* commit 'e97908d32ee8ea80138d085260a0eac93841c722':
AAPT: Move private attrs to new type for framework
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/libs/androidfw/ResourceTypes.cpp
625fa573b4cea5c5ee86f79ef76f16545935507e 03-Dec-2014 Adam Lesinski <adamlesinski@google.com> am 9438ad15: am e580d661: am e89a2865: Merge changes If2c7e09f,Ie21f227c

* commit '9438ad1599716176fb6c593e77a2e93b265bbcb5':
RRO idmap: pad with 0xffffffff, not 0x00000000
RRO: reintroduce lost ResTable insert of assets
9438ad1599716176fb6c593e77a2e93b265bbcb5 03-Dec-2014 Adam Lesinski <adamlesinski@google.com> am e580d661: am e89a2865: Merge changes If2c7e09f,Ie21f227c

* commit 'e580d6617f67a1db5eff7ffe5450684cfc7e1a2b':
RRO idmap: pad with 0xffffffff, not 0x00000000
RRO: reintroduce lost ResTable insert of assets
e89a286541e242ad96705fcdd1fe2c6a9eafb4a0 02-Dec-2014 Adam Lesinski <adamlesinski@google.com> Merge changes If2c7e09f,Ie21f227c

* changes:
RRO idmap: pad with 0xffffffff, not 0x00000000
RRO: reintroduce lost ResTable insert of assets
476edb57012260990e19fe363e6433488518916a 22-Nov-2014 Elliott Hughes <enh@google.com> am ee46d162: am 08e2fd72: am ff4dd15c: Merge "We HAVE_LITTLE_ENDIAN."

* commit 'ee46d1621f817d626e8dd42e9ffe7051f4a829eb':
We HAVE_LITTLE_ENDIAN.
ee46d1621f817d626e8dd42e9ffe7051f4a829eb 22-Nov-2014 Elliott Hughes <enh@google.com> am 08e2fd72: am ff4dd15c: Merge "We HAVE_LITTLE_ENDIAN."

* commit '08e2fd7238c50b5d06af41bc944ee08acb023d51':
We HAVE_LITTLE_ENDIAN.
9d074a1fb727b7b4990cd0501e4661596e828c40 22-Nov-2014 Elliott Hughes <enh@google.com> We HAVE_LITTLE_ENDIAN.

Change-Id: I5b5d0ef3f91fe84d629d2ddac436bd22019edfd4
/frameworks/base/libs/androidfw/ResourceTypes.cpp
d97237071d503e2ca7104237b996edaa369b6f6d 17-Nov-2014 Adam Lesinski <adamlesinski@google.com> am 11bdd5b1: Merge commit \'06d8b7b8\' into manualmerge

* commit '11bdd5b10b5f921b657283fa94463263171218d5':
Implement back-tracking when searching for attributes in XML or resource bag
11bdd5b10b5f921b657283fa94463263171218d5 17-Nov-2014 Adam Lesinski <adamlesinski@google.com> Merge commit '06d8b7b8' into manualmerge

Conflicts:
core/jni/android_util_AssetManager.cpp

Change-Id: I77b72d0d3ec8184ccd97419e4c76b7d55b1a52ca
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
c6dcf1fd67946bcc7b043c164e278fc1ff112e1d 09-Nov-2014 Andreas Gampe <agampe@google.com> am 5bbb52e8: am 189bf056: Merge "Frameworks/base: Fix more warnings"

* commit '5bbb52e8a4242efeea27921ac3e38cf6f9c56162':
Frameworks/base: Fix more warnings
5bbb52e8a4242efeea27921ac3e38cf6f9c56162 09-Nov-2014 Andreas Gampe <agampe@google.com> am 189bf056: Merge "Frameworks/base: Fix more warnings"

* commit '189bf05616b854f0319c7329a96e63ad374fd6c0':
Frameworks/base: Fix more warnings
25df5fba3afff403c749bab7d1d5652c3b929e06 08-Nov-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Fix more warnings

Exposed by switching the target to Clang, and GCC 4.9 used by
MIPS.

Change-Id: Icb79285ab2306c39c2d381e53ea2e643ee2d2947
/frameworks/base/libs/androidfw/ResourceTypes.cpp
1c0668a3f809fcbb6e499b9c7866b5f75af42479 08-Nov-2014 Andreas Gampe <agampe@google.com> am 83892ecb: Merge "resolved conflicts for merge of 487ae9b8 to lmp-mr1-dev-plus-aosp" into lmp-mr1-dev-plus-aosp

* commit '83892ecb5c38f6e8a216e1596cd6a16bf7bd6a55':
Frameworks/base: Wall Werror in libs/androidfw
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/libs/androidfw/ResourceTypes.cpp
96198ebae8deab14b434645f628213db492abdbc 07-Nov-2014 Mårten Kongstad <marten.kongstad@sonymobile.com> RRO idmap: pad with 0xffffffff, not 0x00000000

In the new idmap format (version 0x1), 0x00000000 no longer represents a
non-existing entry: 0xffffffff should be used instead.

Bug: 17765434
Change-Id: If2c7e09feba2224eeafe88fd9230e6392d81b9a7
/frameworks/base/libs/androidfw/ResourceTypes.cpp
1adf32060663404931289a112983260f17affcd2 05-Nov-2014 Adam Lesinski <adamlesinski@google.com> am 8491c4ea: Merge "Merge commit \'fb96e54\' into manualmerge" into lmp-mr1-dev-plus-aosp

* commit '8491c4ead7dba5cfd406cf99a511fc1dce07cc4d':
Add error checking to aapt for split generation
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
24655f37edd8c01efe407f1f00cf63ebdef9d71a 04-Nov-2014 Adam Lesinski <adamlesinski@google.com> am 3fd34002: Merge commit \'78be0498\' into manualmerge

* commit '3fd340028fc24198edb23ddf5eb5a0a100bab745':
Fix issues that will be present in C++11
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
f2ae40739a8aa5b4a48427685a66292c930f6fa0 31-Oct-2014 Alan Viverette <alanv@google.com> am 9a77c8a2: am 3c5cc234: am 674a3a21: Merge "Distinguish unspecified and explicit null values in resources" into lmp-mr1-dev

* commit '9a77c8a279bfe3293295ed77c775ea29b88b2916':
Distinguish unspecified and explicit null values in resources
9a77c8a279bfe3293295ed77c775ea29b88b2916 31-Oct-2014 Alan Viverette <alanv@google.com> am 3c5cc234: am 674a3a21: Merge "Distinguish unspecified and explicit null values in resources" into lmp-mr1-dev

* commit '3c5cc234eeef4a08ad7b00b4e869a1e47cf14ab3':
Distinguish unspecified and explicit null values in resources
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
c34a7c9ca2aa6974f18d52edc7a9921c26325ac1 11-Oct-2014 Adam Lesinski <adamlesinski@google.com> am 97ce1a6a: am 983b668b: am be003a35: am f23e3ea6: am aeef612f: Merge "Search all packages for a given type string when looking up resources by name" into lmp-dev

* commit '97ce1a6a23bdb4213303384c6cf73b43cce6aa8f':
Search all packages for a given type string when looking up resources by name
97ce1a6a23bdb4213303384c6cf73b43cce6aa8f 10-Oct-2014 Adam Lesinski <adamlesinski@google.com> am 983b668b: am be003a35: am f23e3ea6: am aeef612f: Merge "Search all packages for a given type string when looking up resources by name" into lmp-dev

* commit '983b668bd8deb58cbd3faabb931c4fb2dd80bf2f':
Search all packages for a given type string when looking up resources by name
73587de15470ecf04cf9c90bb3c1f603afbc7855 09-Oct-2014 Adam Lesinski <adamlesinski@google.com> am aeef612f: Merge "Search all packages for a given type string when looking up resources by name" into lmp-dev

* commit 'aeef612f200b6b5cee214230271e1c3d718151ee':
Search all packages for a given type string when looking up resources by name
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
29e2e5d2d5815e308443f0fffee18dd1b528968b 02-Oct-2014 Adam Powell <adamp@google.com> am e18d68d6: am 4e789dbf: am 8628387c: am b226d295: am c6a06d43: Merge "Revert "Fix issue with using locally defined attrs in a shared lib"" into lmp-dev

* commit 'e18d68d6ab2f5354441162719ec87cb57de83519':
Revert "Fix issue with using locally defined attrs in a shared lib"
e18d68d6ab2f5354441162719ec87cb57de83519 02-Oct-2014 Adam Powell <adamp@google.com> am 4e789dbf: am 8628387c: am b226d295: am c6a06d43: Merge "Revert "Fix issue with using locally defined attrs in a shared lib"" into lmp-dev

* commit '4e789dbff0bc4d9c259a33d6e8ea595c0f4d5f35':
Revert "Fix issue with using locally defined attrs in a shared lib"
e4275843fede011d7ba45cc8cdbf660e86fb6c33 02-Oct-2014 Adam Powell <adamp@google.com> am c6a06d43: Merge "Revert "Fix issue with using locally defined attrs in a shared lib"" into lmp-dev

* commit 'c6a06d437cf2ee7926a01b2f8ee685555bfb3d81':
Revert "Fix issue with using locally defined attrs in a shared lib"
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
8cb387b3b7004c84fdf5eaea1158591e43838f4c 01-Oct-2014 Adam Lesinski <adamlesinski@google.com> am 7923da5f: am 06f380e9: am 95731abe: am bb7b5197: am cd8e7381: Merge "Fix issue with using locally defined attrs in a shared lib" into lmp-dev

* commit '7923da5f5d05f256179e0d926b3b55bbf1d29a8e':
Fix issue with using locally defined attrs in a shared lib
7923da5f5d05f256179e0d926b3b55bbf1d29a8e 01-Oct-2014 Adam Lesinski <adamlesinski@google.com> am 06f380e9: am 95731abe: am bb7b5197: am cd8e7381: Merge "Fix issue with using locally defined attrs in a shared lib" into lmp-dev

* commit '06f380e9efa4698c223077cacaa2df80a704ef96':
Fix issue with using locally defined attrs in a shared lib
d388b1fdde73124eeda35f18e5bcc2ed1c8cefaa 01-Oct-2014 Adam Lesinski <adamlesinski@google.com> am cd8e7381: Merge "Fix issue with using locally defined attrs in a shared lib" into lmp-dev

* commit 'cd8e73817d14798f9d2031ffd301a03a096b7907':
Fix issue with using locally defined attrs in a shared lib
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
3ae4ac218c56d1603c8b3cc27fe788fea9be4c9f 20-Sep-2014 Adam Lesinski <adamlesinski@google.com> am 60040044: am 9ee3ba23: am e7e9ad6d: am 863b1a90: am 19f9d54f: Merge "Fix backwards compat problem with AAPT public attrs" into lmp-dev

* commit '6004004428a93a03657b513d62eeaab660db0896':
Fix backwards compat problem with AAPT public attrs
0fa7511db2ec1e2326938f92262d00f23876307e 19-Sep-2014 Adam Lesinski <adamlesinski@google.com> am 9ee3ba23: am e7e9ad6d: am 863b1a90: am 19f9d54f: Merge "Fix backwards compat problem with AAPT public attrs" into lmp-dev

* commit '9ee3ba23395bd1a13bbfd3fe523ee611a5ca001b':
Fix backwards compat problem with AAPT public attrs
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/libs/androidfw/ResourceTypes.cpp
181f731f9d3692906a1a85d4b077633e4c4d0bb5 09-Sep-2014 Dan Albert <danalbert@google.com> am 167efbdf: Merge "resolved conflicts for merge of 6c585756 to lmp-dev-plus-aosp" into lmp-dev-plus-aosp

* commit '167efbdfcf22143c7383091ba46d59bea9921e0d':
Use char16_t for char things.
20ec4fa2294a91e5ff87839280904aba4a050cf6 09-Sep-2014 Dan Albert <danalbert@google.com> resolved conflicts for merge of 6c585756 to lmp-dev-plus-aosp

Change-Id: I5a25f2bac44ac5efcd7462af91005e09680a1d96
2ffa4aabd76353a907ee89a3e0c6f1961237f257 09-Sep-2014 Dan Albert <danalbert@google.com> Merge "Use char16_t for char things."
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/libs/androidfw/ResourceTypes.cpp
c51cc683bc4618fbdd20572ba63e1051b14ad08c 29-Aug-2014 Adam Lesinski <adamlesinski@google.com> am 056468ef: am 1ec1f85d: am 995c771f: Merge "Fix memory leak in ResTable" into lmp-dev

* commit '056468ef3b9b63d251c4aac867ae634f813d18cf':
Fix memory leak in ResTable
1be18d56a1a74c8ef7882ad4cc04aa3a98736289 29-Aug-2014 Adam Lesinski <adamlesinski@google.com> am 9e186ec3: am 60f193fb: am e0cfbb61: Merge "Stamp platform version code into app Apks" into lmp-dev

* commit '9e186ec3a0e87e612786b827c04b6c6e1b507196':
Stamp platform version code into app Apks
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
46a807f4eb354a9cdda8dfbcccc1d90c94e3158f 27-Aug-2014 Torne (Richard Coles) <torne@google.com> Also allow + in stringToFloat.

Some resource files also use a + prefix; allow that as well as -.

Change-Id: I79cf13841849633f8fa49ee7e23698079d890489
/frameworks/base/libs/androidfw/ResourceTypes.cpp
463a7c3add58c4999952919dacfd29ff3430edf6 27-Aug-2014 Torne (Richard Coles) <torne@google.com> Fix stringToFloat test to allow '-'.

Check was incorrectly disallowing negative values; allow '-' as the
first character.

Change-Id: I6002c38b4a5141c3ab3e385c4e5fc8c55d285f82
/frameworks/base/libs/androidfw/ResourceTypes.cpp
795c1789ef6ec929954b1eb607a2af30135ac322 27-Aug-2014 Deepanshu Gupta <deepanshu@google.com> Merge "Fix invalid conditional check in ResourceTypes."
71909a62c532628e0332604aaceff1ec30d5ecbd 27-Aug-2014 Deepanshu Gupta <deepanshu@google.com> Fix invalid conditional check in ResourceTypes.

The check was always false. This wasn't really a problem since the regex
check later took care of it. But it's just wrong to leave such mistakes
in the code once they are noticed.

Change-Id: Id3dd602318d8c64d466bd0f102aa3af0a1c80189
/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
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
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.
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