Loading services/java/com/android/server/am/ActivityManagerService.java +18 −5 Original line number Diff line number Diff line Loading @@ -2819,6 +2819,15 @@ public final class ActivityManagerService extends ActivityManagerNative app.usingWrapper = startResult.usingWrapper; app.removed = false; 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); Message msg = mHandler.obtainMessage(PROC_START_TIMEOUT_MSG); msg.obj = app; Loading Loading @@ -3608,7 +3617,8 @@ public final class ActivityManagerService extends ActivityManagerNative */ private final void handleAppDiedLocked(ProcessRecord app, boolean restarting, boolean allowRestart) { cleanUpApplicationRecordLocked(app, restarting, allowRestart, -1); cleanUpApplicationRecordLocked(app, restarting, allowRestart, -1, false /*replacingPid*/); if (!restarting) { removeLruProcessLocked(app); } Loading Loading @@ -12395,7 +12405,8 @@ public final class ActivityManagerService extends ActivityManagerNative * a process when running in single process mode. */ private final void cleanUpApplicationRecordLocked(ProcessRecord app, boolean restarting, boolean allowRestart, int index) { boolean restarting, boolean allowRestart, int index, boolean replacingPid) { Slog.d(TAG, "cleanUpApplicationRecordLocked -- " + app.pid); if (index >= 0) { removeLruProcessLocked(app); } Loading Loading @@ -12519,8 +12530,10 @@ public final class ActivityManagerService extends ActivityManagerNative if (!app.persistent || app.isolated) { if (DEBUG_PROCESSES || DEBUG_CLEANUP) Slog.v(TAG, "Removing non-persistent process during cleanup: " + app); if (!replacingPid) { mProcessNames.remove(app.processName, app.uid); mIsolatedProcesses.remove(app.uid); } if (mHeavyWeightProcess == app) { mHandler.sendMessage(mHandler.obtainMessage(CANCEL_HEAVY_NOTIFICATION_MSG, mHeavyWeightProcess.userId, 0)); Loading Loading @@ -15818,7 +15831,7 @@ public final class ActivityManagerService extends ActivityManagerNative // Ignore exceptions. } } cleanUpApplicationRecordLocked(app, false, true, -1); cleanUpApplicationRecordLocked(app, false, true, -1, false /*replacingPid*/); mRemovedProcesses.remove(i); if (app.persistent) { services/java/com/android/server/am/BroadcastQueue.java +5 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,11 @@ public final class BroadcastQueue { boolean didSomething = false; final BroadcastRecord br = mPendingBroadcast; if (br != null && br.curApp.pid == app.pid) { if (br.curApp != app) { Slog.e(TAG, "App mismatch when sending pending broadcast to " + app.processName + ", intended target is " + br.curApp.processName); return false; } try { mPendingBroadcast = null; processCurBroadcastLocked(br, app); Loading Loading
services/java/com/android/server/am/ActivityManagerService.java +18 −5 Original line number Diff line number Diff line Loading @@ -2819,6 +2819,15 @@ public final class ActivityManagerService extends ActivityManagerNative app.usingWrapper = startResult.usingWrapper; app.removed = false; 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); Message msg = mHandler.obtainMessage(PROC_START_TIMEOUT_MSG); msg.obj = app; Loading Loading @@ -3608,7 +3617,8 @@ public final class ActivityManagerService extends ActivityManagerNative */ private final void handleAppDiedLocked(ProcessRecord app, boolean restarting, boolean allowRestart) { cleanUpApplicationRecordLocked(app, restarting, allowRestart, -1); cleanUpApplicationRecordLocked(app, restarting, allowRestart, -1, false /*replacingPid*/); if (!restarting) { removeLruProcessLocked(app); } Loading Loading @@ -12395,7 +12405,8 @@ public final class ActivityManagerService extends ActivityManagerNative * a process when running in single process mode. */ private final void cleanUpApplicationRecordLocked(ProcessRecord app, boolean restarting, boolean allowRestart, int index) { boolean restarting, boolean allowRestart, int index, boolean replacingPid) { Slog.d(TAG, "cleanUpApplicationRecordLocked -- " + app.pid); if (index >= 0) { removeLruProcessLocked(app); } Loading Loading @@ -12519,8 +12530,10 @@ public final class ActivityManagerService extends ActivityManagerNative if (!app.persistent || app.isolated) { if (DEBUG_PROCESSES || DEBUG_CLEANUP) Slog.v(TAG, "Removing non-persistent process during cleanup: " + app); if (!replacingPid) { mProcessNames.remove(app.processName, app.uid); mIsolatedProcesses.remove(app.uid); } if (mHeavyWeightProcess == app) { mHandler.sendMessage(mHandler.obtainMessage(CANCEL_HEAVY_NOTIFICATION_MSG, mHeavyWeightProcess.userId, 0)); Loading Loading @@ -15818,7 +15831,7 @@ public final class ActivityManagerService extends ActivityManagerNative // Ignore exceptions. } } cleanUpApplicationRecordLocked(app, false, true, -1); cleanUpApplicationRecordLocked(app, false, true, -1, false /*replacingPid*/); mRemovedProcesses.remove(i); if (app.persistent) {
services/java/com/android/server/am/BroadcastQueue.java +5 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,11 @@ public final class BroadcastQueue { boolean didSomething = false; final BroadcastRecord br = mPendingBroadcast; if (br != null && br.curApp.pid == app.pid) { if (br.curApp != app) { Slog.e(TAG, "App mismatch when sending pending broadcast to " + app.processName + ", intended target is " + br.curApp.processName); return false; } try { mPendingBroadcast = null; processCurBroadcastLocked(br, app); Loading