Fix race conditions in removing dying process record
While waiting for the death of a process, if its subsequent process
record is created and killed immediately, we may end up removing
the former process record from the dying process list.
Bug: 201305599
Test: Presubmit
Change-Id: Ib62a3644d927881d7dab577b625460239e54b434
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index ca32e08..0df19ba 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -5143,7 +5143,8 @@
}
Watchdog.getInstance().processDied(app.processName, app.getPid());
- if (app.getDeathRecipient() == null) {
+ if (app.getDeathRecipient() == null
+ && mDyingProcesses.get(app.processName, app.uid) == app) {
// If we've done unlinkDeathRecipient before calling into this, remove from dying list.
mDyingProcesses.remove(app.processName, app.uid);
app.setDyingPid(0);