Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78d68836 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

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
parent eb43f1b2
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -48202,6 +48202,16 @@
 visibility="public"
>
</field>
<field name="firstInstallTime"
 type="long"
 transient="false"
 volatile="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="gids"
 type="int[]"
 transient="false"
@@ -48224,6 +48234,16 @@
 visibility="public"
>
</field>
<field name="lastUpdateTime"
 type="long"
 transient="false"
 volatile="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="packageName"
 type="java.lang.String"
 transient="false"
@@ -79283,7 +79303,7 @@
 type="float"
 transient="false"
 volatile="false"
 value="0.001f"
 value="0.0010f"
 static="true"
 final="true"
 deprecated="not deprecated"
+16 −0
Original line number Diff line number Diff line
@@ -64,6 +64,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);
+1 −1
Original line number Diff line number Diff line
@@ -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);
    }

    /**
+3 −1
Original line number Diff line number Diff line
@@ -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;
        }
+135 −34

File changed.

Preview size limit exceeded, changes collapsed.