OSDN Git Service

Maybe fix issue #10748810: Runtime restart: crash under...
authorDianne Hackborn <hackbod@google.com>
Sat, 14 Sep 2013 01:34:13 +0000 (18:34 -0700)
committerDianne Hackborn <hackbod@google.com>
Sat, 14 Sep 2013 01:34:13 +0000 (18:34 -0700)
...ActivityManagerService.setProcessTrackerState

And if not, at least we'll have a little more debug info
when it happens again.

Change-Id: I685f0f72c2e1b17608a8d069d6c7f2cff2fd0abd

core/java/com/android/internal/app/ProcessStats.java

index 1f55a4c..07854e2 100644 (file)
@@ -983,7 +983,7 @@ public final class ProcessStats implements Parcelable {
                 PackageState pkgState = uids.valueAt(iu);
                 for (int iproc=pkgState.mProcesses.size()-1; iproc>=0; iproc--) {
                     ProcessState ps = pkgState.mProcesses.valueAt(iproc);
-                    if (ps.isInUse()) {
+                    if (ps.isInUse() || ps.mCommonProcess.isInUse()) {
                         pkgState.mProcesses.valueAt(iproc).resetSafely(now);
                     } else {
                         pkgState.mProcesses.removeAt(iproc);
@@ -2496,8 +2496,12 @@ public final class ProcessStats implements Parcelable {
                 // The array map is still pointing to a common process state
                 // that is now shared across packages.  Update it to point to
                 // the new per-package state.
-                proc = mStats.mPackages.get(pkgList.keyAt(index),
-                        proc.mUid).mProcesses.get(proc.mName);
+                PackageState pkg = mStats.mPackages.get(pkgList.keyAt(index), proc.mUid);
+                if (pkg == null) {
+                    throw new IllegalStateException("No existing package "
+                            + pkgList.keyAt(index) + " for multi-proc" + proc.mName);
+                }
+                proc = pkg.mProcesses.get(proc.mName);
                 if (proc == null) {
                     throw new IllegalStateException("Didn't create per-package process");
                 }