From 2ae6ed593dbc381a2616b472cd5795f86e604a6f Mon Sep 17 00:00:00 2001 From: Jeremy Meyer Date: Wed, 13 Sep 2023 12:39:53 -0700 Subject: Make resource multilocale depend on default attribute Change-Id: I8ea32c3eee94435c4e2b6e6e1e09d30db50f268a Test: Manual and automatic Fixes: 117306409 --- libs/androidfw/AssetManager2.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libs/androidfw/AssetManager2.cpp') diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp index 7f226939ffaa..d056248273b2 100644 --- a/libs/androidfw/AssetManager2.cpp +++ b/libs/androidfw/AssetManager2.cpp @@ -785,7 +785,7 @@ base::expected AssetManager2::FindEntry( has_locale = true; } - // if we don't have a result yet + // if we don't have a result yet if (!final_result || // or this config is better before the locale than the existing result result->config.isBetterThanBeforeLocale(final_result->config, desired_config) || @@ -863,9 +863,12 @@ base::expected AssetManager2::FindEntryInternal( // We can skip calling ResTable_config::match() if the caller does not care for the // configuration to match or if we're using the list of types that have already had their - // configuration matched. + // configuration matched. The exception to this is when the user has multiple locales set + // because the filtered list will then have values from multiple locales and we will need to + // call match() to make sure the current entry matches the config we are currently checking. const ResTable_config& this_config = type_entry->config; - if (!(use_filtered || ignore_configuration || this_config.match(desired_config))) { + if (!((use_filtered && (configurations_.size() == 1)) + || ignore_configuration || this_config.match(desired_config))) { continue; } -- cgit v1.2.3-59-g8ed1b