Fix spurious "Timeout waiting for provider"

There is a race that if two clients are acquiring the same
content provider at the same momment, the second one would
create a new ContentProviderRecord and then start a new process.

Bug: 148953992
Test: Manual
Change-Id: I3e95be32208a0869dc0b399da70f767abdd76fb4
This commit is contained in:
Jing Ji
2020-02-14 20:18:20 -08:00
parent 833a785548
commit 6e721e1103

View File

@@ -7156,7 +7156,7 @@ public class ActivityManagerService extends IActivityManager.Stub
} finally {
Binder.restoreCallingIdentity(ident);
}
} else if (dyingProc == cpr.proc) {
} else if (dyingProc == cpr.proc && dyingProc != null) {
// The old stable connection's client should be killed during proc cleaning up,
// so do not re-use the old ContentProviderRecord, otherwise the new clients
// could get killed unexpectedly.