From 73bfe41bab9b06a3d0c4e73c61928982b37b35eb Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Tue, 12 Nov 2019 16:22:04 -0800 Subject: Do not look for R.class of overlays Now that RROs are loaded as shared libraries, LoadedApk#makeApplication is attempting to find the onResourcesLoaded method of the overlays. This is a performance hit and causes more memory than necessary to be allocated during application start up. Bug: 143314947 Test: com.android.performance.tests.HermeticMemoryTest Change-Id: I3b8cd22dae83e0164d6678c80279f9fffceb34e6 --- libs/androidfw/Idmap.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'libs/androidfw/Idmap.cpp') diff --git a/libs/androidfw/Idmap.cpp b/libs/androidfw/Idmap.cpp index 2b69c923597f..773353d32d51 100644 --- a/libs/androidfw/Idmap.cpp +++ b/libs/androidfw/Idmap.cpp @@ -44,8 +44,8 @@ static bool compare_overlay_entries(const Idmap_overlay_entry& e1, const uint32_ } OverlayStringPool::OverlayStringPool(const LoadedIdmap* loaded_idmap) - : data_header_(loaded_idmap->data_header_), - idmap_string_pool_(loaded_idmap->string_pool_.get()) { }; + : data_header_(loaded_idmap->data_header_), + idmap_string_pool_(loaded_idmap->string_pool_.get()) { }; OverlayStringPool::~OverlayStringPool() { uninit(); @@ -188,11 +188,12 @@ LoadedIdmap::LoadedIdmap(const Idmap_header* header, const Idmap_data_header* data_header, const Idmap_target_entry* target_entries, const Idmap_overlay_entry* overlay_entries, - ResStringPool* string_pool) : header_(header), - data_header_(data_header), - target_entries_(target_entries), - overlay_entries_(overlay_entries), - string_pool_(string_pool) { + ResStringPool* string_pool) + : header_(header), + data_header_(data_header), + target_entries_(target_entries), + overlay_entries_(overlay_entries), + string_pool_(string_pool) { size_t length = strnlen(reinterpret_cast(header_->overlay_path), arraysize(header_->overlay_path)); @@ -264,7 +265,7 @@ std::unique_ptr LoadedIdmap::Load(const StringPiece& idmap_da } } - // Can't use make_unique because LoadedImpl constructor is private. + // Can't use make_unique because LoadedIdmap constructor is private. std::unique_ptr loaded_idmap = std::unique_ptr( new LoadedIdmap(header, data_header, target_entries, overlay_entries, idmap_string_pool.release())); -- cgit v1.2.3-59-g8ed1b