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

Commit 436088d1 authored by Yisroel Forta's avatar Yisroel Forta
Browse files

Fix typo in AppStartInfo monotonic time

NO_IFTTT=not working correctly

Test: presubmit
Bug: 384539178
Flag: EXEMPT - fix typo
Change-Id: I8db250d88d4e50009d1b0ed6204b5bdf44d78d8d
parent 9b6454d3
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -231,9 +231,9 @@ public final class ApplicationStartInfo implements Parcelable {
    public static final int START_COMPONENT_OTHER = 5;

    /**
     * @see #getMonoticCreationTimeMs
     * @see #getMonotonicCreationTimeMs
     */
    private long mMonoticCreationTimeMs;
    private long mMonotonicCreationTimeMs;

    /**
     * @see #getStartupState
@@ -545,8 +545,8 @@ public final class ApplicationStartInfo implements Parcelable {
     *
     * @hide
     */
    public long getMonoticCreationTimeMs() {
        return mMonoticCreationTimeMs;
    public long getMonotonicCreationTimeMs() {
        return mMonotonicCreationTimeMs;
    }

    /**
@@ -751,14 +751,14 @@ public final class ApplicationStartInfo implements Parcelable {
        dest.writeParcelable(mStartIntent, flags);
        dest.writeInt(mLaunchMode);
        dest.writeBoolean(mWasForceStopped);
        dest.writeLong(mMonoticCreationTimeMs);
        dest.writeLong(mMonotonicCreationTimeMs);
        dest.writeInt(mStartComponent);
    }
    // LINT.ThenChange(:read_parcel)

    /** @hide */
    public ApplicationStartInfo(long monotonicCreationTimeMs) {
        mMonoticCreationTimeMs = monotonicCreationTimeMs;
        mMonotonicCreationTimeMs = monotonicCreationTimeMs;
    }

    /** @hide */
@@ -776,7 +776,7 @@ public final class ApplicationStartInfo implements Parcelable {
        mStartIntent = other.mStartIntent;
        mLaunchMode = other.mLaunchMode;
        mWasForceStopped = other.mWasForceStopped;
        mMonoticCreationTimeMs = other.mMonoticCreationTimeMs;
        mMonotonicCreationTimeMs = other.mMonotonicCreationTimeMs;
        mStartComponent = other.mStartComponent;
    }

@@ -803,7 +803,7 @@ public final class ApplicationStartInfo implements Parcelable {
                in.readParcelable(Intent.class.getClassLoader(), android.content.Intent.class);
        mLaunchMode = in.readInt();
        mWasForceStopped = in.readBoolean();
        mMonoticCreationTimeMs = in.readLong();
        mMonotonicCreationTimeMs = in.readLong();
        mStartComponent = in.readInt();
    }
    // LINT.ThenChange(:write_parcel)
@@ -887,7 +887,7 @@ public final class ApplicationStartInfo implements Parcelable {
        }
        proto.write(ApplicationStartInfoProto.LAUNCH_MODE, mLaunchMode);
        proto.write(ApplicationStartInfoProto.WAS_FORCE_STOPPED, mWasForceStopped);
        proto.write(ApplicationStartInfoProto.MONOTONIC_CREATION_TIME_MS, mMonoticCreationTimeMs);
        proto.write(ApplicationStartInfoProto.MONOTONIC_CREATION_TIME_MS, mMonotonicCreationTimeMs);
        proto.write(ApplicationStartInfoProto.START_COMPONENT, mStartComponent);
        proto.end(token);
    }
@@ -980,7 +980,7 @@ public final class ApplicationStartInfo implements Parcelable {
                            ApplicationStartInfoProto.WAS_FORCE_STOPPED);
                    break;
                case (int) ApplicationStartInfoProto.MONOTONIC_CREATION_TIME_MS:
                    mMonoticCreationTimeMs = proto.readLong(
                    mMonotonicCreationTimeMs = proto.readLong(
                            ApplicationStartInfoProto.MONOTONIC_CREATION_TIME_MS);
                    break;
                case (int) ApplicationStartInfoProto.START_COMPONENT:
@@ -999,7 +999,7 @@ public final class ApplicationStartInfo implements Parcelable {
        sb.append(prefix)
                .append("ApplicationStartInfo ").append(seqSuffix).append(':')
                .append('\n')
                .append(" monotonicCreationTimeMs=").append(mMonoticCreationTimeMs)
                .append(" monotonicCreationTimeMs=").append(mMonotonicCreationTimeMs)
                .append('\n')
                .append(" pid=").append(mPid)
                .append(" realUid=").append(mRealUid)
@@ -1094,7 +1094,7 @@ public final class ApplicationStartInfo implements Parcelable {
                && TextUtils.equals(mProcessName, o.mProcessName)
                && timestampsEquals(o)
                && mWasForceStopped == o.mWasForceStopped
                && mMonoticCreationTimeMs == o.mMonoticCreationTimeMs
                && mMonotonicCreationTimeMs == o.mMonotonicCreationTimeMs
                && mStartComponent == o.mStartComponent;
    }

@@ -1102,7 +1102,7 @@ public final class ApplicationStartInfo implements Parcelable {
    public int hashCode() {
        return Objects.hash(mPid, mRealUid, mPackageUid, mDefiningUid, mReason, mStartupState,
                mStartType, mLaunchMode, mPackageName, mProcessName, mStartupTimestampsNs,
                mMonoticCreationTimeMs, mStartComponent);
                mMonotonicCreationTimeMs, mStartComponent);
    }

    private boolean timestampsEquals(@NonNull ApplicationStartInfo other) {
+9 −7
Original line number Diff line number Diff line
@@ -728,8 +728,8 @@ public final class AppStartInfoTracker {

                    Collections.sort(
                            list, (a, b) ->
                            Long.compare(b.getMonoticCreationTimeMs(),
                                    a.getMonoticCreationTimeMs()));
                            Long.compare(b.getMonotonicCreationTimeMs(),
                                    a.getMonotonicCreationTimeMs()));
                    int size = list.size();
                    if (maxNum > 0) {
                        size = Math.min(size, maxNum);
@@ -1274,7 +1274,8 @@ public final class AppStartInfoTracker {
            if (!android.app.Flags.appStartInfoKeepRecordsSorted()) {
                // Sort records so we can remove the least recent ones.
                Collections.sort(mInfos, (a, b) ->
                        Long.compare(b.getMonoticCreationTimeMs(), a.getMonoticCreationTimeMs()));
                        Long.compare(b.getMonotonicCreationTimeMs(),
                                a.getMonotonicCreationTimeMs()));
            }

            // Remove records and trim list object back to size.
@@ -1304,8 +1305,8 @@ public final class AppStartInfoTracker {
                    long oldestTimeStamp = Long.MAX_VALUE;
                    for (int i = 0; i < size; i++) {
                        ApplicationStartInfo startInfo = mInfos.get(i);
                        if (startInfo.getMonoticCreationTimeMs() < oldestTimeStamp) {
                            oldestTimeStamp = startInfo.getMonoticCreationTimeMs();
                        if (startInfo.getMonotonicCreationTimeMs() < oldestTimeStamp) {
                            oldestTimeStamp = startInfo.getMonotonicCreationTimeMs();
                            oldestIndex = i;
                        }
                    }
@@ -1315,7 +1316,8 @@ public final class AppStartInfoTracker {
                }
                mInfos.add(info);
                Collections.sort(mInfos, (a, b) ->
                        Long.compare(b.getMonoticCreationTimeMs(), a.getMonoticCreationTimeMs()));
                        Long.compare(b.getMonotonicCreationTimeMs(),
                                a.getMonotonicCreationTimeMs()));
            }
        }

@@ -1464,7 +1466,7 @@ public final class AppStartInfoTracker {
                long removeOlderThan = getMonotonicTimeMs() - APP_START_INFO_HISTORY_LENGTH_MS;
                // Iterate backwards so we can remove old records as we go.
                for (int i = size - 1; i >= 0; i--) {
                    if (mInfos.get(i).getMonoticCreationTimeMs() < removeOlderThan) {
                    if (mInfos.get(i).getMonotonicCreationTimeMs() < removeOlderThan) {
                        // Remove the record.
                        mInfos.remove(i);
                    } else {