diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/androidfw/ResourceTypes.cpp | 59 | ||||
-rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 1 | ||||
-rw-r--r-- | libs/hwui/thread/Signal.h | 6 | ||||
-rw-r--r-- | libs/hwui/thread/TaskManager.cpp | 7 |
4 files changed, 63 insertions, 10 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index d5d583c..e247150 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -2550,6 +2550,58 @@ bool ResTable_config::match(const ResTable_config& settings) const { return true; } +void ResTable_config::appendDirLocale(String8& out) const { + if (!language[0]) { + return; + } + + if (!localeScript[0] && !localeVariant[0]) { + // Legacy format. + if (out.size() > 0) { + out.append("-"); + } + + char buf[4]; + size_t len = unpackLanguage(buf); + out.append(buf, len); + + if (country[0]) { + out.append("-r"); + len = unpackRegion(buf); + out.append(buf, len); + } + return; + } + + // We are writing the modified bcp47 tag. + // It starts with 'b+' and uses '+' as a separator. + + if (out.size() > 0) { + out.append("-"); + } + out.append("b+"); + + char buf[4]; + size_t len = unpackLanguage(buf); + out.append(buf, len); + + if (localeScript[0]) { + out.append("+"); + out.append(localeScript, sizeof(localeScript)); + } + + if (country[0]) { + out.append("+"); + len = unpackRegion(buf); + out.append(buf, len); + } + + if (localeVariant[0]) { + out.append("+"); + out.append(localeVariant, sizeof(localeVariant)); + } +} + void ResTable_config::getBcp47Locale(char str[RESTABLE_MAX_LOCALE_LEN]) const { memset(str, 0, RESTABLE_MAX_LOCALE_LEN); @@ -2650,12 +2702,7 @@ String8 ResTable_config::toString() const { res.appendFormat("mnc%d", dtohs(mnc)); } - char localeStr[RESTABLE_MAX_LOCALE_LEN]; - getBcp47Locale(localeStr); - if (strlen(localeStr) > 0) { - if (res.size() > 0) res.append("-"); - res.append(localeStr); - } + appendDirLocale(res); if ((screenLayout&MASK_LAYOUTDIR) != 0) { if (res.size() > 0) res.append("-"); diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index ea4216c..0091790 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -418,6 +418,7 @@ CREATE_BRIDGE2(dumpGraphicsMemory, int fd, RenderThread* thread) { } void RenderProxy::dumpGraphicsMemory(int fd) { + if (!RenderThread::hasInstance()) return; SETUP_TASK(dumpGraphicsMemory); args->fd = fd; args->thread = &RenderThread::getInstance(); diff --git a/libs/hwui/thread/Signal.h b/libs/hwui/thread/Signal.h index dcf5449..d4cfeeb 100644 --- a/libs/hwui/thread/Signal.h +++ b/libs/hwui/thread/Signal.h @@ -30,8 +30,10 @@ public: ~Signal() { } void signal() { - Mutex::Autolock l(mLock); - mSignaled = true; + { + Mutex::Autolock l(mLock); + mSignaled = true; + } mCondition.signal(mType); } diff --git a/libs/hwui/thread/TaskManager.cpp b/libs/hwui/thread/TaskManager.cpp index c69b2fd..f0ed0bb 100644 --- a/libs/hwui/thread/TaskManager.cpp +++ b/libs/hwui/thread/TaskManager.cpp @@ -109,8 +109,11 @@ bool TaskManager::WorkerThread::addTask(TaskWrapper task) { return false; } - Mutex::Autolock l(mLock); - ssize_t index = mTasks.add(task); + ssize_t index; + { + Mutex::Autolock l(mLock); + index = mTasks.add(task); + } mSignal.signal(); return index >= 0; |