@@ -2818,16 +2818,19 @@ private final void startProcessLocked(ProcessRecord app,
2818
2818
app.setPid(startResult.pid);
2819
2819
app.usingWrapper = startResult.usingWrapper;
2820
2820
app.removed = false;
2821
+ ProcessRecord oldApp;
2822
+ synchronized (mPidsSelfLocked) {
2823
+ oldApp = mPidsSelfLocked.get(startResult.pid);
2824
+ }
2825
+ // If there is already an app occupying that pid that hasn't been cleaned up
2826
+ if (oldApp != null && !app.isolated) {
2827
+ // Clean up anything relating to this pid first
2828
+ Slog.w(TAG, "Reusing pid " + startResult.pid
2829
+ + " while app is still mapped to it");
2830
+ cleanUpApplicationRecordLocked(oldApp, false, false, -1,
2831
+ true /*replacingPid*/);
2832
+ }
2821
2833
synchronized (mPidsSelfLocked) {
2822
- ProcessRecord oldApp;
2823
- // If there is already an app occupying that pid that hasn't been cleaned up
2824
- if ((oldApp = mPidsSelfLocked.get(startResult.pid)) != null && !app.isolated) {
2825
- // Clean up anything relating to this pid first
2826
- Slog.w(TAG, "Reusing pid " + startResult.pid
2827
- + " while app is still mapped to it");
2828
- cleanUpApplicationRecordLocked(oldApp, false, false, -1,
2829
- true /*replacingPid*/);
2830
- }
2831
2834
this.mPidsSelfLocked.put(startResult.pid, app);
2832
2835
Message msg = mHandler.obtainMessage(PROC_START_TIMEOUT_MSG);
2833
2836
msg.obj = app;
0 commit comments