diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2019-11-12 16:22:04 -0800 |
---|---|---|
committer | Ryan Mitchell <rtmitchell@google.com> | 2019-11-13 14:51:14 -0800 |
commit | 73bfe41bab9b06a3d0c4e73c61928982b37b35eb (patch) | |
tree | e1dff38ea774af89ff06e26aa63798132793b9c8 /libs/androidfw/Idmap.cpp | |
parent | 52a3801810fb06e73d1be9874c892fefa6a1bdc2 (diff) |
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
Diffstat (limited to 'libs/androidfw/Idmap.cpp')
-rw-r--r-- | libs/androidfw/Idmap.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
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<const char*>(header_->overlay_path), arraysize(header_->overlay_path)); @@ -264,7 +265,7 @@ std::unique_ptr<const LoadedIdmap> 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<LoadedIdmap> loaded_idmap = std::unique_ptr<LoadedIdmap>( new LoadedIdmap(header, data_header, target_entries, overlay_entries, idmap_string_pool.release())); |