summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Lesinski <adamlesinski@google.com> 2017-05-11 12:15:26 -0700
committer Adam Lesinski <adamlesinski@google.com> 2017-05-11 12:26:52 -0700
commitfa2fc0b263d2eaa3be5eaa5191ffe293abc81489 (patch)
tree06d0b10479702aa4b8d68dd45705d44b64cc6911
parent33532e020873e580c421342e38b2352b836d30d4 (diff)
AAPT: Include empty locale in getLocales
AAPT dump badging relies on the empty locale being present when there are no locales. Bug: 38192121 Test: manual Change-Id: I2f5c431d4fd07c525a2318e7b93be0e93c32448f
-rw-r--r--libs/androidfw/ResourceTypes.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index f661f29bb7f9..c3ae7a419c75 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -5997,16 +5997,14 @@ void ResTable::getLocales(Vector<String8>* locales, bool includeSystemLocales,
char locale[RESTABLE_MAX_LOCALE_LEN];
forEachConfiguration(false, false, includeSystemLocales, [&](const ResTable_config& cfg) {
- if (cfg.locale != 0) {
- cfg.getBcp47Locale(locale, mergeEquivalentLangs /* canonicalize if merging */);
+ cfg.getBcp47Locale(locale, mergeEquivalentLangs /* canonicalize if merging */);
- const auto beginIter = locales->begin();
- const auto endIter = locales->end();
+ const auto beginIter = locales->begin();
+ const auto endIter = locales->end();
- auto iter = std::lower_bound(beginIter, endIter, locale, compareString8AndCString);
- if (iter == endIter || strcmp(iter->string(), locale) != 0) {
- locales->insertAt(String8(locale), std::distance(beginIter, iter));
- }
+ auto iter = std::lower_bound(beginIter, endIter, locale, compareString8AndCString);
+ if (iter == endIter || strcmp(iter->string(), locale) != 0) {
+ locales->insertAt(String8(locale), std::distance(beginIter, iter));
}
});
}