Only spawn one binder thread for screencap.

To work around race conditions in libbinder when
spawning new threads while being shut down.

Bug: 36066697
Test: screencap still works
Change-Id: I774d3dc2491bb578a12dede90cc7fcded976f13f
This commit is contained in:
Martijn Coenen
2017-05-11 09:40:45 -07:00
parent a22a5d83c2
commit 3b53fc5a84

View File

@@ -84,6 +84,11 @@ static status_t notifyMediaScanner(const char* fileName) {
int main(int argc, char** argv)
{
// setThreadPoolMaxThreadCount(0) actually tells the kernel it's
// not allowed to spawn any additional threads, but we still spawn
// a binder thread from userspace when we call startThreadPool().
// See b/36066697 for rationale
ProcessState::self()->setThreadPoolMaxThreadCount(0);
ProcessState::self()->startThreadPool();
const char* pname = argv[0];