Fix NullPointerException in PhantomProcessList due to race condition

Bug: 194897294
Bug: 194146206
Test: atest AppChildProcessTest
Test: atest CtsAppTestCases:ActivityManagerTest
Change-Id: I5d395726d2ff404e8e82d21a7886511a06288c43
This commit is contained in:
Jing Ji
2021-07-28 10:40:21 -07:00
parent 92145ddf77
commit 0a05f5475f

View File

@@ -365,6 +365,9 @@ public final class PhantomProcessList {
private int onPhantomProcessFdEvent(FileDescriptor fd, int events) {
synchronized (mLock) {
final PhantomProcessRecord proc = mPhantomProcessesPidFds.get(fd.getInt$());
if (proc == null) {
return 0;
}
if ((events & EVENT_INPUT) != 0) {
proc.onProcDied(true);
} else {