History log of /frameworks/base/libs/androidfw/AssetManager.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cc5a731fd725a4687625c93cf8490b63ce99884f 23-Mar-2017 Jason Monk <jmonk@google.com> Remove "Allow persistent changes to the vendor overlay theme"

This reverts commit 2dc804be11444565e3d1d151c2a693db3ade94c0.
It also removes the related calls from UiModeManager.

Fixes: 32721178
Test: make & flash
Change-Id: Id371bccec611155cc6910e46b3277c3d27fc1c79
/frameworks/base/libs/androidfw/AssetManager.cpp
7de2f9c73fbe93bfb7dff3c046cf7a3137599f6c 01-Mar-2017 Jaekyun Seok <jaekyun@google.com> Reinstate codes to enable RRO on system server

Test: building succeeded and tested with sailfish
Bug: 35742444
Change-Id: I99d0f1d097525d3eb46255d6cf823f6ae2a02385
/frameworks/base/libs/androidfw/AssetManager.cpp
2e0d0f311100d8e0bb40d7d60b8498237f011f0c 02-Jun-2016 Mårten Kongstad <marten.kongstad@sonymobile.com> OMS: integrate OverlayManagerService into framework

Hand over ownership of overlays to OverlayManagerService.

Changes to a package's overlays are propagated using the activity life
cycle. Affected activities will be recreated as needed. This provides a
well-defined point to modify an application's assets while the
application is paused.

Consolidate how overlays targeting the system and overlays targeting
regular applications are handled. Previously, system overlays were
handled as a special case. Now, everything is handled identically. As a
side effect, the call to idmap --scan during Zygote boot has become
obsolete and is removed.

Information on what overlays to use is recorded in
ApplicationInfo.resourceDirs. The PackageManagerService is responsible
for the creation of ApplicationInfo objects. The OverlayManagerService
is responsible for informing the PackageManagerService in advance about
what resourceDirs to use.

When launching an application, the ApplicationInfo is already populated
with up-to-date information about overlays.

When enabling or disabling an overlay for a running application, the
OverlayManagerService first notifies the PackageManagerService about the
updated resourceDirs. It then tells the ActivityManagerService to push
the new ApplicationInfo object to the application's ActivityThread.
Finally the application requests its ResourcesManager to create new
ResourcesImpl objects based on the updated paths.

Change-Id: Ib8afa05ccab4e2db558f89ce4423983c086bb61a
Co-authored-by: Martin Wallgren <martin.wallgren@sonymobile.com>
Signed-off-by: Zoran Jovanovic <zoran.jovanovic@sonymobile.com>
Bug: 31052947
Test: run tests from 'OMS: tests for OverlayManagerService'
/frameworks/base/libs/androidfw/AssetManager.cpp
95459806920dec34abb3214ab6e1a9b9213a2a61 23-Feb-2017 Guang Zhu <guangzhu@google.com> Revert "OMS: integrate OverlayManagerService into framework"

Bug: 31052947
Bug: 35697944

This reverts commit 21a3d1ad686dee97b9cf0ed80389ee2ab0d48013.

Change-Id: I2d86931020301524c26cf8c8e80d557c97fdd6c3
/frameworks/base/libs/androidfw/AssetManager.cpp
21a3d1ad686dee97b9cf0ed80389ee2ab0d48013 02-Jun-2016 Mårten Kongstad <marten.kongstad@sonymobile.com> OMS: integrate OverlayManagerService into framework

Hand over ownership of overlays to OverlayManagerService.

Changes to a package's overlays are propagated using the activity life
cycle. Affected activities will be recreated as needed. This provides a
well-defined point to modify an application's assets while the
application is paused.

Consolidate how overlays targeting the system and overlays targeting
regular applications are handled. Previously, system overlays were
handled as a special case. Now, everything is handled identically. As a
side effect, the call to idmap --scan during Zygote boot has become
obsolete and is removed.

Information on what overlays to use is recorded in
ApplicationInfo.resourceDirs. The PackageManagerService is responsible
for the creation of ApplicationInfo objects. The OverlayManagerService
is responsible for informing the PackageManagerService in advance about
what resourceDirs to use.

When launching an application, the ApplicationInfo is already populated
with up-to-date information about overlays.

When enabling or disabling an overlay for a running application, the
OverlayManagerService first notifies the PackageManagerService about the
updated resourceDirs. It then tells the ActivityManagerService to push
the new ApplicationInfo object to the application's ActivityThread.
Finally the application requests its ResourcesManager to create new
ResourcesImpl objects based on the updated paths.

Co-authored-by: Martin Wallgren <martin.wallgren@sonymobile.com>
Signed-off-by: Zoran Jovanovic <zoran.jovanovic@sonymobile.com>
Bug: 31052947
Test: run tests from 'OMS: tests for OverlayManagerService'
Change-Id: Idc96dae6fc075d5373aa055bbf50e919136d7353
/frameworks/base/libs/androidfw/AssetManager.cpp
6bb13da2789b2485a628e4fc077524b430661c82 02-Jun-2016 Mårten Kongstad <marten.kongstad@sonymobile.com> Fix memory leak during idmap creation

Plug a memory leak in AssetManager::createIdmap.

Bug: 31052947
Test: use Valgrind and dummy native app
Change-Id: I83af3a40516ed2d50d5a7c8ee175ed960fde9933
/frameworks/base/libs/androidfw/AssetManager.cpp
2dc804be11444565e3d1d151c2a693db3ade94c0 07-Nov-2016 Jason Monk <jmonk@google.com> Allow persistent changes to the vendor overlay theme

This allows the overlay being used to be changed without a new build
but still will require a reboot to take effect. Should no longer be
needed once hierarchical resources are in place, and can be removed.

Also fix check in fd_utils to point at correct location.

Test: Manual
Bug: 32721178
Change-Id: I2a63aea0c87791c8eb845d735cb1182716c8174d
/frameworks/base/libs/androidfw/AssetManager.cpp
6c8b93cf549165fd13c7439aaeb43cf45624c4a6 02-Nov-2016 neo.chae <neo.chae@lge.com> Merge "Fix idmap leak in zygote process" am: f5ad44b60a am: 4720125a3c am: 3e15d09ed4
am: d3a209399a

Change-Id: I2c7272b5f79e029ac88fa6b6acb598bdf68f28e2
3e15d09ed478bae413616463c1beec5c34a062a0 02-Nov-2016 neo.chae <neo.chae@lge.com> Merge "Fix idmap leak in zygote process" am: f5ad44b60a
am: 4720125a3c

Change-Id: If66e9476583ec50d2dca5a15376a4b84ae2a2885
4720125a3cd16799b0153a7bba9eee5302a66ae3 02-Nov-2016 neo.chae <neo.chae@lge.com> Merge "Fix idmap leak in zygote process"
am: f5ad44b60a

Change-Id: Ia9977c8166f797ad716284eda03076e282a9fde7
6a742a38509693f8b39ee9a5ad2803fca12688bf 31-Oct-2016 neo.chae <neo.chae@lge.com> Fix idmap leak in zygote process

Fix a idmap leak in AssetManager::addSystemOverlays.
And, The fix could also prevent fd leak of idmap.

Test: none

Change-Id: Iff8831e1951a1ca103821f64a612a8b28d2c14e7
Signed-off-by: Hyangseok Chae <neo.chae@lge.com>
/frameworks/base/libs/androidfw/AssetManager.cpp
93bbe47d650b7b5e48d705257c0bdfa086300549 21-Oct-2016 Jakub Adamek <jakuba@google.com> Change name of overlay subdir 'sku'->'theme' am: 54dcaaba4f
am: 6bbb63ad91

Change-Id: I71dfaafbebaa7bd61d182405c734eef1ea7ff1eb
54dcaaba4fa0392c36864f99b9dc1da9c975a100 19-Oct-2016 Jakub Adamek <jakuba@google.com> Change name of overlay subdir 'sku'->'theme'

The name 'sku' does not fit well as we recommend to use the same
value for different SKUs if vendors wish to have the same colors
on those SKUs.

Bug: 32268656
Change-Id: Ib5e5a3386676453dafeb13a6a6bf91f81bb48a11
/frameworks/base/libs/androidfw/AssetManager.cpp
85dd1b859482d593fa724b7646f49819818c0e98 12-Oct-2016 Martin Wallgren <martin.wallgren@sonymobile.com> RRO: Synchronize access to overlays.list am: 0fbb608110 am: dce79f10ba
am: 3970c44547

Change-Id: I4c9eecad4c2d935a1f1840fed6d70685b82b7e65
dce79f10ba59e5c6f8a5a38ccb5075c5907d6d46 12-Oct-2016 Martin Wallgren <martin.wallgren@sonymobile.com> RRO: Synchronize access to overlays.list
am: 0fbb608110

Change-Id: I44a716df3954b6d2d58d7c9784f8b55cf041b10b
0fbb60811076e6fcfd576287b6e6a16ac1a69c44 11-Aug-2015 Martin Wallgren <martin.wallgren@sonymobile.com> RRO: Synchronize access to overlays.list

idmap --scan is executed as a part of the pre-loading in ZygoteInit.
The pre loading is executed in parallel for each supported architecture
(32/64 bit). This will cause a race condition in the creation of the
overlays.list file and the idmap files for the system overlays.

Apply flock on overlays.list to prevent the file from being thrown away
and recreated when it is in use by another Zygote.

Cherry-picked from AOSP.

Bug: 28032298
Test: manual
Change-Id: I51d39f121d207b11181340b68b164b60020f0c61
/frameworks/base/libs/androidfw/AssetManager.cpp
f12af5e90727869d225f169e7f475695da64bf48 11-Aug-2015 Martin Wallgren <martin.wallgren@sonymobile.com> RRO: Synchronize access to overlays.list

idmap --scan is executed as a part of the pre-loading in ZygoteInit.
The pre loading is executed in parallel for each supported architecture
(32/64 bit). This will cause a race condition in the creation of the
overlays.list file and the idmap files for the system overlays.

Apply flock on overlays.list to prevent the file from being thrown away
and recreated when it is in use by another Zygote.

Bug: 28032298

Change-Id: I51d39f121d207b11181340b68b164b60020f0c61
/frameworks/base/libs/androidfw/AssetManager.cpp
09901f3bc90600513cdd7d7d15ae6fe43a1b332c 06-Oct-2016 songjinshi <songjinshi@xiaomi.com> Fix thread race caused double free issue.
am: 5754b41c20

Change-Id: Ic9dd6e9c6d216753d997da99158816682d5464d1
fe90eaf528622d66549432538d24722534ad48fc 04-Oct-2016 Adam Lesinski <adamlesinski@google.com> AssetManager: Remove more methods, fix comments

Remove a few vendor-related methods and fix comments
to no longer reference legacy concepts like vendor.

Change-Id: I61dbe53b6b305d8fb3468423462f5de2925b78bd
Test: dead-code removal, if builds, it works
/frameworks/base/libs/androidfw/AssetManager.cpp
a77685fa59a327b33e7acbcefe35e63243014cbd 04-Oct-2016 Adam Lesinski <adamlesinski@google.com> Remove unused methods from AssetManager.cpp

A lot of the vendor/locale specific code existed pre-1.0
and was reworked into the current system.

Test: refactoring CL, all code except setLocale() was not being executed.
Test: setLocale() change tested manually
Change-Id: Ifb098f9808763a6cf5fb4336e089430adc09e198
/frameworks/base/libs/androidfw/AssetManager.cpp
dbfd183fdc16660a66339edaa4c360c9f5615690 03-Oct-2016 Adam Lesinski <adamlesinski@google.com> Merge "[AssetManager]:Fix thread race caused double free issue." am: 126e022095 am: f48d0b8f19 am: 73b91c63ad
am: 224ffd3cb2

Change-Id: Id06724e9d44464d1599743741d73b5bd9c282ff2
224ffd3cb2b4f1cf031877d7ecba50562b3b9571 03-Oct-2016 Adam Lesinski <adamlesinski@google.com> Merge "[AssetManager]:Fix thread race caused double free issue." am: 126e022095 am: f48d0b8f19
am: 73b91c63ad

Change-Id: I27f5cc6106f0a8f0a58721e1e8ed836144347b6a
5754b41c201a388e4e932b18d285d765d7e63536 08-Sep-2016 songjinshi <songjinshi@xiaomi.com> Fix thread race caused double free issue.

The SharedZip's Asset is not thread-safety,the getResourceTableAsset()
and setResourceTableAsset(Asset* asset) function of the SharedZip is
not sync with a same lock.

Consider the following sequence of events:
Thread A calls setResourceTableAsset(Asset* asset),it will set
mResourceTableAsset = asset; then to calls getBuffer() of the asset.
Thread B calls getResourceTableAsset(),which return mResourceTableAsset,
then to calls getBuffer() of the mResourceTableAsset,the asset and
mResourceTableAsset is same one object.
Thread A to delete mZipInflater in getBuffer().
Thread B to delete mZipInflater in getBuffer().

It will cause crash becuase double delete mZipInflater in getBuffer().

https://code.google.com/p/android/issues/detail?id=211941

Bug:31734545
Change-Id: I5a7d67fdf64c4aa03f505b37a2fa840f4443d158
Signed-off-by: songjinshi <songjinshi@xiaomi.com>
/frameworks/base/libs/androidfw/AssetManager.cpp
1c527915f7c6389c8d3bfa3bf70bde50c64599b9 03-Oct-2016 Jakub Adamek <jakuba@google.com> Change name of overlay subdir property to sku. am: c03d9483f0
am: e60842aba3

Change-Id: Ifda5c5a7fc7eaff49aa2f65671d543e285b7f8a4
c03d9483f0380fb7babfdeb11d6762bc6c8d784c 30-Sep-2016 Jakub Adamek <jakuba@google.com> Change name of overlay subdir property to sku.

Also move the SKU subdirectories directly under /vendor/overlay.

Bug: 31692079
Change-Id: I68c712b13918cc99629534580ee4f77d9e5b3823
/frameworks/base/libs/androidfw/AssetManager.cpp
bfc891c25c039eb296d4318cc5b9f64b180fcbfa 28-Sep-2016 Jakub Adamek <jakuba@google.com> Search for runtime resource overlays in subdir. am: 1c15c63578
am: ff5cb98888

Change-Id: I726b08026ceb250cc95669d3b5a5c35e15bf82e4
1c15c635785c64aee961f895dabd184cc2e9e0b1 23-Sep-2016 Jakub Adamek <jakuba@google.com> Search for runtime resource overlays in subdir.

See go/sku-colors. This changes the directory to search for framework
overlays if the right system property is defined. This allows
OEMs to specify different resources based on device SKUs.

Bug: 31692079
Change-Id: I9cb121b286b7f52aa26de1757fde1f3110cd47fd
/frameworks/base/libs/androidfw/AssetManager.cpp
49921f2c05cff6d4526b5b30f7b8e2d8bbabc069 08-Sep-2016 songjinshi <songjinshi@xiaomi.com> [AssetManager]:Fix thread race caused double free issue.

The SharedZip's Asset is not thread-safety,the getResourceTableAsset()
and setResourceTableAsset(Asset* asset) function of the SharedZip is
not sync with a same lock.

Consider the following sequence of events:
Thread A calls setResourceTableAsset(Asset* asset),it will set
mResourceTableAsset = asset; then to calls getBuffer() of the asset.
Thread B calls getResourceTableAsset(),which return mResourceTableAsset,
then to calls getBuffer() of the mResourceTableAsset,the asset and
mResourceTableAsset is same one object.
Thread A to delete mZipInflater in getBuffer().
Thread B to delete mZipInflater in getBuffer().

It will cause crash becuase double delete mZipInflater in getBuffer().

https://code.google.com/p/android/issues/detail?id=211941

Change-Id: I5a7d67fdf64c4aa03f505b37a2fa840f4443d158
Signed-off-by: songjinshi <songjinshi@xiaomi.com>
/frameworks/base/libs/androidfw/AssetManager.cpp
7e5f96f1a37e51164a594930ecc862a94cc8c231 14-Jun-2016 Roozbeh Pournader <roozbeh@google.com> Move matching Tagalog and Filipino to ResourceTypes.cpp

Previously, if a mix of "fil" and "tl" resources existed in Resources
(from mixing resources from libraries for example), only resources
from one or the other would be chosen, resulting in default resources
getting surprisingly used. Now, we resolve the equivalent languages
at a per-resource levels (breaking ties for the identical code).

Also, previously if both "tl" and "fil" resources were present in
assets, getLocales() could return a list with duplicate locales.
This change removes Filipino duplicates in the return value of
AssetManager::getLocales().

Finally, there was a bug in the replacement of "tl" with "fil" that
considered any locale starting with the letter "tl" to be Tagalog.
This failed in case of various languages, including Klingon ("tlh")
and Tlingit ("tli"). It's now fixed.

Bug: 29073000
Change-Id: I0e8b9ae337ced2e640a2575897948c4c5ca307d3
/frameworks/base/libs/androidfw/AssetManager.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/AssetManager.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/AssetManager.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/AssetManager.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/AssetManager.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/AssetManager.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/AssetManager.cpp
ba3fe56edc1da4dad0d831a1892e7b1c3c20c437 12-Aug-2015 Elliott Hughes <enh@google.com> Lose HAVE_ANDROID_OS from frameworks/base.

Change-Id: I713881fdbaec7cbbb5e7f2f4be6f9b8be3d2ca4e
/frameworks/base/libs/androidfw/AssetManager.cpp
05f648e1d3cbbe31173d9134cda6056c79d5a4a4 04-Aug-2015 Yusuke Sato <yusukes@google.com> Clean up AssetManager::scanAndMergeZipLocked

Now that ZipFileRO::startIteration supports prefix/suffix matching,
we can pass dirName to the function for simpler code and slightly
better performance.

(cherry-pick of c796ad0a8be6df4a3b354690dfe5ce1df8136c09)

Change-Id: I0e2ac58de28020c2af8d8e569a97592b09596185
/frameworks/base/libs/androidfw/AssetManager.cpp
407753c456c1eb2c8556ae7891b6bef43b044e76 16-Jun-2015 Narayan Kamath <narayan@google.com> ZipFileRO: Use precise widths for zip file types.

getEntryInfo crashes on 64-bit devices because "long" types
were being passed int pointers (that pointed to a stack frame)
that were reinterpret_cast'ed to long* (sigh.). To fix this issue
once and for all, use types with explicitly defined widths.

This change also removes some dead invariant checking from
Asset.cpp instead of cleaning it up.

Note that we've introduced a wart in NativeLibraryHelper, where
we need to deal with zlib's uLong type, which is "at least 32 bits
wide".

bug: 21622286

(cherry picked from commit 4600dd053dbdbd4b95f3b11057a1cc55b99f9c77)

Change-Id: I7886cb37a229cc27c625699c80e6a6a6117d2203
/frameworks/base/libs/androidfw/AssetManager.cpp
a2b5067aeef5b2d68a7a2f7b4edc7ee0908b5d5b 03-Dec-2014 Adam Lesinski <adamlesinski@google.com> Merge "RRO: prevent duplicate system overlays"
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
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/AssetManager.cpp
cb7b63d928cd562ea66d10d816056b984f50193a 07-Nov-2014 Mårten Kongstad <marten.kongstad@sonymobile.com> RRO: prevent duplicate system overlays

System overlays, ie overlays with targetPackage="android", were loaded
twice, which caused all sorts of issues. Ensure they are only loaded
once, which will be during Zygote initialization.

Bug: 17765434
Change-Id: Ia5064045c77f713c58fb78adc3942f6af1abdc93
/frameworks/base/libs/androidfw/AssetManager.cpp
30113131fb958850ef92c6a8f7f2aa2ed92a8ffe 07-Nov-2014 Mårten Kongstad <marten.kongstad@sonymobile.com> RRO: reintroduce lost ResTable insert of assets

With the recent introduction of AssetManager::appendPathToResTable,
overlay packages were not properly added to the AssetManager, and once
added, were not properly inserted into the ResTable.

Bug: 17765434
Change-Id: Ie21f227c654c98730f74a687d0e16ee2b80e747e
/frameworks/base/libs/androidfw/AssetManager.cpp
7df3625d5bb28d11cce9ac23429f5e3c6ebac030 16-Jan-2014 Martin Kosiba <mkosiba@google.com> Allow for appending of resources to an AssetManager.

BUG: 11505352
Change-Id: Ifa290580a6dc63c2f471d0bbf5f066db14aed4d7
/frameworks/base/libs/androidfw/AssetManager.cpp
23902f5f4d0d6665d6837d3d085d3c11b5aa1ec0 07-Jul-2014 Narayan Kamath <narayan@google.com> am 10eb3b06: am e0849423: am 501bb0a5: Merge "Fix issue when converting fil->tl."

* commit '10eb3b0665dd7c636af5f0d657512c1a2e309e0c':
Fix issue when converting fil->tl.
fec5106c8ea5791614385c17bd1bf0ecff9afe9a 05-Jul-2014 Narayan Kamath <narayan@google.com> Fix issue when converting fil->tl.

We should call ResourceTable::getLocales directly,
and not AssetManager::getLocales. The latter will convert
"tl" to "fil" so we'll end up thinking we have resources
for "fil" when we don't really have any.

bug: 15873165

Change-Id: I9753e4608aaecede328a40ee1f3ee6b016d0dedc
/frameworks/base/libs/androidfw/AssetManager.cpp
a00144ca898ec23c02d3cc4be0ce1bdfee53faf3 03-Jul-2014 Nick Kralevich <nnk@google.com> resolved conflicts for merge of a8dbd7b4 to master

Change-Id: I90f42546c6d0a8f21af3041e59baf6a226247b1c
e4345dbd2a892f38e62269d94e5ee7002d121bed 26-Jun-2014 Narayan Kamath <narayan@google.com> Fall back to "tl" if "fil" is absent.

For JB-MR1, there was a hack that used "tl" where
we really meant "fil" because ICU didn't have localizations
for "fil". This has now been fixed, and we now support 3 letter
language codes for AAPT so we can use "fil" where required.

For the benefit of apps that need to target older platforms,
we fall back to "tl" if the app has assets for "tl" and the
resource locale is "fil".

See bugs 7291355, 7207176 and 8049507 for more context.

Change-Id: I1ac8502525f99b40f9091d5efd2df33518d47a41
/frameworks/base/libs/androidfw/AssetManager.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/AssetManager.cpp
7efc0eb163e8d07963c354805b6f36010aa74106 17-Jun-2014 Adam Lesinski <adamlesinski@google.com> am f5cb96cf: am 51736de1: am 4c488cca: Merge "[Asset Manager] Fix memory leakage bug"

* commit 'f5cb96cfbbd2a7148b4b337097c94bea3f52d5f3':
[Asset Manager] Fix memory leakage bug
7c57d2337150ab52c148d30d9126f3b99ca951b4 16-Jun-2014 sean_lu <sean_lu@htc.com> [Asset Manager] Fix memory leakage bug

Symptom: memory leakage
Root Cause: new SortedVector but not free it in native cpp
Solution: free the SortedVector
Project: AOSP
Note:

Change-Id: Iab5a7f2e8d8509631301e7231427927d4797c856
/frameworks/base/libs/androidfw/AssetManager.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/AssetManager.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/AssetManager.cpp
d5c8044e7e1f1402fdd4a035690329294ab07b33 12-Feb-2014 Nick Kralevich <nnk@google.com> resolved conflicts for merge of 1cbea39f to master

Change-Id: Ib33484546c6a03cbc4cd96e97d9d785d68e10700
1cbea39fe1740d7d1c3e4aa0e4771a99a56c79ef 12-Feb-2014 Nick Kralevich <nnk@google.com> resolved conflicts for merge of dd3d95f1 to klp-volantis-dev

Change-Id: I96c0f0da852a0b3cf8aef9158678d38aa30f456f
ecbeae74f299f44f9ec4c79ddd885e999d4e1b64 12-Feb-2014 Colin Cross <ccross@android.com> Use size_t* in AssetManager::createIdmap

ResTable::createIdmap takes a size_t*, and the idmap command is
passing in a size_t*, make AssetManager::createIdmap take a
size_t*. Should fix the mac build.

Change-Id: Idc16dedfe2aa7367c75f89a937a8242d494e8f8e
/frameworks/base/libs/androidfw/AssetManager.cpp
d9e385b111ebf811beb0f29178a2fbd4d667509f 11-Feb-2014 Dianne Hackborn <hackbod@google.com> Fix build.

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

Change-Id: I367dc0377bd5b4e59d9d9b68f3506bf1d64aa591
(cherry picked from commit 32bb5fae353b5bb6275e75952e89c514c7369cee)
/frameworks/base/libs/androidfw/AssetManager.cpp
32bb5fae353b5bb6275e75952e89c514c7369cee 11-Feb-2014 Dianne Hackborn <hackbod@google.com> Fix build.

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

Change-Id: I367dc0377bd5b4e59d9d9b68f3506bf1d64aa591
/frameworks/base/libs/androidfw/AssetManager.cpp
47b80be208fcc1d4824bc24959080233a44041db 11-Feb-2014 Dianne Hackborn <hackbod@android.com> am be49403a: am 0cd115e1: am 578087e3: Merge "New command line tool \'idmap\'"

* commit 'be49403a0362c18edaeafe59ac09baac14294dee':
New command line tool 'idmap'
91447d88f2bdf9c2bf8d1a53570efef6172fba74 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.

Change-Id: I899a56a9a182ee6be52b9389d1ae59266f5482e9
/frameworks/base/libs/androidfw/AssetManager.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/AssetManager.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/AssetManager.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/AssetManager.cpp
00b314436f4fdfada4bbf1e79ec12e9fa38aeaf1 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.

Change-Id: If7bfa1f640dddca39b9f26a3ce84081fa7b6e6e3
/frameworks/base/libs/androidfw/AssetManager.cpp
a0c6260705c841f501282e0e337970ca9a00e064 24-Jan-2014 Narayan Kamath <narayan@google.com> AssetManager cookies should be int32_t and not void*.

Cookies are really indices into vectors and arrays, so
they don't need to be void*. We choose int32_t instead
of size_t to allow their width to be well specified.

Change-Id: I319f271bd4f102dee7cb9f00df4c75ea697456f5
/frameworks/base/libs/androidfw/AssetManager.cpp
560566d2915c03bed338fc532ac7f7aa3620cfdf 03-Dec-2013 Narayan Kamath <narayan@google.com> Reimplement ZipFileRO in terms of libziparchive.

This lets us share zip archive processing code with both
the runtime (Art, dalvik) and critical java code
(StrictJarFile).

This change also moves several utility methods to ZipUtils
and dedups code across several zip inflation methods.

One of the side effects of this change is that several
processing loops are now O(n) instead of O(n^2).

bug: 10193060

(cherry picked from commit afd31e08299008fdc5c2813f21b2573f29dc53df)

Change-Id: Iae67e62f1dc6dfc3f43e29bc38e3ffd1cb14d191
/frameworks/base/libs/androidfw/AssetManager.cpp
e1aa223657dd1def8609b377afa86a024bfd4e14 29-Oct-2013 Elliott Hughes <enh@google.com> Re-apply androidfw fixes lost by the directory rearrangement.

Assignment to wrong variable in libs/androidfw/AssetManager.cpp.
https://code.google.com/p/android/issues/detail?id=61560

Missing delete[]s in libs/androidfw/ObbFile.cpp.
https://code.google.com/p/android/issues/detail?id=61549

Change-Id: I24e6867284d70a7793d78e62d1a836cbee310fb0
/frameworks/base/libs/androidfw/AssetManager.cpp
16c4d154dca43c662571129af31b27433b919a32 24-Jan-2014 Adam Lesinski <adamlesinski@google.com> Revert "move libandroidfw to frameworks/native"

This reverts commit 84b6292c33d71b5739828d08aa8101d1954577f2.
/frameworks/base/libs/androidfw/AssetManager.cpp
745d4efc8369d255341d810790132660e33d3b61 27-Jan-2014 Narayan Kamath <narayan@google.com> AssetManager cookies should be int32_t and not void*.

Cookies are really indices into vectors and arrays, so
they don't need to be void*. We choose int32_t instead
of size_t to allow their width to be well specified.

(cherry picked from commit ebfdd0f467e39c3af8d92cade78263935340acb7)
(cherry picked from commit a7fa2e592e2e579e5acdb903dba83fc074ebc215)
(cherry picked from commit a9d5701b034ed2d9771b3f0943e1add00741d7cd)

Change-Id: I2aed3db568b6fdc487bf99e2c5dd123206736fda
/frameworks/base/libs/androidfw/AssetManager.cpp
afd31e08299008fdc5c2813f21b2573f29dc53df 03-Dec-2013 Narayan Kamath <narayan@google.com> Reimplement ZipFileRO in terms of libziparchive.

This lets us share zip archive processing code with both
the runtime (Art, dalvik) and critical java code
(StrictJarFile).

This change also moves several utility methods to ZipUtils
and dedups code across several zip inflation methods.

One of the side effects of this change is that several
processing loops are now O(n) instead of O(n^2).

bug: 10193060

Change-Id: I3c7188496837a47246c4f342e45485a70fef3169
/frameworks/base/libs/androidfw/AssetManager.cpp
dbccd44a638ae8705a5b14bff8b2dd74abc26045 22-Nov-2013 The Android Open Source Project <initial-contribution@android.com> Merge commit 'b873a17ce7be0a9771c24999adca6964431728f6' into HEAD

Change-Id: I938755073e70602cc8f51ce9bd420fdcf870cecd
c367d48c55e5a3fa0df14fd62889e4bb6b63cb01 29-Oct-2013 Elliott Hughes <enh@google.com> Fix a variety of small publicly-reported bugs.

Possible NULL dereference in cmds/bootanimation/BootAnimation.cpp.
https://code.google.com/p/android/issues/detail?id=61556

Missing fclose in core/jni/android_os_Debug.cpp.
https://code.google.com/p/android/issues/detail?id=61546

Bad loop guards in core/jni/android_util_Process.cpp.
https://code.google.com/p/android/issues/detail?id=61557

Assignment to wrong variable in libs/androidfw/AssetManager.cpp.
https://code.google.com/p/android/issues/detail?id=61560

Missing delete[]s in libs/androidfw/ObbFile.cpp.
https://code.google.com/p/android/issues/detail?id=61549

Leaks on error in tools/aapt/Images.cpp.
https://code.google.com/p/android/issues/detail?id=61552

Two missing fclose calls in tools/aapt/Resource.cpp.
https://code.google.com/p/android/issues/detail?id=61553

Missing fclose in tools/aidl/aidl.cpp.
https://code.google.com/p/android/issues/detail?id=61554

Change-Id: I5820f3824e72d07a9acb776cf0af3e7443f5694a
/frameworks/base/libs/androidfw/AssetManager.cpp
84b6292c33d71b5739828d08aa8101d1954577f2 03-Oct-2013 Mike Lockwood <lockwood@google.com> move libandroidfw to frameworks/native

Change-Id: Ic5b8a2742c7141156ab0f00ca29097bfe92bce60
/frameworks/base/libs/androidfw/AssetManager.cpp
1f5762e646bed2290934280464832782766ee68e 07-May-2013 Mathias Agopian <mathias@google.com> libutils clean-up

Change-Id: I11ee943da23a66828455a9770fc3c5ceb4bbcaa9
/frameworks/base/libs/androidfw/AssetManager.cpp
c51d050f1bc2c393707f7c5e1f6906169ace7497 16-Apr-2013 Dianne Hackborn <hackbod@google.com> Maybe fix issue #8620910: Win_sdk build failed and unable to create...

...the sdk platform repo

Change-Id: Ib6cd7c0dfb9b6217ae79af3e2ac25fe0442996e3
/frameworks/base/libs/androidfw/AssetManager.cpp
f7be4800df28d7cb6a96003046bf90245e7054ab 12-Apr-2013 Dianne Hackborn <hackbod@google.com> Add new resources trace, also trace apk dex loading.

Change-Id: Ia48566efb21ee018659bd976ddb3a0f4997b9a3a
/frameworks/base/libs/androidfw/AssetManager.cpp
69a3ce1eb1af3129056f7da95a491da0280019b5 05-Aug-2012 Mathias Agopian <mathias@google.com> libutils cleanup

Change-Id: Ic069539338ba4097dba9399904f02bbd0296c20e
/frameworks/base/libs/androidfw/AssetManager.cpp
a982dc05d7ca919c07f50e446549ef9dceadf6bd 23-Mar-2012 Colin Cross <ccross@android.com> frameworks/base: move Zip* from libandroidfw to libutils

ZipUtils is needed by build/tools, move it from libandroidfw
(frameworks/base) to libutils (frameworks/native).

Change-Id: I2b4b7adcdf68eb25ee7cba5dd3b69eadf0523af3
/frameworks/base/libs/androidfw/AssetManager.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/AssetManager.cpp