diff options
author | Aurimas Liutikas <aurimas@google.com> | 2021-05-11 21:19:00 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-05-11 21:19:00 +0000 |
commit | de6c7e8d3a89f5c34d17b925943f0a23035770d5 (patch) | |
tree | 0ba1896045b67bf6dd1fb8f2470fc79a13b68fcc | |
parent | d3eafff21c7269ceeefa148b3786fd0146a9855d (diff) | |
parent | b8f6cdd074ddc63aca911e0167496eb8085f5b99 (diff) | |
download | trebuchet-de6c7e8d3a89f5c34d17b925943f0a23035770d5.tar.gz |
Fix usage of minBy to unblock Kotlin 1.5 upgrade am: 6e914b3fe5 am: b8f6cdd074
Original change: https://android-review.googlesource.com/c/platform/tools/trebuchet/+/1697313
Change-Id: Ief6e71f4e63612c46e687bb14a36ce306ed18598
-rw-r--r-- | core/common/src/main/kotlin/trebuchet/queries/SliceQueries.kt | 2 | ||||
-rw-r--r-- | trebuchet/startup-common/src/StartupCommon.kt | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/common/src/main/kotlin/trebuchet/queries/SliceQueries.kt b/core/common/src/main/kotlin/trebuchet/queries/SliceQueries.kt index 79a9183..00f9953 100644 --- a/core/common/src/main/kotlin/trebuchet/queries/SliceQueries.kt +++ b/core/common/src/main/kotlin/trebuchet/queries/SliceQueries.kt @@ -113,7 +113,7 @@ fun ThreadModel.selectAll(predicate: (Slice) -> Boolean): List<Slice> { * @param predicate The predicate used to test slices */ fun Model.selectFirst(predicate: (Slice) -> Boolean) : Slice? { - return this.processes.values.mapNotNull { it.selectFirst(predicate) }.minBy { it.startTime } + return this.processes.values.mapNotNull { it.selectFirst(predicate) }.minByOrNull { it.startTime } } diff --git a/trebuchet/startup-common/src/StartupCommon.kt b/trebuchet/startup-common/src/StartupCommon.kt index 75ed400..2cf4793 100644 --- a/trebuchet/startup-common/src/StartupCommon.kt +++ b/trebuchet/startup-common/src/StartupCommon.kt @@ -115,7 +115,7 @@ fun Model.findProcess(queryName: String, map { it.slices }. filter { it.isNotEmpty() }. map { it.first().startTime }. - min() ?: throw MissingProcessInfoException(process.id) + minOrNull() ?: throw MissingProcessInfoException(process.id) if (firstSliceStart in lowerBound..upperBound) { return process @@ -142,7 +142,7 @@ fun Model.getStartupEvents() : List<StartupEvent> { val newProc = this.findProcess(newProcName, systemServerSlice.startTime, systemServerSlice.endTime) val startProcSlice = systemServerProc.findFirstSlice(SLICE_NAME_PROC_START, newProcName, systemServerSlice.startTime, systemServerSlice.endTime) val rfdSlice = systemServerProc.findFirstSliceOrNull(SLICE_NAME_REPORT_FULLY_DRAWN, newProcName, systemServerSlice.startTime) - val firstSliceTime = newProc.threads.map { it.slices.firstOrNull()?.startTime ?: Double.POSITIVE_INFINITY }.min()!! + val firstSliceTime = newProc.threads.map { it.slices.firstOrNull()?.startTime ?: Double.POSITIVE_INFINITY }.minOrNull()!! val schedSliceInfo : MutableMap<SchedulingState, Double> = mutableMapOf() newProc.threads.first().schedSlices.forEach schedLoop@ { schedSlice -> |