Skip to content

Commit c554ca2

Browse files
authored
reduced bitmap size and background worker count in ProfilingSampleActivity to reduce the likeliness of ANRs during tests (#3138)
1 parent 174dacb commit c554ca2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

sentry-android-integration-tests/sentry-uitest-android/src/main/java/io/sentry/uitest/android/ProfilingSampleActivity.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class ProfilingSampleActivity : AppCompatActivity() {
2626
}
2727

2828
private lateinit var binding: ActivityProfilingSampleBinding
29-
private val backgroundThreadPoolSize = 2
30-
private val executor: ExecutorService = Executors.newFixedThreadPool(backgroundThreadPoolSize)
29+
private val executor: ExecutorService = Executors.newFixedThreadPool(1)
3130
private var resumed = false
3231

3332
override fun onCreate(savedInstanceState: Bundle?) {
@@ -64,10 +63,8 @@ class ProfilingSampleActivity : AppCompatActivity() {
6463
resumed = true
6564

6665
// Do operations until the activity is paused.
67-
repeat(backgroundThreadPoolSize) {
68-
executor.execute {
69-
fibonacci(50)
70-
}
66+
executor.execute {
67+
fibonacci(50)
7168
}
7269
}
7370

@@ -99,7 +96,7 @@ internal class ProfilingSampleListAdapter : RecyclerView.Adapter<ViewHolder>() {
9996

10097
@Suppress("MagicNumber")
10198
private fun generateBitmap(): Bitmap {
102-
val bitmapSize = 512
99+
val bitmapSize = 256
103100
val colors = (0 until (bitmapSize * bitmapSize)).map {
104101
Color.rgb(Random.nextInt(256), Random.nextInt(256), Random.nextInt(256))
105102
}.toIntArray()

0 commit comments

Comments
 (0)