Merge "Migrate to use new javascript-for-kotlin repo" into androidx-main
diff --git a/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/rotary/RotaryScrollEventTest.kt b/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/rotary/RotaryScrollEventTest.kt
index 60a83c0..be72fd0 100644
--- a/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/rotary/RotaryScrollEventTest.kt
+++ b/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/rotary/RotaryScrollEventTest.kt
@@ -16,6 +16,7 @@
package androidx.compose.ui.input.rotary
+import android.view.MotionEvent
import android.view.MotionEvent.ACTION_SCROLL
import android.view.View
import android.view.ViewConfiguration
@@ -38,6 +39,7 @@
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.test.performRotaryScrollInput
import androidx.compose.ui.unit.dp
+import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.view.InputDeviceCompat.SOURCE_ROTARY_ENCODER
import androidx.core.view.ViewConfigurationCompat.getScaledHorizontalScrollFactor
import androidx.core.view.ViewConfigurationCompat.getScaledVerticalScrollFactor
@@ -452,6 +454,41 @@
}
}
+ @Test
+ fun onRotary_views_Interop() {
+ // Arrange
+ var eventFromOnView: MotionEvent? = null
+ lateinit var buttonView: View
+
+ rule.setFocusableContent {
+ AndroidView(
+ factory = { context ->
+ android.widget.Button(context).apply {
+ isFocusable = true
+ isFocusableInTouchMode = true
+ text = "Text"
+ setOnGenericMotionListener { view, event ->
+ if (view == this) {
+ eventFromOnView = event
+ }
+ false
+ }
+
+ buttonView = this
+ }
+ }
+ )
+ }
+ rule.runOnIdle { buttonView.requestFocus() }
+
+ // Act.
+ @OptIn(ExperimentalTestApi::class)
+ rule.onRoot().performRotaryScrollInput { rotateToScrollVertically(3.0f) }
+
+ // Assert.
+ rule.runOnIdle { assertThat(eventFromOnView).isNotNull() }
+ }
+
private fun Modifier.focusable(initiallyFocused: Boolean = false) =
this.then(if (initiallyFocused) Modifier.focusRequester(initialFocus) else Modifier)
.focusTarget()
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
index c7891fd..7b2f1c2 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
@@ -1961,7 +1961,9 @@
uptimeMillis = event.eventTime,
inputDeviceId = event.deviceId
)
- return focusOwner.dispatchRotaryEvent(rotaryEvent)
+ return focusOwner.dispatchRotaryEvent(rotaryEvent) {
+ super.dispatchGenericMotionEvent(event)
+ }
}
private fun handleMotionEvent(motionEvent: MotionEvent): ProcessResult {
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/FocusGroupNode.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/FocusGroupNode.android.kt
index 2406bfa..72c11a2 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/FocusGroupNode.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/FocusGroupNode.android.kt
@@ -76,6 +76,7 @@
// If this requestFocus is triggered by the embedded view getting focus,
// then we don't perform this onEnter logic.
val embeddedView = getView()
+
if (embeddedView.isFocused || embeddedView.hasFocus()) return Default
val focusOwner = requireOwner().focusOwner
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwner.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwner.kt
index 4f4d655..a22a570 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwner.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwner.kt
@@ -130,7 +130,10 @@
fun dispatchInterceptedSoftKeyboardEvent(keyEvent: KeyEvent): Boolean
/** Dispatches a rotary scroll event through the compose hierarchy. */
- fun dispatchRotaryEvent(event: RotaryScrollEvent): Boolean
+ fun dispatchRotaryEvent(
+ event: RotaryScrollEvent,
+ onFocusedItem: () -> Boolean = { false }
+ ): Boolean
/** Schedule a FocusTarget node to be invalidated after onApplyChanges. */
fun scheduleInvalidation(node: FocusTargetNode)
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwnerImpl.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwnerImpl.kt
index 368f783..3ec79ad 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwnerImpl.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwnerImpl.kt
@@ -310,7 +310,10 @@
}
/** Dispatches a rotary scroll event through the compose hierarchy. */
- override fun dispatchRotaryEvent(event: RotaryScrollEvent): Boolean {
+ override fun dispatchRotaryEvent(
+ event: RotaryScrollEvent,
+ onFocusedItem: () -> Boolean
+ ): Boolean {
check(!focusInvalidationManager.hasPendingInvalidation()) {
"Dispatching rotary event while focus system is invalidated."
}
@@ -321,7 +324,7 @@
focusedRotaryInputNode?.traverseAncestorsIncludingSelf(
type = Nodes.RotaryInput,
onPreVisit = { if (it.onPreRotaryScrollEvent(event)) return true },
- onVisit = { /* TODO(b/320510084): dispatch rotary events to embedded views. */ },
+ onVisit = { if (onFocusedItem()) return true },
onPostVisit = { if (it.onRotaryScrollEvent(event)) return true }
)
diff --git a/libraryversions.toml b/libraryversions.toml
index 6c18973..22137c4 100644
--- a/libraryversions.toml
+++ b/libraryversions.toml
@@ -162,9 +162,9 @@
WEAR_INPUT_TESTING = "1.2.0-alpha03"
WEAR_ONGOING = "1.1.0-alpha02"
WEAR_PHONE_INTERACTIONS = "1.1.0-alpha04"
-WEAR_PROTOLAYOUT = "1.3.0-alpha02"
+WEAR_PROTOLAYOUT = "1.3.0-alpha03"
WEAR_REMOTE_INTERACTIONS = "1.1.0-rc01"
-WEAR_TILES = "1.5.0-alpha02"
+WEAR_TILES = "1.5.0-alpha03"
WEAR_TOOLING_PREVIEW = "1.0.0-rc01"
WEAR_WATCHFACE = "1.3.0-alpha04"
WEBKIT = "1.13.0-alpha01"
diff --git a/wear/compose/compose-material3/macrobenchmark-common/build.gradle b/wear/compose/compose-material3/macrobenchmark-common/build.gradle
index 57d5456..9f17202 100644
--- a/wear/compose/compose-material3/macrobenchmark-common/build.gradle
+++ b/wear/compose/compose-material3/macrobenchmark-common/build.gradle
@@ -20,6 +20,7 @@
dependencies {
implementation(libs.kotlinStdlib)
+ implementation(project(":benchmark:benchmark-macro-junit4"))
implementation(project(":compose:foundation:foundation"))
implementation(project(":compose:foundation:foundation-layout"))
implementation(project(":compose:runtime:runtime"))
@@ -28,4 +29,5 @@
implementation(project(":compose:ui:ui-tooling"))
implementation(project(":wear:compose:compose-foundation"))
implementation(project(":wear:compose:compose-material3"))
+ implementation project(':wear:compose:compose-material3-samples')
}
\ No newline at end of file
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/BaselineProfileScreens.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/BaselineProfileScreens.kt
deleted file mode 100644
index 49cea0a..0000000
--- a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/BaselineProfileScreens.kt
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.wear.compose.material3.macrobenchmark.common
-
-import android.os.Build
-import androidx.annotation.RequiresApi
-import androidx.compose.animation.core.Animatable
-import androidx.compose.foundation.clickable
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.size
-import androidx.compose.foundation.layout.wrapContentSize
-import androidx.compose.foundation.rememberScrollState
-import androidx.compose.foundation.verticalScroll
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableIntStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.rememberCoroutineScope
-import androidx.compose.runtime.setValue
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.res.painterResource
-import androidx.compose.ui.semantics.contentDescription
-import androidx.compose.ui.semantics.semantics
-import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.font.Font
-import androidx.compose.ui.text.font.FontVariation
-import androidx.compose.ui.text.font.toFontFamily
-import androidx.compose.ui.text.style.TextAlign
-import androidx.compose.ui.unit.sp
-import androidx.wear.compose.material3.AnimatedText
-import androidx.wear.compose.material3.AppCard
-import androidx.wear.compose.material3.Card
-import androidx.wear.compose.material3.CardDefaults
-import androidx.wear.compose.material3.Icon
-import androidx.wear.compose.material3.IconButton
-import androidx.wear.compose.material3.IconButtonDefaults
-import androidx.wear.compose.material3.ListHeader
-import androidx.wear.compose.material3.MaterialTheme
-import androidx.wear.compose.material3.OutlinedCard
-import androidx.wear.compose.material3.Text
-import androidx.wear.compose.material3.TitleCard
-import androidx.wear.compose.material3.rememberAnimatedTextFontRegistry
-import kotlinx.coroutines.launch
-
-val BaselineProfileScreens =
- listOf(
- BaselineProfileScreen { CardScreen() },
- BaselineProfileScreen { AnimatedIconButtonScreen() },
- BaselineProfileScreen {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) AnimatedTextScreen()
- },
- )
-
-@Composable
-private fun CardScreen() {
- Column(
- modifier = Modifier.verticalScroll(rememberScrollState()),
- verticalArrangement = Arrangement.Center,
- horizontalAlignment = Alignment.CenterHorizontally
- ) {
- ListHeader { Text("Card") }
- Card(
- onClick = {},
- onLongClick = {},
- onLongClickLabel = "Long click",
- colors = CardDefaults.cardColors()
- ) {
- Text("Card")
- }
-
- OutlinedCard(onClick = {}) { Text("Outlined card") }
-
- AppCard(
- onClick = {},
- appName = { Text("AppName") },
- title = {},
- time = { Text("02:34") },
- appImage = {
- Icon(
- painter = painterResource(id = android.R.drawable.star_big_off),
- contentDescription = "Star icon",
- modifier =
- Modifier.size(CardDefaults.AppImageSize)
- .wrapContentSize(align = Alignment.Center),
- )
- },
- ) {
- Text("AppCard")
- }
-
- TitleCard(
- onClick = {},
- title = { Text("Title") },
- subtitle = { Text("Subtitle") },
- colors =
- CardDefaults.imageCardColors(
- containerPainter =
- CardDefaults.imageWithScrimBackgroundPainter(
- backgroundImagePainter =
- painterResource(id = R.drawable.backgroundimage)
- ),
- contentColor = MaterialTheme.colorScheme.onSurface,
- titleColor = MaterialTheme.colorScheme.onSurface
- ),
- ) {
- Text("TitleCard")
- }
-
- TitleCard(
- onClick = { /* Do something */ },
- title = { Text("Card title") },
- time = { Text("now") },
- colors =
- CardDefaults.imageCardColors(
- containerPainter =
- CardDefaults.imageWithScrimBackgroundPainter(
- backgroundImagePainter =
- painterResource(id = R.drawable.backgroundimage)
- ),
- contentColor = MaterialTheme.colorScheme.onSurface,
- titleColor = MaterialTheme.colorScheme.onSurface
- ),
- contentPadding = CardDefaults.ImageContentPadding,
- modifier = Modifier.semantics { contentDescription = "Background image" }
- ) {
- Text("Card content")
- }
- }
-}
-
-@RequiresApi(Build.VERSION_CODES.S)
-@Composable
-private fun AnimatedTextScreen() {
- val scope = rememberCoroutineScope()
- val animatable = remember { Animatable(0.5f) }
- val textStyle = remember {
- TextStyle.Default.copy(
- fontFamily = Font(R.font.robotoflex_variable).toFontFamily(),
- fontSize = 50.sp
- )
- }
- val fontRegistry =
- rememberAnimatedTextFontRegistry(
- startFontVariationSettings =
- FontVariation.Settings(FontVariation.width(10f), FontVariation.weight(100)),
- endFontVariationSettings =
- FontVariation.Settings(FontVariation.width(100f), FontVariation.weight(900)),
- textStyle = textStyle
- )
-
- Row(
- modifier = Modifier.fillMaxSize(),
- horizontalArrangement = Arrangement.Center,
- verticalAlignment = Alignment.CenterVertically
- ) {
- var textValue by remember { mutableIntStateOf(150) }
- Box(
- modifier =
- Modifier.weight(1f)
- .semantics { contentDescription = "minusContentDescription" }
- .clickable {
- textValue -= 1
- scope.launch {
- animatable.animateTo(0f)
- animatable.animateTo(0.5f)
- }
- },
- contentAlignment = Alignment.Center
- ) {
- Text("-", fontSize = 30.sp, textAlign = TextAlign.Center)
- }
- Box(modifier = Modifier.weight(2f), contentAlignment = Alignment.Center) {
- AnimatedText(
- text = textValue.toString(),
- fontRegistry = fontRegistry,
- progressFraction = { animatable.value }
- )
- }
- Box(
- modifier =
- Modifier.weight(1f)
- .semantics { contentDescription = "plusContentDescription" }
- .clickable {
- textValue += 1
- scope.launch {
- animatable.animateTo(1f)
- animatable.animateTo(0.5f)
- }
- },
- contentAlignment = Alignment.Center
- ) {
- Text("+", fontSize = 30.sp)
- }
- }
-}
-
-@Composable
-fun AnimatedIconButtonScreen() {
- Column(
- Modifier.fillMaxSize(),
- verticalArrangement = Arrangement.SpaceAround,
- horizontalAlignment = Alignment.CenterHorizontally
- ) {
- repeat(4) {
- IconButton(
- modifier =
- Modifier.semantics { contentDescription = numberedContentDescription(it) },
- colors = IconButtonDefaults.filledIconButtonColors(),
- shapes = IconButtonDefaults.animatedShapes(),
- onClick = {}
- ) {
- Icon(
- painter = painterResource(R.drawable.ic_favorite_rounded),
- contentDescription = null,
- modifier = Modifier.size(IconButtonDefaults.DefaultIconSize)
- )
- }
- }
- }
-}
-
-/** Represents a screen used for generating a baseline profile. */
-class BaselineProfileScreen(
- val content: @Composable () -> Unit,
-)
-
-private fun numberedContentDescription(n: Int) = "find-me-$n"
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/Utils.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/Utils.kt
new file mode 100644
index 0000000..1f54bb2
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/Utils.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common
+
+import androidx.test.uiautomator.UiDevice
+
+internal fun numberedContentDescription(n: Int) = "find-me-$n"
+
+internal fun UiDevice.scrollDown() {
+ swipe(
+ displayWidth / 2,
+ displayHeight - displayHeight / 10,
+ displayWidth / 2,
+ displayHeight / 10,
+ 10
+ )
+}
+
+internal const val FIND_OBJECT_TIMEOUT_MS = 10_000L
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/AlertDialogScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/AlertDialogScreen.kt
new file mode 100644
index 0000000..2b5adb3
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/AlertDialogScreen.kt
@@ -0,0 +1,239 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.unit.dp
+import androidx.test.uiautomator.By
+import androidx.test.uiautomator.Until
+import androidx.wear.compose.material3.AlertDialog
+import androidx.wear.compose.material3.AlertDialogDefaults
+import androidx.wear.compose.material3.FilledTonalButton
+import androidx.wear.compose.material3.Icon
+import androidx.wear.compose.material3.MaterialTheme
+import androidx.wear.compose.material3.Text
+import androidx.wear.compose.material3.macrobenchmark.common.FIND_OBJECT_TIMEOUT_MS
+import androidx.wear.compose.material3.macrobenchmark.common.R
+
+val AlertDialogScreen =
+ object : BaselineProfileScreen {
+
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column(
+ modifier = Modifier.verticalScroll(rememberScrollState()),
+ verticalArrangement = Arrangement.Center,
+ horizontalAlignment = Alignment.CenterHorizontally
+ ) {
+ AlertDialogWithConfirmAndDismiss()
+ AlertDialogWithEdgeButton()
+ AlertDialogWithContentGroups()
+ }
+ }
+
+ override val exercise: MacrobenchmarkScope.() -> Unit
+ get() = {
+ device.findObject(By.desc(OpenAlertDialogWithConfirmAndDismiss)).click()
+ device.waitForIdle()
+ device.pressBack()
+ device.waitForIdle()
+
+ device
+ .wait(
+ Until.findObject(By.desc(OpenAlertDialogWithEdgeButton)),
+ FIND_OBJECT_TIMEOUT_MS
+ )
+ .click()
+ device.waitForIdle()
+ device.pressBack()
+ device.waitForIdle()
+
+ device
+ .wait(
+ Until.findObject(By.desc(OpenAlertDialogWithContentGroups)),
+ FIND_OBJECT_TIMEOUT_MS
+ )
+ .click()
+ device.waitForIdle()
+ device.pressBack()
+ device.waitForIdle()
+
+ device.wait(
+ Until.findObject(By.desc(OpenAlertDialogWithConfirmAndDismiss)),
+ FIND_OBJECT_TIMEOUT_MS
+ )
+ }
+ }
+
+@Composable
+private fun AlertDialogWithConfirmAndDismiss() {
+ var showDialog by remember { mutableStateOf(false) }
+
+ Box(Modifier.fillMaxSize()) {
+ FilledTonalButton(
+ modifier =
+ Modifier.align(Alignment.Center).semantics {
+ contentDescription = OpenAlertDialogWithConfirmAndDismiss
+ },
+ onClick = { showDialog = true },
+ label = { Text("Show Dialog") }
+ )
+ }
+ AlertDialog(
+ show = showDialog,
+ onDismissRequest = { showDialog = false },
+ icon = {
+ Icon(
+ painterResource(R.drawable.ic_favorite_rounded),
+ modifier = Modifier.size(32.dp),
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.primary
+ )
+ },
+ title = { Text("Enable Battery Saver Mode?") },
+ text = { Text("Your battery is low. Turn on battery saver.") },
+ confirmButton = {
+ AlertDialogDefaults.ConfirmButton(
+ onClick = {
+ // Perform confirm action here
+ showDialog = false
+ }
+ )
+ },
+ dismissButton = {
+ AlertDialogDefaults.DismissButton(
+ onClick = {
+ // Perform dismiss action here
+ showDialog = false
+ }
+ )
+ }
+ )
+}
+
+@Composable
+private fun AlertDialogWithEdgeButton() {
+ var showDialog by remember { mutableStateOf(false) }
+
+ Box(Modifier.fillMaxSize()) {
+ FilledTonalButton(
+ modifier =
+ Modifier.align(Alignment.Center).semantics {
+ contentDescription = OpenAlertDialogWithEdgeButton
+ },
+ onClick = { showDialog = true },
+ label = { Text("Show Dialog") }
+ )
+ }
+
+ AlertDialog(
+ show = showDialog,
+ onDismissRequest = { showDialog = false },
+ icon = {
+ Icon(
+ painterResource(R.drawable.ic_favorite_rounded),
+ modifier = Modifier.size(32.dp),
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.primary
+ )
+ },
+ title = { Text("Mobile network is not currently available") },
+ edgeButton = {
+ AlertDialogDefaults.EdgeButton(
+ onClick = {
+ // Perform confirm action here
+ showDialog = false
+ }
+ )
+ }
+ )
+}
+
+@Composable
+private fun AlertDialogWithContentGroups() {
+ var showDialog by remember { mutableStateOf(false) }
+
+ Box(Modifier.fillMaxSize()) {
+ FilledTonalButton(
+ modifier =
+ Modifier.align(Alignment.Center).semantics {
+ contentDescription = OpenAlertDialogWithContentGroups
+ },
+ onClick = { showDialog = true },
+ label = { Text("Show Dialog") }
+ )
+ }
+ AlertDialog(
+ show = showDialog,
+ onDismissRequest = { showDialog = false },
+ title = { Text("Share your location") },
+ text = { Text(" The following apps have asked you to share your location") },
+ ) {
+ item {
+ FilledTonalButton(
+ modifier = Modifier.fillMaxWidth(),
+ onClick = {},
+ label = { Text("Weather") }
+ )
+ }
+ item {
+ FilledTonalButton(
+ modifier = Modifier.fillMaxWidth(),
+ onClick = {},
+ label = { Text("Calendar") }
+ )
+ }
+ item { AlertDialogDefaults.GroupSeparator() }
+ item {
+ FilledTonalButton(
+ modifier = Modifier.fillMaxWidth(),
+ onClick = {},
+ label = { Text(modifier = Modifier.fillMaxWidth(), text = "Never share") }
+ )
+ }
+ item {
+ FilledTonalButton(
+ modifier = Modifier.fillMaxWidth(),
+ onClick = {},
+ label = { Text(modifier = Modifier.fillMaxWidth(), text = "Share always") }
+ )
+ }
+ }
+}
+
+private const val OpenAlertDialogWithConfirmAndDismiss = "OpenAlertDialogWithConfirmAndDismiss"
+private const val OpenAlertDialogWithEdgeButton = "OpenAlertDialogWithEdgeButton"
+private const val OpenAlertDialogWithContentGroups = "OpenAlertDialogWithContentGroups"
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/AnimatedTextScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/AnimatedTextScreen.kt
new file mode 100644
index 0000000..6be0bfe
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/AnimatedTextScreen.kt
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import android.os.Build
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.animation.core.Animatable
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.Font
+import androidx.compose.ui.text.font.FontVariation
+import androidx.compose.ui.text.font.toFontFamily
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.unit.sp
+import androidx.test.uiautomator.By
+import androidx.test.uiautomator.Until
+import androidx.wear.compose.material3.AnimatedText
+import androidx.wear.compose.material3.Text
+import androidx.wear.compose.material3.macrobenchmark.common.FIND_OBJECT_TIMEOUT_MS
+import androidx.wear.compose.material3.macrobenchmark.common.R
+import androidx.wear.compose.material3.rememberAnimatedTextFontRegistry
+import kotlinx.coroutines.launch
+
+val AnimatedTextScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ val scope = rememberCoroutineScope()
+ val animatable = remember { Animatable(0.5f) }
+ val textStyle = remember {
+ TextStyle.Default.copy(
+ fontFamily = Font(R.font.robotoflex_variable).toFontFamily(),
+ fontSize = 50.sp
+ )
+ }
+ val fontRegistry =
+ rememberAnimatedTextFontRegistry(
+ startFontVariationSettings =
+ FontVariation.Settings(
+ FontVariation.width(10f),
+ FontVariation.weight(100)
+ ),
+ endFontVariationSettings =
+ FontVariation.Settings(
+ FontVariation.width(100f),
+ FontVariation.weight(900)
+ ),
+ textStyle = textStyle
+ )
+
+ Row(
+ modifier = Modifier.fillMaxSize(),
+ horizontalArrangement = Arrangement.Center,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ var textValue by remember { mutableIntStateOf(150) }
+ Box(
+ modifier =
+ Modifier.weight(1f)
+ .semantics { contentDescription = MinusContentDescription }
+ .clickable {
+ textValue -= 1
+ scope.launch {
+ animatable.animateTo(0f)
+ animatable.animateTo(0.5f)
+ }
+ },
+ contentAlignment = Alignment.Center
+ ) {
+ Text("-", fontSize = 30.sp, textAlign = TextAlign.Center)
+ }
+ Box(
+ modifier = Modifier.weight(2f),
+ contentAlignment = Alignment.Center
+ ) {
+ AnimatedText(
+ text = textValue.toString(),
+ fontRegistry = fontRegistry,
+ progressFraction = { animatable.value }
+ )
+ }
+ Box(
+ modifier =
+ Modifier.weight(1f)
+ .semantics { contentDescription = PlusContentDescription }
+ .clickable {
+ textValue += 1
+ scope.launch {
+ animatable.animateTo(1f)
+ animatable.animateTo(0.5f)
+ }
+ },
+ contentAlignment = Alignment.Center
+ ) {
+ Text("+", fontSize = 30.sp)
+ }
+ }
+ }
+ }
+ }
+
+ override val exercise: MacrobenchmarkScope.() -> Unit
+ get() = {
+ device.wait(
+ Until.findObject(By.desc(MinusContentDescription)),
+ FIND_OBJECT_TIMEOUT_MS
+ )
+ repeat(3) { device.findObject(By.desc(MinusContentDescription)).click() }
+ repeat(3) { device.findObject(By.desc(PlusContentDescription)).click() }
+ device.waitForIdle()
+ }
+ }
+
+private const val MinusContentDescription = "MinusContentDescription"
+private const val PlusContentDescription = "PlusContentDescription"
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/BaselineProfileScreens.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/BaselineProfileScreens.kt
new file mode 100644
index 0000000..c50d169
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/BaselineProfileScreens.kt
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+
+val BaselineProfileScreens =
+ listOf(
+ AlertDialogScreen,
+ TextToggleButtonScreen,
+ AnimatedTextScreen,
+ ButtonGroupScreen,
+ ButtonScreen,
+ CardScreen,
+ CheckboxButtonScreen,
+ ColorSchemeScreen,
+ ConfirmationScreen,
+ CurvedTextScreen,
+ DatePickerScreen,
+ EdgeButtonScreen,
+ IconButtonScreen,
+ IconToggleButtonScreen,
+ ListHeaderScreen,
+ OpenOnPhoneDialogScreen,
+ PageIndicatorScreen,
+ PickerGroupScreen,
+ PickerScreen,
+ PlaceHolderScreen,
+ ProgressIndicatorScreen,
+ RadioButtonScreen,
+ ScaffoldScreen,
+ ScrollIndicatorScreen,
+ SwipeToDismissScreen,
+ SliderScreen,
+ StepperScreen,
+ SwipeToRevealScreen,
+ SwitchButtonScreen,
+ TextButtonScreen,
+ TimeTextScreen,
+ TimePickerScreen,
+ TransformingLazyColumnScreen,
+ )
+
+/** Represents a screen used for generating a baseline profile. */
+interface BaselineProfileScreen {
+ val content: @Composable BoxScope.() -> Unit
+ val exercise: MacrobenchmarkScope.() -> Unit
+ get() = { device.waitForIdle() }
+}
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ButtonGroupScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ButtonGroupScreen.kt
new file mode 100644
index 0000000..2125418
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ButtonGroupScreen.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.ButtonGroupSample
+
+val ButtonGroupScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { ButtonGroupSample() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ButtonScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ButtonScreen.kt
new file mode 100644
index 0000000..6274bc5
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ButtonScreen.kt
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.painterResource
+import androidx.wear.compose.material3.IconButtonDefaults
+import androidx.wear.compose.material3.macrobenchmark.common.R
+import androidx.wear.compose.material3.macrobenchmark.common.scrollDown
+import androidx.wear.compose.material3.samples.ButtonSample
+import androidx.wear.compose.material3.samples.ChildButtonSample
+import androidx.wear.compose.material3.samples.CompactButtonSample
+import androidx.wear.compose.material3.samples.FilledTonalButtonSample
+import androidx.wear.compose.material3.samples.FilledTonalCompactButtonSample
+import androidx.wear.compose.material3.samples.FilledVariantButtonSample
+import androidx.wear.compose.material3.samples.IconButtonWithImageSample
+import androidx.wear.compose.material3.samples.OutlinedButtonSample
+import androidx.wear.compose.material3.samples.OutlinedCompactButtonSample
+
+val ButtonScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ ButtonSample()
+ FilledTonalButtonSample()
+ FilledVariantButtonSample()
+ OutlinedButtonSample()
+ ChildButtonSample()
+ CompactButtonSample()
+ FilledTonalCompactButtonSample()
+ OutlinedCompactButtonSample()
+ IconButtonWithImageSample(
+ painterResource(R.drawable.backgroundimage),
+ enabled = true,
+ shapes = IconButtonDefaults.animatedShapes()
+ )
+ }
+ }
+
+ override val exercise: MacrobenchmarkScope.() -> Unit
+ get() = { device.scrollDown() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/CardScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/CardScreen.kt
new file mode 100644
index 0000000..4e149a6
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/CardScreen.kt
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.wrapContentSize
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
+import androidx.wear.compose.material3.AppCard
+import androidx.wear.compose.material3.Card
+import androidx.wear.compose.material3.CardDefaults
+import androidx.wear.compose.material3.Icon
+import androidx.wear.compose.material3.MaterialTheme
+import androidx.wear.compose.material3.OutlinedCard
+import androidx.wear.compose.material3.Text
+import androidx.wear.compose.material3.TitleCard
+import androidx.wear.compose.material3.macrobenchmark.common.R
+import androidx.wear.compose.material3.macrobenchmark.common.scrollDown
+
+val CardScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ Card(
+ onClick = {},
+ onLongClick = {},
+ onLongClickLabel = "Long click",
+ colors = CardDefaults.cardColors()
+ ) {
+ Text("Card")
+ }
+ OutlinedCard(onClick = {}) { Text("Outlined card") }
+ AppCard(
+ onClick = {},
+ appName = { Text("AppName") },
+ title = {},
+ time = { Text("02:34") },
+ appImage = {
+ Icon(
+ painter = painterResource(id = android.R.drawable.star_big_off),
+ contentDescription = "Star icon",
+ modifier =
+ Modifier.size(CardDefaults.AppImageSize)
+ .wrapContentSize(align = Alignment.Center),
+ )
+ },
+ ) {
+ Text("AppCard")
+ }
+ TitleCard(
+ onClick = {},
+ title = { Text("Title") },
+ subtitle = { Text("Subtitle") },
+ colors =
+ CardDefaults.imageCardColors(
+ containerPainter =
+ CardDefaults.imageWithScrimBackgroundPainter(
+ backgroundImagePainter =
+ painterResource(id = R.drawable.backgroundimage)
+ ),
+ contentColor = MaterialTheme.colorScheme.onSurface,
+ titleColor = MaterialTheme.colorScheme.onSurface
+ ),
+ ) {
+ Text("TitleCard")
+ }
+ TitleCard(
+ onClick = { /* Do something */ },
+ title = { Text("Card title") },
+ time = { Text("now") },
+ colors =
+ CardDefaults.imageCardColors(
+ containerPainter =
+ CardDefaults.imageWithScrimBackgroundPainter(
+ backgroundImagePainter =
+ painterResource(id = R.drawable.backgroundimage)
+ ),
+ contentColor = MaterialTheme.colorScheme.onSurface,
+ titleColor = MaterialTheme.colorScheme.onSurface
+ ),
+ contentPadding = CardDefaults.ImageContentPadding,
+ modifier = Modifier.semantics { contentDescription = "Background image" }
+ ) {
+ Text("Card content")
+ }
+ }
+ }
+
+ override val exercise: MacrobenchmarkScope.() -> Unit
+ get() = { device.scrollDown() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/CheckboxButtonScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/CheckboxButtonScreen.kt
new file mode 100644
index 0000000..8d8000a
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/CheckboxButtonScreen.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.wear.compose.material3.samples.CheckboxButtonSample
+import androidx.wear.compose.material3.samples.SplitCheckboxButtonSample
+
+val CheckboxButtonScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ CheckboxButtonSample()
+ SplitCheckboxButtonSample()
+ }
+ }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ColorSchemeScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ColorSchemeScreen.kt
new file mode 100644
index 0000000..f978ad6
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ColorSchemeScreen.kt
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.text.style.TextAlign
+import androidx.wear.compose.material3.Button
+import androidx.wear.compose.material3.ButtonDefaults
+import androidx.wear.compose.material3.MaterialTheme
+import androidx.wear.compose.material3.Text
+import androidx.wear.compose.material3.macrobenchmark.common.scrollDown
+
+val ColorSchemeScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ ButtonWithColor(
+ "Primary",
+ MaterialTheme.colorScheme.primary,
+ MaterialTheme.colorScheme.onPrimary
+ )
+ ButtonWithColor(
+ "Primary Dim",
+ MaterialTheme.colorScheme.primaryDim,
+ MaterialTheme.colorScheme.onPrimary
+ )
+ ButtonWithColor(
+ "Primary Container",
+ MaterialTheme.colorScheme.primaryContainer,
+ MaterialTheme.colorScheme.onPrimaryContainer
+ )
+ ButtonWithColor(
+ "On Primary",
+ MaterialTheme.colorScheme.onPrimary,
+ MaterialTheme.colorScheme.primary
+ )
+ ButtonWithColor(
+ "On Primary Container",
+ MaterialTheme.colorScheme.onPrimaryContainer,
+ MaterialTheme.colorScheme.primaryContainer
+ )
+ ButtonWithColor(
+ "Secondary",
+ MaterialTheme.colorScheme.secondary,
+ MaterialTheme.colorScheme.onSecondary
+ )
+ ButtonWithColor(
+ "Secondary Dim",
+ MaterialTheme.colorScheme.secondaryDim,
+ MaterialTheme.colorScheme.onSecondary
+ )
+ ButtonWithColor(
+ "Secondary Container",
+ MaterialTheme.colorScheme.secondaryContainer,
+ MaterialTheme.colorScheme.onSecondaryContainer
+ )
+ ButtonWithColor(
+ "On Secondary",
+ MaterialTheme.colorScheme.onSecondary,
+ MaterialTheme.colorScheme.secondary
+ )
+ ButtonWithColor(
+ "On Secondary Container",
+ MaterialTheme.colorScheme.onSecondaryContainer,
+ MaterialTheme.colorScheme.secondaryContainer
+ )
+ ButtonWithColor(
+ "Tertiary",
+ MaterialTheme.colorScheme.tertiary,
+ MaterialTheme.colorScheme.onTertiary
+ )
+ ButtonWithColor(
+ "Tertiary Dim",
+ MaterialTheme.colorScheme.tertiaryDim,
+ MaterialTheme.colorScheme.onTertiary
+ )
+ ButtonWithColor(
+ "Tertiary Container",
+ MaterialTheme.colorScheme.tertiaryContainer,
+ MaterialTheme.colorScheme.onTertiaryContainer
+ )
+ ButtonWithColor(
+ "On Tertiary",
+ MaterialTheme.colorScheme.onTertiary,
+ MaterialTheme.colorScheme.tertiary
+ )
+ ButtonWithColor(
+ "On Tertiary Container",
+ MaterialTheme.colorScheme.onTertiaryContainer,
+ MaterialTheme.colorScheme.tertiaryContainer
+ )
+ ButtonWithColor(
+ "Surface Container",
+ MaterialTheme.colorScheme.surfaceContainer,
+ MaterialTheme.colorScheme.onSurface
+ )
+ ButtonWithColor(
+ "Surface Container Low",
+ MaterialTheme.colorScheme.surfaceContainerLow,
+ MaterialTheme.colorScheme.onSurface
+ )
+ ButtonWithColor(
+ "Surface Container High",
+ MaterialTheme.colorScheme.surfaceContainerHigh,
+ MaterialTheme.colorScheme.onSurface
+ )
+ ButtonWithColor(
+ "On Surface",
+ MaterialTheme.colorScheme.onSurface,
+ MaterialTheme.colorScheme.surfaceContainer
+ )
+ ButtonWithColor(
+ "On Surface Variant",
+ MaterialTheme.colorScheme.onSurfaceVariant,
+ MaterialTheme.colorScheme.surfaceContainer
+ )
+ ButtonWithColor(
+ "Background",
+ MaterialTheme.colorScheme.background,
+ MaterialTheme.colorScheme.onBackground
+ )
+ ButtonWithColor(
+ "On Background",
+ MaterialTheme.colorScheme.onBackground,
+ MaterialTheme.colorScheme.background
+ )
+ ButtonWithColor(
+ "Outline",
+ MaterialTheme.colorScheme.outline,
+ MaterialTheme.colorScheme.surfaceContainer
+ )
+ ButtonWithColor(
+ "Outline Variant",
+ MaterialTheme.colorScheme.outlineVariant,
+ MaterialTheme.colorScheme.surfaceContainer
+ )
+ ButtonWithColor(
+ "Error",
+ MaterialTheme.colorScheme.error,
+ MaterialTheme.colorScheme.onError
+ )
+ ButtonWithColor(
+ "Error Container",
+ MaterialTheme.colorScheme.errorContainer,
+ MaterialTheme.colorScheme.onErrorContainer
+ )
+ ButtonWithColor(
+ "On Error",
+ MaterialTheme.colorScheme.onError,
+ MaterialTheme.colorScheme.error
+ )
+ ButtonWithColor(
+ "On Error Container",
+ MaterialTheme.colorScheme.onErrorContainer,
+ MaterialTheme.colorScheme.errorContainer
+ )
+ }
+ }
+
+ override val exercise: MacrobenchmarkScope.() -> Unit
+ get() = {
+ repeat(4) {
+ device.scrollDown()
+ device.waitForIdle()
+ }
+ }
+ }
+
+@Composable
+private fun ButtonWithColor(text: String, containerColor: Color, contentColor: Color) {
+ Button(
+ onClick = {},
+ label = { Text(text, textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth()) },
+ modifier = Modifier.fillMaxWidth(),
+ colors =
+ ButtonDefaults.buttonColors(
+ containerColor = containerColor,
+ contentColor = contentColor
+ )
+ )
+}
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ConfirmationScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ConfirmationScreen.kt
new file mode 100644
index 0000000..8796147
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ConfirmationScreen.kt
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.MutableState
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
+import androidx.test.uiautomator.By
+import androidx.test.uiautomator.Until
+import androidx.wear.compose.material3.Confirmation
+import androidx.wear.compose.material3.ConfirmationDefaults
+import androidx.wear.compose.material3.FailureConfirmation
+import androidx.wear.compose.material3.FilledTonalButton
+import androidx.wear.compose.material3.Icon
+import androidx.wear.compose.material3.SuccessConfirmation
+import androidx.wear.compose.material3.Text
+import androidx.wear.compose.material3.macrobenchmark.common.FIND_OBJECT_TIMEOUT_MS
+import androidx.wear.compose.material3.macrobenchmark.common.R
+import androidx.wear.compose.material3.macrobenchmark.common.numberedContentDescription
+
+val ConfirmationScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ ButtonsForSubmenu(
+ listOf(
+ { showConfirmation -> Confirmation(showConfirmation) },
+ { showConfirmation -> LongTextConfirmation(showConfirmation) },
+ { showConfirmation -> SuccessConfirmation(showConfirmation) },
+ { showConfirmation -> FailureConfirmation(showConfirmation) },
+ )
+ )
+ }
+ }
+
+ override val exercise: MacrobenchmarkScope.() -> Unit
+ get() = {
+ for (i in 0..3) {
+ device
+ .wait(
+ Until.findObject(By.desc(numberedContentDescription(i))),
+ FIND_OBJECT_TIMEOUT_MS
+ )
+ .click()
+ device.waitForIdle()
+ }
+ device.wait(
+ Until.findObject(By.desc(numberedContentDescription(0))),
+ FIND_OBJECT_TIMEOUT_MS
+ )
+ }
+ }
+
+@Composable
+private fun ButtonsForSubmenu(
+ confirmations: List<@Composable (showConfirmation: MutableState) -> Unit>
+) {
+ confirmations.forEachIndexed { index, confirmation ->
+ val showConfirmation = remember { mutableStateOf(false) }
+
+ Box(Modifier.fillMaxSize()) {
+ FilledTonalButton(
+ modifier =
+ Modifier.align(Alignment.Center).semantics {
+ contentDescription = numberedContentDescription(index)
+ },
+ onClick = { showConfirmation.value = true },
+ label = { Text("Show Confirmation") }
+ )
+ }
+ confirmation(showConfirmation)
+ }
+}
+
+@Composable
+private fun Confirmation(showConfirmation: MutableState) {
+ Confirmation(
+ show = showConfirmation.value,
+ onDismissRequest = { showConfirmation.value = false },
+ curvedText = ConfirmationDefaults.curvedText("Confirmed")
+ ) {
+ Icon(
+ painterResource(R.drawable.ic_favorite_rounded),
+ contentDescription = null,
+ modifier = Modifier.size(ConfirmationDefaults.IconSize),
+ )
+ }
+}
+
+@Composable
+fun LongTextConfirmation(showConfirmation: MutableState) {
+ Confirmation(
+ show = showConfirmation.value,
+ onDismissRequest = { showConfirmation.value = false },
+ text = { Text(text = "Your message has been sent") },
+ ) {
+ Icon(
+ painterResource(R.drawable.ic_favorite_rounded),
+ contentDescription = null,
+ modifier = Modifier.size(ConfirmationDefaults.SmallIconSize),
+ )
+ }
+}
+
+@Composable
+fun SuccessConfirmation(showConfirmation: MutableState) {
+ SuccessConfirmation(
+ show = showConfirmation.value,
+ onDismissRequest = { showConfirmation.value = false }
+ )
+}
+
+@Composable
+fun FailureConfirmation(showConfirmation: MutableState) {
+ FailureConfirmation(
+ show = showConfirmation.value,
+ onDismissRequest = { showConfirmation.value = false }
+ )
+}
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/CurvedTextScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/CurvedTextScreen.kt
new file mode 100644
index 0000000..e5f6508
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/CurvedTextScreen.kt
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.CurvedTextBottom
+import androidx.wear.compose.material3.samples.CurvedTextTop
+
+val CurvedTextScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ CurvedTextTop()
+ CurvedTextBottom()
+ }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/DatePickerScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/DatePickerScreen.kt
new file mode 100644
index 0000000..97b1296
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/DatePickerScreen.kt
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import android.os.Build
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.DatePicker
+import androidx.wear.compose.material3.DatePickerType
+import java.time.LocalDate
+
+val DatePickerScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ if (Build.VERSION.SDK_INT >= 26) {
+ val minDate = LocalDate.of(2022, 10, 15)
+ val maxDate = LocalDate.of(2025, 2, 4)
+ DatePicker(
+ initialDate = LocalDate.of(2024, 9, 2),
+ onDatePicked = {},
+ minDate = minDate,
+ maxDate = maxDate,
+ datePickerType = DatePickerType.YearMonthDay
+ )
+ }
+ }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/EdgeButtonScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/EdgeButtonScreen.kt
new file mode 100644
index 0000000..910bac1
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/EdgeButtonScreen.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.macrobenchmark.common.scrollDown
+import androidx.wear.compose.material3.samples.EdgeButtonSample
+
+val EdgeButtonScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { EdgeButtonSample() }
+
+ override val exercise: MacrobenchmarkScope.() -> Unit
+ get() = { device.scrollDown() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/IconButtonScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/IconButtonScreen.kt
new file mode 100644
index 0000000..31d35a2
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/IconButtonScreen.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.ExperimentalLayoutApi
+import androidx.compose.foundation.layout.FlowRow
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.wear.compose.material3.samples.FilledIconButtonSample
+import androidx.wear.compose.material3.samples.FilledTonalIconButtonSample
+import androidx.wear.compose.material3.samples.FilledVariantIconButtonSample
+import androidx.wear.compose.material3.samples.IconButtonSample
+import androidx.wear.compose.material3.samples.IconButtonWithCornerAnimationSample
+import androidx.wear.compose.material3.samples.IconButtonWithOnLongClickSample
+import androidx.wear.compose.material3.samples.OutlinedIconButtonSample
+
+@OptIn(ExperimentalLayoutApi::class)
+val IconButtonScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable() (BoxScope.() -> Unit)
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ FlowRow {
+ IconButtonSample()
+ FilledTonalIconButtonSample()
+ FilledIconButtonSample()
+ FilledVariantIconButtonSample()
+ OutlinedIconButtonSample()
+ IconButtonWithOnLongClickSample {}
+ IconButtonWithCornerAnimationSample()
+ }
+ }
+ }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/IconToggleButtonScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/IconToggleButtonScreen.kt
new file mode 100644
index 0000000..2a170f3
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/IconToggleButtonScreen.kt
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.ExperimentalLayoutApi
+import androidx.compose.foundation.layout.FlowRow
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
+import androidx.test.uiautomator.By
+import androidx.test.uiautomator.Until
+import androidx.wear.compose.material3.Icon
+import androidx.wear.compose.material3.IconToggleButton
+import androidx.wear.compose.material3.IconToggleButtonDefaults
+import androidx.wear.compose.material3.macrobenchmark.common.FIND_OBJECT_TIMEOUT_MS
+import androidx.wear.compose.material3.macrobenchmark.common.R
+import androidx.wear.compose.material3.samples.IconToggleButtonSample
+import androidx.wear.compose.material3.samples.IconToggleButtonVariantSample
+
+@OptIn(ExperimentalLayoutApi::class)
+val IconToggleButtonScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable (BoxScope.() -> Unit)
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ FlowRow {
+ IconToggleButtonSample()
+ IconToggleButtonVariantSample()
+
+ val checked = remember { mutableStateOf(false) }
+ IconToggleButton(
+ onCheckedChange = { checked.value = !checked.value },
+ shapes = IconToggleButtonDefaults.animatedShapes(),
+ checked = checked.value,
+ modifier =
+ Modifier.semantics { contentDescription = ToggleButtonDescription },
+ ) {
+ Icon(
+ painterResource(R.drawable.ic_favorite_rounded),
+ contentDescription = null
+ )
+ }
+
+ IconToggleButton(
+ onCheckedChange = { checked.value = !checked.value },
+ shapes = IconToggleButtonDefaults.variantAnimatedShapes(),
+ checked = checked.value,
+ ) {
+ Icon(
+ painterResource(R.drawable.ic_favorite_rounded),
+ contentDescription = null
+ )
+ }
+ }
+ }
+ }
+
+ override val exercise: MacrobenchmarkScope.() -> Unit
+ get() = {
+ device
+ .wait(
+ Until.findObject(By.desc(ToggleButtonDescription)),
+ FIND_OBJECT_TIMEOUT_MS
+ )
+ .click()
+ device.waitForIdle()
+ }
+ }
+
+private const val ToggleButtonDescription = "ToggleButtonDescription"
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ListHeaderScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ListHeaderScreen.kt
new file mode 100644
index 0000000..0cede8a
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ListHeaderScreen.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.wear.compose.material3.samples.ListHeaderSample
+import androidx.wear.compose.material3.samples.ListSubHeaderSample
+import androidx.wear.compose.material3.samples.ListSubHeaderWithIconSample
+
+val ListHeaderScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ ListHeaderSample()
+ ListSubHeaderSample()
+ ListSubHeaderWithIconSample()
+ }
+ }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/OpenOnPhoneDialogScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/OpenOnPhoneDialogScreen.kt
new file mode 100644
index 0000000..1515b55
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/OpenOnPhoneDialogScreen.kt
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
+import androidx.test.uiautomator.By
+import androidx.test.uiautomator.Until
+import androidx.wear.compose.material3.FilledTonalButton
+import androidx.wear.compose.material3.OpenOnPhoneDialog
+import androidx.wear.compose.material3.Text
+
+val OpenOnPhoneDialogScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column {
+ var showConfirmation by remember { mutableStateOf(false) }
+
+ Box(Modifier.fillMaxSize()) {
+ FilledTonalButton(
+ modifier =
+ Modifier.align(Alignment.Center).semantics {
+ contentDescription = OpenOnPhoneDialog
+ },
+ onClick = { showConfirmation = true },
+ label = { Text("Open on phone") }
+ )
+ }
+
+ val test = ""
+ test.let { ExcludePaths.none { path -> it.contains(path) } }
+
+ OpenOnPhoneDialog(
+ show = showConfirmation,
+ onDismissRequest = { showConfirmation = false },
+ )
+ }
+ }
+
+ override val exercise: MacrobenchmarkScope.() -> Unit
+ get() = {
+ device.wait(Until.findObject(By.desc(OpenOnPhoneDialog)), 10_000L).click()
+ device.waitForIdle()
+ device.wait(Until.findObject(By.desc(OpenOnPhoneDialog)), 10_000L)
+ }
+ }
+
+private const val OpenOnPhoneDialog = "OpenOnPhoneDialog"
+
+private val ExcludePaths = listOf("/material3/macrobenchmark/", "/material3/samples/")
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PageIndicatorScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PageIndicatorScreen.kt
new file mode 100644
index 0000000..1c069dc
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PageIndicatorScreen.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.VerticalPageIndicatorWithPagerSample
+
+val PageIndicatorScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { VerticalPageIndicatorWithPagerSample() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PickerGroupScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PickerGroupScreen.kt
new file mode 100644
index 0000000..037263f
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PickerGroupScreen.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.AutoCenteringPickerGroup
+
+val PickerGroupScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable (BoxScope.() -> Unit)
+ get() = { AutoCenteringPickerGroup() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PickerScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PickerScreen.kt
new file mode 100644
index 0000000..ba68003
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PickerScreen.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.PickerScrollToOption
+
+val PickerScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { PickerScrollToOption() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PlaceHolderScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PlaceHolderScreen.kt
new file mode 100644
index 0000000..1dd1def
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/PlaceHolderScreen.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.wear.compose.material3.samples.ButtonWithIconAndLabelAndPlaceholders
+import androidx.wear.compose.material3.samples.ButtonWithIconAndLabelsAndOverlaidPlaceholder
+import androidx.wear.compose.material3.samples.TextPlaceholder
+
+val PlaceHolderScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ ButtonWithIconAndLabelAndPlaceholders()
+ ButtonWithIconAndLabelsAndOverlaidPlaceholder()
+ TextPlaceholder()
+ }
+ }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ProgressIndicatorScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ProgressIndicatorScreen.kt
new file mode 100644
index 0000000..8c3a78b
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ProgressIndicatorScreen.kt
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.FullScreenProgressIndicatorSample
+import androidx.wear.compose.material3.samples.IndeterminateProgressIndicatorSample
+import androidx.wear.compose.material3.samples.MediaButtonProgressIndicatorSample
+import androidx.wear.compose.material3.samples.OverflowProgressIndicatorSample
+import androidx.wear.compose.material3.samples.SegmentedProgressIndicatorBinarySample
+import androidx.wear.compose.material3.samples.SegmentedProgressIndicatorSample
+import androidx.wear.compose.material3.samples.SmallSegmentedProgressIndicatorSample
+import androidx.wear.compose.material3.samples.SmallValuesProgressIndicatorSample
+
+val ProgressIndicatorScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ FullScreenProgressIndicatorSample()
+ MediaButtonProgressIndicatorSample()
+ OverflowProgressIndicatorSample()
+ SmallValuesProgressIndicatorSample()
+ IndeterminateProgressIndicatorSample()
+ SegmentedProgressIndicatorSample()
+ SegmentedProgressIndicatorBinarySample()
+ SmallSegmentedProgressIndicatorSample()
+ }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/RadioButtonScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/RadioButtonScreen.kt
new file mode 100644
index 0000000..db6b300
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/RadioButtonScreen.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.wear.compose.material3.samples.RadioButtonSample
+import androidx.wear.compose.material3.samples.SplitRadioButtonSample
+
+val RadioButtonScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ RadioButtonSample()
+ SplitRadioButtonSample()
+ }
+ }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ScaffoldScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ScaffoldScreen.kt
new file mode 100644
index 0000000..8a63b05
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ScaffoldScreen.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.ScaffoldSample
+
+val ScaffoldScreen =
+ object : BaselineProfileScreen {
+
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { ScaffoldSample() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ScrollIndicatorScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ScrollIndicatorScreen.kt
new file mode 100644
index 0000000..3929d0e
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ScrollIndicatorScreen.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.ScrollIndicatorWithColumnSample
+
+val ScrollIndicatorScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { ScrollIndicatorWithColumnSample() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SliderScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SliderScreen.kt
new file mode 100644
index 0000000..5d133de
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SliderScreen.kt
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.wear.compose.material3.macrobenchmark.common.scrollDown
+import androidx.wear.compose.material3.samples.ChangedSliderSample
+import androidx.wear.compose.material3.samples.SliderSample
+import androidx.wear.compose.material3.samples.SliderSegmentedSample
+import androidx.wear.compose.material3.samples.SliderWithIntegerSample
+
+val SliderScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ SliderSample()
+ SliderSegmentedSample()
+ SliderWithIntegerSample()
+ ChangedSliderSample()
+ }
+ }
+
+ override val exercise: MacrobenchmarkScope.() -> Unit
+ get() = { device.scrollDown() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/StepperScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/StepperScreen.kt
new file mode 100644
index 0000000..b262e91
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/StepperScreen.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.StepperWithButtonSample
+
+val StepperScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { StepperWithButtonSample() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SwipeToDismissScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SwipeToDismissScreen.kt
new file mode 100644
index 0000000..80fe730
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SwipeToDismissScreen.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.StatefulSwipeToDismissBox
+
+val SwipeToDismissScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { StatefulSwipeToDismissBox() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SwipeToRevealScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SwipeToRevealScreen.kt
new file mode 100644
index 0000000..7356bc9
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SwipeToRevealScreen.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.SwipeToRevealSample
+
+val SwipeToRevealScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { SwipeToRevealSample() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SwitchButtonScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SwitchButtonScreen.kt
new file mode 100644
index 0000000..e9e98188
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/SwitchButtonScreen.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.wear.compose.material3.samples.SplitSwitchButtonSample
+import androidx.wear.compose.material3.samples.SwitchButtonSample
+
+val SwitchButtonScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ SwitchButtonSample()
+ SplitSwitchButtonSample()
+ }
+ }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TextButtonScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TextButtonScreen.kt
new file mode 100644
index 0000000..b9b82e7
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TextButtonScreen.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.ExperimentalLayoutApi
+import androidx.compose.foundation.layout.FlowRow
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.wear.compose.material3.samples.FilledTextButtonSample
+import androidx.wear.compose.material3.samples.FilledTonalTextButtonSample
+import androidx.wear.compose.material3.samples.FilledVariantTextButtonSample
+import androidx.wear.compose.material3.samples.LargeFilledTonalTextButtonSample
+import androidx.wear.compose.material3.samples.OutlinedTextButtonSample
+import androidx.wear.compose.material3.samples.TextButtonSample
+import androidx.wear.compose.material3.samples.TextButtonWithOnLongClickSample
+
+@OptIn(ExperimentalLayoutApi::class)
+val TextButtonScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable (BoxScope.() -> Unit)
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ FlowRow {
+ TextButtonSample()
+ FilledTonalTextButtonSample()
+ FilledTextButtonSample()
+ FilledVariantTextButtonSample()
+ OutlinedTextButtonSample()
+ TextButtonWithOnLongClickSample {}
+ LargeFilledTonalTextButtonSample()
+ }
+ }
+ }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TextToggleButtonScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TextToggleButtonScreen.kt
new file mode 100644
index 0000000..72a2aa4
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TextToggleButtonScreen.kt
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.benchmark.macro.MacrobenchmarkScope
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.ExperimentalLayoutApi
+import androidx.compose.foundation.layout.FlowRow
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
+import androidx.test.uiautomator.By
+import androidx.test.uiautomator.Until
+import androidx.wear.compose.material3.Text
+import androidx.wear.compose.material3.TextToggleButton
+import androidx.wear.compose.material3.TextToggleButtonDefaults
+import androidx.wear.compose.material3.macrobenchmark.common.FIND_OBJECT_TIMEOUT_MS
+import androidx.wear.compose.material3.samples.LargeTextToggleButtonSample
+import androidx.wear.compose.material3.samples.TextToggleButtonSample
+
+@OptIn(ExperimentalLayoutApi::class)
+val TextToggleButtonScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable (BoxScope.() -> Unit)
+ get() = {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ FlowRow {
+ TextToggleButtonSample()
+ LargeTextToggleButtonSample()
+ val checked = remember { mutableStateOf(false) }
+ TextToggleButton(
+ onCheckedChange = { checked.value = !checked.value },
+ shapes = TextToggleButtonDefaults.animatedShapes(),
+ checked = checked.value,
+ modifier =
+ Modifier.semantics { contentDescription = ToggleButtonDescription },
+ ) {
+ Text(text = "ABC")
+ }
+ TextToggleButton(
+ onCheckedChange = { checked.value = !checked.value },
+ shapes = TextToggleButtonDefaults.variantAnimatedShapes(),
+ checked = checked.value,
+ ) {
+ Text(text = "ABC")
+ }
+ }
+ }
+ }
+
+ override val exercise: MacrobenchmarkScope.() -> Unit
+ get() = {
+ device.wait(
+ Until.findObject(By.desc(ToggleButtonDescription)),
+ FIND_OBJECT_TIMEOUT_MS
+ )
+ device.findObject(By.desc(ToggleButtonDescription)).click()
+ device.waitForIdle()
+ }
+ }
+
+private const val ToggleButtonDescription = "ToggleButtonDescription"
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TimePickerScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TimePickerScreen.kt
new file mode 100644
index 0000000..8022686
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TimePickerScreen.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.TimePickerSample
+
+val TimePickerScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { TimePickerSample() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TimeTextScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TimeTextScreen.kt
new file mode 100644
index 0000000..e2b5bb9
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TimeTextScreen.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.TimeTextWithStatus
+
+val TimeTextScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { TimeTextWithStatus() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TransformingLazyColumnScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TransformingLazyColumnScreen.kt
new file mode 100644
index 0000000..ffb08e1
--- /dev/null
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/TransformingLazyColumnScreen.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.macrobenchmark.common.baselineprofile
+
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.runtime.Composable
+import androidx.wear.compose.material3.samples.TransformingLazyColumnScalingMorphingEffectSample
+
+val TransformingLazyColumnScreen =
+ object : BaselineProfileScreen {
+ override val content: @Composable BoxScope.() -> Unit
+ get() = { TransformingLazyColumnScalingMorphingEffectSample() }
+ }
diff --git a/wear/compose/compose-material3/macrobenchmark-target/src/main/java/androidx/wear/compose/material3/macrobenchmark/target/BaselineActivity.kt b/wear/compose/compose-material3/macrobenchmark-target/src/main/java/androidx/wear/compose/material3/macrobenchmark/target/BaselineActivity.kt
index 3b464167..77c3b0e 100644
--- a/wear/compose/compose-material3/macrobenchmark-target/src/main/java/androidx/wear/compose/material3/macrobenchmark/target/BaselineActivity.kt
+++ b/wear/compose/compose-material3/macrobenchmark-target/src/main/java/androidx/wear/compose/material3/macrobenchmark/target/BaselineActivity.kt
@@ -28,7 +28,7 @@
import androidx.wear.compose.material3.HorizontalPagerScaffold
import androidx.wear.compose.material3.MaterialTheme
import androidx.wear.compose.material3.ScreenScaffold
-import androidx.wear.compose.material3.macrobenchmark.common.BaselineProfileScreens
+import androidx.wear.compose.material3.macrobenchmark.common.baselineprofile.BaselineProfileScreens
class BaselineActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@@ -37,13 +37,14 @@
MaterialTheme {
AppScaffold {
val pagerState = rememberPagerState(pageCount = { BaselineProfileScreens.size })
+
HorizontalPagerScaffold(pagerState = pagerState) { page ->
ScreenScaffold {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
- BaselineProfileScreens[page].content()
+ BaselineProfileScreens[page].content.invoke(this)
}
}
}
diff --git a/wear/compose/compose-material3/macrobenchmark/src/main/java/androidx/wear/compose/material3/macrobenchmark/BaselineProfile.kt b/wear/compose/compose-material3/macrobenchmark/src/main/java/androidx/wear/compose/material3/macrobenchmark/BaselineProfile.kt
index 82d0b1f..168f053 100644
--- a/wear/compose/compose-material3/macrobenchmark/src/main/java/androidx/wear/compose/material3/macrobenchmark/BaselineProfile.kt
+++ b/wear/compose/compose-material3/macrobenchmark/src/main/java/androidx/wear/compose/material3/macrobenchmark/BaselineProfile.kt
@@ -17,10 +17,11 @@
package androidx.wear.compose.material3.macrobenchmark
import android.content.Intent
+import androidx.benchmark.macro.MacrobenchmarkScope
import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.filters.LargeTest
-import androidx.test.uiautomator.UiDevice
-import androidx.wear.compose.material3.macrobenchmark.common.BaselineProfileScreens
+import androidx.wear.compose.material3.macrobenchmark.common.baselineprofile.BaselineProfileScreens
+import java.lang.Thread.sleep
import org.junit.Rule
import org.junit.Test
@@ -55,23 +56,24 @@
intent.action = BASELINE_ACTIVITY
startActivityAndWait(intent)
device.waitForIdle()
- device.iterateAllPages(pageCount = BaselineProfileScreens.size)
+ iterateAllPages(pageCount = BaselineProfileScreens.size)
}
)
}
- private fun UiDevice.iterateAllPages(pageCount: Int) {
- // Get screen dimensions
- val screenWidth = displayWidth
- val screenHeight = displayHeight
- // Calculate swipe start and end points (adjust these as needed)
- val startX = (screenWidth * 0.8).toInt() // 80% of screen width
- val startY = screenHeight / 2 // Middle of the screen
- val endX = (screenWidth * 0.2).toInt() // 20% of screen width
- val endY = startY
- for (i in 1 until pageCount) {
- swipe(startX, startY, endX, endY, 10)
- waitForIdle()
+ private fun MacrobenchmarkScope.iterateAllPages(pageCount: Int) {
+ val screenWidth = device.displayWidth
+ val screenHeight = device.displayHeight
+ val startX = (screenWidth * 0.9).toInt()
+ val y = (screenHeight * 0.9).toInt()
+ val endX = (screenWidth * 0.1).toInt()
+ for (i in 0 until pageCount) {
+ BaselineProfileScreens[i].exercise.invoke(this)
+ device.waitForIdle()
+ sleep(1_000L)
+ device.swipe(startX, y, endX, y, 10)
+ device.waitForIdle()
+ sleep(1_000L)
}
}
diff --git a/wear/compose/compose-material3/src/main/baseline-prof.txt b/wear/compose/compose-material3/src/main/baseline-prof.txt
index 82edd51..4e7e567 100644
--- a/wear/compose/compose-material3/src/main/baseline-prof.txt
+++ b/wear/compose/compose-material3/src/main/baseline-prof.txt
@@ -1,69 +1,193 @@
-HSPLandroidx/wear/compose/material3/AnimatedCornerShapeKt**->**(**)**
-HSPLandroidx/wear/compose/material3/AnimatedRoundedCornerShape;->**(**)**
-HSPLandroidx/wear/compose/material3/AnimatedTextFontRegistry;->**(**)**
+HPLandroidx/wear/compose/material3/AbstractPlaceholderModifierNode;->**(**)**
+SPLandroidx/wear/compose/material3/AlertButtonsParams;->**(**)**
+HSPLandroidx/wear/compose/material3/AlertDialogDefaults;->**(**)**
+HSPLandroidx/wear/compose/material3/AlertDialogKt**->**(**)**
+PLandroidx/wear/compose/material3/AnimatedCornerShapeKt**->**(**)**
+PLandroidx/wear/compose/material3/AnimatedCornerSize;->**(**)**
+PLandroidx/wear/compose/material3/AnimatedRoundedCornerShape;->**(**)**
+PLandroidx/wear/compose/material3/AnimatedTextFontRegistry;->**(**)**
HSPLandroidx/wear/compose/material3/AnimatedTextKt**->**(**)**
-HSPLandroidx/wear/compose/material3/AnimatedTextState;->**(**)**
-HSPLandroidx/wear/compose/material3/AppScaffoldKt**->**(**)**
-HSPLandroidx/wear/compose/material3/CardColors;->**(**)**
-HSPLandroidx/wear/compose/material3/CardDefaults;->**(**)**
+PLandroidx/wear/compose/material3/AnimatedTextState;->**(**)**
+PLandroidx/wear/compose/material3/AnimatedToggleRoundedCornerShape;->**(**)**
+SPLandroidx/wear/compose/material3/AppScaffoldKt**->**(**)**
+HSPLandroidx/wear/compose/material3/ButtonColors;->**(**)**
+HSPLandroidx/wear/compose/material3/ButtonDefaults;->**(**)**
+PLandroidx/wear/compose/material3/ButtonGroupDefaults;->**(**)**
+PLandroidx/wear/compose/material3/ButtonGroupItem;->**(**)**
+PLandroidx/wear/compose/material3/ButtonGroupKt**->**(**)**
+PLandroidx/wear/compose/material3/ButtonGroupScope;->**(**)**
+HSPLandroidx/wear/compose/material3/ButtonKt**->**(**)**
+PLandroidx/wear/compose/material3/CardColors;->**(**)**
+PLandroidx/wear/compose/material3/CardDefaults;->**(**)**
HSPLandroidx/wear/compose/material3/CardKt**->**(**)**
+PLandroidx/wear/compose/material3/CheckboxButtonColors;->**(**)**
+PLandroidx/wear/compose/material3/CheckboxButtonDefaults;->**(**)**
+PLandroidx/wear/compose/material3/CheckboxButtonKt**->**(**)**
+PLandroidx/wear/compose/material3/CircularProgressIndicatorDefaults;->**(**)**
+HPLandroidx/wear/compose/material3/CircularProgressIndicatorKt**->**(**)**
HSPLandroidx/wear/compose/material3/ColorScheme;->**(**)**
HSPLandroidx/wear/compose/material3/ColorSchemeKt**->**(**)**
-SPLandroidx/wear/compose/material3/ComposableSingletons;->**(**)**
+HSPLandroidx/wear/compose/material3/ComposableSingletons;->**(**)**
+PLandroidx/wear/compose/material3/ComputeHelper;->**(**)**
+PLandroidx/wear/compose/material3/ConfirmationColors;->**(**)**
+PLandroidx/wear/compose/material3/ConfirmationDefaults;->**(**)**
+PLandroidx/wear/compose/material3/ConfirmationKt**->**(**)**
SPLandroidx/wear/compose/material3/ContentColorKt**->**(**)**
HSPLandroidx/wear/compose/material3/CurvedTextKt**->**(**)**
SPLandroidx/wear/compose/material3/CurvedTimeTextScope;->**(**)**
+PLandroidx/wear/compose/material3/DatePickerColors;->**(**)**
+HSPLandroidx/wear/compose/material3/DatePickerKt**->**(**)**
+PLandroidx/wear/compose/material3/DatePickerOption;->**(**)**
+PLandroidx/wear/compose/material3/DatePickerState;->**(**)**
SPLandroidx/wear/compose/material3/DefaultTimeSource;->**(**)**
-SPLandroidx/wear/compose/material3/DefaultTouchExplorationStateProvider;->**(**)**
+HSPLandroidx/wear/compose/material3/DefaultTouchExplorationStateProvider;->**(**)**
Landroidx/wear/compose/material3/DelegatingThemeAwareRippleNode;
+HSPLandroidx/wear/compose/material3/DialogKt**->**(**)**
+SPLandroidx/wear/compose/material3/DialogVisibility;->**(**)**
+HSPLandroidx/wear/compose/material3/DisplayState;->**(**)**
+PLandroidx/wear/compose/material3/DynamicDayState;->**(**)**
+SPLandroidx/wear/compose/material3/DynamicHeightElement;->**(**)**
+HSPLandroidx/wear/compose/material3/DynamicHeightNode;->**(**)**
+PLandroidx/wear/compose/material3/DynamicMonthState;->**(**)**
+HSPLandroidx/wear/compose/material3/EdgeButtonKt**->**(**)**
+HSPLandroidx/wear/compose/material3/EdgeButtonShape;->**(**)**
+SPLandroidx/wear/compose/material3/EdgeButtonSize;->**(**)**
+PLandroidx/wear/compose/material3/FractionPositionStateAdapter;->**(**)**
SPLandroidx/wear/compose/material3/IconButtonColors;->**(**)**
-SPLandroidx/wear/compose/material3/IconButtonDefaults;->**(**)**
+HSPLandroidx/wear/compose/material3/IconButtonDefaults;->**(**)**
HSPLandroidx/wear/compose/material3/IconButtonKt**->**(**)**
SPLandroidx/wear/compose/material3/IconButtonShapes;->**(**)**
HSPLandroidx/wear/compose/material3/IconKt**->**(**)**
+PLandroidx/wear/compose/material3/IconToggleButtonColors;->**(**)**
+PLandroidx/wear/compose/material3/IconToggleButtonDefaults;->**(**)**
+PLandroidx/wear/compose/material3/IconToggleButtonKt**->**(**)**
+PLandroidx/wear/compose/material3/IconToggleButtonShapes;->**(**)**
+Landroidx/wear/compose/material3/IndicatorState;
SPLandroidx/wear/compose/material3/InteractiveComponentSizeKt**->**(**)**
-SPLandroidx/wear/compose/material3/ListHeaderDefaults;->**(**)**
-HSPLandroidx/wear/compose/material3/ListHeaderKt**->**(**)**
+PLandroidx/wear/compose/material3/LevelIndicatorColors;->**(**)**
+PLandroidx/wear/compose/material3/LevelIndicatorDefaults;->**(**)**
+PLandroidx/wear/compose/material3/LevelIndicatorKt**->**(**)**
+PLandroidx/wear/compose/material3/ListHeaderDefaults;->**(**)**
+PLandroidx/wear/compose/material3/ListHeaderKt**->**(**)**
+HSPLandroidx/wear/compose/material3/MaterialThemeKt**->**(**)**
SPLandroidx/wear/compose/material3/MinimumInteractiveModifier;->**(**)**
HSPLandroidx/wear/compose/material3/MinimumInteractiveModifierNode;->**(**)**
SPLandroidx/wear/compose/material3/MotionScheme;->**(**)**
SPLandroidx/wear/compose/material3/MotionSchemeKt**->**(**)**
-SPLandroidx/wear/compose/material3/PaddingDefaults;->**(**)**
+PLandroidx/wear/compose/material3/OpenOnPhoneDialogColors;->**(**)**
+PLandroidx/wear/compose/material3/OpenOnPhoneDialogDefaults;->**(**)**
+PLandroidx/wear/compose/material3/OpenOnPhoneDialogKt**->**(**)**
+HSPLandroidx/wear/compose/material3/PaddingDefaults;->**(**)**
HSPLandroidx/wear/compose/material3/PageIndicatorKt**->**(**)**
HSPLandroidx/wear/compose/material3/PagerScaffoldKt**->**(**)**
HSPLandroidx/wear/compose/material3/PagesState;->**(**)**
+PLandroidx/wear/compose/material3/PickerGroupItem;->**(**)**
+HSPLandroidx/wear/compose/material3/PickerGroupKt**->**(**)**
+PLandroidx/wear/compose/material3/PickerGroupScope;->**(**)**
+HSPLandroidx/wear/compose/material3/PickerKt**->**(**)**
+PLandroidx/wear/compose/material3/PickerRotarySnapLayoutInfoProvider;->**(**)**
+PLandroidx/wear/compose/material3/PickerState;->**(**)**
+PLandroidx/wear/compose/material3/PlaceholderBackgroundPainter;->**(**)**
+PLandroidx/wear/compose/material3/PlaceholderDefaults;->**(**)**
+PLandroidx/wear/compose/material3/PlaceholderElement;->**(**)**
+PLandroidx/wear/compose/material3/PlaceholderKt**->**(**)**
+PLandroidx/wear/compose/material3/PlaceholderModifierNode;->**(**)**
+PLandroidx/wear/compose/material3/PlaceholderShimmerElement;->**(**)**
+HPLandroidx/wear/compose/material3/PlaceholderShimmerModifierNode;->**(**)**
+PLandroidx/wear/compose/material3/PlaceholderStage;->**(**)**
+HPLandroidx/wear/compose/material3/PlaceholderState;->**(**)**
+PLandroidx/wear/compose/material3/ProgressIndicatorColors;->**(**)**
+PLandroidx/wear/compose/material3/ProgressIndicatorDefaults;->**(**)**
HSPLandroidx/wear/compose/material3/ProvidersKt**->**(**)**
+PLandroidx/wear/compose/material3/RadioButtonColors;->**(**)**
+PLandroidx/wear/compose/material3/RadioButtonDefaults;->**(**)**
+HSPLandroidx/wear/compose/material3/RadioButtonKt**->**(**)**
+PLandroidx/wear/compose/material3/RangeSemanticsKt**->**(**)**
HSPLandroidx/wear/compose/material3/RippleKt**->**(**)**
HSPLandroidx/wear/compose/material3/RippleNodeFactory;->**(**)**
HSPLandroidx/wear/compose/material3/RoundButtonKt**->**(**)**
HSPLandroidx/wear/compose/material3/ScaffoldKt**->**(**)**
HSPLandroidx/wear/compose/material3/ScaffoldState;->**(**)**
+SPLandroidx/wear/compose/material3/ScaleAndAlignContentElement;->**(**)**
+HSPLandroidx/wear/compose/material3/ScaleAndAlignContentNode;->**(**)**
+HSPLandroidx/wear/compose/material3/ScalingLazyColumnStateAdapter;->**(**)**
HSPLandroidx/wear/compose/material3/ScreenScaffoldKt**->**(**)**
HSPLandroidx/wear/compose/material3/ScreenStage;->**(**)**
SPLandroidx/wear/compose/material3/ScrollAwayKt**->**(**)**
-SPLandroidx/wear/compose/material3/ScrollAwayModifierElement;->**(**)**
+HSPLandroidx/wear/compose/material3/ScrollAwayModifierElement;->**(**)**
HSPLandroidx/wear/compose/material3/ScrollAwayModifierNode;->**(**)**
+SPLandroidx/wear/compose/material3/ScrollIndicatorDefaults;->**(**)**
+HSPLandroidx/wear/compose/material3/ScrollIndicatorKt**->**(**)**
+PLandroidx/wear/compose/material3/ScrollStateAdapter;->**(**)**
+PLandroidx/wear/compose/material3/SegmentParams;->**(**)**
+HPLandroidx/wear/compose/material3/SegmentedCircularProgressIndicatorKt**->**(**)**
SPLandroidx/wear/compose/material3/ShapeDefaults;->**(**)**
+HSPLandroidx/wear/compose/material3/ShapeHelper;->**(**)**
SPLandroidx/wear/compose/material3/Shapes;->**(**)**
HSPLandroidx/wear/compose/material3/ShapesKt**->**(**)**
-Landroidx/wear/compose/material3/TextConfiguration;
+PLandroidx/wear/compose/material3/SliderColors;->**(**)**
+PLandroidx/wear/compose/material3/SliderDefaults;->**(**)**
+SPLandroidx/wear/compose/material3/SliderKt**->**(**)**
+PLandroidx/wear/compose/material3/SplitCheckboxButtonColors;->**(**)**
+PLandroidx/wear/compose/material3/SplitRadioButtonColors;->**(**)**
+PLandroidx/wear/compose/material3/SplitSwitchButtonColors;->**(**)**
+PLandroidx/wear/compose/material3/StepperColors;->**(**)**
+PLandroidx/wear/compose/material3/StepperDefaults;->**(**)**
+HSPLandroidx/wear/compose/material3/StepperKt**->**(**)**
+HSPLandroidx/wear/compose/material3/SwipeToDismissBoxKt**->**(**)**
+PLandroidx/wear/compose/material3/SwipeToRevealAction;->**(**)**
+PLandroidx/wear/compose/material3/SwipeToRevealDefaults;->**(**)**
+PLandroidx/wear/compose/material3/SwipeToRevealKt**->**(**)**
+PLandroidx/wear/compose/material3/SwitchButtonColors;->**(**)**
+PLandroidx/wear/compose/material3/SwitchButtonDefaults;->**(**)**
+PLandroidx/wear/compose/material3/SwitchButtonKt**->**(**)**
+PLandroidx/wear/compose/material3/TextButtonColors;->**(**)**
+PLandroidx/wear/compose/material3/TextButtonDefaults;->**(**)**
+PLandroidx/wear/compose/material3/TextButtonKt**->**(**)**
+PLandroidx/wear/compose/material3/TextButtonShapes;->**(**)**
+HSPLandroidx/wear/compose/material3/TextConfiguration;->**(**)**
HSPLandroidx/wear/compose/material3/TextKt**->**(**)**
+PLandroidx/wear/compose/material3/TextToggleButtonColors;->**(**)**
+PLandroidx/wear/compose/material3/TextToggleButtonDefaults;->**(**)**
+PLandroidx/wear/compose/material3/TextToggleButtonKt**->**(**)**
+PLandroidx/wear/compose/material3/TextToggleButtonShapes;->**(**)**
SPLandroidx/wear/compose/material3/TimeBroadcastReceiver;->**(**)**
-SPLandroidx/wear/compose/material3/TimeTextDefaults;->**(**)**
+PLandroidx/wear/compose/material3/TimePickerColors;->**(**)**
+HSPLandroidx/wear/compose/material3/TimePickerKt**->**(**)**
+PLandroidx/wear/compose/material3/TimePickerStyles;->**(**)**
+HSPLandroidx/wear/compose/material3/TimeTextDefaults;->**(**)**
HSPLandroidx/wear/compose/material3/TimeTextKt**->**(**)**
Landroidx/wear/compose/material3/TimeTextScope;
+PLandroidx/wear/compose/material3/ToggleState;->**(**)**
+PLandroidx/wear/compose/material3/TouchExplorationStateProviderKt**->**(**)**
+PLandroidx/wear/compose/material3/TouchTargetAwareSizeKt**->**(**)**
+PLandroidx/wear/compose/material3/TransformingLazyColumnStateAdapter;->**(**)**
HSPLandroidx/wear/compose/material3/Typography;->**(**)**
HSPLandroidx/wear/compose/material3/TypographyKt**->**(**)**
-HSPLandroidx/wear/compose/material3/tokens/CardTokens;->**(**)**
+PLandroidx/wear/compose/material3/internal/Icons;->**(**)**
+PLandroidx/wear/compose/material3/internal/IconsKt**->**(**)**
+PLandroidx/wear/compose/material3/lazy/LazyColumnScrollTransformBehavior;->**(**)**
+PLandroidx/wear/compose/material3/lazy/ScalingMorphingBackgroundPainter;->**(**)**
+PLandroidx/wear/compose/material3/lazy/TargetMorphingHeightConsumerModifierElement;->**(**)**
+PLandroidx/wear/compose/material3/lazy/TransformingLazyColumnScrollTransformModifiersKt**->**(**)**
+PLandroidx/wear/compose/material3/tokens/CardTokens;->**(**)**
HSPLandroidx/wear/compose/material3/tokens/ColorSchemeKeyTokens;->**(**)**
HSPLandroidx/wear/compose/material3/tokens/ColorTokens;->**(**)**
+SPLandroidx/wear/compose/material3/tokens/CompactButtonTokens;->**(**)**
+HSPLandroidx/wear/compose/material3/tokens/FilledButtonTokens;->**(**)**
SPLandroidx/wear/compose/material3/tokens/IconButtonTokens;->**(**)**
-HSPLandroidx/wear/compose/material3/tokens/ImageCardTokens;->**(**)**
-SPLandroidx/wear/compose/material3/tokens/ListHeaderTokens;->**(**)**
-SPLandroidx/wear/compose/material3/tokens/OutlinedCardTokens;->**(**)**
+PLandroidx/wear/compose/material3/tokens/IconToggleButtonTokens;->**(**)**
+PLandroidx/wear/compose/material3/tokens/ListHeaderTokens;->**(**)**
+PLandroidx/wear/compose/material3/tokens/ListSubHeaderTokens;->**(**)**
+PLandroidx/wear/compose/material3/tokens/MotionTokens;->**(**)**
+PLandroidx/wear/compose/material3/tokens/OutlinedButtonTokens;->**(**)**
+PLandroidx/wear/compose/material3/tokens/OutlinedCardTokens;->**(**)**
HSPLandroidx/wear/compose/material3/tokens/PaletteTokens;->**(**)**
HSPLandroidx/wear/compose/material3/tokens/ShapeKeyTokens;->**(**)**
SPLandroidx/wear/compose/material3/tokens/ShapeTokens;->**(**)**
+HSPLandroidx/wear/compose/material3/tokens/SliderTokens;->**(**)**
+PLandroidx/wear/compose/material3/tokens/TextButtonTokens;->**(**)**
+PLandroidx/wear/compose/material3/tokens/TextToggleButtonTokens;->**(**)**
HSPLandroidx/wear/compose/material3/tokens/TypeScaleTokens;->**(**)**
SPLandroidx/wear/compose/material3/tokens/TypefaceTokens;->**(**)**
HSPLandroidx/wear/compose/material3/tokens/TypographyKeyTokens;->**(**)**
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ScrollAway.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ScrollAway.kt
index bfc37da..366e9be 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ScrollAway.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ScrollAway.kt
@@ -16,7 +16,6 @@
package androidx.wear.compose.material3
-import android.util.Log
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.animation.core.tween
@@ -148,8 +147,6 @@
(offsetPx / maxScrollOut.toPx()).coerceIn(0f, 1f) to 1f
}
- Log.d("SCROLL", "OffsetPx = $offsetPx, TargetProgress=$targetProgress")
-
val screenStage = screenStage()
// When idle, or on a new screen, if it's hidden, show it
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Shapes.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Shapes.kt
index 4a00aab..43564c2 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Shapes.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Shapes.kt
@@ -48,12 +48,12 @@
* 4dp [CornerSize] (used by bundled Cards).
* @param small By default, provides [ShapeDefaults.Small], a [RoundedCornerShape] with 8dp
* [CornerSize].
- * @param medium By default, provides [ShapeDefaults.Medium], a [RoundedCornerShape] with 16dp
+ * @param medium By default, provides [ShapeDefaults.Medium], a [RoundedCornerShape] with 18dp
* [CornerSize] (used by shape-shifting Buttons and rounded rectangle buttons).
- * @param large By default, provides [ShapeDefaults.Large], a [RoundedCornerShape] with 24dp
+ * @param large By default, provides [ShapeDefaults.Large], a [RoundedCornerShape] with 26dp
* [CornerSize] (used by Cards).
* @param extraLarge By default, provides [ShapeDefaults.ExtraLarge], a [RoundedCornerShape] with
- * 32dp [CornerSize].
+ * 36dp [CornerSize].
*/
// TODO(b/273226734) Review documentation with references to components that use the shape themes.
@Immutable
diff --git a/wear/compose/integration-tests/demos/build.gradle b/wear/compose/integration-tests/demos/build.gradle
index 7ba3d67..5e7f93c 100644
--- a/wear/compose/integration-tests/demos/build.gradle
+++ b/wear/compose/integration-tests/demos/build.gradle
@@ -26,8 +26,8 @@
defaultConfig {
applicationId "androidx.wear.compose.integration.demos"
minSdk 25
- versionCode 46
- versionName "1.46"
+ versionCode 47
+ versionName "1.47"
}
buildTypes {
diff --git a/wear/compose/integration-tests/profileparser/src/main/java/androidx/wear/compose/integration/profileparser/ProfileParser.kt b/wear/compose/integration-tests/profileparser/src/main/java/androidx/wear/compose/integration/profileparser/ProfileParser.kt
index e58e40a..8336501 100644
--- a/wear/compose/integration-tests/profileparser/src/main/java/androidx/wear/compose/integration/profileparser/ProfileParser.kt
+++ b/wear/compose/integration-tests/profileparser/src/main/java/androidx/wear/compose/integration/profileparser/ProfileParser.kt
@@ -43,7 +43,9 @@
it.toList()
.map { it.truncatedAt(';') }
.map { it.truncatedAt('$') }
- .filter { it.contains(parse) && !it.contains("/material3/macrobenchmark/") }
+ .filter {
+ it.contains(parse) && ExcludePaths.none { path -> it.contains(path) }
+ }
.fold(mutableMapOf()) {
acc: MutableMap>,
item: String ->
@@ -79,5 +81,7 @@
val idx = this.indexOf(c)
return if (idx == -1) this else this.substring(0, idx)
}
+
+ private val ExcludePaths = listOf("/material3/macrobenchmark/", "/material3/samples/")
}
}