History log of /frameworks/base/libs/androidfw/LoadedArsc.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
19c3315ce0ec83c4e7db1ba2eb5fd7ef2a50ccc5 12-Jul-2018 Todd Kennedy <toddke@google.com> Loosen resource file verification

Bug: 77808145
Test: Tried to install corrupt APK prior to the change, install failed
Test: Tried to install corrupt APK after the change, install succeeded
Test: atest CtsAppSecurityHostTestCases:CorruptApkTests
Change-Id: I19a69e52a17c1080beaf2cc575c32f564b1033a3
(cherry picked from commit 28e663cbed28fb6c8c8dec0849e0277daf67651b)
/frameworks/base/libs/androidfw/LoadedArsc.cpp
bebfcc46a249a70af04bc18490a897888a142fb8 12-Feb-2018 Adam Lesinski <adamlesinski@google.com> Refactor AssetManager

Bug: 64071469
Test: atest CtsContentTestCases
Change-Id: Ia6856157e8813856268fba003e1e591d690cb26e
/frameworks/base/libs/androidfw/LoadedArsc.cpp
bde1df21adf264d3398b9f3274f353faa6399008 09-Feb-2018 Adam Lesinski <adamlesinski@google.com> Revert "Replace AssetManager with AssetManager2 implementation"

This reverts commit 1187590da38457809dd368d4901c9c47ac5a6958.

Bug: 73134570
Change-Id: I59b4d714e447478ea124f086356f127f42251fb7
/frameworks/base/libs/androidfw/LoadedArsc.cpp
b8b3a2619435eb226ce13b1792a6ccb1302b3cb2 09-Feb-2018 Adam Lesinski <adamlesinski@google.com> Revert "libandroidfw: Improve performance of AssetManager2"

This reverts commit 88c9959e5b417320bbc2484fab42ab4b12379533.

Bug: 73134570
Change-Id: I012643d2b4212cef5aef68feb4146add34f9ecfc
/frameworks/base/libs/androidfw/LoadedArsc.cpp
dfeb7ceb2afc1f630e7d2afdd9f37ef70386e146 09-Feb-2018 Adam Lesinski <adamlesinski@google.com> Revert "AssetManager2: Allow out of order type/type spec"

This reverts commit 78695c354342bd95ba5f63937b4e789139b50072.

Bug: 73134570
Change-Id: I6acc35372d9071d067d2fb7caa775ee9ba689811
/frameworks/base/libs/androidfw/LoadedArsc.cpp
78695c354342bd95ba5f63937b4e789139b50072 08-Feb-2018 Adam Lesinski <adamlesinski@google.com> AssetManager2: Allow out of order type/type spec

AssetManager2 assumes that RES_TABLE_TYPE_SPEC_TYPEs must immediately
precede their associated RES_TABLE_TYPE_TYPEs. This is not correct.
RES_TABLE_TYPE_SPEC_TYPEs must precede their associated
RES_TABLE_TYPE_TYPEs, but they do not need to immediately precede them.

For example, this is what we currently expect:

RES_TABLE_TYPE_SPEC_TYPE id=1
RES_TABLE_TYPE_TYPE id=1
RES_TABLE_TYPE_SPEC_TYPE id=2
RES_TABLE_TYPE_TYPE id=2

but this is also valid:

RES_TABLE_TYPE_SPEC_TYPE id=1
RES_TABLE_TYPE_SPEC_TYPE id=2
RES_TABLE_TYPE_TYPE id=1
RES_TABLE_TYPE_TYPE id=2

Bug: 73052092
Test: make libandroidfw_tests
Change-Id: I1f3c43760f8108eee24c2c6ed7bc16f70e951c2b
/frameworks/base/libs/androidfw/LoadedArsc.cpp
88c9959e5b417320bbc2484fab42ab4b12379533 09-Jan-2018 Adam Lesinski <adamlesinski@google.com> libandroidfw: Improve performance of AssetManager2

AssetManager2 relied on creating a list of configurations
present in the resource table so as to avoid copying and
converting ResTable_config's from the APK on every
resource retrieval.

ResTable, however, had a better optimization that pruned
the configurations that didn't match the currently set
configuration. This vastly reduced the number of ResTable_configs
to test.

In this CL, AssetManager2 follows suite with this optimization
and only maintains the filtered ResTable_configs, falling back
to the slow path when the configuration is overridden.

Test: mma frameworks/base/libs/androidfw
Test: adb sync system data
Test: adb shell /data/benchmarktest64/libandroidfw_benchmarks/libandroidfw_benchmarks
Change-Id: Ib57b75fbb32e1d310eec146e5a12dfc6de4385f9
/frameworks/base/libs/androidfw/LoadedArsc.cpp
1187590da38457809dd368d4901c9c47ac5a6958 23-Jan-2017 Adam Lesinski <adamlesinski@google.com> Replace AssetManager with AssetManager2 implementation

Test: atest CtsContentTestCases:android.content.res.cts
Test: make libandroidfw_tests
Change-Id: I2bb6d7656d2516d371e83e541ed02f91405f6d94
/frameworks/base/libs/androidfw/LoadedArsc.cpp
f7d01dd7e14e01420c39e7fb8eca3cfa0f5f31b6 26-Jan-2018 Adam Lesinski <adamlesinski@google.com> Revert "Replace AssetManager with AssetManager2 implementation"

This reverts commit dcb3c6559b09ec89771858ec27a787027da9af50.

Bug:72511998
Change-Id: I665966ca109f66f85d8665db388c71ea2303c3b8
/frameworks/base/libs/androidfw/LoadedArsc.cpp
0dd369912a2b46c22d09ddc6ae117fe173e51cb8 26-Jan-2018 Adam Lesinski <adamlesinski@google.com> Revert "libandroidfw: Improve performance of AssetManager2"

This reverts commit 64ee69d0f1f412edee2eb7a0c846deebbfa37ef9.

Bug:72511998
Change-Id: Iab3ce449e60ec2451d391217543528d312089080
/frameworks/base/libs/androidfw/LoadedArsc.cpp
64ee69d0f1f412edee2eb7a0c846deebbfa37ef9 09-Jan-2018 Adam Lesinski <adamlesinski@google.com> libandroidfw: Improve performance of AssetManager2

AssetManager2 relied on creating a list of configurations
present in the resource table so as to avoid copying and
converting ResTable_config's from the APK on every
resource retrieval.

ResTable, however, had a better optimization that pruned
the configurations that didn't match the currently set
configuration. This vastly reduced the number of ResTable_configs
to test.

In this CL, AssetManager2 follows suite with this optimization
and only maintains the filtered ResTable_configs, falling back
to the slow path when the configuration is overridden.

Test: mma frameworks/base/libs/androidfw
Test: adb sync system data
Test: adb shell /data/benchmarktest64/libandroidfw_benchmarks/libandroidfw_benchmarks
Change-Id: I5d46f8b005a37b72750d00bd75f090e7b5a36f60
/frameworks/base/libs/androidfw/LoadedArsc.cpp
dcb3c6559b09ec89771858ec27a787027da9af50 23-Jan-2017 Adam Lesinski <adamlesinski@google.com> Replace AssetManager with AssetManager2 implementation

Test: atest CtsContentTestCases:android.content.res.cts
Test: make libandroidfw_tests
Change-Id: I572eb13c6a4372c7f656f5912821cececd5bf3d4
/frameworks/base/libs/androidfw/LoadedArsc.cpp
7fb38311361390e24d7e43ce1eb220faccd251ff 23-Jan-2018 Adam Lesinski <adamlesinski@google.com> Revert "Replace AssetManager with AssetManager2 implementation"

This reverts commit b20a0ce59f59cb5ec857748e056cc341dbd13b92.
/frameworks/base/libs/androidfw/LoadedArsc.cpp
50706b6ebc224920bceffa66baa30734de5e27ff 23-Jan-2018 Adam Lesinski <adamlesinski@google.com> Revert "libandroidfw: Improve performance of AssetManager2"

This reverts commit 392132748416719e3df427e6ac8dc11af194342c.
/frameworks/base/libs/androidfw/LoadedArsc.cpp
392132748416719e3df427e6ac8dc11af194342c 09-Jan-2018 Adam Lesinski <adamlesinski@google.com> libandroidfw: Improve performance of AssetManager2

AssetManager2 relied on creating a list of configurations
present in the resource table so as to avoid copying and
converting ResTable_config's from the APK on every
resource retrieval.

ResTable, however, had a better optimization that pruned
the configurations that didn't match the currently set
configuration. This vastly reduced the number of ResTable_configs
to test.

In this CL, AssetManager2 follows suite with this optimization
and only maintains the filtered ResTable_configs, falling back
to the slow path when the configuration is overridden.

Test: mma frameworks/base/libs/androidfw
Test: adb sync system data
Test: adb shell /data/benchmarktest64/libandroidfw_benchmarks/libandroidfw_benchmarks
Change-Id: I42d53f703623cf7c3f7cbcf194f5026ff540faf4
/frameworks/base/libs/androidfw/LoadedArsc.cpp
b20a0ce59f59cb5ec857748e056cc341dbd13b92 23-Jan-2017 Adam Lesinski <adamlesinski@google.com> Replace AssetManager with AssetManager2 implementation

Test: Existing CTS tests pass
Test: make libandroidfw_tests
Change-Id: I858f7e1d909c08273b096601136e3f28e15eb5d4
/frameworks/base/libs/androidfw/LoadedArsc.cpp
498f6053dad29d715dd532f5272df12dabccf8c8 29-Nov-2017 Adam Lesinski <adamlesinski@google.com> libandroidfw: Remove pre-verification

This added more up-front cost to loading an APK and didn't provide
a significant benefit to resource retrieval.

Test: make libandroidfw_tests
Change-Id: Idbf993abc433fa8c8950d106c66469b310b66f7f
/frameworks/base/libs/androidfw/LoadedArsc.cpp
73f6f9daf6bb38e49747bd103c97617b3dccddc4 14-Nov-2017 Adam Lesinski <adamlesinski@google.com> libandroidfw: Add SparseEntry support for LoadedArsc

go/o-restable-sparse-entries

Test: make libandroidfw_tests
Change-Id: Ib1a7d1fc69008390eee53a1de04356dc50e05b45
/frameworks/base/libs/androidfw/LoadedArsc.cpp
1a1e9c272459f05c846a03fc15989ff7e492517e 14-Oct-2017 Adam Lesinski <adamlesinski@google.com> AssetManager2: Run ApkAssets that have failed verification

ApkAssets who have failed verification should still run for
compatibility. Not all resources are accessed, and therefore
errors in the APK are not necessarily fatal. However, this means
we must do bounds checks when retrieving resources, which is
slower.

Test: make libandroidfw_tests && $ANDROID_BUILD_TOP/out/host/<host>/nativetest64/libandroidfw_tests/libandroidfw_tests
Test: make libandroidfw_benchmarks && adb sync system && adb sync data && /data/benchmarktest64/libandroidfw_benchmarks/libandroidfw_benchmarks
Change-Id: I4cc926c064bca0491785d82cdac0419d74d7d9b0
/frameworks/base/libs/androidfw/LoadedArsc.cpp
970bd8d2835b05237c4561bd6c12329e26f136b3 25-Sep-2017 Adam Lesinski <adamlesinski@google.com> AssetManager2: Implement IDMAP support

This enables RRO (runtime resource overlays) with AssetManager2

Test: make libandroidfw_tests
Test: out/host/<platform>/nativetest64/libandroidfw_tests/libandroidfw_tests --testdata=frameworks/base/libs/androidfw/tests/data
Change-Id: Id8079104faefbfaa3f4017d8f7ee1a8968f151a2
/frameworks/base/libs/androidfw/LoadedArsc.cpp
33af6c730f9f7fc51f04516c7a22cac82cb9823e 29-Mar-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Parse an ID encoded as a map

ID types should not be encoded as a map. AAPT and AAPT2 emit
IDs as boolean types.

Some apps exist that for some reason have their ID types encoded
as empty maps. This is the case only for the auto generated IDs
from enum values in <attr> tags.

Allow IDs as maps and ignore their content when processing an APK
for optimizing.

Also fixes an issue with expected size of the ResTable_package struct.

Bug: 35861796
Test: tested against the APK in b/35861796
Change-Id: I29a19cd9777bb10bed6766cd42e35e50e098797b
/frameworks/base/libs/androidfw/LoadedArsc.cpp
136fd0764faf7a588b4a1b479d7a8cc6fe18fcc6 03-Mar-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix parsing ResTable_type

ResTable_type's size changes due to it containing
ResTable_config. Make sure we check for the minimum size
required to read it.

Bug: 35861796
Test: Manual (don't have an integration test harness setup yet)
Change-Id: Ifb0cd1d732625f59835c8ed0449adb78129636de
/frameworks/base/libs/androidfw/LoadedArsc.cpp
929d6517dfd338f0d481dbe6587643d5aef27ec6 17-Jan-2017 Adam Lesinski <adamlesinski@google.com> AssetManager2: Add GetResourceId

Add ability to lookup a resource by name.

Test: make libandroidfw_tests
Change-Id: I262ba5ce4c9892458226fbdb44cf21f9877fb92d
/frameworks/base/libs/androidfw/LoadedArsc.cpp
0c40524953f3d36a880f91183302a2ea5c722930 14-Jan-2017 Adam Lesinski <adamlesinski@google.com> AssetManager2: Add other support methods

- Add GetResourceConfigurations()
- Add GetResourceLocales()
- Add ResolveReference()
- Add stub for GetResourceId()
- Change LoadedArsc and ApkAssets factory method to return const

Test: make libandroidfw_tests
Change-Id: Ia797dc9381a523b1a3e7029048a413e544730379
/frameworks/base/libs/androidfw/LoadedArsc.cpp
c6aada9c5789b2777b19c522d3cd5052bbe784a4 14-Jan-2017 Adam Lesinski <adamlesinski@google.com> LoadedArsc: Support feature splits.

Test: make libandroidfw_tests
Change-Id: I278273e688da597f4af86dd55f87750501ef8154
/frameworks/base/libs/androidfw/LoadedArsc.cpp
da431a22da38f9c4085b5d71ed9a9c6122c6a5a6 29-Dec-2016 Adam Lesinski <adamlesinski@google.com> libandroidfw: Add new support for shared libraries

This adds support for shared resource libraries in the new
ResTable/AssetManager implementation.

The dynamic package map encoded in resources.arsc is parsed
and stored with LoadedArsc, and combined to form a resolved table
in AssetManager2.

Benchmarks show that this implementation is an order of magnitude
faster on angler-userdebug (make libandroidfw_benchmarks).

Test: libandroidfw_tests
Change-Id: I57c80248728b63b162bf8269ac9495b53c3e7fa0
/frameworks/base/libs/androidfw/LoadedArsc.cpp
7ad1110ecd6a840fcd2895c62668828a1ca029c6 29-Oct-2016 Adam Lesinski <adamlesinski@google.com> New implementation of AssetManager/ResTable

The multiwindow model and Resources-per-activity
model that came in N puts greater demands on AssetManagers.
They are created whenever window dimensions change, which
can be frequently. There is a need to be able to cheaply
create a new AssetManager for each Activity, which shares
a lot of underlying state.

In order to make the creation of AssetManagers cheap,
we need a new implementation of the native AssetManager
and ResTable to support immutable representations of
APKs. This new data structure/class is ApkAssets.

ApkAssets have the same functionality of an AssetManager, except
that they operate on a single APK, and they do not do any caching.
Once loaded, they are immutable.

ApkAssets will be exposed as a Java object, with its implementation in
native code. The existing Java StringBlock will be owned by ApkAssets,
which means that Strings can be shared across AssetManagers.

ApkAssets can be cached by the ResourcesManager. Creating an AssetManager
requires only a list of ApkAssets and a configuration.

AssetManager2 (named with the suffix '2' for now while transitioning
to the new implementation) caches bags that are accessed.

Since ApkAssets are expected to be kept around longer, they do more validation
of the resource table, which cause slower load times. Measured on an angler-userdebug,
loading the framework assets takes 11ms with ApkAssets, and 2ms with the old
AssetManager implementation.

The tradeoff is that there does not need to be any security checks once an ApkAssets
is loaded, and regular resource retrieval is faster. Measured on an angler-userdebug,
accessing resource (android:string/ok) with many locales takes 18us with AssetManager2,
and 19us with AssetManager (this is per resource, so these add up).

Test: make libandroidfw_tests
Change-Id: Id0e57ee828f17008891fe3741935a9be8830b01d
/frameworks/base/libs/androidfw/LoadedArsc.cpp