Skip to content

Commit c0393d4

Browse files
committed
Update baseline profiles
1 parent 82fc269 commit c0393d4

File tree

10 files changed

+19495
-843
lines changed

10 files changed

+19495
-843
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ android {
1616

1717
defaultConfig {
1818
applicationId = "io.getstream.webrtc.sample.compose"
19-
minSdk = Configurations.minSdk
19+
minSdk = Configurations.appMinSdk
2020
targetSdk = Configurations.targetSdk
2121
versionName = Configurations.versionName
2222

app/src/main/kotlin/io/getstream/webrtc/sample/compose/MainActivity.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import androidx.compose.runtime.mutableStateOf
3030
import androidx.compose.runtime.remember
3131
import androidx.compose.runtime.setValue
3232
import androidx.compose.ui.Modifier
33-
import io.getstream.webrtc.sample.compose.ui.screens.stage.StageScreen
3433
import io.getstream.webrtc.sample.compose.ui.screens.video.VideoCallScreen
3534
import io.getstream.webrtc.sample.compose.ui.theme.WebrtcSampleComposeTheme
3635
import io.getstream.webrtc.sample.compose.webrtc.SignalingClient
@@ -65,11 +64,7 @@ class MainActivity : ComponentActivity() {
6564
var onCallScreen by remember { mutableStateOf(BuildConfig.BUILD_TYPE == "benchmark") }
6665
val state by sessionManager.signalingClient.sessionStateFlow.collectAsState()
6766

68-
if (!onCallScreen) {
69-
StageScreen(state = state) { onCallScreen = true }
70-
} else {
71-
VideoCallScreen()
72-
}
67+
VideoCallScreen()
7368
}
7469
}
7570
}

app/src/release/generated/baselineProfiles/baseline-prof.txt

Lines changed: 9701 additions & 0 deletions
Large diffs are not rendered by default.

app/src/release/generated/baselineProfiles/startup-prof.txt

Lines changed: 9701 additions & 0 deletions
Large diffs are not rendered by default.

benchmark/build.gradle.kts

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,27 @@ android {
2626
namespace = "io.getstream.webrtc.android.benchmark"
2727
compileSdk = Configurations.compileSdk
2828

29+
defaultConfig {
30+
minSdk = 24
31+
targetSdk = Configurations.targetSdk
32+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
33+
}
34+
2935
compileOptions {
3036
sourceCompatibility = JavaVersion.VERSION_11
3137
targetCompatibility = JavaVersion.VERSION_11
3238
}
3339

34-
buildTypes {
35-
// This benchmark buildType is used for benchmarking, and should function like your
36-
// release build (for example, with minification on). It"s signed with a debug key
37-
// for easy local/CI testing.
38-
create("benchmark") {
39-
isDebuggable = true
40-
signingConfig = getByName("debug").signingConfig
41-
matchingFallbacks += listOf("release")
42-
}
43-
}
44-
45-
defaultConfig {
46-
minSdk = 24
47-
targetSdk = Configurations.targetSdk
48-
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
40+
buildFeatures {
41+
buildConfig = true
4942
}
5043

5144
targetProjectPath = ":app"
45+
experimentalProperties["android.experimental.self-instrumenting"] = true
5246
testOptions.managedDevices.devices {
53-
maybeCreate<com.android.build.api.dsl.ManagedVirtualDevice>("pixel6api31").apply {
47+
maybeCreate<com.android.build.api.dsl.ManagedVirtualDevice>("pixel6Api33").apply {
5448
device = "Pixel 6"
55-
apiLevel = 31
49+
apiLevel = 33
5650
systemImageSource = "aosp"
5751
}
5852
}
@@ -61,10 +55,9 @@ android {
6155
// This is the plugin configuration. Everything is optional. Defaults are in the
6256
// comments. In this example, you use the GMD added earlier and disable connected devices.
6357
baselineProfile {
64-
65-
// This specifies the managed devices to use that you run the tests on. The default
66-
// is none.
67-
managedDevices += "pixel6api31"
58+
// This specifies the managed devices to use that you run the tests on.
59+
managedDevices.clear()
60+
managedDevices += "pixel6Api33"
6861

6962
// This enables using connected devices to generate profiles. The default is true.
7063
// When using connected devices, they must be rooted or API 33 and higher.

benchmark/src/main/java/io/getstream/webrtc/android/benchmark/BaselineProfileGenerator.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package io.getstream.webrtc.android.benchmark
1919
import android.os.Build
2020
import androidx.annotation.RequiresApi
2121
import androidx.benchmark.macro.junit4.BaselineProfileRule
22+
import androidx.test.uiautomator.By
2223
import org.junit.Rule
2324
import org.junit.Test
2425

@@ -34,13 +35,15 @@ class BaselineProfileGenerator {
3435
fun startup() =
3536
baselineProfileRule.collect(
3637
packageName = "io.getstream.webrtc.sample.compose",
38+
stableIterations = 2,
39+
maxIterations = 8,
3740
includeInStartupProfile = true,
3841
) {
39-
pressHome()
40-
// This block defines the app's critical user journey. Here we are interested in
41-
// optimizing for app startup. But you can also navigate and scroll
42-
// through your most important UI.
4342
startActivityAndWait()
43+
4444
device.waitForIdle()
45+
46+
device.waitForObject(By.text(getPermissionText()), 5_000)?.click()
47+
device.waitForObject(By.text(getPermissionText()), 5_000)?.click()
4548
}
4649
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2014-2024 Stream.io Inc. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.getstream.webrtc.android.benchmark
18+
19+
import android.os.Build
20+
import androidx.test.uiautomator.BySelector
21+
import androidx.test.uiautomator.UiDevice
22+
import androidx.test.uiautomator.UiObject2
23+
import androidx.test.uiautomator.Until
24+
25+
internal fun getPermissionText(): String {
26+
return when {
27+
Build.VERSION.SDK_INT <= 28 -> "ALLOW"
28+
Build.VERSION.SDK_INT == 29 -> "Allow only while using the app"
29+
else -> "While using the app"
30+
}
31+
}
32+
33+
internal fun UiDevice.waitForObject(selector: BySelector, timeout: Long = 5_000): UiObject2? {
34+
if (wait(Until.hasObject(selector), timeout)) {
35+
return findObject(selector)
36+
}
37+
return null
38+
}

buildSrc/src/main/kotlin/io/getstream/Configurations.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ object Configurations {
44
const val compileSdk = 35
55
const val targetSdk = 35
66
const val minSdk = 21
7+
const val appMinSdk = 24
78
const val majorVersion = 1
89
const val minorVersion = 2
910
const val patchVersion = 3

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22
streamLog = "1.1.4"
3-
landscapist = "2.4.1"
3+
landscapist = "2.4.2"
44
jvmTarget = "11"
55
androidGradlePlugin = "8.6.1"
66
androidxActivity = "1.9.3"
@@ -20,7 +20,7 @@ kotlinxCoroutines = "1.9.0"
2020
okhttp = "4.12.0"
2121
retrofit = "2.9.0"
2222
spotless = "6.21.0"
23-
androidxMacroBenchmark = "1.3.3"
23+
androidxMacroBenchmark = "1.4.0-alpha05"
2424
androidxProfileinstaller = "1.4.1"
2525
androidxUiAutomator = "2.3.0"
2626

0 commit comments

Comments
 (0)