OSDN Git Service

Fix locale matching algorithm for resources
authorRoozbeh Pournader <roozbeh@google.com>
Fri, 12 Feb 2016 01:58:24 +0000 (17:58 -0800)
committerRoozbeh Pournader <roozbeh@google.com>
Fri, 12 Feb 2016 05:18:38 +0000 (05:18 +0000)
commit4de4596ac1175908657f29cdc2a56529f2ca4b25
tree9086b62ab7eebaf7d72f253692f565fbb20c1635
parent7f036f8bce5c2f70b2cbc5e252220909bba69b5d
Fix locale matching algorithm for resources

We get ResTables two different ways: one is from AAPT, another from
settings-based requests from the Java side. In the settings-based
requests, localeScript will be autocomputed, but for AAPT-filled
tables (especially if they come from older versions of AAPT), we need
to compute the script.

Previously, locales that came from packages were incorrectly assumed
to have "undeterminable" scripts, rather than "undetermined" scripts.
This led to us mistakenly falling back to the old logic of requiring
the locales' countries to match, rather than just looking at computed
scripts.

Bug: 27157452

Change-Id: Id7e346d3ecfb17273ffb63de5bcb4849a6eafbbd
libs/androidfw/ResourceTypes.cpp
libs/androidfw/tests/ConfigLocale_test.cpp