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

Commit 57c352e2 authored by Song Chun Fan's avatar Song Chun Fan Committed by Automerger Merge Worker
Browse files

Merge "[pm/metrics] add loadingCompletedTime in stats" into udc-dev am: aede9255

parents 9c6336bd aede9255
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -27,14 +27,18 @@ public class IncrementalStatesInfo implements Parcelable {
    private boolean mIsLoading;
    private float mProgress;

    public IncrementalStatesInfo(boolean isLoading, float progress) {
    private long mLoadingCompletedTime;

    public IncrementalStatesInfo(boolean isLoading, float progress, long loadingCompletedTime) {
        mIsLoading = isLoading;
        mProgress = progress;
        mLoadingCompletedTime = loadingCompletedTime;
    }

    private IncrementalStatesInfo(Parcel source) {
        mIsLoading = source.readBoolean();
        mProgress = source.readFloat();
        mLoadingCompletedTime = source.readLong();
    }

    public boolean isLoading() {
@@ -45,6 +49,10 @@ public class IncrementalStatesInfo implements Parcelable {
        return mProgress;
    }

    public long getLoadingCompletedTime() {
        return mLoadingCompletedTime;
    }

    @Override
    public int describeContents() {
        return 0;
@@ -54,6 +62,7 @@ public class IncrementalStatesInfo implements Parcelable {
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeBoolean(mIsLoading);
        dest.writeFloat(mProgress);
        dest.writeLong(mLoadingCompletedTime);
    }

    public static final @android.annotation.NonNull Creator<IncrementalStatesInfo> CREATOR =
+2 −0
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ final class IncrementalProgressListener extends IPackageLoadingProgressCallback.
                    state -> state.setLoadingProgress(progress));
            // Only report the state change when loading state changes from loading to not
            if (Math.abs(1.0f - progress) < 0.00000001f) {
                mPm.commitPackageStateMutation(null, mPackageName,
                        state -> state.setLoadingCompletedTime(System.currentTimeMillis()));
                // Unregister progress listener
                mPm.mIncrementalManager
                        .unregisterLoadingProgressCallbacks(packageState.getPathString());
+2 −1
Original line number Diff line number Diff line
@@ -6811,7 +6811,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService
            if (ps == null) {
                return null;
            }
            return new IncrementalStatesInfo(ps.isLoading(), ps.getLoadingProgress());
            return new IncrementalStatesInfo(ps.isLoading(), ps.getLoadingProgress(),
                    ps.getLoadingCompletedTime());
        }

        @Override
+19 −2

File changed.

Preview size limit exceeded, changes collapsed.

+10 −5
Original line number Diff line number Diff line
@@ -2902,6 +2902,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            serializer.attributeInt(null, "sharedUserId", pkg.getAppId());
        }
        serializer.attributeFloat(null, "loadingProgress", pkg.getLoadingProgress());
        serializer.attributeLongHex(null, "loadingCompletedTime",
                pkg.getLoadingCompletedTime());

        writeUsesSdkLibLPw(serializer, pkg.getUsesSdkLibraries(),
                pkg.getUsesSdkLibrariesVersionsMajor());
@@ -2988,6 +2990,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            serializer.attributeBoolean(null, "isLoading", true);
        }
        serializer.attributeFloat(null, "loadingProgress", pkg.getLoadingProgress());
        serializer.attributeLongHex(null, "loadingCompletedTime", pkg.getLoadingCompletedTime());

        serializer.attribute(null, "domainSetId", pkg.getDomainSetId().toString());

@@ -3687,9 +3690,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            ps.setAppId(sharedUserAppId);
            ps.setSharedUserAppId(sharedUserAppId);
        }
        final float loadingProgress =
                parser.getAttributeFloat(null, "loadingProgress", 0);
        ps.setLoadingProgress(loadingProgress);

        int outerDepth = parser.getDepth();
        int type;
@@ -3760,6 +3760,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        long versionCode = 0;
        boolean installedForceQueryable = false;
        float loadingProgress = 0;
        long loadingCompletedTime = 0;
        UUID domainSetId;
        try {
            name = parser.getAttributeValue(null, ATTR_NAME);
@@ -3777,6 +3778,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            updateAvailable = parser.getAttributeBoolean(null, "updateAvailable", false);
            installedForceQueryable = parser.getAttributeBoolean(null, "forceQueryable", false);
            loadingProgress = parser.getAttributeFloat(null, "loadingProgress", 0);
            loadingCompletedTime = parser.getAttributeLongHex(null, "loadingCompletedTime", 0);

            if (primaryCpuAbiString == null && legacyCpuAbiString != null) {
                primaryCpuAbiString = legacyCpuAbiString;
@@ -3939,7 +3941,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                    .setSecondaryCpuAbi(secondaryCpuAbiString)
                    .setUpdateAvailable(updateAvailable)
                    .setForceQueryableOverride(installedForceQueryable)
                    .setLoadingProgress(loadingProgress);
                    .setLoadingProgress(loadingProgress)
                    .setLoadingCompletedTime(loadingCompletedTime);
            // Handle legacy string here for single-user mode
            final String enabledStr = parser.getAttributeValue(null, ATTR_ENABLED);
            if (enabledStr != null) {
@@ -4900,9 +4903,11 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        }
        pw.print(prefix); pw.print("  packageSource=");
        pw.println(ps.getInstallSource().mPackageSource);
        if (ps.isLoading()) {
        if (ps.isIncremental()) {
            pw.print(prefix); pw.println("  loadingProgress=" +
                    (int) (ps.getLoadingProgress() * 100) + "%");
            date.setTime(ps.getLoadingCompletedTime());
            pw.print(prefix); pw.println("  loadingCompletedTime=" + sdf.format(date));
        }
        if (ps.getVolumeUuid() != null) {
            pw.print(prefix); pw.print("  volumeUuid=");
Loading