summaryrefslogtreecommitdiff
path: root/libs/androidfw/AssetManager.cpp
diff options
context:
space:
mode:
author Narayan Kamath <narayan@google.com> 2014-02-17 03:03:49 -0800
committer Android Git Automerger <android-git-automerger@android.com> 2014-02-17 03:03:49 -0800
commit28879bbfe89dc4bf2067a7183975ecffb82f68e6 (patch)
treeaf994f62d0f6fa15ae2d1355f9632a87da083c04 /libs/androidfw/AssetManager.cpp
parent183e5e038bd844ac415b14f22df5c476732066c8 (diff)
parentbe57fca41a731217010d9f92554cf48708b06ecf (diff)
am be57fca4: Merge "Extended locales in AAPT / AssetManager."
* commit 'be57fca41a731217010d9f92554cf48708b06ecf': 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);
}