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

Commit aede9255 authored by Song Chun Fan's avatar Song Chun Fan Committed by Android (Google) Code Review
Browse files

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

parents 0177c5f2 6a7e6de6
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
Loading