Merge "When fork() fails, clean up data structures." into nyc-dev

am: f10640adef

* commit 'f10640adef2ca62204d802029e65f12d61908e7b':
  When fork() fails, clean up data structures.

Change-Id: I9ff64d4a91123660ea11fc762dfcd4b04164d7cf
This commit is contained in:
Jeff Sharkey
2016-05-02 22:17:15 +00:00
committed by android-build-merger

View File

@@ -3724,13 +3724,16 @@ public final class ActivityManagerService extends ActivityManagerNative
} }
checkTime(startTime, "startProcess: done updating pids map"); checkTime(startTime, "startProcess: done updating pids map");
} catch (RuntimeException e) { } catch (RuntimeException e) {
// XXX do better error recovery.
app.setPid(0);
mBatteryStatsService.noteProcessFinish(app.processName, app.info.uid);
if (app.isolated) {
mBatteryStatsService.removeIsolatedUid(app.uid, app.info.uid);
}
Slog.e(TAG, "Failure starting process " + app.processName, e); Slog.e(TAG, "Failure starting process " + app.processName, e);
// Something went very wrong while trying to start this process; one
// common case is when the package is frozen due to an active
// upgrade. To recover, clean up any active bookkeeping related to
// starting this process. (We already invoked this method once when
// the package was initially frozen through KILL_APPLICATION_MSG, so
// it doesn't hurt to use it again.)
forceStopPackageLocked(app.info.packageName, UserHandle.getAppId(app.uid), false,
false, true, false, false, UserHandle.getUserId(app.userId), "start failure");
} }
} }