File tree Expand file tree Collapse file tree 8 files changed +33
-12
lines changed
app-nia-catalog/dependencies
src/main/kotlin/com/google/samples/apps/nowinandroid Expand file tree Collapse file tree 8 files changed +33
-12
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0
6868androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0
6969androidx.lifecycle:lifecycle-viewmodel:2.7.0
7070androidx.loader:loader:1.0.0
71- androidx.metrics:metrics-performance:1.0.0-alpha04
71+ androidx.metrics:metrics-performance:1.0.0-beta01
7272androidx.profileinstaller:profileinstaller:1.3.1
7373androidx.savedstate:savedstate-ktx:1.2.1
7474androidx.savedstate:savedstate:1.2.1
Original file line number Diff line number Diff line change @@ -52,9 +52,7 @@ android {
5252 // To publish on the Play store a private signing key is required, but to allow anyone
5353 // who clones the code to sign and run the release variant, use the debug signing key.
5454 // TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
55- signingConfig = signingConfigs.named(" debug" ).get()
56- // Ensure Baseline Profile is fresh for release builds.
57- baselineProfile.automaticGenerationDuringBuild = true
55+ signingConfig = signingConfigs.getByName(" debug" )
5856 }
5957 }
6058
@@ -71,6 +69,20 @@ android {
7169 namespace = " com.google.samples.apps.nowinandroid"
7270}
7371
72+ baselineProfile {
73+ saveInSrc = false
74+ // Don't build on every iteration of a full assemble.
75+ // Instead enable generation directly for the release build variant.
76+ automaticGenerationDuringBuild = false
77+ mergeIntoMain = true
78+ variants {
79+ create(" release" ) {
80+ // Ensure Baseline Profile is fresh for release builds.
81+ automaticGenerationDuringBuild = true
82+ }
83+ }
84+ }
85+
7486dependencies {
7587 implementation(projects.feature.interests)
7688 implementation(projects.feature.foryou)
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.0-alpha04
102102androidx.lifecycle:lifecycle-viewmodel:2.8.0-alpha04
103103androidx.loader:loader:1.0.0
104104androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
105- androidx.metrics:metrics-performance:1.0.0-alpha04
105+ androidx.metrics:metrics-performance:1.0.0-beta01
106106androidx.navigation:navigation-common-ktx:2.7.4
107107androidx.navigation:navigation-common:2.7.4
108108androidx.navigation:navigation-compose:2.7.4
Original file line number Diff line number Diff line change 1313 * See the License for the specific language governing permissions and
1414 * limitations under the License.
1515 */
16+ import com.android.build.api.dsl.ManagedVirtualDevice
1617import com.google.samples.apps.nowinandroid.configureFlavors
1718
1819plugins {
@@ -46,7 +47,7 @@ android {
4647 }
4748
4849 testOptions.managedDevices.devices {
49- create< com.android.build.api.dsl. ManagedVirtualDevice > (" pixel6Api33" ) {
50+ create<ManagedVirtualDevice >(" pixel6Api33" ) {
5051 device = " Pixel 6"
5152 apiLevel = 33
5253 systemImageSource = " aosp"
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ fun MacrobenchmarkScope.forYouWaitForContent() {
4141 */
4242fun MacrobenchmarkScope.forYouSelectTopics (recheckTopicsIfChecked : Boolean = false) {
4343 val topics = device.findObject(By .res(" forYou:topicSelection" ))
44+ val noChildren = topics.childCount == 0
45+ if (noChildren) {
46+ // TODO: Ensure ForYou has topics.
47+ fail(" No topics found, can't scroll for baseline profile generation." )
48+ }
4449
4550 // Set gesture margin from sides not to trigger system gesture navigation
4651 val horizontalMargin = 10 * topics.visibleBounds.width() / 100
@@ -51,9 +56,6 @@ fun MacrobenchmarkScope.forYouSelectTopics(recheckTopicsIfChecked: Boolean = fal
5156 var visited = 0
5257
5358 while (visited < 3 ) {
54- if (topics.childCount == 0 ) {
55- fail(" No topics found, can't generate profile for ForYou page." )
56- }
5759 // Selecting some topics, which will populate items in the feed.
5860 val topic = topics.children[index % topics.childCount]
5961 // Find the checkable element to figure out whether it's checked or not
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import androidx.test.uiautomator.By
2121import androidx.test.uiautomator.Until
2222import com.google.samples.apps.nowinandroid.flingElementDownUp
2323import com.google.samples.apps.nowinandroid.waitForObjectOnTopAppBar
24+ import org.junit.Assert.fail
2425
2526fun MacrobenchmarkScope.goToInterestsScreen () {
2627 device.findObject(By .text(" Interests" )).click()
@@ -35,7 +36,12 @@ fun MacrobenchmarkScope.goToInterestsScreen() {
3536fun MacrobenchmarkScope.interestsScrollTopicsDownUp () {
3637 device.wait(Until .hasObject(By .res(" interests:topics" )), 5_000 )
3738 val topicsList = device.findObject(By .res(" interests:topics" ))
38- device.flingElementDownUp(topicsList)
39+ if (topicsList != null ) {
40+ // TODO: Ensure topics are availble.
41+ device.flingElementDownUp(topicsList)
42+ } else {
43+ fail(" No topics found, can't scroll during baseline profile generation." )
44+ }
3945}
4046
4147fun MacrobenchmarkScope.interestsWaitForTopics () {
Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ androidxDataStore = "1.0.0"
1818androidxEspresso = " 3.5.1"
1919androidxHiltNavigationCompose = " 1.2.0"
2020androidxLifecycle = " 2.7.0"
21- androidxMacroBenchmark = " 1.2.2 "
22- androidxMetrics = " 1.0.0-alpha04 "
21+ androidxMacroBenchmark = " 1.2.4 "
22+ androidxMetrics = " 1.0.0-beta01 "
2323androidxNavigation = " 2.7.4"
2424androidxProfileinstaller = " 1.3.1"
2525androidxTestCore = " 1.5.0"
You can’t perform that action at this time.
0 commit comments