summaryrefslogtreecommitdiffstats
path: root/libs/hwui/thread/TaskManager.cpp
diff options
context:
space:
mode:
authorSangkyu Lee <sk82.lee@lge.com>2015-01-12 09:51:53 +0900
committerSangkyu Lee <sk82.lee@lge.com>2015-01-12 13:10:52 +0900
commitc3c58e015fa30a0ad87d4af2b95b7071baa8ffe4 (patch)
tree9d76978e72832d6f33357c39445aecf804ee4b21 /libs/hwui/thread/TaskManager.cpp
parent7f94b52fc7c66bc40702b46f59b3929c076cbbfb (diff)
downloadframeworks_base-c3c58e015fa30a0ad87d4af2b95b7071baa8ffe4.zip
frameworks_base-c3c58e015fa30a0ad87d4af2b95b7071baa8ffe4.tar.gz
frameworks_base-c3c58e015fa30a0ad87d4af2b95b7071baa8ffe4.tar.bz2
Fix ANR caused by hwuiTask thread
If hwuiTask thread is exited while HWUI renders something, some tasks can remain unfinished forever. This can make ANR problem if RenderThread waits this kind of tasks. According to the current implementation, hwuiTask threads are exited when HWUI receives trimMemory() callback with level >= 20 and some applications such as SystemUI can receive trimMemory() with level >= 20 even though they renders something yet. (For instance, when RecentsActivity in SystemUI is finished, HWUI receives trimMemory() callback with level >= 20 but SystemUI should still render the status bar and navigation bar.) This patch prevents the tasks from remaining unfinished and make the tasks executed immediately if they cannot be added to their TaskProcessors. Change-Id: I5bd26439aa5f183b1a7c1ce466362e27554b4d16
Diffstat (limited to 'libs/hwui/thread/TaskManager.cpp')
-rw-r--r--libs/hwui/thread/TaskManager.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/libs/hwui/thread/TaskManager.cpp b/libs/hwui/thread/TaskManager.cpp
index cb5401c..d600797 100644
--- a/libs/hwui/thread/TaskManager.cpp
+++ b/libs/hwui/thread/TaskManager.cpp
@@ -109,6 +109,8 @@ bool TaskManager::WorkerThread::threadLoop() {
bool TaskManager::WorkerThread::addTask(TaskWrapper task) {
if (!isRunning()) {
run(mName.string(), PRIORITY_DEFAULT);
+ } else if (exitPending()) {
+ return false;
}
Mutex::Autolock l(mLock);
@@ -124,10 +126,6 @@ size_t TaskManager::WorkerThread::getTaskCount() const {
}
void TaskManager::WorkerThread::exit() {
- {
- Mutex::Autolock l(mLock);
- mTasks.clear();
- }
requestExit();
mSignal.signal();
}