Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Revert "Configure baseline profiles in the baselineProfile lambda" (#1398)

Jose Alcérreca1da560f582bb
diff --git a/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt b/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt
index 55632ca61..8a4bff7ab 100644
--- a/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt
+++ b/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt
@@ -68,7 +68,7 @@ androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0
androidx.lifecycle:lifecycle-viewmodel:2.7.0
androidx.loader:loader:1.0.0
-androidx.metrics:metrics-performance:1.0.0-beta01
+androidx.metrics:metrics-performance:1.0.0-alpha04
androidx.profileinstaller:profileinstaller:1.3.1
androidx.savedstate:savedstate-ktx:1.2.1
androidx.savedstate:savedstate:1.2.1
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 6e2d9618b..afd37736f 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -52,7 +52,9 @@ android {
// To publish on the Play store a private signing key is required, but to allow anyone
// who clones the code to sign and run the release variant, use the debug signing key.
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
- signingConfig = signingConfigs.getByName("debug")
+ signingConfig = signingConfigs.named("debug").get()
+ // Ensure Baseline Profile is fresh for release builds.
+ baselineProfile.automaticGenerationDuringBuild = true
}
}
@@ -69,20 +71,6 @@ android {
namespace = "com.google.samples.apps.nowinandroid"
}
-baselineProfile {
- saveInSrc = false
- // Don't build on every iteration of a full assemble.
- // Instead enable generation directly for the release build variant.
- automaticGenerationDuringBuild = false
- mergeIntoMain = true
- variants {
- create("release") {
- // Ensure Baseline Profile is fresh for release builds.
- automaticGenerationDuringBuild = true
- }
- }
-}
-
dependencies {
implementation(projects.feature.interests)
implementation(projects.feature.foryou)
diff --git a/app/dependencies/prodReleaseRuntimeClasspath.txt b/app/dependencies/prodReleaseRuntimeClasspath.txt
index 69e3cd651..7cd6df2d2 100644
--- a/app/dependencies/prodReleaseRuntimeClasspath.txt
+++ b/app/dependencies/prodReleaseRuntimeClasspath.txt
@@ -102,7 +102,7 @@ androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.0-alpha04
androidx.lifecycle:lifecycle-viewmodel:2.8.0-alpha04
androidx.loader:loader:1.0.0
androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
-androidx.metrics:metrics-performance:1.0.0-beta01
+androidx.metrics:metrics-performance:1.0.0-alpha04
androidx.navigation:navigation-common-ktx:2.7.4
androidx.navigation:navigation-common:2.7.4
androidx.navigation:navigation-compose:2.7.4
diff --git a/app/src/testDemo/screenshots/snackbar_expanded_expanded.png b/app/src/testDemo/screenshots/snackbar_expanded_expanded.png
index ec075f3d9..e4c7520ab 100644
Binary files a/app/src/testDemo/screenshots/snackbar_expanded_expanded.png and b/app/src/testDemo/screenshots/snackbar_expanded_expanded.png differ
diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts
index 6ff797c2b..279c4b226 100644
--- a/benchmarks/build.gradle.kts
+++ b/benchmarks/build.gradle.kts
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import com.android.build.api.dsl.ManagedVirtualDevice
import com.google.samples.apps.nowinandroid.configureFlavors
plugins {
@@ -47,7 +46,7 @@ android {
}
testOptions.managedDevices.devices {
- create<ManagedVirtualDevice>("pixel6Api33") {
+ create<com.android.build.api.dsl.ManagedVirtualDevice>("pixel6Api33") {
device = "Pixel 6"
apiLevel = 33
systemImageSource = "aosp"
diff --git a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt
index bca9ce117..20b941a24 100644
--- a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt
+++ b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt
@@ -41,11 +41,6 @@ fun MacrobenchmarkScope.forYouWaitForContent() {
*/
fun MacrobenchmarkScope.forYouSelectTopics(recheckTopicsIfChecked: Boolean = false) {
val topics = device.findObject(By.res("forYou:topicSelection"))
- val noChildren = topics.childCount == 0
- if (noChildren) {
- // TODO: Ensure ForYou has topics.
- fail("No topics found, can't scroll for baseline profile generation.")
- }
// Set gesture margin from sides not to trigger system gesture navigation
val horizontalMargin = 10 * topics.visibleBounds.width() / 100
@@ -56,6 +51,9 @@ fun MacrobenchmarkScope.forYouSelectTopics(recheckTopicsIfChecked: Boolean = fal
var visited = 0
while (visited < 3) {
+ if (topics.childCount == 0) {
+ fail("No topics found, can't generate profile for ForYou page.")
+ }
// Selecting some topics, which will populate items in the feed.
val topic = topics.children[index % topics.childCount]
// Find the checkable element to figure out whether it's checked or not
diff --git a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsActions.kt b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsActions.kt
index 82b707c2e..05b276faa 100644
--- a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsActions.kt
+++ b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsActions.kt
@@ -21,7 +21,6 @@ import androidx.test.uiautomator.By
import androidx.test.uiautomator.Until
import com.google.samples.apps.nowinandroid.flingElementDownUp
import com.google.samples.apps.nowinandroid.waitForObjectOnTopAppBar
-import org.junit.Assert.fail
fun MacrobenchmarkScope.goToInterestsScreen() {
device.findObject(By.text("Interests")).click()
@@ -36,12 +35,7 @@ fun MacrobenchmarkScope.goToInterestsScreen() {
fun MacrobenchmarkScope.interestsScrollTopicsDownUp() {
device.wait(Until.hasObject(By.res("interests:topics")), 5_000)
val topicsList = device.findObject(By.res("interests:topics"))
- if (topicsList != null) {
- // TODO: Ensure topics are availble.
- device.flingElementDownUp(topicsList)
- } else {
- fail("No topics found, can't scroll during baseline profile generation.")
- }
+ device.flingElementDownUp(topicsList)
}
fun MacrobenchmarkScope.interestsWaitForTopics() {
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 6c1acdfe9..7c354432c 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -18,8 +18,8 @@ androidxDataStore = "1.0.0"
androidxEspresso = "3.5.1"
androidxHiltNavigationCompose = "1.2.0"
androidxLifecycle = "2.7.0"
-androidxMacroBenchmark = "1.2.4"
-androidxMetrics = "1.0.0-beta01"
+androidxMacroBenchmark = "1.2.2"
+androidxMetrics = "1.0.0-alpha04"
androidxNavigation = "2.7.4"
androidxProfileinstaller = "1.3.1"
androidxTestCore = "1.5.0"