Merge change I490e01ba into eclair

* changes:
  Fix issue #2174566: HOT STABILITY: NPE in activity manager
This commit is contained in:
Android (Google) Code Review
2009-10-08 21:38:39 -04:00

View File

@ -4556,7 +4556,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
long now = SystemClock.uptimeMillis(); long now = SystemClock.uptimeMillis();
for (i=0; i<count; i++) { for (i=0; i<count; i++) {
ProcessRecord rec = mLRUProcesses.get(i); ProcessRecord rec = mLRUProcesses.get(i);
if (rec.thread != null && if (rec != app && rec.thread != null &&
(rec.lastLowMemory+GC_MIN_INTERVAL) <= now) { (rec.lastLowMemory+GC_MIN_INTERVAL) <= now) {
// The low memory report is overriding any current // The low memory report is overriding any current
// state for a GC request. Make sure to do // state for a GC request. Make sure to do
@ -9852,6 +9852,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
mLRUProcesses.remove(index); mLRUProcesses.remove(index);
} }
mProcessesToGc.remove(app);
// Dismiss any open dialogs. // Dismiss any open dialogs.
if (app.crashDialog != null) { if (app.crashDialog != null) {
app.crashDialog.dismiss(); app.crashDialog.dismiss();
@ -10519,7 +10521,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
//Log.i(TAG, "Bring up service:"); //Log.i(TAG, "Bring up service:");
//r.dump(" "); //r.dump(" ");
if (r.app != null) { if (r.app != null && r.app.thread != null) {
sendServiceArgsLocked(r, false); sendServiceArgsLocked(r, false);
return true; return true;
} }
@ -10550,7 +10552,6 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// restart the application. // restart the application.
} }
if (!mPendingServices.contains(r)) {
// Not running -- get it started, and enqueue this service record // Not running -- get it started, and enqueue this service record
// to be executed when the app comes up. // to be executed when the app comes up.
if (startProcessLocked(appName, r.appInfo, true, intentFlags, if (startProcessLocked(appName, r.appInfo, true, intentFlags,
@ -10562,8 +10563,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
bringDownServiceLocked(r, true); bringDownServiceLocked(r, true);
return false; return false;
} }
if (!mPendingServices.contains(r)) {
mPendingServices.add(r); mPendingServices.add(r);
} }
return true; return true;
} }