Fix race condition in OomAdjuster.
OomAdjuster accesses the not-thread-safe HandlerThread.getThreadId from outside the thread. Modify so it posts a message to thread instead. See bug 22476742 Bug: 151407445 Test: See repro instructions in bug Change-Id: Iae03d46896561f0442af6595a8d0bdf617ccd61e
This commit is contained in:
@@ -227,7 +227,8 @@ public final class OomAdjuster {
|
||||
final ServiceThread adjusterThread =
|
||||
new ServiceThread(TAG, TOP_APP_PRIORITY_BOOST, false /* allowIo */);
|
||||
adjusterThread.start();
|
||||
Process.setThreadGroupAndCpuset(adjusterThread.getThreadId(), THREAD_GROUP_TOP_APP);
|
||||
adjusterThread.getThreadHandler().post(() -> Process.setThreadGroupAndCpuset(
|
||||
adjusterThread.getThreadId(), THREAD_GROUP_TOP_APP));
|
||||
return adjusterThread;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user