Merge "AAPT: Include empty locale in getLocales" into oc-dev

am: 19af4cc375

Change-Id: Idcac3756eede932c7924ccc3ef3edc7e12b7a10b
This commit is contained in:
Adam Lesinski
2017-05-12 04:10:49 +00:00
committed by android-build-merger

View File

@@ -5999,16 +5999,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));
}
});
}