summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-10-07 01:12:46 -0700
committerDianne Hackborn <hackbod@google.com>2010-10-07 18:48:22 -0700
commit78d688369a2240009d3bbe4126996a973b2e2fe2 (patch)
tree409d53a06e612867fcef6673a89def6a6b5e768b /core/java/android/content
parenteb43f1b2eedbcfe0e8ac34452a43eaaef5dde513 (diff)
downloadframeworks_base-78d688369a2240009d3bbe4126996a973b2e2fe2.zip
frameworks_base-78d688369a2240009d3bbe4126996a973b2e2fe2.tar.gz
frameworks_base-78d688369a2240009d3bbe4126996a973b2e2fe2.tar.bz2
Implement tracking of package install times.
Provides information about the time at which the package was first installed and the time it was last updated. Change-Id: Icb43f77b5b669a1ce685e8913046b8be386b6175
Diffstat (limited to 'core/java/android/content')
-rw-r--r--core/java/android/content/pm/PackageInfo.java16
-rw-r--r--core/java/android/content/pm/PackageManager.java2
-rw-r--r--core/java/android/content/pm/PackageParser.java4
3 files changed, 20 insertions, 2 deletions
diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java
index af327c3..eb05d76 100644
--- a/core/java/android/content/pm/PackageInfo.java
+++ b/core/java/android/content/pm/PackageInfo.java
@@ -65,6 +65,18 @@ public class PackageInfo implements Parcelable {
public ApplicationInfo applicationInfo;
/**
+ * The time at which the app was first installed. Units are as
+ * per {@link System#currentTimeMillis()}.
+ */
+ public long firstInstallTime;
+
+ /**
+ * The time at which the app was last updated. Units are as
+ * per {@link System#currentTimeMillis()}.
+ */
+ public long lastUpdateTime;
+
+ /**
* All kernel group-IDs that have been assigned to this package.
* This is only filled in if the flag {@link PackageManager#GET_GIDS} was set.
*/
@@ -207,6 +219,8 @@ public class PackageInfo implements Parcelable {
} else {
dest.writeInt(0);
}
+ dest.writeLong(firstInstallTime);
+ dest.writeLong(lastUpdateTime);
dest.writeIntArray(gids);
dest.writeTypedArray(activities, parcelableFlags);
dest.writeTypedArray(receivers, parcelableFlags);
@@ -242,6 +256,8 @@ public class PackageInfo implements Parcelable {
if (hasApp != 0) {
applicationInfo = ApplicationInfo.CREATOR.createFromParcel(source);
}
+ firstInstallTime = source.readLong();
+ lastUpdateTime = source.readLong();
gids = source.createIntArray();
activities = source.createTypedArray(ActivityInfo.CREATOR);
receivers = source.createTypedArray(ActivityInfo.CREATOR);
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 7346561..b5d1653 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1891,7 +1891,7 @@ public abstract class PackageManager {
if (pkg == null) {
return null;
}
- return PackageParser.generatePackageInfo(pkg, null, flags);
+ return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0);
}
/**
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 89839ce..51f4202 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -187,7 +187,7 @@ public class PackageParser {
* @param flags indicating which optional information is included.
*/
public static PackageInfo generatePackageInfo(PackageParser.Package p,
- int gids[], int flags) {
+ int gids[], int flags, long firstInstallTime, long lastUpdateTime) {
PackageInfo pi = new PackageInfo();
pi.packageName = p.packageName;
@@ -197,6 +197,8 @@ public class PackageParser {
pi.sharedUserLabel = p.mSharedUserLabel;
pi.applicationInfo = p.applicationInfo;
pi.installLocation = p.installLocation;
+ pi.firstInstallTime = firstInstallTime;
+ pi.lastUpdateTime = lastUpdateTime;
if ((flags&PackageManager.GET_GIDS) != 0) {
pi.gids = gids;
}