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/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 9c46d96..8434c5d 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -338,7 +338,7 @@
* the normal application lifecycle.
*
* <p>Comes from the
- * {@link android.R.styleable#AndroidManifestApplication_cantSaveState android:cantSaveState}
+ * android.R.styleable#AndroidManifestApplication_cantSaveState
* attribute of the <application> tag.
*
* {@hide}
@@ -456,7 +456,13 @@
* behavior was introduced.
*/
public int targetSdkVersion;
-
+
+ /**
+ * The app's declared version code.
+ * @hide
+ */
+ public int versionCode;
+
/**
* When false, indicates that all components within this application are
* considered disabled, regardless of their individually set enabled status.
@@ -508,7 +514,8 @@
if (sharedLibraryFiles != null) {
pw.println(prefix + "sharedLibraryFiles=" + sharedLibraryFiles);
}
- pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion);
+ pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion
+ + " versionCode=" + versionCode);
if (manageSpaceActivityName != null) {
pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
}
@@ -576,6 +583,7 @@
dataDir = orig.dataDir;
uid = orig.uid;
targetSdkVersion = orig.targetSdkVersion;
+ versionCode = orig.versionCode;
enabled = orig.enabled;
enabledSetting = orig.enabledSetting;
installLocation = orig.installLocation;
@@ -616,6 +624,7 @@
dest.writeString(dataDir);
dest.writeInt(uid);
dest.writeInt(targetSdkVersion);
+ dest.writeInt(versionCode);
dest.writeInt(enabled ? 1 : 0);
dest.writeInt(enabledSetting);
dest.writeInt(installLocation);
@@ -655,6 +664,7 @@
dataDir = source.readString();
uid = source.readInt();
targetSdkVersion = source.readInt();
+ versionCode = source.readInt();
enabled = source.readInt() != 0;
enabledSetting = source.readInt();
installLocation = source.readInt();