summaryrefslogtreecommitdiff
path: root/libs/androidfw/AssetManager.cpp
diff options
context:
space:
mode:
author Narayan Kamath <narayan@google.com> 2014-02-17 11:06:38 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2014-02-17 11:06:38 +0000
commit8c1fc83445f8dce7e6d0789feeed8bf98d33bf01 (patch)
treeb9eae6651529003e33abaea6a3f18fd17266fb42 /libs/androidfw/AssetManager.cpp
parent982931c72b6cd00c5eea28efc4b086f47f7aca17 (diff)
parent28879bbfe89dc4bf2067a7183975ecffb82f68e6 (diff)
am 28879bbf: am be57fca4: Merge "Extended locales in AAPT / AssetManager."
* commit '28879bbfe89dc4bf2067a7183975ecffb82f68e6': Extended locales in AAPT / AssetManager.
Diffstat (limited to 'libs/androidfw/AssetManager.cpp')
-rw-r--r--libs/androidfw/AssetManager.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index 5069958ee1d2..b4d482ad0a54 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -386,17 +386,8 @@ void AssetManager::setConfiguration(const ResTable_config& config, const char* l
if (locale) {
setLocaleLocked(locale);
} else if (config.language[0] != 0) {
- char spec[9];
- spec[0] = config.language[0];
- spec[1] = config.language[1];
- if (config.country[0] != 0) {
- spec[2] = '_';
- spec[3] = config.country[0];
- spec[4] = config.country[1];
- spec[5] = 0;
- } else {
- spec[3] = 0;
- }
+ char spec[RESTABLE_MAX_LOCALE_LEN];
+ config.getBcp47Locale(spec);
setLocaleLocked(spec);
} else {
updateResourceParamsLocked();
@@ -668,20 +659,11 @@ void AssetManager::updateResourceParamsLocked() const
return;
}
- size_t llen = mLocale ? strlen(mLocale) : 0;
- mConfig->language[0] = 0;
- mConfig->language[1] = 0;
- mConfig->country[0] = 0;
- mConfig->country[1] = 0;
- if (llen >= 2) {
- mConfig->language[0] = mLocale[0];
- mConfig->language[1] = mLocale[1];
- }
- if (llen >= 5) {
- mConfig->country[0] = mLocale[3];
- mConfig->country[1] = mLocale[4];
+ if (mLocale) {
+ mConfig->setBcp47Locale(mLocale);
+ } else {
+ mConfig->clearLocale();
}
- mConfig->size = sizeof(*mConfig);
res->setParameters(mConfig);
}