Skip to content

Commit 051a6bd

Browse files
committed
Fix benchmark
1 parent 80bf8e7 commit 051a6bd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

benchmark/src/main/kotlin/com/github/skydoves/benchmark/BaselineProfileGenerator.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
package com.github.skydoves.benchmark
1818

19-
import androidx.benchmark.macro.ExperimentalStableBaselineProfilesApi
19+
import android.os.Build
20+
import androidx.annotation.RequiresApi
2021
import androidx.benchmark.macro.junit4.BaselineProfileRule
2122
import androidx.test.uiautomator.By
2223
import androidx.test.uiautomator.BySelector
@@ -30,14 +31,14 @@ import org.junit.Test
3031
/**
3132
* Generates a baseline profile which can be copied to `app/src/main/baseline-prof.txt`.
3233
*/
34+
@RequiresApi(Build.VERSION_CODES.P)
3335
class BaselineProfileGenerator {
3436
@get:Rule
3537
val baselineProfileRule = BaselineProfileRule()
3638

3739
@Test
38-
@OptIn(ExperimentalStableBaselineProfilesApi::class)
3940
fun startup() =
40-
baselineProfileRule.collectStableBaselineProfile(
41+
baselineProfileRule.collect(
4142
packageName = packageName,
4243
stableIterations = 2,
4344
maxIterations = 8
@@ -50,7 +51,7 @@ class BaselineProfileGenerator {
5051
device.waitForIdle()
5152

5253
// Navigate to the details screen
53-
device.testDiscover() || return@collectStableBaselineProfile
54+
device.testDiscover() || return@collect
5455
device.navigateFromMainToDetails()
5556
device.pressBack()
5657
}

0 commit comments

Comments
 (0)