diff options
author | 2024-02-13 21:42:21 +0000 | |
---|---|---|
committer | 2024-02-13 22:27:17 +0000 | |
commit | 7b43333a26c7588a8d7d2f7ea0f46d9b107ffdaa (patch) | |
tree | b043fa2065a9e52d90e13e6286ebec2fd6cce518 /libs/androidfw/AssetManager2.cpp | |
parent | d38bd5180b2e39c48a5e3ffd1ea420a747a26d17 (diff) |
Revert^2 "[res] Don't recalculate configuration twice on init"
This reverts commit d38bd5180b2e39c48a5e3ffd1ea420a747a26d17.
Reason for revert: Forward fix
Bug: 282215580
Bug: 324939476
Change-Id: Ia919e3a7e7188900e4e98c82d3b3f295fb51ca39
Diffstat (limited to 'libs/androidfw/AssetManager2.cpp')
-rw-r--r-- | libs/androidfw/AssetManager2.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp index 8748dab581bb..46f636e2ae7f 100644 --- a/libs/androidfw/AssetManager2.cpp +++ b/libs/androidfw/AssetManager2.cpp @@ -117,6 +117,10 @@ bool AssetManager2::SetApkAssets(ApkAssetsList apk_assets, bool invalidate_cache return true; } +void AssetManager2::PresetApkAssets(ApkAssetsList apk_assets) { + BuildDynamicRefTable(apk_assets); +} + bool AssetManager2::SetApkAssets(std::initializer_list<ApkAssetsPtr> apk_assets, bool invalidate_caches) { return SetApkAssets(ApkAssetsList(apk_assets.begin(), apk_assets.size()), invalidate_caches); @@ -432,13 +436,18 @@ bool AssetManager2::ContainsAllocatedTable() const { return false; } -void AssetManager2::SetConfigurations(std::vector<ResTable_config> configurations) { +void AssetManager2::SetConfigurations(std::vector<ResTable_config> configurations, + bool force_refresh) { int diff = 0; - if (configurations_.size() != configurations.size()) { + if (force_refresh) { diff = -1; } else { - for (int i = 0; i < configurations_.size(); i++) { - diff |= configurations_[i].diff(configurations[i]); + if (configurations_.size() != configurations.size()) { + diff = -1; + } else { + for (int i = 0; i < configurations_.size(); i++) { + diff |= configurations_[i].diff(configurations[i]); + } } } configurations_ = std::move(configurations); @@ -775,8 +784,7 @@ base::expected<FindEntryResult, NullOrIOError> AssetManager2::FindEntry( bool has_locale = false; if (result->config.locale == 0) { if (default_locale_ != 0) { - ResTable_config conf; - conf.locale = default_locale_; + ResTable_config conf = {.locale = default_locale_}; // Since we know conf has a locale and only a locale, match will tell us if that locale // matches has_locale = conf.match(config); |