Add app version codes to procstats.

Now the per-package proc stats data is also per-app-version-code.

In addition to changing the data structure to have one more
SparseArray and passing a version code all over, this also required
improving how we reset the stats so that we can prune a multi-package
process record back to a single package.  Otherwise, as you install
updates to apps, the proc stats data would continue to explode as
the data for each of those app's processes got turned to a
multi-package due to tracking the old and new versions at the
same time.

This also bumps the checkin version code, since the package entries
also include a new field for the app version code.

Change-Id: I80de36addb0a75c7b08aef747c6f6c8012d01ee4
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index 1f0fc3a..10574ed 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -392,14 +392,15 @@
                 origBase.makeInactive();
             }
             baseProcessTracker = tracker.getProcessStateLocked(info.packageName, info.uid,
-                    processName);
+                    info.versionCode, processName);
             baseProcessTracker.makeActive();
             for (int i=0; i<pkgList.size(); i++) {
                 ProcessStats.ProcessState ps = pkgList.valueAt(i);
                 if (ps != null && ps != origBase) {
                     ps.makeInactive();
                 }
-                ps = tracker.getProcessStateLocked(pkgList.keyAt(i), info.uid, processName);
+                ps = tracker.getProcessStateLocked(pkgList.keyAt(i), info.uid,
+                        info.versionCode, processName);
                 if (ps != baseProcessTracker) {
                     ps.makeActive();
                 }
@@ -572,7 +573,7 @@
         if (!pkgList.containsKey(pkg)) {
             if (baseProcessTracker != null) {
                 ProcessStats.ProcessState state = tracker.getProcessStateLocked(
-                        pkg, info.uid, processName);
+                        pkg, info.uid, info.versionCode, processName);
                 pkgList.put(pkg, state);
                 if (state != baseProcessTracker) {
                     state.makeActive();
@@ -619,7 +620,7 @@
                 }
                 pkgList.clear();
                 ProcessStats.ProcessState ps = tracker.getProcessStateLocked(
-                        info.packageName, info.uid, processName);
+                        info.packageName, info.uid, info.versionCode, processName);
                 pkgList.put(info.packageName, ps);
                 if (ps != baseProcessTracker) {
                     ps.makeActive();