History log of /frameworks/base/libs/androidfw/tests/ApkAssets_test.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
bebfcc46a249a70af04bc18490a897888a142fb8 12-Feb-2018 Adam Lesinski <adamlesinski@google.com> Refactor AssetManager

Bug: 64071469
Test: atest CtsContentTestCases
Change-Id: Ia6856157e8813856268fba003e1e591d690cb26e
/frameworks/base/libs/androidfw/tests/ApkAssets_test.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/tests/ApkAssets_test.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/tests/ApkAssets_test.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/tests/ApkAssets_test.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/tests/ApkAssets_test.cpp
50706b6ebc224920bceffa66baa30734de5e27ff 23-Jan-2018 Adam Lesinski <adamlesinski@google.com> Revert "libandroidfw: Improve performance of AssetManager2"

This reverts commit 392132748416719e3df427e6ac8dc11af194342c.
/frameworks/base/libs/androidfw/tests/ApkAssets_test.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/tests/ApkAssets_test.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/tests/ApkAssets_test.cpp
441500b23ffc4f15d1e2e58da55b37efe9d2ffe1 14-Nov-2017 Adam Lesinski <adamlesinski@google.com> libandroidfw: Support loading ApkAssets from a file descriptor

Test: make aapt2_tests
Change-Id: I041f9e9e3d3f6a10684cbd8baa49f4dda7d6dc40
/frameworks/base/libs/androidfw/tests/ApkAssets_test.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/tests/ApkAssets_test.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/tests/ApkAssets_test.cpp
d1ecd7af687bcad0f87c37fe33515ff6c5ea0f1d 23-Jan-2017 Adam Lesinski <adamlesinski@google.com> AssetManager2: Various fixes

- Use FileMaps to open Assets (prevents closing of ApkAssets underlying
zip)
- Implement OpenDir and List methods
- Fix issue where DynamicRefTable wasn't properly constructed

Test: make libandroidfw_tests
Change-Id: Ib21a84e1114d028120744aa3bc1c6eb9d9399fa8
/frameworks/base/libs/androidfw/tests/ApkAssets_test.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/tests/ApkAssets_test.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/tests/ApkAssets_test.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/tests/ApkAssets_test.cpp