summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSudheer Shanka <sudheersai@google.com>2016-09-14 14:37:14 -0700
committergitbuildkicker <android-build@google.com>2016-09-27 15:58:49 -0700
commit115baf8f0fb54fa86db6afc489ab8413ff714e46 (patch)
tree31430e890ef728d0a40aa88309b8c048bdab4704
parent77fa5d963f796f7682fd3f859e3f148681f60bde (diff)
downloadframeworks_base-115baf8f0fb54fa86db6afc489ab8413ff714e46.zip
frameworks_base-115baf8f0fb54fa86db6afc489ab8413ff714e46.tar.gz
frameworks_base-115baf8f0fb54fa86db6afc489ab8413ff714e46.tar.bz2
DO NOT MERGE: Fix deadlock in AcitivityManagerService.
Don't hold mPidsSelfLocked lock when calling cleanUpApplicationRecordLocked. Bug: 31463143 Change-Id: I421962cbfd7c466662edcef805c3e27321dc5a98 (cherry picked from commit b59e73613bbaf252e2ee5892d7a95cbbd7d40b26)
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 701cb84..16620cd 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -3424,16 +3424,19 @@ public final class ActivityManagerService extends ActivityManagerNative
app.killed = false;
app.killedByAm = false;
checkTime(startTime, "startProcess: starting to update pids map");
+ ProcessRecord oldApp;
+ synchronized (mPidsSelfLocked) {
+ oldApp = mPidsSelfLocked.get(startResult.pid);
+ }
+ // If there is already an app occupying that pid that hasn't been cleaned up
+ if (oldApp != null && !app.isolated) {
+ // Clean up anything relating to this pid first
+ Slog.w(TAG, "Reusing pid " + startResult.pid
+ + " while app is still mapped to it");
+ cleanUpApplicationRecordLocked(oldApp, false, false, -1,
+ true /*replacingPid*/);
+ }
synchronized (mPidsSelfLocked) {
- ProcessRecord oldApp;
- // If there is already an app occupying that pid that hasn't been cleaned up
- if ((oldApp = mPidsSelfLocked.get(startResult.pid)) != null && !app.isolated) {
- // Clean up anything relating to this pid first
- Slog.w(TAG, "Reusing pid " + startResult.pid
- + " while app is still mapped to it");
- cleanUpApplicationRecordLocked(oldApp, false, false, -1,
- true /*replacingPid*/);
- }
this.mPidsSelfLocked.put(startResult.pid, app);
if (isActivityProcess) {
Message msg = mHandler.obtainMessage(PROC_START_TIMEOUT_MSG);