OSDN Git Service

For locale negotiation, assume English is always supported
authorRoozbeh Pournader <roozbeh@google.com>
Wed, 16 Dec 2015 07:56:11 +0000 (23:56 -0800)
committerRoozbeh Pournader <roozbeh@google.com>
Tue, 5 Jan 2016 22:52:38 +0000 (14:52 -0800)
commitfb9236cb0c7bdad05ad01b722806edde7385b296
tree57f5277ccb8247714ce58da95687f5490038be0b
parentab6fb6fcaf9b2406697971f7464d331b6d1d46b5
For locale negotiation, assume English is always supported

In practice, a lot of apps provide English resources as their default
resources, so assume that English is always supported.

With this change, users can safely set secondary locales after
English in their preferred locale lists. Such settings would help
the apps (and parts of the system that are aware of multiple locales)
consider the user's familiarity with the secondary locale or the
user's preference for glyphs forms in the secondary locale.  This
change makes sure that no app unintentionally switches to such
secondary locales.

Note that this doesn't break from the tradition of previous releases.
Traditionally, if the user had set the system locale to English, they
would get the default resources when the app didn't explicitly
provide English resources. This will continue to be the case where
the user's locale list has English in it before another supported
language. (English will be the first locale in most cases.)

Bug: 26192817
Change-Id: I2c1a003760299157786c1b3f9fb116ce18db3b8c
core/java/android/content/res/Resources.java
core/java/android/util/LocaleList.java
core/tests/coretests/Android.mk
core/tests/coretests/res/values-fa/strings.xml [new file with mode: 0644]
core/tests/coretests/res/values/strings.xml
core/tests/coretests/src/android/content/res/ResourcesLocaleResolutionTest.java [new file with mode: 0644]