summaryrefslogtreecommitdiff
path: root/startop
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2021-01-10 08:36:36 -0800
committerRyan Mitchell <rtmitchell@google.com>2021-02-03 10:38:24 -0800
commit1a48fa659bd877712dee5611524f903fd22aaae8 (patch)
tree44d35bcc4ff6a60128cbe3d3be72be133220a3d3 /startop
parent8155ef9ea1f6b9082b4c65ed7f78bb33185c5838 (diff)
Dependency injection of AssetProviders into ApkAssets
Creates ApkAssets creation methods that allow an AssetsProvider to be specified. During idmap verification and creation, idmap2 currently opens the target package and overlay package several times: 1) When the crc of the package is calculated in idmap2 verify 2) When the manifest of an overlay is parsed 3) When an ApkAssets is opened. Opening large zip files (like framework-res.apk) is slow. If we opened the zip one time as an ApkAssets, the resources.arsc would have to be parsed (which means mmaping/unmapping and touching a lot of resources.arsc pages). This would cause idmap2 to preform unnecessary work just to check the crc of some files. This change allows a ZipAssetsProvider to be created and then moved for the creation of an ApkAssets. The zip file only needs to be opened once and the resources.arsc is not parsed until reading resources is actually necessary. Bug: 172471315 Test: libandroidfw_tests Test: CtsResourcesLoaderTests Change-Id: I940bb2c13844c7f028776a623a9ecef45a4813bf
Diffstat (limited to 'startop')
-rw-r--r--startop/view_compiler/apk_layout_compiler.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/startop/view_compiler/apk_layout_compiler.cc b/startop/view_compiler/apk_layout_compiler.cc
index eaa3e04cc814..5cb0c171e06f 100644
--- a/startop/view_compiler/apk_layout_compiler.cc
+++ b/startop/view_compiler/apk_layout_compiler.cc
@@ -80,7 +80,7 @@ bool CanCompileLayout(ResXMLParser* parser) {
}
namespace {
-void CompileApkAssetsLayouts(const std::unique_ptr<const android::ApkAssets>& assets,
+void CompileApkAssetsLayouts(const std::unique_ptr<android::ApkAssets>& assets,
CompilationTarget target, std::ostream& target_out) {
android::AssetManager2 resources;
resources.SetApkAssets({assets.get()});