Various API refinements for Compose Runtime
Fixes: 178391231
Fixes: 178391247
Fixes: 178392215
Fixes: 177245490
Relnote:”””
- Providers has been renamed to CompositionLocalProvider
- The Composition constructor no longer accepts a key parameter, and has been deprecated.
- currentCompositeKeyHash has been turned into a composable top level property instead of a composable top level function.
- CompositionData and CompositionGroup have been moved to the androidx.compose.runtime.tooling namespace
- ComposableLambda has been made an interface instead of a concrete class, and no longer has type parameters.
- ComposableLambdaN has been made an interface instead of a concrete class, and no longer has type parameters.
- The snapshotFlow function has been moved to the androidx.compose.runtime namespace
- the merge method of SnapshotMutationPolicy is no longer experimental
- The @TestOnly top level clearRoots function has been removed. It is no longer necessary.
- keySourceInfoOf and resetSourceInfo functions have been removed. They are no longer necessary.
- Composer.collectKeySourceInformation has been removed. It is no longer necessary.
- isJoinedKey, joinedKeyLeft, and joinedKeyRight methods have been removed. They are no longer necessary.
- Various top level APIs have been moved and reorganized into different files. Due to Kotlin’s file class semantics, this will break binary compatibility but not source compatibility, so should not be an issue for most users.
“””
Change-Id: I99b7de8ea0fb5d73a0ee4667a65e35d976383831
diff --git a/activity/activity-compose/src/androidTest/java/androidx/activity/compose/ActivityResultRegistryTest.kt b/activity/activity-compose/src/androidTest/java/androidx/activity/compose/ActivityResultRegistryTest.kt
index 140c5c5..6d22c1d 100644
--- a/activity/activity-compose/src/androidTest/java/androidx/activity/compose/ActivityResultRegistryTest.kt
+++ b/activity/activity-compose/src/androidTest/java/androidx/activity/compose/ActivityResultRegistryTest.kt
@@ -23,7 +23,7 @@
import androidx.activity.result.ActivityResultRegistryOwner
import androidx.activity.result.contract.ActivityResultContract
import androidx.activity.result.contract.ActivityResultContracts
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
@@ -63,7 +63,7 @@
fun testRegisterForActivityResult() {
var launcher: ActivityResultLauncher<Intent>? by mutableStateOf(null)
composeTestRule.setContent {
- Providers(
+ CompositionLocalProvider(
LocalActivityResultRegistryOwner.asProvidableCompositionLocal()
provides registryOwner
) {
@@ -91,7 +91,7 @@
activityScenario.onActivity { activity ->
(activity as ComponentActivity).setContent {
- Providers(
+ CompositionLocalProvider(
LocalActivityResultRegistryOwner.asProvidableCompositionLocal()
provides registryOwner
) {
diff --git a/activity/activity-compose/src/androidTest/java/androidx/activity/compose/BackPressedDispatcherOwnerTest.kt b/activity/activity-compose/src/androidTest/java/androidx/activity/compose/BackPressedDispatcherOwnerTest.kt
index 69730c3..f3f93ac 100644
--- a/activity/activity-compose/src/androidTest/java/androidx/activity/compose/BackPressedDispatcherOwnerTest.kt
+++ b/activity/activity-compose/src/androidTest/java/androidx/activity/compose/BackPressedDispatcherOwnerTest.kt
@@ -20,7 +20,7 @@
import androidx.activity.OnBackPressedDispatcherOwner
import androidx.compose.material.Button
import androidx.compose.material.Text
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
@@ -68,7 +68,7 @@
var innerDispatcherOwner: OnBackPressedDispatcherOwner? = null
composeTestRule.setContent {
- Providers(
+ CompositionLocalProvider(
LocalOnBackPressedDispatcherOwner.asProvidableCompositionLocal()
provides testDispatcherOwner
) {
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractCodegenSignatureTest.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractCodegenSignatureTest.kt
index 43732d3..49f83020 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractCodegenSignatureTest.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractCodegenSignatureTest.kt
@@ -120,6 +120,8 @@
import android.widget.LinearLayout
import android.content.Context
import androidx.compose.ui.node.UiApplier
+ import androidx.compose.runtime.tooling.CompositionData
+ import androidx.compose.runtime.tooling.CompositionGroup
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCallLoweringTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCallLoweringTests.kt
index 3662862..4f6b12d 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCallLoweringTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCallLoweringTests.kt
@@ -329,7 +329,7 @@
@Composable
fun test() {
- Providers(x provides 456) {
+ CompositionLocalProvider(x provides 456) {
}
}
@@ -1413,7 +1413,7 @@
@Composable
fun Main() {
var text = remember { mutableStateOf("$initialText") }
- Providers(LocalText provides text.value) {
+ CompositionLocalProvider(LocalText provides text.value) {
LinearLayout {
ConsumesCompositionLocalFromDefaultParameter()
Button(
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/RobolectricComposeTester.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/RobolectricComposeTester.kt
index 9b3a197..024f822 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/RobolectricComposeTester.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/RobolectricComposeTester.kt
@@ -24,7 +24,6 @@
import androidx.activity.ComponentActivity
import androidx.compose.runtime.Composer
import androidx.compose.runtime.Composition
-import androidx.compose.runtime.ExperimentalComposeApi
import androidx.compose.runtime.Recomposer
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
@@ -103,9 +102,7 @@
// endProviders.invoke(composer)
// }
- @Suppress("DEPRECATION")
- @OptIn(ExperimentalComposeApi::class)
-// val composition = Composition(root, UiApplier(root), recomposer)
+// val composition = Composition(UiApplier(root), recomposer)
// fun setContent() {
// setContentMethod.invoke(composition, realComposable)
// }
diff --git a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/Main.kt b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/Main.kt
index 3fc4f935..e0f2942 100644
--- a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/Main.kt
+++ b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/Main.kt
@@ -18,7 +18,7 @@
import androidx.compose.desktop.AppManager
import androidx.compose.desktop.AppWindow
import androidx.compose.desktop.WindowEvents
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.window.Menu
@@ -77,7 +77,7 @@
)
)
).show {
- Providers(
+ CompositionLocalProvider(
AmbientTest provides 42
) {
content()
diff --git a/compose/desktop/desktop/src/jvmMain/kotlin/androidx/compose/desktop/DesktopTheme.kt b/compose/desktop/desktop/src/jvmMain/kotlin/androidx/compose/desktop/DesktopTheme.kt
index 4b56fa5..cfd39318 100644
--- a/compose/desktop/desktop/src/jvmMain/kotlin/androidx/compose/desktop/DesktopTheme.kt
+++ b/compose/desktop/desktop/src/jvmMain/kotlin/androidx/compose/desktop/DesktopTheme.kt
@@ -23,7 +23,7 @@
import androidx.compose.material.Shapes
import androidx.compose.material.Typography
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.unit.dp
@Composable
@@ -51,7 +51,7 @@
hoverColor = MaterialTheme.colors.onSurface.copy(alpha = 0.50f)
),
content: @Composable () -> Unit
-) = Providers(
+) = CompositionLocalProvider(
ScrollbarStyleAmbient provides scrollbar,
content = content
)
\ No newline at end of file
diff --git a/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/RtlDemo.kt b/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/RtlDemo.kt
index 5ac328d..5c70ba6 100644
--- a/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/RtlDemo.kt
+++ b/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/RtlDemo.kt
@@ -29,7 +29,7 @@
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -61,10 +61,10 @@
)
CustomLayout(false)
Text("WITH CONSTRAINTS", Modifier.align(Alignment.CenterHorizontally))
- Providers(LocalLayoutDirection provides LayoutDirection.Ltr) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {
LayoutWithConstraints("LD: set LTR via CompositionLocal")
}
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
LayoutWithConstraints("LD: set RTL via CompositionLocal")
}
LayoutWithConstraints(text = "LD: locale")
@@ -109,7 +109,7 @@
Row {
Box(boxSize.background(Color.Red)) {}
Box(boxSize.background(Color.Green)) {}
- Providers(LocalLayoutDirection provides LayoutDirection.Ltr) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {
Row {
Box(boxSize.background(Color.Magenta)) {}
Box(boxSize.background(Color.Yellow)) {}
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxTest.kt
index 05033d5..f0981a7 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxTest.kt
@@ -17,7 +17,7 @@
package androidx.compose.foundation.layout
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -258,7 +258,7 @@
val childPosition = Array(9) { Ref<Offset>() }
show {
Box(Modifier.wrapContentSize(Alignment.TopStart)) {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Box(
Modifier
.preferredSize(tripleSizeDp)
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/OffsetTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/OffsetTest.kt
index 3fac96c..63d0da7 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/OffsetTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/OffsetTest.kt
@@ -17,7 +17,7 @@
package androidx.compose.foundation.layout
import android.os.Build
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
@@ -104,7 +104,7 @@
var positionX = 0
var positionY = 0
rule.setContent {
- Providers((LocalLayoutDirection provides LayoutDirection.Rtl)) {
+ CompositionLocalProvider((LocalLayoutDirection provides LayoutDirection.Rtl)) {
Box(
Modifier.testTag("box")
.wrapContentSize(Alignment.TopEnd)
@@ -164,7 +164,7 @@
var positionX = 0
var positionY = 0
rule.setContent {
- Providers((LocalLayoutDirection provides LayoutDirection.Rtl)) {
+ CompositionLocalProvider((LocalLayoutDirection provides LayoutDirection.Rtl)) {
Box(
Modifier.testTag("box")
.wrapContentSize(Alignment.TopEnd)
@@ -224,7 +224,7 @@
var positionX = 0
var positionY = 0
rule.setContent {
- Providers((LocalLayoutDirection provides LayoutDirection.Rtl)) {
+ CompositionLocalProvider((LocalLayoutDirection provides LayoutDirection.Rtl)) {
Box(
Modifier.testTag("box")
.wrapContentSize(Alignment.TopEnd)
@@ -287,7 +287,7 @@
var positionX = 0
var positionY = 0
rule.setContent {
- Providers((LocalLayoutDirection provides LayoutDirection.Rtl)) {
+ CompositionLocalProvider((LocalLayoutDirection provides LayoutDirection.Rtl)) {
Box(
Modifier.testTag("box")
.wrapContentSize(Alignment.TopEnd)
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/PaddingTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/PaddingTest.kt
index 7693010..2750c52 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/PaddingTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/PaddingTest.kt
@@ -17,7 +17,7 @@
package androidx.compose.foundation.layout
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.Modifier
@@ -275,7 +275,7 @@
// ltr: P1 S P2 | S P3 | P1 S
// rtl: S P1 | P3 S | P2 S P1
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(Modifier.fillMaxSize()) {
Box(
Modifier.padding(start = padding1Dp, end = padding2Dp)
@@ -351,7 +351,7 @@
// ltr: P1 S P2 | S P3
// rtl: S P3 | P1 S P2
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(Modifier.fillMaxSize()) {
Box(
Modifier.absolutePadding(left = padding1Dp, right = padding2Dp)
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnTest.kt
index 3ca28e5..e152de4 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnTest.kt
@@ -18,7 +18,7 @@
import androidx.compose.ui.layout.FirstBaseline
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.layout.HorizontalAlignmentLine
import androidx.compose.ui.layout.Layout
@@ -4049,7 +4049,7 @@
val drawLatch = CountDownLatch(2)
val childPosition = arrayOf(Offset.Zero, Offset.Zero)
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(Modifier.fillMaxWidth()) {
Container(
Modifier.preferredSize(sizeDp).onGloballyPositioned { coordinates ->
@@ -4093,7 +4093,7 @@
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(
modifier = Modifier
.fillMaxWidth()
@@ -4149,7 +4149,7 @@
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(
modifier = Modifier
.fillMaxWidth()
@@ -4204,7 +4204,7 @@
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(
modifier = Modifier
.fillMaxWidth()
@@ -4257,7 +4257,7 @@
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(
modifier = Modifier
.fillMaxWidth()
@@ -4307,7 +4307,7 @@
val drawLatch = CountDownLatch(2)
val childPosition = arrayOf(Offset.Zero, Offset.Zero)
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(
Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.End
@@ -4354,7 +4354,7 @@
val rowSize = rowSizePx.toDp()
val latch = CountDownLatch(3)
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Column {
Row(
horizontalArrangement = Arrangement.spacedBy(space, Alignment.End),
@@ -4390,7 +4390,7 @@
val drawLatch = CountDownLatch(2)
val childPosition = arrayOf(Offset.Zero, Offset.Zero)
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Column(Modifier.fillMaxWidth()) {
Container(
Modifier.preferredSize(sizeDp).onGloballyPositioned { coordinates ->
@@ -4435,7 +4435,7 @@
val drawLatch = CountDownLatch(2)
val childPosition = arrayOf(Offset.Zero, Offset.Zero)
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Column(Modifier.fillMaxWidth()) {
Container(
Modifier.preferredSize(sizeDp)
@@ -4474,7 +4474,7 @@
val drawLatch = CountDownLatch(2)
val childPosition = arrayOf(Offset.Zero, Offset.Zero)
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Column(Modifier.fillMaxWidth()) {
Container(
Modifier.preferredSize(sizeDp)
@@ -4582,7 +4582,7 @@
arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(
Modifier
.fillMaxWidth()
@@ -4695,7 +4695,7 @@
arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(
modifier = Modifier
.fillMaxWidth()
@@ -4824,7 +4824,7 @@
arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(
modifier = Modifier
.fillMaxWidth()
@@ -4960,7 +4960,7 @@
arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(
modifier = Modifier
.fillMaxWidth()
@@ -5092,7 +5092,7 @@
arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(
modifier = Modifier
.fillMaxWidth()
@@ -5224,7 +5224,7 @@
arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Row(
modifier = Modifier
.fillMaxWidth()
@@ -5295,7 +5295,7 @@
val rowSize = rowSizePx.toDp()
val latch = CountDownLatch(3)
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Column {
Row(
horizontalArrangement = Arrangement.Absolute.spacedBy(space, Alignment.End),
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SizeTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SizeTest.kt
index b4c5beb..03d2de4 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SizeTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SizeTest.kt
@@ -17,7 +17,7 @@
package androidx.compose.foundation.layout
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.Modifier
@@ -1417,7 +1417,7 @@
val childSize = Array(3) { Ref<IntSize>() }
val childPosition = Array(3) { Ref<Offset>() }
show {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Box(Modifier.fillMaxSize()) {
Box(Modifier.fillMaxSize().wrapContentSize(Alignment.TopStart)) {
Box(
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt
index db3306e..13018675 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt
@@ -49,7 +49,7 @@
import androidx.compose.material.LocalTextStyle
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -239,7 +239,7 @@
@Composable
private fun RtlListDemo() {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
LazyRow(Modifier.fillMaxWidth()) {
items(100) {
Text(
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt
index c05cbd0..c760846 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt
@@ -26,7 +26,7 @@
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
@@ -47,7 +47,7 @@
TagLine(tag = "LTR Layout")
}
item {
- Providers(LocalLayoutDirection provides LayoutDirection.Ltr) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {
Column(modifier = Modifier.fillMaxWidth()) {
TagLine(tag = "simple editing single line")
EditLine(singleLine = true)
@@ -62,7 +62,7 @@
TagLine(tag = "RTL Layout")
}
item {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Column(modifier = Modifier.fillMaxWidth()) {
TagLine(tag = "simple editing RTL")
EditLine()
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt
index 95ca719..eabe70f 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt
@@ -22,7 +22,7 @@
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.testutils.assertShape
import androidx.compose.ui.Alignment
@@ -183,7 +183,7 @@
fun background_rtl_initially() {
rule.setContent {
SemanticParent {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Box(
Modifier.preferredSize(40f.toDp())
.background(Color.Magenta)
@@ -210,7 +210,7 @@
val direction = mutableStateOf(LayoutDirection.Ltr)
rule.setContent {
SemanticParent {
- Providers(LocalLayoutDirection provides direction.value) {
+ CompositionLocalProvider(LocalLayoutDirection provides direction.value) {
Box(
Modifier.preferredSize(40f.toDp())
.background(Color.Magenta)
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BorderTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BorderTest.kt
index f228931..a11834c 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BorderTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BorderTest.kt
@@ -24,7 +24,7 @@
import androidx.compose.foundation.shape.GenericShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.testutils.assertShape
import androidx.compose.ui.Modifier
@@ -264,7 +264,7 @@
val direction = mutableStateOf(LayoutDirection.Ltr)
rule.setContent {
SemanticParent {
- Providers(LocalLayoutDirection provides direction.value) {
+ CompositionLocalProvider(LocalLayoutDirection provides direction.value) {
Box(
Modifier.preferredSize(40.0f.toDp(), 40.0f.toDp())
.background(color = Color.Blue)
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollTest.kt
index 3c09c5a..c0a6aa6 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollTest.kt
@@ -31,7 +31,7 @@
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.testutils.assertPixels
import androidx.compose.ui.Modifier
@@ -691,7 +691,7 @@
with(rule.density) {
rule.setContent {
val direction = if (isRtl) LayoutDirection.Rtl else LayoutDirection.Ltr
- Providers(LocalLayoutDirection provides direction) {
+ CompositionLocalProvider(LocalLayoutDirection provides direction) {
Box {
Row(
modifier = Modifier
@@ -783,7 +783,7 @@
}
} else {
val direction = if (isRtl) LayoutDirection.Rtl else LayoutDirection.Ltr
- Providers(LocalLayoutDirection provides direction) {
+ CompositionLocalProvider(LocalLayoutDirection provides direction) {
Row(
Modifier.testTag(scrollerTag)
.horizontalScroll(
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyArrangementsTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyArrangementsTest.kt
index ea61262..23a5834 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyArrangementsTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyArrangementsTest.kt
@@ -19,7 +19,7 @@
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.platform.testTag
@@ -320,7 +320,7 @@
fun composeRowWith(arrangement: Arrangement.Horizontal, layoutDirection: LayoutDirection) {
rule.setContent {
- Providers(LocalLayoutDirection provides layoutDirection) {
+ CompositionLocalProvider(LocalLayoutDirection provides layoutDirection) {
LazyRow(
horizontalArrangement = arrangement,
modifier = Modifier.size(containerSize)
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyColumnTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyColumnTest.kt
index 6a90157..1ee7478 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyColumnTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyColumnTest.kt
@@ -34,7 +34,7 @@
import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
@@ -1274,7 +1274,7 @@
composable: @Composable () -> Unit
) {
this.setContent {
- Providers(LocalViewConfiguration provides FakeViewConfiguration) {
+ CompositionLocalProvider(LocalViewConfiguration provides FakeViewConfiguration) {
composable()
}
}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyListsReverseLayoutTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyListsReverseLayoutTest.kt
index 56d67f9..4ce9bbf 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyListsReverseLayoutTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyListsReverseLayoutTest.kt
@@ -18,7 +18,7 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.platform.testTag
@@ -365,7 +365,7 @@
@Test
fun row_rtl_emitTwoElementsAsOneItem_positionedReversed() {
rule.setContentWithTestViewConfiguration {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
LazyRow(
reverseLayout = true
) {
@@ -386,7 +386,7 @@
@Test
fun row_rtl_emitTwoItems_positionedReversed() {
rule.setContentWithTestViewConfiguration {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
LazyRow(
reverseLayout = true
) {
@@ -410,7 +410,7 @@
fun row_rtl_scrollForwardHalfWay() {
lateinit var state: LazyListState
rule.setContentWithTestViewConfiguration {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
LazyRow(
reverseLayout = true,
state = rememberLazyListState().also { state = it },
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyRowTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyRowTest.kt
index 31138fd..0e2e3e5 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyRowTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyRowTest.kt
@@ -27,7 +27,7 @@
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.sizeIn
import androidx.compose.foundation.layout.width
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
@@ -509,7 +509,7 @@
@Test
fun scrollsLeftInRtl() {
rule.setContentWithTestViewConfiguration {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Box(Modifier.preferredWidth(100.dp)) {
LazyRow(Modifier.testTag(LazyListTag)) {
items(4) {
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftWrapTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftWrapTest.kt
index d478324..54011a4 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftWrapTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftWrapTest.kt
@@ -17,7 +17,7 @@
package androidx.compose.foundation.text
import androidx.compose.foundation.layout.width
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity
@@ -67,7 +67,7 @@
var width: Int? = null
rule.setContent {
- Providers(LocalDensity provides density) {
+ CompositionLocalProvider(LocalDensity provides density) {
CoreTextField(
value = TextFieldValue(string),
>
@@ -104,7 +104,7 @@
var width: Int? = null
rule.setContent {
- Providers(LocalDensity provides density) {
+ CompositionLocalProvider(LocalDensity provides density) {
CoreTextField(
value = TextFieldValue(string),
>
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextLayoutDirectionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextLayoutDirectionTest.kt
index 1b292b8..a46a643 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextLayoutDirectionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextLayoutDirectionTest.kt
@@ -16,7 +16,7 @@
package androidx.compose.foundation.text
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.text.InternalTextApi
@@ -40,7 +40,7 @@
var layoutDirection: LayoutDirection? = null
rule.setContent {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
@OptIn(InternalTextApi::class)
CoreTextField(
value = TextFieldValue("..."),
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerFocusTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerFocusTest.kt
index 822db7f..80d471a 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerFocusTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerFocusTest.kt
@@ -24,7 +24,7 @@
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.text.CoreText
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
@@ -159,7 +159,7 @@
val layoutDirection = if (isRtl) LayoutDirection.Rtl else LayoutDirection.Ltr
rule.setContent {
- Providers(
+ CompositionLocalProvider(
LocalHapticFeedback provides hapticFeedback,
LocalLayoutDirection provides layoutDirection
) {
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt
index 73507fd..710cd9e 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt
@@ -22,7 +22,7 @@
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.CoreText
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
@@ -272,7 +272,7 @@
val layoutDirection = if (isRtl) LayoutDirection.Rtl else LayoutDirection.Ltr
rule.setContent {
- Providers(
+ CompositionLocalProvider(
LocalHapticFeedback provides hapticFeedback,
LocalLayoutDirection provides layoutDirection
) {
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlePopupPositionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlePopupPositionTest.kt
index 7e2fae2..d25f41b 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlePopupPositionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlePopupPositionTest.kt
@@ -19,7 +19,7 @@
import android.view.View
import android.view.WindowManager
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
@@ -174,7 +174,7 @@
// Align the parent of the popup on the top left corner, this results in the global
// position of the parent to be (0, 0)
val layoutDirection = if (isRtl) LayoutDirection.Rtl else LayoutDirection.Ltr
- Providers(LocalLayoutDirection provides layoutDirection) {
+ CompositionLocalProvider(LocalLayoutDirection provides layoutDirection) {
SimpleLayout {
SimpleContainer(width = parentWidthDp, height = parentHeightDp) {}
SelectionHandle(
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/TextSelectionColorsScreenshotTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/TextSelectionColorsScreenshotTest.kt
index 84b244b..f4a5006 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/TextSelectionColorsScreenshotTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/TextSelectionColorsScreenshotTest.kt
@@ -24,7 +24,7 @@
import androidx.compose.foundation.text.BasicText
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.testutils.assertAgainstGolden
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
@@ -174,7 +174,7 @@
@OptIn(InternalTextApi::class)
@Composable
private fun TextTestContent(textSelectionColors: TextSelectionColors) {
- Providers(LocalTextSelectionColors provides textSelectionColors) {
+ CompositionLocalProvider(LocalTextSelectionColors provides textSelectionColors) {
Row(Modifier.testTag(Tag), horizontalArrangement = Arrangement.spacedBy(20.dp)) {
// Manually draw selection handles as we cannot screenshot the ones drawn in the popup
DefaultSelectionHandle(
@@ -200,7 +200,7 @@
@Composable
private fun TextFieldTestContent(textSelectionColors: TextSelectionColors) {
- Providers(LocalTextSelectionColors provides textSelectionColors) {
+ CompositionLocalProvider(LocalTextSelectionColors provides textSelectionColors) {
Box(Modifier.testTag(Tag)) {
BasicTextField(value = Text, >
}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/SoftwareKeyboardTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/SoftwareKeyboardTest.kt
index e63050b..12bf1c3 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/SoftwareKeyboardTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/SoftwareKeyboardTest.kt
@@ -19,7 +19,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.BasicTextField
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
@@ -57,7 +57,7 @@
val onTextInputStarted: (SoftwareKeyboardController) -> Unit = mock()
rule.setContent {
- Providers(
+ CompositionLocalProvider(
LocalTextInputService provides textInputService
) {
val state = remember { mutableStateOf("") }
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldDefaultWidthTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldDefaultWidthTest.kt
index 06993e6..d3254b3 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldDefaultWidthTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldDefaultWidthTest.kt
@@ -22,7 +22,7 @@
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity
@@ -194,7 +194,7 @@
style = FontStyle.Normal
)
- Providers(LocalDensity provides density) {
+ CompositionLocalProvider(LocalDensity provides density) {
androidx.compose.foundation.layout.Box {
BasicTextField(
value = text,
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldOnValueChangeTextFieldValueTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldOnValueChangeTextFieldValueTest.kt
index b6d392b..467fc71 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldOnValueChangeTextFieldValueTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldOnValueChangeTextFieldValueTest.kt
@@ -18,7 +18,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.text.BasicTextField
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.geometry.Offset
@@ -73,7 +73,7 @@
.thenReturn(inputSessionToken)
rule.setContent {
- Providers(
+ CompositionLocalProvider(
LocalTextInputService provides textInputService
) {
val state = remember {
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt
index 90d22dbf..8129296 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt
@@ -37,7 +37,7 @@
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -125,7 +125,7 @@
var isFocused = false
rule.setContent {
val state = remember { mutableStateOf("") }
- Providers(
+ CompositionLocalProvider(
LocalTextInputService provides inputService
) {
BasicTextField(
@@ -164,7 +164,7 @@
.thenReturn(inputSessionToken)
rule.setContent {
- Providers(
+ CompositionLocalProvider(
LocalTextInputService provides textInputService
) {
TextFieldApp()
@@ -235,7 +235,7 @@
.thenReturn(inputSessionToken)
rule.setContent {
- Providers(
+ CompositionLocalProvider(
LocalTextInputService provides textInputService
) {
OnlyDigitsApp()
@@ -294,7 +294,7 @@
val onTextLayout: (TextLayoutResult) -> Unit = mock()
rule.setContent {
- Providers(
+ CompositionLocalProvider(
LocalTextInputService provides textInputService
) {
val state = remember { mutableStateOf("") }
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionContainer.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionContainer.kt
index bc60b85..608b333 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionContainer.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionContainer.kt
@@ -19,7 +19,7 @@
import androidx.compose.foundation.Interaction
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -58,7 +58,7 @@
*/
@Composable
fun DisableSelection(content: @Composable () -> Unit) {
- Providers(
+ CompositionLocalProvider(
LocalSelectionRegistrar provides null,
content = content
)
@@ -93,7 +93,7 @@
manager.>
manager.selection = selection
- Providers(LocalSelectionRegistrar provides registrarImpl) {
+ CompositionLocalProvider(LocalSelectionRegistrar provides registrarImpl) {
// Get the layout coordinates of the selection container. This is for hit test of
// cross-composable selection.
SimpleLayout(modifier = modifier.then(manager.modifier)) {
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/selection/DesktopSelection.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/selection/DesktopSelection.kt
index 1c4da68..7e3f8e6 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/selection/DesktopSelection.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/selection/DesktopSelection.kt
@@ -19,7 +19,7 @@
package androidx.compose.foundation.text.selection
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.layout.Layout
@@ -117,7 +117,7 @@
}
}
- Providers(LocalSelectionRegistrar provides registrarImpl) {
+ CompositionLocalProvider(LocalSelectionRegistrar provides registrarImpl) {
Wrap(modifier) {
content()
}
diff --git a/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/ScrollbarTest.kt b/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/ScrollbarTest.kt
index 152d884..73c9baa 100644
--- a/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/ScrollbarTest.kt
+++ b/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/ScrollbarTest.kt
@@ -28,7 +28,7 @@
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
@@ -446,7 +446,7 @@
}
@Composable
- private fun withTestEnvironment(content: @Composable () -> Unit) = Providers(
+ private fun withTestEnvironment(content: @Composable () -> Unit) = CompositionLocalProvider(
ScrollbarStyleAmbient provides ScrollbarStyle(
minimalHeight = 16.dp,
thickness = 8.dp,
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/SuspendingGestureTestUtil.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/SuspendingGestureTestUtil.kt
index eb3c828..944c044 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/SuspendingGestureTestUtil.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/SuspendingGestureTestUtil.kt
@@ -21,7 +21,7 @@
import androidx.compose.runtime.Composer
import androidx.compose.runtime.ExperimentalComposeApi
import androidx.compose.runtime.InternalComposeApi
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Recomposer
import androidx.compose.runtime.ControlledComposition
import androidx.compose.runtime.currentComposer
@@ -95,7 +95,7 @@
private suspend fun composeGesture(block: suspend SuspendingGestureTestUtil.() -> Unit) {
withRunningRecomposer { recomposer ->
compose(recomposer) {
- Providers(
+ CompositionLocalProvider(
LocalDensity provides Density(1f),
LocalViewConfiguration provides TestViewConfiguration()
) {
diff --git a/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/theming/Theming.kt b/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/theming/Theming.kt
index 0dfeb5a..9fefe71 100644
--- a/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/theming/Theming.kt
+++ b/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/theming/Theming.kt
@@ -40,7 +40,7 @@
import androidx.compose.material.lightColors
import androidx.compose.material.primarySurface
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
@@ -143,10 +143,10 @@
@Composable private fun ThemingSnippet7() {
// By default, both Icon & Text use the combination of LocalContentColor &
// LocalContentAlpha. De-emphasize content by setting content alpha
- Providers(LocalContentAlpha provides ContentAlpha.medium) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text(/*...*/)
}
- Providers(LocalContentAlpha provides ContentAlpha.disabled) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.disabled) {
Icon(/*...*/)
Text(/*...*/)
}
diff --git a/compose/integration-tests/src/androidTest/java/androidx/ui/integration/test/ObservableThemeTest.kt b/compose/integration-tests/src/androidTest/java/androidx/ui/integration/test/ObservableThemeTest.kt
index 3417cd8..4948a1e6 100644
--- a/compose/integration-tests/src/androidTest/java/androidx/ui/integration/test/ObservableThemeTest.kt
+++ b/compose/integration-tests/src/androidTest/java/androidx/ui/integration/test/ObservableThemeTest.kt
@@ -20,7 +20,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.MutableState
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -173,7 +173,7 @@
primaryTracker: CompositionTracker,
secondaryTracker: CompositionTracker
) {
- Providers(LocalTestTheme provides theme) {
+ CompositionLocalProvider(LocalTestTheme provides theme) {
CheapPrimaryColorConsumer(primaryTracker)
ExpensiveSecondaryColorConsumer(secondaryTracker)
CheapPrimaryColorConsumer(primaryTracker)
diff --git a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/DynamicThemeActivity.kt b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/DynamicThemeActivity.kt
index f810c92..d398e04 100644
--- a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/DynamicThemeActivity.kt
+++ b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/DynamicThemeActivity.kt
@@ -44,7 +44,7 @@
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.snapshots.snapshotFlow
+import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ContentAlphaSamples.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ContentAlphaSamples.kt
index b9a4d1c..be3d8e7 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ContentAlphaSamples.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ContentAlphaSamples.kt
@@ -22,7 +22,7 @@
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
@Sampled
@Composable
@@ -34,16 +34,16 @@
"No content alpha applied - uses the default content alpha set by MaterialTheme - " +
"87% alpha"
)
- Providers(LocalContentAlpha provides 1.00f) {
+ CompositionLocalProvider(LocalContentAlpha provides 1.00f) {
Text("1.00f alpha applied - 100% alpha")
}
- Providers(LocalContentAlpha provides ContentAlpha.high) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
Text("High content alpha applied - 87% alpha")
}
- Providers(LocalContentAlpha provides ContentAlpha.medium) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text("Medium content alpha applied - 60% alpha")
}
- Providers(LocalContentAlpha provides ContentAlpha.disabled) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.disabled) {
Text("Disabled content alpha applied - 38% alpha")
}
}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ButtonTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ButtonTest.kt
index fa7b688..bdd4db0 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ButtonTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ButtonTest.kt
@@ -30,7 +30,7 @@
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.CutCornerShape
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -289,7 +289,7 @@
rule.setMaterialContent {
surface = MaterialTheme.colors.surface
primary = MaterialTheme.colors.primary
- Providers(LocalShapes provides Shapes(small = shape)) {
+ CompositionLocalProvider(LocalShapes provides Shapes(small = shape)) {
Button(modifier = Modifier.testTag("myButton"), elevation = null) {
Box(Modifier.preferredSize(10.dp, 10.dp))
}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CardTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CardTest.kt
index bc3836c..c27157d 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CardTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CardTest.kt
@@ -20,7 +20,7 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.shape.CutCornerShape
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.testutils.assertShape
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -56,7 +56,7 @@
Surface(color = background) {
Box {
cardColor = MaterialTheme.colors.surface
- Providers(LocalShapes provides Shapes(medium = shape)) {
+ CompositionLocalProvider(LocalShapes provides Shapes(medium = shape)) {
Card(
modifier = Modifier
.semantics(mergeDescendants = true) {}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ContentAlphaTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ContentAlphaTest.kt
index f9b5fb2..8276636 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ContentAlphaTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ContentAlphaTest.kt
@@ -16,7 +16,7 @@
package androidx.compose.material
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.test.filters.MediumTest
@@ -68,7 +68,7 @@
rule.setContent {
MaterialTheme(colors) {
Surface {
- Providers(LocalContentAlpha provides ContentAlpha.high) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
assertThat(LocalContentAlpha.current)
.isEqualTo(ReducedContrastHighContentAlpha)
}
@@ -82,7 +82,7 @@
rule.setContent {
MaterialTheme(colors) {
Surface {
- Providers(LocalContentAlpha provides ContentAlpha.medium) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
assertThat(LocalContentAlpha.current)
.isEqualTo(ReducedContrastMediumContentAlpha)
}
@@ -96,7 +96,7 @@
rule.setContent {
MaterialTheme(colors) {
Surface {
- Providers(LocalContentAlpha provides ContentAlpha.disabled) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.disabled) {
assertThat(LocalContentAlpha.current)
.isEqualTo(ReducedContrastDisabledContentAlpha)
}
@@ -123,7 +123,7 @@
rule.setContent {
MaterialTheme(colors) {
Surface(color = colors.primary) {
- Providers(LocalContentAlpha provides ContentAlpha.high) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
assertThat(LocalContentAlpha.current)
.isEqualTo(HighContrastHighContentAlpha)
}
@@ -137,7 +137,7 @@
rule.setContent {
MaterialTheme(colors) {
Surface(color = colors.primary) {
- Providers(LocalContentAlpha provides ContentAlpha.medium) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
assertThat(LocalContentAlpha.current)
.isEqualTo(HighContrastMediumContentAlpha)
}
@@ -151,7 +151,7 @@
rule.setContent {
MaterialTheme(colors) {
Surface(color = colors.primary) {
- Providers(LocalContentAlpha provides ContentAlpha.disabled) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.disabled) {
assertThat(LocalContentAlpha.current)
.isEqualTo(HighContrastDisabledContentAlpha)
}
@@ -177,7 +177,7 @@
MaterialTheme(colors) {
val contentColor = Color(0.9f, 0.9f, 0.9f)
Surface(contentColor = contentColor) {
- Providers(LocalContentAlpha provides ContentAlpha.high) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
val expectedAlpha = if (colors.isLight) {
HighContrastHighContentAlpha
} else {
@@ -196,7 +196,7 @@
MaterialTheme(colors) {
val contentColor = Color(0.9f, 0.9f, 0.9f)
Surface(contentColor = contentColor) {
- Providers(LocalContentAlpha provides ContentAlpha.medium) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
val expectedAlpha = if (colors.isLight) {
HighContrastMediumContentAlpha
} else {
@@ -215,7 +215,7 @@
MaterialTheme(colors) {
val contentColor = Color(0.9f, 0.9f, 0.9f)
Surface(contentColor = contentColor) {
- Providers(LocalContentAlpha provides ContentAlpha.disabled) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.disabled) {
val expectedAlpha = if (colors.isLight) {
HighContrastDisabledContentAlpha
} else {
@@ -234,7 +234,7 @@
MaterialTheme(colors) {
val contentColor = Color(0.1f, 0.1f, 0.1f)
Surface(contentColor = contentColor) {
- Providers(LocalContentAlpha provides ContentAlpha.high) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
val expectedAlpha = if (colors.isLight) {
ReducedContrastHighContentAlpha
} else {
@@ -253,7 +253,7 @@
MaterialTheme(colors) {
val contentColor = Color(0.1f, 0.1f, 0.1f)
Surface(contentColor = contentColor) {
- Providers(LocalContentAlpha provides ContentAlpha.medium) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
val expectedAlpha = if (colors.isLight) {
ReducedContrastMediumContentAlpha
} else {
@@ -272,7 +272,7 @@
MaterialTheme(colors) {
val contentColor = Color(0.1f, 0.1f, 0.1f)
Surface(contentColor = contentColor) {
- Providers(LocalContentAlpha provides ContentAlpha.disabled) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.disabled) {
val expectedAlpha = if (colors.isLight) {
ReducedContrastDisabledContentAlpha
} else {
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
index 606452c3..01235a9 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
@@ -21,7 +21,7 @@
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalLayoutDirection
@@ -436,7 +436,7 @@
rule.setMaterialContent {
drawerState = rememberDrawerState(DrawerValue.Closed)
// emulate click on the screen
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Box(Modifier.testTag("Drawer")) {
ModalDrawer(
drawerState = drawerState,
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ElevationOverlayTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ElevationOverlayTest.kt
index 270f0fc..885dc7c 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ElevationOverlayTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ElevationOverlayTest.kt
@@ -20,7 +20,7 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.testutils.assertPixels
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -158,7 +158,7 @@
rule.setContent {
// Turn off overlay behavior
- Providers(LocalElevationOverlay provides null) {
+ CompositionLocalProvider(LocalElevationOverlay provides null) {
TestSurface(elevation!!, colors)
}
}
@@ -183,7 +183,7 @@
}
rule.setContent {
- Providers(LocalElevationOverlay provides customOverlay) {
+ CompositionLocalProvider(LocalElevationOverlay provides customOverlay) {
TestSurface(elevation!!, lightColors())
}
}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/FloatingActionButtonTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/FloatingActionButtonTest.kt
index 4cd637a..a679c2b 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/FloatingActionButtonTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/FloatingActionButtonTest.kt
@@ -25,7 +25,7 @@
import androidx.compose.foundation.shape.CutCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.testutils.assertShape
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Rect
@@ -178,7 +178,7 @@
Box {
surface = MaterialTheme.colors.surface
fabColor = MaterialTheme.colors.secondary
- Providers(LocalShapes provides Shapes(small = themeShape)) {
+ CompositionLocalProvider(LocalShapes provides Shapes(small = themeShape)) {
FloatingActionButton(
modifier = Modifier.testTag("myButton"),
>
@@ -215,7 +215,7 @@
Box {
surface = MaterialTheme.colors.surface
fabColor = MaterialTheme.colors.secondary
- Providers(LocalShapes provides Shapes(small = themeShape)) {
+ CompositionLocalProvider(LocalShapes provides Shapes(small = themeShape)) {
ExtendedFloatingActionButton(
modifier = Modifier.testTag("myButton"),
>
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialRippleThemeTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialRippleThemeTest.kt
index b8517a5..e7bc989 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialRippleThemeTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialRippleThemeTest.kt
@@ -33,7 +33,7 @@
import androidx.compose.material.ripple.RippleTheme
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
@@ -437,7 +437,7 @@
rule.setContent {
MaterialTheme {
- Providers(LocalRippleTheme provides rippleTheme) {
+ CompositionLocalProvider(LocalRippleTheme provides rippleTheme) {
Surface(contentColor = contentColor) {
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
RippleBox(interactionState, rememberRipple())
@@ -479,7 +479,7 @@
rule.setContent {
MaterialTheme {
- Providers(LocalRippleTheme provides rippleTheme) {
+ CompositionLocalProvider(LocalRippleTheme provides rippleTheme) {
Surface(contentColor = contentColor) {
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
RippleBox(interactionState, rememberRipple())
@@ -522,7 +522,7 @@
rule.setContent {
MaterialTheme {
- Providers(LocalRippleTheme provides rippleTheme) {
+ CompositionLocalProvider(LocalRippleTheme provides rippleTheme) {
Surface(contentColor = Color.Black) {
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
RippleBox(interactionState, rememberRipple())
@@ -586,7 +586,7 @@
rule.setContent {
MaterialTheme {
- Providers(LocalRippleTheme provides theme) {
+ CompositionLocalProvider(LocalRippleTheme provides theme) {
Surface(contentColor = Color.Black) {
// Create ripple where contentColor is black
val ripple = rememberRipple()
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldScreenshotTest.kt
index bb27f89..ef7bd8e 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldScreenshotTest.kt
@@ -27,7 +27,7 @@
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.Menu
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.testutils.assertAgainstGolden
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalLayoutDirection
@@ -653,7 +653,7 @@
val layoutDirection = if (rtl) LayoutDirection.Rtl else LayoutDirection.Ltr
- Providers(LocalLayoutDirection provides layoutDirection) {
+ CompositionLocalProvider(LocalLayoutDirection provides layoutDirection) {
Box(
Modifier
.fillMaxSize(0.5f)
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderTest.kt
index 8cd2d38..03edfbd 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderTest.kt
@@ -16,7 +16,7 @@
package androidx.compose.material
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
@@ -236,7 +236,7 @@
var slop = 0f
rule.setMaterialContent {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
slop = LocalViewConfiguration.current.touchSlop
Slider(
modifier = Modifier.testTag(tag),
@@ -270,7 +270,7 @@
val state = mutableStateOf(0f)
rule.setMaterialContent {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Slider(
modifier = Modifier.testTag(tag),
value = state.value,
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarTest.kt
index 78dc0b3..8324804 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarTest.kt
@@ -19,7 +19,7 @@
import android.os.Build
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.shape.CutCornerShape
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.testutils.assertShape
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -342,7 +342,7 @@
// on top of surface
snackBarColor = MaterialTheme.colors.onSurface.copy(alpha = 0.8f)
.compositeOver(background)
- Providers(LocalShapes provides Shapes(medium = shape)) {
+ CompositionLocalProvider(LocalShapes provides Shapes(medium = shape)) {
Snackbar(
modifier = Modifier
.semantics(mergeDescendants = true) {}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SurfaceTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SurfaceTest.kt
index 745c2a5..60fb15a 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SurfaceTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SurfaceTest.kt
@@ -22,7 +22,7 @@
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.preferredSize
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.testutils.assertPixels
import androidx.compose.testutils.assertShape
import androidx.compose.ui.Modifier
@@ -158,7 +158,7 @@
var contentColor: Color = Color.Unspecified
val expectedColor = Color.Blue
rule.setMaterialContent {
- Providers(LocalContentColor provides Color.Red) {
+ CompositionLocalProvider(LocalContentColor provides Color.Red) {
Surface(
Modifier.composed {
contentColor = LocalContentColor.current
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeToDismissTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeToDismissTest.kt
index cdcd919..b054212 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeToDismissTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeToDismissTest.kt
@@ -19,7 +19,7 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.preferredSize
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.platform.testTag
@@ -217,7 +217,7 @@
lateinit var dismissState: DismissState
rule.setContent {
dismissState = rememberDismissState(DismissValue.Default)
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
SwipeToDismiss(
modifier = Modifier.testTag(swipeToDismissTag),
state = dismissState,
@@ -242,7 +242,7 @@
lateinit var dismissState: DismissState
rule.setContent {
dismissState = rememberDismissState(DismissValue.Default)
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
SwipeToDismiss(
modifier = Modifier.testTag(swipeToDismissTag),
state = dismissState,
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchScreenshotTest.kt
index 15d9955..c62072b 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchScreenshotTest.kt
@@ -20,7 +20,7 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.testutils.assertAgainstGolden
@@ -84,7 +84,7 @@
fun switchTest_checked_rtl() {
rule.setMaterialContent {
Box(wrapperModifier) {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Switch(checked = true, })
}
}
@@ -120,7 +120,7 @@
fun switchTest_unchecked_rtl() {
rule.setMaterialContent {
Box(wrapperModifier) {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Switch(checked = false, })
}
}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchTest.kt
index b61d926..4ff71b6 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchTest.kt
@@ -18,7 +18,7 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
@@ -187,7 +187,7 @@
rule.setMaterialContent {
// Box is needed because otherwise the control will be expanded to fill its parent
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Box {
Switch(
modifier = Modifier.testTag(defaultSwitchTag),
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt
index 82ec65c..d44c3c7 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt
@@ -25,7 +25,7 @@
import androidx.compose.material.OutlinedTextField
import androidx.compose.material.Text
import androidx.compose.material.setMaterialContent
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.testutils.assertAgainstGolden
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -129,7 +129,7 @@
@Test
fun outlinedTextField_focused_rtl() {
rule.setMaterialContent {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Box(Modifier.semantics(mergeDescendants = true) {}.testTag(TextFieldTag)) {
OutlinedTextField(
value = "",
@@ -186,7 +186,7 @@
@Test
fun outlinedTextField_textColor_fallbackToContentColor() {
rule.setMaterialContent {
- Providers(LocalContentColor provides Color.Magenta) {
+ CompositionLocalProvider(LocalContentColor provides Color.Magenta) {
OutlinedTextField(
value = "Hello, world!",
>
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldTest.kt
index 7ae3a17..b0f6b78 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldTest.kt
@@ -35,7 +35,7 @@
import androidx.compose.material.runOnIdleWithDensity
import androidx.compose.material.setMaterialContent
import androidx.compose.material.setMaterialContentForSizeAssertions
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.testutils.assertShape
@@ -656,7 +656,7 @@
fun testOutlinedTextField_imeActionAndKeyboardTypePropagatedDownstream() {
val textInputService = mock<TextInputService>()
rule.setContent {
- Providers(
+ CompositionLocalProvider(
LocalTextInputService provides textInputService
) {
var text = remember { mutableStateOf("") }
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldScreenshotTest.kt
index 42e842f..7b49507 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldScreenshotTest.kt
@@ -25,7 +25,7 @@
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.material.setMaterialContent
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.testutils.assertAgainstGolden
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -126,7 +126,7 @@
@Test
fun textField_focused_rtl() {
rule.setMaterialContent {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Box(Modifier.semantics(mergeDescendants = true) {}.testTag(TextFieldTag)) {
TextField(
value = "",
@@ -178,7 +178,7 @@
@Test
fun textField_textColor_fallbackToContentColor() {
rule.setMaterialContent {
- Providers(LocalContentColor provides Color.Green) {
+ CompositionLocalProvider(LocalContentColor provides Color.Green) {
TextField(
value = "Hello, world!",
>
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldTest.kt
index 532b5b7..b4e0554 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldTest.kt
@@ -40,7 +40,7 @@
import androidx.compose.material.runOnIdleWithDensity
import androidx.compose.material.setMaterialContent
import androidx.compose.material.setMaterialContentForSizeAssertions
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.testutils.assertShape
@@ -810,7 +810,7 @@
fun testTextField_imeActionAndKeyboardTypePropagatedDownstream() {
val textInputService = mock<TextInputService>()
rule.setContent {
- Providers(
+ CompositionLocalProvider(
LocalTextInputService provides textInputService
) {
val text = remember { mutableStateOf("") }
diff --git a/compose/material/material/src/androidMain/kotlin/androidx/compose/material/AlertDialog.kt b/compose/material/material/src/androidMain/kotlin/androidx/compose/material/AlertDialog.kt
index 1666207..ec411e1 100644
--- a/compose/material/material/src/androidMain/kotlin/androidx/compose/material/AlertDialog.kt
+++ b/compose/material/material/src/androidMain/kotlin/androidx/compose/material/AlertDialog.kt
@@ -23,7 +23,7 @@
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -156,7 +156,7 @@
AlertDialogBaselineLayout(
title = title?.let {
@Composable {
- Providers(LocalContentAlpha provides ContentAlpha.high) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
val textStyle = MaterialTheme.typography.subtitle1
ProvideTextStyle(textStyle, title)
}
@@ -164,7 +164,9 @@
},
text = text?.let {
@Composable {
- Providers(LocalContentAlpha provides ContentAlpha.medium) {
+ CompositionLocalProvider(
+ LocalContentAlpha provides ContentAlpha.medium
+ ) {
val textStyle = MaterialTheme.typography.body2
ProvideTextStyle(textStyle, text)
}
diff --git a/compose/material/material/src/androidMain/kotlin/androidx/compose/material/Menu.kt b/compose/material/material/src/androidMain/kotlin/androidx/compose/material/Menu.kt
index 17ff491..c6cea1a 100644
--- a/compose/material/material/src/androidMain/kotlin/androidx/compose/material/Menu.kt
+++ b/compose/material/material/src/androidMain/kotlin/androidx/compose/material/Menu.kt
@@ -41,7 +41,7 @@
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -239,7 +239,7 @@
val typography = MaterialTheme.typography
ProvideTextStyle(typography.subtitle1) {
val contentAlpha = if (enabled) ContentAlpha.high else ContentAlpha.disabled
- Providers(LocalContentAlpha provides contentAlpha) {
+ CompositionLocalProvider(LocalContentAlpha provides contentAlpha) {
content()
}
}
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AppBar.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AppBar.kt
index 8411efd..9c0969e 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AppBar.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AppBar.kt
@@ -28,7 +28,7 @@
import androidx.compose.foundation.layout.preferredWidth
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
@@ -93,7 +93,7 @@
Spacer(TitleInsetWithoutIcon)
} else {
Row(TitleIconModifier, verticalAlignment = Alignment.CenterVertically) {
- Providers(
+ CompositionLocalProvider(
LocalContentAlpha provides ContentAlpha.high,
content = navigationIcon
)
@@ -105,11 +105,14 @@
verticalAlignment = Alignment.CenterVertically
) {
ProvideTextStyle(value = MaterialTheme.typography.h6) {
- Providers(LocalContentAlpha provides ContentAlpha.high, content = title)
+ CompositionLocalProvider(
+ LocalContentAlpha provides ContentAlpha.high,
+ content = title
+ )
}
}
- Providers(LocalContentAlpha provides ContentAlpha.medium) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Row(
Modifier.fillMaxHeight(),
horizontalArrangement = Arrangement.End,
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
index 04d3a87..0c61187 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
@@ -32,7 +32,7 @@
import androidx.compose.foundation.selection.selectable
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
@@ -225,7 +225,7 @@
val color = lerp(inactiveColor, activeColor, animationProgress)
- Providers(
+ CompositionLocalProvider(
LocalContentColor provides color.copy(alpha = 1f),
LocalContentAlpha provides color.alpha,
) {
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Button.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Button.kt
index a02d7efc..09b0385 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Button.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Button.kt
@@ -35,7 +35,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Stable
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
@@ -122,7 +122,7 @@
indication = null
)
) {
- Providers(LocalContentAlpha provides contentColor.alpha) {
+ CompositionLocalProvider(LocalContentAlpha provides contentColor.alpha) {
ProvideTextStyle(
value = MaterialTheme.typography.button
) {
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/FloatingActionButton.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/FloatingActionButton.kt
index 82aaa75..7e189b5 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/FloatingActionButton.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/FloatingActionButton.kt
@@ -33,7 +33,7 @@
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Stable
import androidx.compose.runtime.State
import androidx.compose.runtime.remember
@@ -95,7 +95,7 @@
contentColor = contentColor,
elevation = elevation.elevation(interactionState).value
) {
- Providers(LocalContentAlpha provides contentColor.alpha) {
+ CompositionLocalProvider(LocalContentAlpha provides contentColor.alpha) {
ProvideTextStyle(MaterialTheme.typography.button) {
Box(
modifier = Modifier
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ListItem.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ListItem.kt
index cd5631b..f285a10 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ListItem.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ListItem.kt
@@ -23,7 +23,7 @@
import androidx.compose.foundation.layout.preferredSizeIn
import androidx.compose.foundation.layout.preferredWidthIn
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.AlignmentLine
@@ -417,7 +417,7 @@
): @Composable (() -> Unit)? {
if (icon == null) return null
return {
- Providers(LocalContentAlpha provides contentAlpha) {
+ CompositionLocalProvider(LocalContentAlpha provides contentAlpha) {
ProvideTextStyle(textStyle, icon)
}
}
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/MaterialTheme.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/MaterialTheme.kt
index 6db8042..a336319 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/MaterialTheme.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/MaterialTheme.kt
@@ -23,7 +23,7 @@
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.remember
import androidx.compose.foundation.text.selection.LocalTextSelectionColors
@@ -68,7 +68,7 @@
}.apply { updateColorsFrom(colors) }
val rippleIndication = rememberRipple()
val selectionColors = rememberTextSelectionColors(rememberedColors)
- Providers(
+ CompositionLocalProvider(
LocalColors provides rememberedColors,
LocalContentAlpha provides ContentAlpha.high,
LocalIndication provides rippleIndication,
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt
index 8f213e0..2819fda 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt
@@ -20,7 +20,7 @@
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Stable
import androidx.compose.runtime.remember
import androidx.compose.runtime.staticCompositionLocalOf
@@ -274,7 +274,7 @@
}
val bottomBarPlaceables = subcompose(ScaffoldLayoutContent.BottomBar) {
- Providers(
+ CompositionLocalProvider(
LocalFabPlacement provides fabPlacement,
content = bottomBar
)
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Snackbar.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Snackbar.kt
index cd140e6e..4655951 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Snackbar.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Snackbar.kt
@@ -22,7 +22,7 @@
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.paddingFromBaseline
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -91,7 +91,7 @@
color = backgroundColor,
contentColor = contentColor
) {
- Providers(LocalContentAlpha provides ContentAlpha.high) {
+ CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
val textStyle = MaterialTheme.typography.body2
ProvideTextStyle(value = textStyle) {
when {
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Surface.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Surface.kt
index 7b82af7..46eb88b 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Surface.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Surface.kt
@@ -21,7 +21,7 @@
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
@@ -99,7 +99,7 @@
} else {
color
}
- Providers(
+ CompositionLocalProvider(
LocalContentColor provides contentColor,
LocalAbsoluteElevation provides absoluteElevation
) {
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Tab.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Tab.kt
index 384eb60..abe0b41 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Tab.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Tab.kt
@@ -31,7 +31,7 @@
import androidx.compose.foundation.selection.selectable
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
@@ -194,7 +194,7 @@
) {
if (it) activeColor else inactiveColor
}
- Providers(
+ CompositionLocalProvider(
LocalContentColor provides color.copy(alpha = 1f),
LocalContentAlpha provides color.alpha,
content = content
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Text.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Text.kt
index 1f5c503..44a1f15 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Text.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Text.kt
@@ -19,7 +19,7 @@
import androidx.compose.foundation.text.BasicText
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.structuralEqualityPolicy
import androidx.compose.ui.Modifier
@@ -243,5 +243,5 @@
@Composable
fun ProvideTextStyle(value: TextStyle, content: @Composable () -> Unit) {
val mergedStyle = LocalTextStyle.current.merge(value)
- Providers(LocalTextStyle provides mergedStyle, content = content)
+ CompositionLocalProvider(LocalTextStyle provides mergedStyle, content = content)
}
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
index 05e2f63..97c906a 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
@@ -30,7 +30,7 @@
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
@@ -250,14 +250,14 @@
content: @Composable () -> Unit
) {
val colorAndEmphasis = @Composable {
- Providers(LocalContentColor provides contentColor) {
+ CompositionLocalProvider(LocalContentColor provides contentColor) {
if (contentAlpha != null) {
- Providers(
+ CompositionLocalProvider(
LocalContentAlpha provides contentAlpha,
content = content
)
} else {
- Providers(
+ CompositionLocalProvider(
LocalContentAlpha provides contentColor.alpha,
content = content
)
diff --git a/compose/runtime/runtime-livedata/src/androidTest/java/androidx/compose/runtime/livedata/LiveDataAdapterTest.kt b/compose/runtime/runtime-livedata/src/androidTest/java/androidx/compose/runtime/livedata/LiveDataAdapterTest.kt
index f752298..807c340 100644
--- a/compose/runtime/runtime-livedata/src/androidTest/java/androidx/compose/runtime/livedata/LiveDataAdapterTest.kt
+++ b/compose/runtime/runtime-livedata/src/androidTest/java/androidx/compose/runtime/livedata/LiveDataAdapterTest.kt
@@ -16,7 +16,7 @@
package androidx.compose.runtime.livedata
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
@@ -88,7 +88,7 @@
var realValue: String? = null
val lifecycleOwner = rule.runOnUiThread { RegistryOwner() }
rule.setContent {
- Providers(LocalLifecycleOwner provides lifecycleOwner) {
+ CompositionLocalProvider(LocalLifecycleOwner provides lifecycleOwner) {
realValue = liveData.observeAsState().value
}
}
@@ -112,7 +112,7 @@
var emit by mutableStateOf(false)
val lifecycleOwner = rule.runOnUiThread { RegistryOwner() }
rule.setContent {
- Providers(LocalLifecycleOwner provides lifecycleOwner) {
+ CompositionLocalProvider(LocalLifecycleOwner provides lifecycleOwner) {
if (emit) {
liveData.observeAsState()
}
@@ -138,7 +138,7 @@
var realValue: String? = null
val lifecycleOwner = rule.runOnUiThread { RegistryOwner() }
rule.setContent {
- Providers(LocalLifecycleOwner provides lifecycleOwner) {
+ CompositionLocalProvider(LocalLifecycleOwner provides lifecycleOwner) {
realValue = liveData.observeAsState().value
}
}
@@ -176,7 +176,7 @@
}
}
rule.setContent {
- Providers(LocalLifecycleOwner provides lifecycleOwner) {
+ CompositionLocalProvider(LocalLifecycleOwner provides lifecycleOwner) {
realValue = liveData.observeAsState(null).value
}
}
@@ -195,7 +195,7 @@
}
}
rule.setContent {
- Providers(LocalLifecycleOwner provides lifecycleOwner) {
+ CompositionLocalProvider(LocalLifecycleOwner provides lifecycleOwner) {
realValue = liveData.observeAsState().value!!
}
}
diff --git a/compose/runtime/runtime-saveable/src/androidAndroidTest/kotlin/androidx/compose/runtime/saveable/RememberSaveableTest.kt b/compose/runtime/runtime-saveable/src/androidAndroidTest/kotlin/androidx/compose/runtime/saveable/RememberSaveableTest.kt
index 32f5e04..2e204db 100644
--- a/compose/runtime/runtime-saveable/src/androidAndroidTest/kotlin/androidx/compose/runtime/saveable/RememberSaveableTest.kt
+++ b/compose/runtime/runtime-saveable/src/androidAndroidTest/kotlin/androidx/compose/runtime/saveable/RememberSaveableTest.kt
@@ -17,7 +17,7 @@
package androidx.compose.runtime.saveable
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
@@ -389,7 +389,7 @@
wrap: @Composable (SaveableStateRegistry) -> SaveableStateRegistry,
content: @Composable () -> Unit
) {
- Providers(
+ CompositionLocalProvider(
LocalSaveableStateRegistry provides wrap(LocalSaveableStateRegistry.current!!),
content = content
)
diff --git a/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/RememberSaveable.kt b/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/RememberSaveable.kt
index 3847bb8..12838e2 100644
--- a/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/RememberSaveable.kt
+++ b/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/RememberSaveable.kt
@@ -72,7 +72,7 @@
val finalKey = if (!key.isNullOrEmpty()) {
key
} else {
- currentCompositeKeyHash().toString()
+ currentCompositeKeyHash.toString()
}
@Suppress("UNCHECKED_CAST")
(saver as Saver<T, Any>)
diff --git a/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/SaveableStateHolder.kt b/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/SaveableStateHolder.kt
index 99c0c08..e8e4f98 100644
--- a/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/SaveableStateHolder.kt
+++ b/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/SaveableStateHolder.kt
@@ -19,7 +19,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.ExperimentalComposeApi
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.key
import androidx.compose.runtime.remember
@@ -83,7 +83,7 @@
}
RegistryHolder(key)
}
- Providers(
+ CompositionLocalProvider(
LocalSaveableStateRegistry provides registryHolder.registry,
content = content
)
diff --git a/compose/runtime/runtime/api/api_lint.ignore b/compose/runtime/runtime/api/api_lint.ignore
index d689b08..1f1e491 100644
--- a/compose/runtime/runtime/api/api_lint.ignore
+++ b/compose/runtime/runtime/api/api_lint.ignore
@@ -3,8 +3,8 @@
Class should be named SnapshotStateCallback
-DocumentExceptions: androidx.compose.runtime.ComposerKt#getCurrentComposer():
- Method ComposerKt.getCurrentComposer appears to be throwing kotlin.NotImplementedError; this should be listed in the documentation; see https://android.github.io/kotlin-guides/interop.html#document-exceptions
+DocumentExceptions: androidx.compose.runtime.ComposablesKt#getCurrentComposer():
+ Method ComposablesKt.getCurrentComposer appears to be throwing kotlin.NotImplementedError; this should be listed in the documentation; see https://android.github.io/kotlin-guides/interop.html#document-exceptions
DocumentExceptions: androidx.compose.runtime.snapshots.SnapshotApplyResult.Failure#check():
Method Failure.check appears to be throwing androidx.compose.runtime.snapshots.SnapshotApplyConflictException; this should be recorded with a @Throws annotation; see https://android.github.io/kotlin-guides/interop.html#document-exceptions
diff --git a/compose/runtime/runtime/api/current.txt b/compose/runtime/runtime/api/current.txt
index c8fd523..ed9df9d 100644
--- a/compose/runtime/runtime/api/current.txt
+++ b/compose/runtime/runtime/api/current.txt
@@ -64,6 +64,22 @@
property public abstract boolean tracked;
}
+ public final class ComposablesKt {
+ method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update);
+ method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static inline <T, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.SkippableUpdater<T>,? extends kotlin.Unit> skippableUpdate, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static androidx.compose.runtime.Composer getCurrentComposer();
+ method @androidx.compose.runtime.Composable public static int getCurrentCompositeKeyHash();
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static androidx.compose.runtime.RecomposeScope getCurrentRecomposeScope();
+ method @androidx.compose.runtime.Composable public static inline <T> T! key(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> block);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static androidx.compose.runtime.CompositionContext rememberCompositionContext();
+ }
+
@kotlin.RequiresOptIn(level=kotlin.RequiresOptIn.Level, message="This API is intended to be targeted by the Compose Compiler Plugin and not called " + "directly.") @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface ComposeCompilerApi {
}
@@ -72,12 +88,6 @@
method @Deprecated public static inline kotlin.jvm.functions.Function0<kotlin.Unit> orEmpty(kotlin.jvm.functions.Function0<kotlin.Unit>?);
}
- public final class ComposeNodeKt {
- method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update);
- method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static inline <T, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.SkippableUpdater<T>,? extends kotlin.Unit> skippableUpdate, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
- }
-
public interface Composer {
method @androidx.compose.runtime.ComposeCompilerApi public <V, T> void apply(V? value, kotlin.jvm.functions.Function2<? super T,? super V,kotlin.Unit> block);
method @androidx.compose.runtime.InternalComposeApi public androidx.compose.runtime.CompositionContext buildContext();
@@ -102,7 +112,7 @@
method public androidx.compose.runtime.Applier<?> getApplier();
method @org.jetbrains.annotations.TestOnly public kotlin.coroutines.CoroutineContext getApplyCoroutineContext();
method @org.jetbrains.annotations.TestOnly public androidx.compose.runtime.ControlledComposition getComposition();
- method public androidx.compose.runtime.CompositionData getCompositionData();
+ method public androidx.compose.runtime.tooling.CompositionData getCompositionData();
method public int getCompoundKeyHash();
method public boolean getDefaultsInvalid();
method public boolean getInserting();
@@ -130,7 +140,7 @@
property public abstract androidx.compose.runtime.Applier<?> applier;
property @org.jetbrains.annotations.TestOnly public abstract kotlin.coroutines.CoroutineContext applyCoroutineContext;
property @org.jetbrains.annotations.TestOnly public abstract androidx.compose.runtime.ControlledComposition composition;
- property public abstract androidx.compose.runtime.CompositionData compositionData;
+ property public abstract androidx.compose.runtime.tooling.CompositionData compositionData;
property public abstract int compoundKeyHash;
property public abstract boolean defaultsInvalid;
property public abstract boolean inserting;
@@ -146,8 +156,6 @@
public final class ComposerKt {
method @androidx.compose.runtime.ComposeCompilerApi public static inline <T> T! cache(androidx.compose.runtime.Composer, boolean invalid, kotlin.jvm.functions.Function0<? extends T> block);
- method @androidx.compose.runtime.Composable public static int currentCompositeKeyHash();
- method @androidx.compose.runtime.Composable public static androidx.compose.runtime.Composer getCurrentComposer();
}
public interface Composition {
@@ -163,31 +171,11 @@
}
public final class CompositionContextKt {
- method @androidx.compose.runtime.Composable public static androidx.compose.runtime.CompositionContext rememberCompositionContext();
method @Deprecated @androidx.compose.runtime.Composable public static androidx.compose.runtime.CompositionContext rememberCompositionReference();
}
- public interface CompositionData {
- method public Iterable<androidx.compose.runtime.CompositionGroup> getCompositionGroups();
- method public boolean isEmpty();
- property public abstract Iterable<androidx.compose.runtime.CompositionGroup> compositionGroups;
- property public abstract boolean isEmpty;
- }
-
- public interface CompositionGroup extends androidx.compose.runtime.CompositionData {
- method public Iterable<java.lang.Object> getData();
- method public Object getKey();
- method public Object? getNode();
- method public String? getSourceInfo();
- property public abstract Iterable<java.lang.Object> data;
- property public abstract Object key;
- property public abstract Object? node;
- property public abstract String? sourceInfo;
- }
-
public final class CompositionKt {
- method @androidx.compose.runtime.ExperimentalComposeApi public static androidx.compose.runtime.Composition Composition(Object key, androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent, optional kotlin.jvm.functions.Function0<kotlin.Unit> onCreated);
- method @androidx.compose.runtime.ExperimentalComposeApi public static androidx.compose.runtime.Composition Composition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent);
+ method public static androidx.compose.runtime.Composition Composition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent);
method @org.jetbrains.annotations.TestOnly public static androidx.compose.runtime.ControlledComposition ControlledComposition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent);
}
@@ -197,7 +185,7 @@
}
public final class CompositionLocalKt {
- method @androidx.compose.runtime.Composable public static void Providers(androidx.compose.runtime.ProvidedValue<?>![] values, kotlin.jvm.functions.Function0<kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void CompositionLocalProvider(androidx.compose.runtime.ProvidedValue<?>![] values, kotlin.jvm.functions.Function0<kotlin.Unit> content);
method public static <T> androidx.compose.runtime.ProvidableCompositionLocal<T> compositionLocalOf(optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy, optional kotlin.jvm.functions.Function0<? extends T>? defaultFactory);
method public static <T> androidx.compose.runtime.ProvidableCompositionLocal<T> staticCompositionLocalOf(optional kotlin.jvm.functions.Function0<? extends T>? defaultFactory);
}
@@ -217,10 +205,6 @@
property public abstract boolean isComposing;
}
- public final class DerivedStateKt {
- method public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
- }
-
@kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface DisallowComposableCalls {
}
@@ -233,29 +217,33 @@
method public inline androidx.compose.runtime.DisposableEffectResult onDispose(kotlin.jvm.functions.Function0<kotlin.Unit> onDisposeEffect);
}
+ public final class EffectsKt {
+ method @Deprecated @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object![]? keys, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @Deprecated @androidx.compose.runtime.Composable public static void LaunchedEffect(kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object![]? keys, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void SideEffect(kotlin.jvm.functions.Function0<kotlin.Unit> effect);
+ method @androidx.compose.runtime.Composable public static inline kotlinx.coroutines.CoroutineScope rememberCoroutineScope(optional kotlin.jvm.functions.Function0<? extends kotlin.coroutines.CoroutineContext> getContext);
+ }
+
public final class ExpectKt {
}
@kotlin.RequiresOptIn(level=kotlin.RequiresOptIn.Level, message="This is an experimental API for Compose and is likely to change before becoming " + "stable.") @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface ExperimentalComposeApi {
}
- public final class FlowAdapterKt {
- method @androidx.compose.runtime.Composable @kotlinx.coroutines.ExperimentalCoroutinesApi public static <T> androidx.compose.runtime.State<T> collectAsState(kotlinx.coroutines.flow.StateFlow<? extends T>, optional kotlin.coroutines.CoroutineContext context);
- method @androidx.compose.runtime.Composable public static <T extends R, R> androidx.compose.runtime.State<R> collectAsState(kotlinx.coroutines.flow.Flow<? extends T>, R? initial, optional kotlin.coroutines.CoroutineContext context);
- }
-
@androidx.compose.runtime.StableMarker @kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface Immutable {
}
@kotlin.RequiresOptIn(level=kotlin.RequiresOptIn.Level, message="This is internal API for Compose modules that may change frequently " + "and without warning.") @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface InternalComposeApi {
}
- public final class JoinedKeyKt {
- method @androidx.compose.runtime.InternalComposeApi public static boolean isJoinedKey(Object? key);
- method @androidx.compose.runtime.InternalComposeApi public static Object? joinedKeyLeft(Object? key);
- method @androidx.compose.runtime.InternalComposeApi public static Object? joinedKeyRight(Object? key);
- }
-
@androidx.compose.runtime.InternalComposeApi public final class KeyInfo {
method public int getIndex();
method public int getKey();
@@ -269,15 +257,6 @@
property public final Object? objectKey;
}
- public final class KeyKt {
- method @androidx.compose.runtime.Composable public static inline <T> T! key(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> block);
- }
-
- public final class KeySourceInfoKt {
- method @androidx.compose.runtime.InternalComposeApi public static String? keySourceInfoOf(Object key);
- method @androidx.compose.runtime.InternalComposeApi public static void resetSourceInfo();
- }
-
public interface MonotonicFrameClock extends kotlin.coroutines.CoroutineContext.Element {
method public default kotlin.coroutines.CoroutineContext.Key<?> getKey();
method public suspend <R> Object? withFrameNanos(kotlin.jvm.functions.Function1<? super java.lang.Long,? extends R> onFrame, kotlin.coroutines.Continuation<? super R> p);
@@ -301,21 +280,6 @@
property public abstract T! value;
}
- public final class MutableStateKt {
- method public static inline operator <T> T! getValue(androidx.compose.runtime.State<T>, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
- method public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T? value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
- method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> neverEqualPolicy();
- method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> referentialEqualityPolicy();
- method public static inline operator <T> void setValue(androidx.compose.runtime.MutableState<T>, Object? thisObj, kotlin.reflect.KProperty<?> property, T? value);
- method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> structuralEqualityPolicy();
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> toMutableStateList(java.util.Collection<? extends T>);
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> toMutableStateMap(Iterable<? extends kotlin.Pair<? extends K,? extends V>>);
- }
-
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface NoLiveLiterals {
}
@@ -331,14 +295,6 @@
property public final boolean isPaused;
}
- public final class ProduceStateKt {
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, Object? key3, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object![]? keys, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- }
-
public interface ProduceStateScope<T> extends androidx.compose.runtime.MutableState<T> kotlinx.coroutines.CoroutineScope {
method public suspend Object? awaitDispose(kotlin.jvm.functions.Function0<kotlin.Unit> onDispose, kotlin.coroutines.Continuation<?> p);
}
@@ -364,10 +320,6 @@
method public void invalidate();
}
- public final class RecomposeScopeImplKt {
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static androidx.compose.runtime.RecomposeScope getCurrentRecomposeScope();
- }
-
public final class Recomposer extends androidx.compose.runtime.CompositionContext {
ctor public Recomposer(kotlin.coroutines.CoroutineContext effectCoroutineContext);
method public androidx.compose.runtime.RecomposerInfo asRecomposerInfo();
@@ -414,15 +366,6 @@
method public static suspend <R> Object? withRunningRecomposer(kotlin.jvm.functions.Function3<? super kotlinx.coroutines.CoroutineScope,? super androidx.compose.runtime.Recomposer,? super kotlin.coroutines.Continuation<? super R>,?> block, kotlin.coroutines.Continuation<? super R> p);
}
- public final class RememberKt {
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> androidx.compose.runtime.State<T> rememberUpdatedState(T? newValue);
- }
-
public interface RememberObserver {
method public void onAbandoned();
method public void onForgotten();
@@ -433,20 +376,6 @@
method public void updateScope(kotlin.jvm.functions.Function2<? super androidx.compose.runtime.Composer,? super java.lang.Integer,kotlin.Unit> block);
}
- public final class SideEffectKt {
- method @Deprecated @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object![]? keys, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @Deprecated @androidx.compose.runtime.Composable public static void LaunchedEffect(kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object![]? keys, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void SideEffect(kotlin.jvm.functions.Function0<kotlin.Unit> effect);
- }
-
public final inline class SkippableUpdater<T> {
ctor public SkippableUpdater();
method public static androidx.compose.runtime.Composer! constructor-impl(androidx.compose.runtime.Composer composer);
@@ -458,12 +387,36 @@
}
public final class SlotTableKt {
- method public static java.util.List<java.lang.Integer> slice(int[], Iterable<java.lang.Integer> indices);
}
public interface SnapshotMutationPolicy<T> {
method public boolean equivalent(T? a, T? b);
- method @androidx.compose.runtime.ExperimentalComposeApi public default T? merge(T? previous, T? current, T? applied);
+ method public default T? merge(T? previous, T? current, T? applied);
+ }
+
+ public final class SnapshotStateKt {
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> collectAsState(kotlinx.coroutines.flow.StateFlow<? extends T>, optional kotlin.coroutines.CoroutineContext context);
+ method @androidx.compose.runtime.Composable public static <T extends R, R> androidx.compose.runtime.State<R> collectAsState(kotlinx.coroutines.flow.Flow<? extends T>, R? initial, optional kotlin.coroutines.CoroutineContext context);
+ method public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
+ method public static inline operator <T> T! getValue(androidx.compose.runtime.State<T>, Object? thisObj, kotlin.reflect.KProperty<?> property);
+ method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
+ method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
+ method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
+ method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
+ method public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T? value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
+ method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> neverEqualPolicy();
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, Object? key3, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object![]? keys, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> referentialEqualityPolicy();
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> rememberUpdatedState(T? newValue);
+ method public static inline operator <T> void setValue(androidx.compose.runtime.MutableState<T>, Object? thisObj, kotlin.reflect.KProperty<?> property, T? value);
+ method public static <T> kotlinx.coroutines.flow.Flow<T> snapshotFlow(kotlin.jvm.functions.Function0<? extends T> block);
+ method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> structuralEqualityPolicy();
+ method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> toMutableStateList(java.util.Collection<? extends T>);
+ method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> toMutableStateMap(Iterable<? extends kotlin.Pair<? extends K,? extends V>>);
}
@androidx.compose.runtime.StableMarker @kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface Stable {
@@ -477,10 +430,6 @@
property public abstract T! value;
}
- public final class SuspendingEffectsKt {
- method @androidx.compose.runtime.Composable public static inline kotlinx.coroutines.CoroutineScope rememberCoroutineScope(optional kotlin.jvm.functions.Function0<? extends kotlin.coroutines.CoroutineContext> getContext);
- }
-
public final class TraceKt {
}
@@ -581,58 +530,28 @@
package androidx.compose.runtime.internal {
- @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public final class ComposableLambda<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, R> implements kotlin.jvm.functions.Function10<P1,P2,P3,P4,P5,P6,P7,P8,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function11<P1,P2,P3,P4,P5,P6,P7,P8,P9,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function13<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function14<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function15<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function16<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function17<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function18<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function19<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function2<androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function20<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function21<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function3<P1,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function4<P1,P2,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function5<P1,P2,P3,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function6<P1,P2,P3,P4,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function7<P1,P2,P3,P4,P5,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function8<P1,P2,P3,P4,P5,P6,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function9<P1,P2,P3,P4,P5,P6,P7,androidx.compose.runtime.Composer,java.lang.Integer,R> {
- ctor public ComposableLambda(int key, boolean tracked, String? sourceInformation);
- method public int getKey();
- method public operator R! invoke(androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, P16? p16, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, P16? p16, P17? p17, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, P16? p16, P17? p17, P18? p18, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public void update(Object block);
- property public final int key;
+ @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public interface ComposableLambda extends kotlin.jvm.functions.Function2<androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function10<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function11<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function13<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function14<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function15<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function16<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function17<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function18<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function19<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function20<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function21<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function3<java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function4<java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function5<java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function6<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function7<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function8<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function9<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> {
}
public final class ComposableLambdaKt {
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object> composableLambda(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, Object block);
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object> composableLambdaInstance(int key, boolean tracked, String? sourceInformation, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda composableLambda(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda composableLambdaInstance(int key, boolean tracked, String? sourceInformation, Object block);
}
- @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public final class ComposableLambdaN<R> implements kotlin.jvm.functions.FunctionN<R> {
- ctor public ComposableLambdaN(int key, boolean tracked, String? sourceInformation, int arity);
- method public int getArity();
- method public int getKey();
- method public R! invoke(java.lang.Object?... args);
- method public void update(Object block, androidx.compose.runtime.Composer? composer);
- property public int arity;
- property public final int key;
+ @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public interface ComposableLambdaN extends kotlin.jvm.functions.FunctionN<java.lang.Object> {
}
public final class ComposableLambdaNKt {
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN<?> composableLambdaN(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, int arity, Object block);
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN<?> composableLambdaNInstance(int key, boolean tracked, int arity, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN composableLambdaN(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, int arity, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN composableLambdaNInstance(int key, boolean tracked, String? sourceInformation, int arity, Object block);
}
- @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) public @interface LiveLiteralFileInfo {
+ @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface LiveLiteralFileInfo {
method public abstract String file();
property public abstract String file;
}
- @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) public @interface LiveLiteralInfo {
+ @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface LiveLiteralInfo {
method public abstract String key();
method public abstract int offset();
property public abstract String key;
@@ -642,11 +561,11 @@
public final class LiveLiteralKt {
method @androidx.compose.runtime.InternalComposeApi public static void enableLiveLiterals();
method public static boolean isLiveLiteralsEnabled();
- method @androidx.compose.runtime.InternalComposeApi public static <T> androidx.compose.runtime.State<T> liveLiteral(String key, T? value);
+ method @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.InternalComposeApi public static <T> androidx.compose.runtime.State<T> liveLiteral(String key, T? value);
method @androidx.compose.runtime.InternalComposeApi public static void updateLiveLiteralValue(String key, Object? value);
}
- @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) public @interface StabilityInferred {
+ @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface StabilityInferred {
method public abstract int parameters();
property public abstract int parameters;
}
@@ -745,7 +664,6 @@
}
public final class SnapshotFlowKt {
- method public static <T> kotlinx.coroutines.flow.Flow<T> snapshotFlow(kotlin.jvm.functions.Function0<? extends T> block);
method @Deprecated @androidx.compose.runtime.ExperimentalComposeApi public static inline <R> R! withMutableSnapshot(kotlin.jvm.functions.Function0<? extends R> block);
}
@@ -855,8 +773,26 @@
package androidx.compose.runtime.tooling {
+ public interface CompositionData {
+ method public Iterable<androidx.compose.runtime.tooling.CompositionGroup> getCompositionGroups();
+ method public boolean isEmpty();
+ property public abstract Iterable<androidx.compose.runtime.tooling.CompositionGroup> compositionGroups;
+ property public abstract boolean isEmpty;
+ }
+
+ public interface CompositionGroup extends androidx.compose.runtime.tooling.CompositionData {
+ method public Iterable<java.lang.Object> getData();
+ method public Object getKey();
+ method public Object? getNode();
+ method public String? getSourceInfo();
+ property public abstract Iterable<java.lang.Object> data;
+ property public abstract Object key;
+ property public abstract Object? node;
+ property public abstract String? sourceInfo;
+ }
+
public final class InspectionTablesKt {
- method public static androidx.compose.runtime.ProvidableCompositionLocal<java.util.Set<androidx.compose.runtime.CompositionData>> getLocalInspectionTables();
+ method public static androidx.compose.runtime.ProvidableCompositionLocal<java.util.Set<androidx.compose.runtime.tooling.CompositionData>> getLocalInspectionTables();
}
}
diff --git a/compose/runtime/runtime/api/public_plus_experimental_current.txt b/compose/runtime/runtime/api/public_plus_experimental_current.txt
index c8fd523..ed9df9d 100644
--- a/compose/runtime/runtime/api/public_plus_experimental_current.txt
+++ b/compose/runtime/runtime/api/public_plus_experimental_current.txt
@@ -64,6 +64,22 @@
property public abstract boolean tracked;
}
+ public final class ComposablesKt {
+ method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update);
+ method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static inline <T, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.SkippableUpdater<T>,? extends kotlin.Unit> skippableUpdate, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static androidx.compose.runtime.Composer getCurrentComposer();
+ method @androidx.compose.runtime.Composable public static int getCurrentCompositeKeyHash();
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static androidx.compose.runtime.RecomposeScope getCurrentRecomposeScope();
+ method @androidx.compose.runtime.Composable public static inline <T> T! key(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> block);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static androidx.compose.runtime.CompositionContext rememberCompositionContext();
+ }
+
@kotlin.RequiresOptIn(level=kotlin.RequiresOptIn.Level, message="This API is intended to be targeted by the Compose Compiler Plugin and not called " + "directly.") @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface ComposeCompilerApi {
}
@@ -72,12 +88,6 @@
method @Deprecated public static inline kotlin.jvm.functions.Function0<kotlin.Unit> orEmpty(kotlin.jvm.functions.Function0<kotlin.Unit>?);
}
- public final class ComposeNodeKt {
- method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update);
- method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static inline <T, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.SkippableUpdater<T>,? extends kotlin.Unit> skippableUpdate, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
- }
-
public interface Composer {
method @androidx.compose.runtime.ComposeCompilerApi public <V, T> void apply(V? value, kotlin.jvm.functions.Function2<? super T,? super V,kotlin.Unit> block);
method @androidx.compose.runtime.InternalComposeApi public androidx.compose.runtime.CompositionContext buildContext();
@@ -102,7 +112,7 @@
method public androidx.compose.runtime.Applier<?> getApplier();
method @org.jetbrains.annotations.TestOnly public kotlin.coroutines.CoroutineContext getApplyCoroutineContext();
method @org.jetbrains.annotations.TestOnly public androidx.compose.runtime.ControlledComposition getComposition();
- method public androidx.compose.runtime.CompositionData getCompositionData();
+ method public androidx.compose.runtime.tooling.CompositionData getCompositionData();
method public int getCompoundKeyHash();
method public boolean getDefaultsInvalid();
method public boolean getInserting();
@@ -130,7 +140,7 @@
property public abstract androidx.compose.runtime.Applier<?> applier;
property @org.jetbrains.annotations.TestOnly public abstract kotlin.coroutines.CoroutineContext applyCoroutineContext;
property @org.jetbrains.annotations.TestOnly public abstract androidx.compose.runtime.ControlledComposition composition;
- property public abstract androidx.compose.runtime.CompositionData compositionData;
+ property public abstract androidx.compose.runtime.tooling.CompositionData compositionData;
property public abstract int compoundKeyHash;
property public abstract boolean defaultsInvalid;
property public abstract boolean inserting;
@@ -146,8 +156,6 @@
public final class ComposerKt {
method @androidx.compose.runtime.ComposeCompilerApi public static inline <T> T! cache(androidx.compose.runtime.Composer, boolean invalid, kotlin.jvm.functions.Function0<? extends T> block);
- method @androidx.compose.runtime.Composable public static int currentCompositeKeyHash();
- method @androidx.compose.runtime.Composable public static androidx.compose.runtime.Composer getCurrentComposer();
}
public interface Composition {
@@ -163,31 +171,11 @@
}
public final class CompositionContextKt {
- method @androidx.compose.runtime.Composable public static androidx.compose.runtime.CompositionContext rememberCompositionContext();
method @Deprecated @androidx.compose.runtime.Composable public static androidx.compose.runtime.CompositionContext rememberCompositionReference();
}
- public interface CompositionData {
- method public Iterable<androidx.compose.runtime.CompositionGroup> getCompositionGroups();
- method public boolean isEmpty();
- property public abstract Iterable<androidx.compose.runtime.CompositionGroup> compositionGroups;
- property public abstract boolean isEmpty;
- }
-
- public interface CompositionGroup extends androidx.compose.runtime.CompositionData {
- method public Iterable<java.lang.Object> getData();
- method public Object getKey();
- method public Object? getNode();
- method public String? getSourceInfo();
- property public abstract Iterable<java.lang.Object> data;
- property public abstract Object key;
- property public abstract Object? node;
- property public abstract String? sourceInfo;
- }
-
public final class CompositionKt {
- method @androidx.compose.runtime.ExperimentalComposeApi public static androidx.compose.runtime.Composition Composition(Object key, androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent, optional kotlin.jvm.functions.Function0<kotlin.Unit> onCreated);
- method @androidx.compose.runtime.ExperimentalComposeApi public static androidx.compose.runtime.Composition Composition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent);
+ method public static androidx.compose.runtime.Composition Composition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent);
method @org.jetbrains.annotations.TestOnly public static androidx.compose.runtime.ControlledComposition ControlledComposition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent);
}
@@ -197,7 +185,7 @@
}
public final class CompositionLocalKt {
- method @androidx.compose.runtime.Composable public static void Providers(androidx.compose.runtime.ProvidedValue<?>![] values, kotlin.jvm.functions.Function0<kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void CompositionLocalProvider(androidx.compose.runtime.ProvidedValue<?>![] values, kotlin.jvm.functions.Function0<kotlin.Unit> content);
method public static <T> androidx.compose.runtime.ProvidableCompositionLocal<T> compositionLocalOf(optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy, optional kotlin.jvm.functions.Function0<? extends T>? defaultFactory);
method public static <T> androidx.compose.runtime.ProvidableCompositionLocal<T> staticCompositionLocalOf(optional kotlin.jvm.functions.Function0<? extends T>? defaultFactory);
}
@@ -217,10 +205,6 @@
property public abstract boolean isComposing;
}
- public final class DerivedStateKt {
- method public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
- }
-
@kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface DisallowComposableCalls {
}
@@ -233,29 +217,33 @@
method public inline androidx.compose.runtime.DisposableEffectResult onDispose(kotlin.jvm.functions.Function0<kotlin.Unit> onDisposeEffect);
}
+ public final class EffectsKt {
+ method @Deprecated @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object![]? keys, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @Deprecated @androidx.compose.runtime.Composable public static void LaunchedEffect(kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object![]? keys, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void SideEffect(kotlin.jvm.functions.Function0<kotlin.Unit> effect);
+ method @androidx.compose.runtime.Composable public static inline kotlinx.coroutines.CoroutineScope rememberCoroutineScope(optional kotlin.jvm.functions.Function0<? extends kotlin.coroutines.CoroutineContext> getContext);
+ }
+
public final class ExpectKt {
}
@kotlin.RequiresOptIn(level=kotlin.RequiresOptIn.Level, message="This is an experimental API for Compose and is likely to change before becoming " + "stable.") @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface ExperimentalComposeApi {
}
- public final class FlowAdapterKt {
- method @androidx.compose.runtime.Composable @kotlinx.coroutines.ExperimentalCoroutinesApi public static <T> androidx.compose.runtime.State<T> collectAsState(kotlinx.coroutines.flow.StateFlow<? extends T>, optional kotlin.coroutines.CoroutineContext context);
- method @androidx.compose.runtime.Composable public static <T extends R, R> androidx.compose.runtime.State<R> collectAsState(kotlinx.coroutines.flow.Flow<? extends T>, R? initial, optional kotlin.coroutines.CoroutineContext context);
- }
-
@androidx.compose.runtime.StableMarker @kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface Immutable {
}
@kotlin.RequiresOptIn(level=kotlin.RequiresOptIn.Level, message="This is internal API for Compose modules that may change frequently " + "and without warning.") @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface InternalComposeApi {
}
- public final class JoinedKeyKt {
- method @androidx.compose.runtime.InternalComposeApi public static boolean isJoinedKey(Object? key);
- method @androidx.compose.runtime.InternalComposeApi public static Object? joinedKeyLeft(Object? key);
- method @androidx.compose.runtime.InternalComposeApi public static Object? joinedKeyRight(Object? key);
- }
-
@androidx.compose.runtime.InternalComposeApi public final class KeyInfo {
method public int getIndex();
method public int getKey();
@@ -269,15 +257,6 @@
property public final Object? objectKey;
}
- public final class KeyKt {
- method @androidx.compose.runtime.Composable public static inline <T> T! key(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> block);
- }
-
- public final class KeySourceInfoKt {
- method @androidx.compose.runtime.InternalComposeApi public static String? keySourceInfoOf(Object key);
- method @androidx.compose.runtime.InternalComposeApi public static void resetSourceInfo();
- }
-
public interface MonotonicFrameClock extends kotlin.coroutines.CoroutineContext.Element {
method public default kotlin.coroutines.CoroutineContext.Key<?> getKey();
method public suspend <R> Object? withFrameNanos(kotlin.jvm.functions.Function1<? super java.lang.Long,? extends R> onFrame, kotlin.coroutines.Continuation<? super R> p);
@@ -301,21 +280,6 @@
property public abstract T! value;
}
- public final class MutableStateKt {
- method public static inline operator <T> T! getValue(androidx.compose.runtime.State<T>, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
- method public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T? value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
- method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> neverEqualPolicy();
- method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> referentialEqualityPolicy();
- method public static inline operator <T> void setValue(androidx.compose.runtime.MutableState<T>, Object? thisObj, kotlin.reflect.KProperty<?> property, T? value);
- method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> structuralEqualityPolicy();
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> toMutableStateList(java.util.Collection<? extends T>);
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> toMutableStateMap(Iterable<? extends kotlin.Pair<? extends K,? extends V>>);
- }
-
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface NoLiveLiterals {
}
@@ -331,14 +295,6 @@
property public final boolean isPaused;
}
- public final class ProduceStateKt {
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, Object? key3, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object![]? keys, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- }
-
public interface ProduceStateScope<T> extends androidx.compose.runtime.MutableState<T> kotlinx.coroutines.CoroutineScope {
method public suspend Object? awaitDispose(kotlin.jvm.functions.Function0<kotlin.Unit> onDispose, kotlin.coroutines.Continuation<?> p);
}
@@ -364,10 +320,6 @@
method public void invalidate();
}
- public final class RecomposeScopeImplKt {
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static androidx.compose.runtime.RecomposeScope getCurrentRecomposeScope();
- }
-
public final class Recomposer extends androidx.compose.runtime.CompositionContext {
ctor public Recomposer(kotlin.coroutines.CoroutineContext effectCoroutineContext);
method public androidx.compose.runtime.RecomposerInfo asRecomposerInfo();
@@ -414,15 +366,6 @@
method public static suspend <R> Object? withRunningRecomposer(kotlin.jvm.functions.Function3<? super kotlinx.coroutines.CoroutineScope,? super androidx.compose.runtime.Recomposer,? super kotlin.coroutines.Continuation<? super R>,?> block, kotlin.coroutines.Continuation<? super R> p);
}
- public final class RememberKt {
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> androidx.compose.runtime.State<T> rememberUpdatedState(T? newValue);
- }
-
public interface RememberObserver {
method public void onAbandoned();
method public void onForgotten();
@@ -433,20 +376,6 @@
method public void updateScope(kotlin.jvm.functions.Function2<? super androidx.compose.runtime.Composer,? super java.lang.Integer,kotlin.Unit> block);
}
- public final class SideEffectKt {
- method @Deprecated @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object![]? keys, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @Deprecated @androidx.compose.runtime.Composable public static void LaunchedEffect(kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object![]? keys, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void SideEffect(kotlin.jvm.functions.Function0<kotlin.Unit> effect);
- }
-
public final inline class SkippableUpdater<T> {
ctor public SkippableUpdater();
method public static androidx.compose.runtime.Composer! constructor-impl(androidx.compose.runtime.Composer composer);
@@ -458,12 +387,36 @@
}
public final class SlotTableKt {
- method public static java.util.List<java.lang.Integer> slice(int[], Iterable<java.lang.Integer> indices);
}
public interface SnapshotMutationPolicy<T> {
method public boolean equivalent(T? a, T? b);
- method @androidx.compose.runtime.ExperimentalComposeApi public default T? merge(T? previous, T? current, T? applied);
+ method public default T? merge(T? previous, T? current, T? applied);
+ }
+
+ public final class SnapshotStateKt {
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> collectAsState(kotlinx.coroutines.flow.StateFlow<? extends T>, optional kotlin.coroutines.CoroutineContext context);
+ method @androidx.compose.runtime.Composable public static <T extends R, R> androidx.compose.runtime.State<R> collectAsState(kotlinx.coroutines.flow.Flow<? extends T>, R? initial, optional kotlin.coroutines.CoroutineContext context);
+ method public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
+ method public static inline operator <T> T! getValue(androidx.compose.runtime.State<T>, Object? thisObj, kotlin.reflect.KProperty<?> property);
+ method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
+ method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
+ method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
+ method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
+ method public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T? value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
+ method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> neverEqualPolicy();
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, Object? key3, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object![]? keys, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> referentialEqualityPolicy();
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> rememberUpdatedState(T? newValue);
+ method public static inline operator <T> void setValue(androidx.compose.runtime.MutableState<T>, Object? thisObj, kotlin.reflect.KProperty<?> property, T? value);
+ method public static <T> kotlinx.coroutines.flow.Flow<T> snapshotFlow(kotlin.jvm.functions.Function0<? extends T> block);
+ method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> structuralEqualityPolicy();
+ method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> toMutableStateList(java.util.Collection<? extends T>);
+ method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> toMutableStateMap(Iterable<? extends kotlin.Pair<? extends K,? extends V>>);
}
@androidx.compose.runtime.StableMarker @kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface Stable {
@@ -477,10 +430,6 @@
property public abstract T! value;
}
- public final class SuspendingEffectsKt {
- method @androidx.compose.runtime.Composable public static inline kotlinx.coroutines.CoroutineScope rememberCoroutineScope(optional kotlin.jvm.functions.Function0<? extends kotlin.coroutines.CoroutineContext> getContext);
- }
-
public final class TraceKt {
}
@@ -581,58 +530,28 @@
package androidx.compose.runtime.internal {
- @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public final class ComposableLambda<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, R> implements kotlin.jvm.functions.Function10<P1,P2,P3,P4,P5,P6,P7,P8,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function11<P1,P2,P3,P4,P5,P6,P7,P8,P9,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function13<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function14<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function15<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function16<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function17<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function18<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function19<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function2<androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function20<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function21<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function3<P1,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function4<P1,P2,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function5<P1,P2,P3,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function6<P1,P2,P3,P4,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function7<P1,P2,P3,P4,P5,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function8<P1,P2,P3,P4,P5,P6,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function9<P1,P2,P3,P4,P5,P6,P7,androidx.compose.runtime.Composer,java.lang.Integer,R> {
- ctor public ComposableLambda(int key, boolean tracked, String? sourceInformation);
- method public int getKey();
- method public operator R! invoke(androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, P16? p16, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, P16? p16, P17? p17, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, P16? p16, P17? p17, P18? p18, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public void update(Object block);
- property public final int key;
+ @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public interface ComposableLambda extends kotlin.jvm.functions.Function2<androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function10<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function11<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function13<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function14<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function15<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function16<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function17<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function18<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function19<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function20<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function21<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function3<java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function4<java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function5<java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function6<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function7<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function8<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function9<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> {
}
public final class ComposableLambdaKt {
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object> composableLambda(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, Object block);
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object> composableLambdaInstance(int key, boolean tracked, String? sourceInformation, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda composableLambda(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda composableLambdaInstance(int key, boolean tracked, String? sourceInformation, Object block);
}
- @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public final class ComposableLambdaN<R> implements kotlin.jvm.functions.FunctionN<R> {
- ctor public ComposableLambdaN(int key, boolean tracked, String? sourceInformation, int arity);
- method public int getArity();
- method public int getKey();
- method public R! invoke(java.lang.Object?... args);
- method public void update(Object block, androidx.compose.runtime.Composer? composer);
- property public int arity;
- property public final int key;
+ @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public interface ComposableLambdaN extends kotlin.jvm.functions.FunctionN<java.lang.Object> {
}
public final class ComposableLambdaNKt {
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN<?> composableLambdaN(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, int arity, Object block);
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN<?> composableLambdaNInstance(int key, boolean tracked, int arity, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN composableLambdaN(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, int arity, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN composableLambdaNInstance(int key, boolean tracked, String? sourceInformation, int arity, Object block);
}
- @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) public @interface LiveLiteralFileInfo {
+ @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface LiveLiteralFileInfo {
method public abstract String file();
property public abstract String file;
}
- @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) public @interface LiveLiteralInfo {
+ @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface LiveLiteralInfo {
method public abstract String key();
method public abstract int offset();
property public abstract String key;
@@ -642,11 +561,11 @@
public final class LiveLiteralKt {
method @androidx.compose.runtime.InternalComposeApi public static void enableLiveLiterals();
method public static boolean isLiveLiteralsEnabled();
- method @androidx.compose.runtime.InternalComposeApi public static <T> androidx.compose.runtime.State<T> liveLiteral(String key, T? value);
+ method @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.InternalComposeApi public static <T> androidx.compose.runtime.State<T> liveLiteral(String key, T? value);
method @androidx.compose.runtime.InternalComposeApi public static void updateLiveLiteralValue(String key, Object? value);
}
- @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) public @interface StabilityInferred {
+ @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface StabilityInferred {
method public abstract int parameters();
property public abstract int parameters;
}
@@ -745,7 +664,6 @@
}
public final class SnapshotFlowKt {
- method public static <T> kotlinx.coroutines.flow.Flow<T> snapshotFlow(kotlin.jvm.functions.Function0<? extends T> block);
method @Deprecated @androidx.compose.runtime.ExperimentalComposeApi public static inline <R> R! withMutableSnapshot(kotlin.jvm.functions.Function0<? extends R> block);
}
@@ -855,8 +773,26 @@
package androidx.compose.runtime.tooling {
+ public interface CompositionData {
+ method public Iterable<androidx.compose.runtime.tooling.CompositionGroup> getCompositionGroups();
+ method public boolean isEmpty();
+ property public abstract Iterable<androidx.compose.runtime.tooling.CompositionGroup> compositionGroups;
+ property public abstract boolean isEmpty;
+ }
+
+ public interface CompositionGroup extends androidx.compose.runtime.tooling.CompositionData {
+ method public Iterable<java.lang.Object> getData();
+ method public Object getKey();
+ method public Object? getNode();
+ method public String? getSourceInfo();
+ property public abstract Iterable<java.lang.Object> data;
+ property public abstract Object key;
+ property public abstract Object? node;
+ property public abstract String? sourceInfo;
+ }
+
public final class InspectionTablesKt {
- method public static androidx.compose.runtime.ProvidableCompositionLocal<java.util.Set<androidx.compose.runtime.CompositionData>> getLocalInspectionTables();
+ method public static androidx.compose.runtime.ProvidableCompositionLocal<java.util.Set<androidx.compose.runtime.tooling.CompositionData>> getLocalInspectionTables();
}
}
diff --git a/compose/runtime/runtime/api/restricted_current.txt b/compose/runtime/runtime/api/restricted_current.txt
index ef934e6..abdc904 100644
--- a/compose/runtime/runtime/api/restricted_current.txt
+++ b/compose/runtime/runtime/api/restricted_current.txt
@@ -65,6 +65,23 @@
property public abstract boolean tracked;
}
+ public final class ComposablesKt {
+ method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update);
+ method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static inline <T, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.SkippableUpdater<T>,? extends kotlin.Unit> skippableUpdate, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static androidx.compose.runtime.Composer getCurrentComposer();
+ method @androidx.compose.runtime.Composable public static int getCurrentCompositeKeyHash();
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static androidx.compose.runtime.RecomposeScope getCurrentRecomposeScope();
+ method @kotlin.PublishedApi internal static void invalidApplier();
+ method @androidx.compose.runtime.Composable public static inline <T> T! key(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> block);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.Composable public static androidx.compose.runtime.CompositionContext rememberCompositionContext();
+ }
+
@kotlin.RequiresOptIn(level=kotlin.RequiresOptIn.Level, message="This API is intended to be targeted by the Compose Compiler Plugin and not called " + "directly.") @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface ComposeCompilerApi {
}
@@ -73,13 +90,6 @@
method @Deprecated public static inline kotlin.jvm.functions.Function0<kotlin.Unit> orEmpty(kotlin.jvm.functions.Function0<kotlin.Unit>?);
}
- public final class ComposeNodeKt {
- method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update);
- method @androidx.compose.runtime.Composable public static inline <T extends java.lang.Object, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static inline <T, reified E extends androidx.compose.runtime.Applier<?>> void ComposeNode(kotlin.jvm.functions.Function0<? extends T> factory, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.Updater<T>,? extends kotlin.Unit> update, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.SkippableUpdater<T>,? extends kotlin.Unit> skippableUpdate, kotlin.jvm.functions.Function0<? extends kotlin.Unit> content);
- method @kotlin.PublishedApi internal static void invalidApplier();
- }
-
public interface Composer {
method @androidx.compose.runtime.ComposeCompilerApi public <V, T> void apply(V? value, kotlin.jvm.functions.Function2<? super T,? super V,kotlin.Unit> block);
method @androidx.compose.runtime.InternalComposeApi public androidx.compose.runtime.CompositionContext buildContext();
@@ -104,7 +114,7 @@
method public androidx.compose.runtime.Applier<?> getApplier();
method @org.jetbrains.annotations.TestOnly public kotlin.coroutines.CoroutineContext getApplyCoroutineContext();
method @org.jetbrains.annotations.TestOnly public androidx.compose.runtime.ControlledComposition getComposition();
- method public androidx.compose.runtime.CompositionData getCompositionData();
+ method public androidx.compose.runtime.tooling.CompositionData getCompositionData();
method public int getCompoundKeyHash();
method public boolean getDefaultsInvalid();
method public boolean getInserting();
@@ -132,7 +142,7 @@
property public abstract androidx.compose.runtime.Applier<?> applier;
property @org.jetbrains.annotations.TestOnly public abstract kotlin.coroutines.CoroutineContext applyCoroutineContext;
property @org.jetbrains.annotations.TestOnly public abstract androidx.compose.runtime.ControlledComposition composition;
- property public abstract androidx.compose.runtime.CompositionData compositionData;
+ property public abstract androidx.compose.runtime.tooling.CompositionData compositionData;
property public abstract int compoundKeyHash;
property public abstract boolean defaultsInvalid;
property public abstract boolean inserting;
@@ -148,19 +158,17 @@
public final class ComposerKt {
method @androidx.compose.runtime.ComposeCompilerApi public static inline <T> T! cache(androidx.compose.runtime.Composer, boolean invalid, kotlin.jvm.functions.Function0<? extends T> block);
- method @androidx.compose.runtime.Composable public static int currentCompositeKeyHash();
- method @androidx.compose.runtime.Composable public static androidx.compose.runtime.Composer getCurrentComposer();
- field @kotlin.PublishedApi internal static final androidx.compose.runtime.OpaqueKey compositionLocalMap;
+ field @kotlin.PublishedApi internal static final Object compositionLocalMap;
field @kotlin.PublishedApi internal static final int compositionLocalMapKey = 202; // 0xca
- field @kotlin.PublishedApi internal static final androidx.compose.runtime.OpaqueKey invocation;
+ field @kotlin.PublishedApi internal static final Object invocation;
field @kotlin.PublishedApi internal static final int invocationKey = 200; // 0xc8
- field @kotlin.PublishedApi internal static final androidx.compose.runtime.OpaqueKey provider;
+ field @kotlin.PublishedApi internal static final Object provider;
field @kotlin.PublishedApi internal static final int providerKey = 201; // 0xc9
- field @kotlin.PublishedApi internal static final androidx.compose.runtime.OpaqueKey providerMaps;
+ field @kotlin.PublishedApi internal static final Object providerMaps;
field @kotlin.PublishedApi internal static final int providerMapsKey = 204; // 0xcc
- field @kotlin.PublishedApi internal static final androidx.compose.runtime.OpaqueKey providerValues;
+ field @kotlin.PublishedApi internal static final Object providerValues;
field @kotlin.PublishedApi internal static final int providerValuesKey = 203; // 0xcb
- field @kotlin.PublishedApi internal static final androidx.compose.runtime.OpaqueKey reference;
+ field @kotlin.PublishedApi internal static final Object reference;
field @kotlin.PublishedApi internal static final int referenceKey = 206; // 0xce
}
@@ -177,31 +185,11 @@
}
public final class CompositionContextKt {
- method @androidx.compose.runtime.Composable public static androidx.compose.runtime.CompositionContext rememberCompositionContext();
method @Deprecated @androidx.compose.runtime.Composable public static androidx.compose.runtime.CompositionContext rememberCompositionReference();
}
- public interface CompositionData {
- method public Iterable<androidx.compose.runtime.CompositionGroup> getCompositionGroups();
- method public boolean isEmpty();
- property public abstract Iterable<androidx.compose.runtime.CompositionGroup> compositionGroups;
- property public abstract boolean isEmpty;
- }
-
- public interface CompositionGroup extends androidx.compose.runtime.CompositionData {
- method public Iterable<java.lang.Object> getData();
- method public Object getKey();
- method public Object? getNode();
- method public String? getSourceInfo();
- property public abstract Iterable<java.lang.Object> data;
- property public abstract Object key;
- property public abstract Object? node;
- property public abstract String? sourceInfo;
- }
-
public final class CompositionKt {
- method @androidx.compose.runtime.ExperimentalComposeApi public static androidx.compose.runtime.Composition Composition(Object key, androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent, optional kotlin.jvm.functions.Function0<kotlin.Unit> onCreated);
- method @androidx.compose.runtime.ExperimentalComposeApi public static androidx.compose.runtime.Composition Composition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent);
+ method public static androidx.compose.runtime.Composition Composition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent);
method @org.jetbrains.annotations.TestOnly public static androidx.compose.runtime.ControlledComposition ControlledComposition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent);
}
@@ -211,7 +199,7 @@
}
public final class CompositionLocalKt {
- method @androidx.compose.runtime.Composable public static void Providers(androidx.compose.runtime.ProvidedValue<?>![] values, kotlin.jvm.functions.Function0<kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void CompositionLocalProvider(androidx.compose.runtime.ProvidedValue<?>![] values, kotlin.jvm.functions.Function0<kotlin.Unit> content);
method public static <T> androidx.compose.runtime.ProvidableCompositionLocal<T> compositionLocalOf(optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy, optional kotlin.jvm.functions.Function0<? extends T>? defaultFactory);
method public static <T> androidx.compose.runtime.ProvidableCompositionLocal<T> staticCompositionLocalOf(optional kotlin.jvm.functions.Function0<? extends T>? defaultFactory);
}
@@ -240,10 +228,6 @@
property public abstract boolean isComposing;
}
- public final class DerivedStateKt {
- method public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
- }
-
@kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface DisallowComposableCalls {
}
@@ -256,6 +240,22 @@
method public inline androidx.compose.runtime.DisposableEffectResult onDispose(kotlin.jvm.functions.Function0<kotlin.Unit> onDisposeEffect);
}
+ public final class EffectsKt {
+ method @Deprecated @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object![]? keys, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
+ method @Deprecated @androidx.compose.runtime.Composable public static void LaunchedEffect(kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object![]? keys, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void SideEffect(kotlin.jvm.functions.Function0<kotlin.Unit> effect);
+ method @kotlin.PublishedApi internal static kotlinx.coroutines.CoroutineScope createCompositionCoroutineScope(kotlin.coroutines.CoroutineContext coroutineContext, androidx.compose.runtime.Composer composer);
+ method @androidx.compose.runtime.Composable public static inline kotlinx.coroutines.CoroutineScope rememberCoroutineScope(optional kotlin.jvm.functions.Function0<? extends kotlin.coroutines.CoroutineContext> getContext);
+ }
+
public final class ExpectKt {
method @kotlin.PublishedApi internal static inline <R> R! synchronized(Object lock, kotlin.jvm.functions.Function0<? extends R> block);
}
@@ -263,23 +263,12 @@
@kotlin.RequiresOptIn(level=kotlin.RequiresOptIn.Level, message="This is an experimental API for Compose and is likely to change before becoming " + "stable.") @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface ExperimentalComposeApi {
}
- public final class FlowAdapterKt {
- method @androidx.compose.runtime.Composable @kotlinx.coroutines.ExperimentalCoroutinesApi public static <T> androidx.compose.runtime.State<T> collectAsState(kotlinx.coroutines.flow.StateFlow<? extends T>, optional kotlin.coroutines.CoroutineContext context);
- method @androidx.compose.runtime.Composable public static <T extends R, R> androidx.compose.runtime.State<R> collectAsState(kotlinx.coroutines.flow.Flow<? extends T>, R? initial, optional kotlin.coroutines.CoroutineContext context);
- }
-
@androidx.compose.runtime.StableMarker @kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface Immutable {
}
@kotlin.RequiresOptIn(level=kotlin.RequiresOptIn.Level, message="This is internal API for Compose modules that may change frequently " + "and without warning.") @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface InternalComposeApi {
}
- public final class JoinedKeyKt {
- method @androidx.compose.runtime.InternalComposeApi public static boolean isJoinedKey(Object? key);
- method @androidx.compose.runtime.InternalComposeApi public static Object? joinedKeyLeft(Object? key);
- method @androidx.compose.runtime.InternalComposeApi public static Object? joinedKeyRight(Object? key);
- }
-
@androidx.compose.runtime.InternalComposeApi public final class KeyInfo {
method public int getIndex();
method public int getKey();
@@ -293,15 +282,6 @@
property public final Object? objectKey;
}
- public final class KeyKt {
- method @androidx.compose.runtime.Composable public static inline <T> T! key(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> block);
- }
-
- public final class KeySourceInfoKt {
- method @androidx.compose.runtime.InternalComposeApi public static String? keySourceInfoOf(Object key);
- method @androidx.compose.runtime.InternalComposeApi public static void resetSourceInfo();
- }
-
public interface MonotonicFrameClock extends kotlin.coroutines.CoroutineContext.Element {
method public default kotlin.coroutines.CoroutineContext.Key<?> getKey();
method public suspend <R> Object? withFrameNanos(kotlin.jvm.functions.Function1<? super java.lang.Long,? extends R> onFrame, kotlin.coroutines.Continuation<? super R> p);
@@ -325,21 +305,6 @@
property public abstract T! value;
}
- public final class MutableStateKt {
- method public static inline operator <T> T! getValue(androidx.compose.runtime.State<T>, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
- method public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T? value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
- method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> neverEqualPolicy();
- method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> referentialEqualityPolicy();
- method public static inline operator <T> void setValue(androidx.compose.runtime.MutableState<T>, Object? thisObj, kotlin.reflect.KProperty<?> property, T? value);
- method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> structuralEqualityPolicy();
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> toMutableStateList(java.util.Collection<? extends T>);
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> toMutableStateMap(Iterable<? extends kotlin.Pair<? extends K,? extends V>>);
- }
-
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface NoLiveLiterals {
}
@@ -355,14 +320,6 @@
property public final boolean isPaused;
}
- public final class ProduceStateKt {
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, Object? key3, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object![]? keys, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
- }
-
public interface ProduceStateScope<T> extends androidx.compose.runtime.MutableState<T> kotlinx.coroutines.CoroutineScope {
method public suspend Object? awaitDispose(kotlin.jvm.functions.Function0<kotlin.Unit> onDispose, kotlin.coroutines.Continuation<?> p);
}
@@ -388,10 +345,6 @@
method public void invalidate();
}
- public final class RecomposeScopeImplKt {
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public static androidx.compose.runtime.RecomposeScope getCurrentRecomposeScope();
- }
-
public final class Recomposer extends androidx.compose.runtime.CompositionContext {
ctor public Recomposer(kotlin.coroutines.CoroutineContext effectCoroutineContext);
method public androidx.compose.runtime.RecomposerInfo asRecomposerInfo();
@@ -438,15 +391,6 @@
method public static suspend <R> Object? withRunningRecomposer(kotlin.jvm.functions.Function3<? super kotlinx.coroutines.CoroutineScope,? super androidx.compose.runtime.Recomposer,? super kotlin.coroutines.Continuation<? super R>,?> block, kotlin.coroutines.Continuation<? super R> p);
}
- public final class RememberKt {
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> T! remember(Object![]? keys, kotlin.jvm.functions.Function0<? extends T> calculation);
- method @androidx.compose.runtime.Composable public static inline <T> androidx.compose.runtime.State<T> rememberUpdatedState(T? newValue);
- }
-
public interface RememberObserver {
method public void onAbandoned();
method public void onForgotten();
@@ -457,20 +401,6 @@
method public void updateScope(kotlin.jvm.functions.Function2<? super androidx.compose.runtime.Composer,? super java.lang.Integer,kotlin.Unit> block);
}
- public final class SideEffectKt {
- method @Deprecated @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void DisposableEffect(Object![]? keys, kotlin.jvm.functions.Function1<? super androidx.compose.runtime.DisposableEffectScope,? extends androidx.compose.runtime.DisposableEffectResult> effect);
- method @Deprecated @androidx.compose.runtime.Composable public static void LaunchedEffect(kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, Object? key2, Object? key3, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object![]? keys, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void SideEffect(kotlin.jvm.functions.Function0<kotlin.Unit> effect);
- }
-
public final inline class SkippableUpdater<T> {
ctor public SkippableUpdater();
method public static androidx.compose.runtime.Composer! constructor-impl(androidx.compose.runtime.Composer composer);
@@ -482,12 +412,36 @@
}
public final class SlotTableKt {
- method public static java.util.List<java.lang.Integer> slice(int[], Iterable<java.lang.Integer> indices);
}
public interface SnapshotMutationPolicy<T> {
method public boolean equivalent(T? a, T? b);
- method @androidx.compose.runtime.ExperimentalComposeApi public default T? merge(T? previous, T? current, T? applied);
+ method public default T? merge(T? previous, T? current, T? applied);
+ }
+
+ public final class SnapshotStateKt {
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> collectAsState(kotlinx.coroutines.flow.StateFlow<? extends T>, optional kotlin.coroutines.CoroutineContext context);
+ method @androidx.compose.runtime.Composable public static <T extends R, R> androidx.compose.runtime.State<R> collectAsState(kotlinx.coroutines.flow.Flow<? extends T>, R? initial, optional kotlin.coroutines.CoroutineContext context);
+ method public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
+ method public static inline operator <T> T! getValue(androidx.compose.runtime.State<T>, Object? thisObj, kotlin.reflect.KProperty<?> property);
+ method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
+ method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
+ method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
+ method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
+ method public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T? value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
+ method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> neverEqualPolicy();
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object? key1, Object? key2, Object? key3, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T? initialValue, Object![]? keys, @kotlin.BuilderInference kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
+ method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> referentialEqualityPolicy();
+ method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> rememberUpdatedState(T? newValue);
+ method public static inline operator <T> void setValue(androidx.compose.runtime.MutableState<T>, Object? thisObj, kotlin.reflect.KProperty<?> property, T? value);
+ method public static <T> kotlinx.coroutines.flow.Flow<T> snapshotFlow(kotlin.jvm.functions.Function0<? extends T> block);
+ method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> structuralEqualityPolicy();
+ method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> toMutableStateList(java.util.Collection<? extends T>);
+ method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> toMutableStateMap(Iterable<? extends kotlin.Pair<? extends K,? extends V>>);
}
@androidx.compose.runtime.StableMarker @kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget, kotlin.annotation.AnnotationTarget}) public @interface Stable {
@@ -501,11 +455,6 @@
property public abstract T! value;
}
- public final class SuspendingEffectsKt {
- method @kotlin.PublishedApi internal static kotlinx.coroutines.CoroutineScope createCompositionCoroutineScope(kotlin.coroutines.CoroutineContext coroutineContext, androidx.compose.runtime.Composer composer);
- method @androidx.compose.runtime.Composable public static inline kotlinx.coroutines.CoroutineScope rememberCoroutineScope(optional kotlin.jvm.functions.Function0<? extends kotlin.coroutines.CoroutineContext> getContext);
- }
-
public final class TraceKt {
}
@@ -608,58 +557,28 @@
package androidx.compose.runtime.internal {
- @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public final class ComposableLambda<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, R> implements kotlin.jvm.functions.Function10<P1,P2,P3,P4,P5,P6,P7,P8,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function11<P1,P2,P3,P4,P5,P6,P7,P8,P9,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function13<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function14<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function15<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function16<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function17<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function18<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function19<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function2<androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function20<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function21<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,R> kotlin.jvm.functions.Function3<P1,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function4<P1,P2,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function5<P1,P2,P3,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function6<P1,P2,P3,P4,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function7<P1,P2,P3,P4,P5,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function8<P1,P2,P3,P4,P5,P6,androidx.compose.runtime.Composer,java.lang.Integer,R> kotlin.jvm.functions.Function9<P1,P2,P3,P4,P5,P6,P7,androidx.compose.runtime.Composer,java.lang.Integer,R> {
- ctor public ComposableLambda(int key, boolean tracked, String? sourceInformation);
- method public int getKey();
- method public operator R! invoke(androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, androidx.compose.runtime.Composer c, int changed);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, P16? p16, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, P16? p16, P17? p17, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public operator R! invoke(P1? p1, P2? p2, P3? p3, P4? p4, P5? p5, P6? p6, P7? p7, P8? p8, P9? p9, P10? p10, P11? p11, P12? p12, P13? p13, P14? p14, P15? p15, P16? p16, P17? p17, P18? p18, androidx.compose.runtime.Composer c, int changed, int changed1);
- method public void update(Object block);
- property public final int key;
+ @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public interface ComposableLambda extends kotlin.jvm.functions.Function2<androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function10<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function11<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function13<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function14<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function15<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function16<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function17<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function18<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function19<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function20<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function21<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function3<java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function4<java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function5<java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function6<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function7<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function8<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> kotlin.jvm.functions.Function9<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,androidx.compose.runtime.Composer,java.lang.Integer,java.lang.Object> {
}
public final class ComposableLambdaKt {
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object> composableLambda(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, Object block);
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda<java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object,java.lang.Object> composableLambdaInstance(int key, boolean tracked, String? sourceInformation, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda composableLambda(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambda composableLambdaInstance(int key, boolean tracked, String? sourceInformation, Object block);
}
- @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public final class ComposableLambdaN<R> implements kotlin.jvm.functions.FunctionN<R> {
- ctor public ComposableLambdaN(int key, boolean tracked, String? sourceInformation, int arity);
- method public int getArity();
- method public int getKey();
- method public R! invoke(java.lang.Object?... args);
- method public void update(Object block, androidx.compose.runtime.Composer? composer);
- property public int arity;
- property public final int key;
+ @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.Stable public interface ComposableLambdaN extends kotlin.jvm.functions.FunctionN<java.lang.Object> {
}
public final class ComposableLambdaNKt {
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN<?> composableLambdaN(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, int arity, Object block);
- method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN<?> composableLambdaNInstance(int key, boolean tracked, int arity, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN composableLambdaN(androidx.compose.runtime.Composer composer, int key, boolean tracked, String? sourceInformation, int arity, Object block);
+ method @androidx.compose.runtime.ComposeCompilerApi public static androidx.compose.runtime.internal.ComposableLambdaN composableLambdaNInstance(int key, boolean tracked, String? sourceInformation, int arity, Object block);
}
- @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) public @interface LiveLiteralFileInfo {
+ @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface LiveLiteralFileInfo {
method public abstract String file();
property public abstract String file;
}
- @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) public @interface LiveLiteralInfo {
+ @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface LiveLiteralInfo {
method public abstract String key();
method public abstract int offset();
property public abstract String key;
@@ -669,11 +588,11 @@
public final class LiveLiteralKt {
method @androidx.compose.runtime.InternalComposeApi public static void enableLiveLiterals();
method public static boolean isLiveLiteralsEnabled();
- method @androidx.compose.runtime.InternalComposeApi public static <T> androidx.compose.runtime.State<T> liveLiteral(String key, T? value);
+ method @androidx.compose.runtime.ComposeCompilerApi @androidx.compose.runtime.InternalComposeApi public static <T> androidx.compose.runtime.State<T> liveLiteral(String key, T? value);
method @androidx.compose.runtime.InternalComposeApi public static void updateLiveLiteralValue(String key, Object? value);
}
- @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) public @interface StabilityInferred {
+ @androidx.compose.runtime.ComposeCompilerApi @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget) public @interface StabilityInferred {
method public abstract int parameters();
property public abstract int parameters;
}
@@ -776,7 +695,6 @@
}
public final class SnapshotFlowKt {
- method public static <T> kotlinx.coroutines.flow.Flow<T> snapshotFlow(kotlin.jvm.functions.Function0<? extends T> block);
method @Deprecated @androidx.compose.runtime.ExperimentalComposeApi public static inline <R> R! withMutableSnapshot(kotlin.jvm.functions.Function0<? extends R> block);
}
@@ -892,8 +810,26 @@
package androidx.compose.runtime.tooling {
+ public interface CompositionData {
+ method public Iterable<androidx.compose.runtime.tooling.CompositionGroup> getCompositionGroups();
+ method public boolean isEmpty();
+ property public abstract Iterable<androidx.compose.runtime.tooling.CompositionGroup> compositionGroups;
+ property public abstract boolean isEmpty;
+ }
+
+ public interface CompositionGroup extends androidx.compose.runtime.tooling.CompositionData {
+ method public Iterable<java.lang.Object> getData();
+ method public Object getKey();
+ method public Object? getNode();
+ method public String? getSourceInfo();
+ property public abstract Iterable<java.lang.Object> data;
+ property public abstract Object key;
+ property public abstract Object? node;
+ property public abstract String? sourceInfo;
+ }
+
public final class InspectionTablesKt {
- method public static androidx.compose.runtime.ProvidableCompositionLocal<java.util.Set<androidx.compose.runtime.CompositionData>> getLocalInspectionTables();
+ method public static androidx.compose.runtime.ProvidableCompositionLocal<java.util.Set<androidx.compose.runtime.tooling.CompositionData>> getLocalInspectionTables();
}
}
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/BaseComposeTest.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/BaseComposeTest.kt
index bd1eda7..2c04f92 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/BaseComposeTest.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/BaseComposeTest.kt
@@ -102,14 +102,13 @@
@Composable
@Suppress("UNUSED_PARAMETER")
fun subCompose(block: @Composable () -> Unit) {
-// val container = remember { View(activity) }
// val reference = rememberCompositionContext()
-// @OptIn(ExperimentalComposeApi::class)
-// Composition(
-// container,
-// UiApplier(container),
-// reference
-// ).apply {
+// remember {
+// Composition(
+// UiApplier(View(activity)),
+// reference
+// )
+// }.apply {
// setContent {
// block()
// }
@@ -137,7 +136,7 @@
private fun initialComposition(composable: @Composable () -> Unit) {
activity.show {
- Providers(
+ CompositionLocalProvider(
LocalContext provides activity
) {
composable()
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeIntoTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeIntoTests.kt
index 3c8130f..74ff81f 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeIntoTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeIntoTests.kt
@@ -21,7 +21,6 @@
import androidx.core.os.HandlerCompat
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
-import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
@@ -36,11 +35,6 @@
@RunWith(AndroidJUnit4::class)
class ComposeIntoTests : BaseComposeTest() {
- @After
- fun teardown() {
- clearRoots()
- }
-
@get:Rule
override val activityRule = makeTestActivityRule()
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeModelTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeModelTests.kt
index 84460be..dc3ea2b 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeModelTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeModelTests.kt
@@ -25,7 +25,7 @@
import androidx.test.filters.MediumTest
import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertFalse
-import org.junit.After
+
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
@@ -81,12 +81,6 @@
@MediumTest
@RunWith(AndroidJUnit4::class)
class ModelViewTests : BaseComposeTest() {
-
- @After
- fun teardown() {
- clearRoots()
- }
-
@get:Rule
override val activityRule = makeTestActivityRule()
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/CompositionLocalTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/CompositionLocalTests.kt
index 0bb1ce3..9fab12a 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/CompositionLocalTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/CompositionLocalTests.kt
@@ -65,7 +65,7 @@
compose {
assertEquals("Default", someTextCompositionLocal.current)
assertEquals(1, someIntCompositionLocal.current)
- Providers(
+ CompositionLocalProvider(
someTextCompositionLocal provides "Test1",
someIntCompositionLocal provides 12,
someOtherIntProvider provides 42,
@@ -81,7 +81,7 @@
someOtherIntCompositionLocal.current
)
assertEquals(50, someStaticInt.current)
- Providers(
+ CompositionLocalProvider(
someTextCompositionLocal provides "Test2",
someStaticInt provides 60
) {
@@ -126,7 +126,7 @@
var someText = "Unmodified"
compose {
invalidates.add(currentRecomposeScope)
- Providers(
+ CompositionLocalProvider(
someTextCompositionLocal provides someText
) {
ReadStringCompositionLocal(
@@ -154,7 +154,7 @@
var someText = "Unmodified"
compose {
invalidates.add(currentRecomposeScope)
- Providers(
+ CompositionLocalProvider(
staticStringCompositionLocal provides someText
) {
ReadStringCompositionLocal(
@@ -182,7 +182,7 @@
compose {
invalidates.add(currentRecomposeScope)
- Providers(
+ CompositionLocalProvider(
someTextCompositionLocal provides someText,
someIntCompositionLocal provides 0
) {
@@ -195,7 +195,7 @@
)
assertEquals(0, someIntCompositionLocal.current)
- Providers(
+ CompositionLocalProvider(
someIntCompositionLocal provides 42
) {
assertEquals(
@@ -231,7 +231,7 @@
compose {
invalidates.add(currentRecomposeScope)
- Providers(
+ CompositionLocalProvider(
staticSomeTextCompositionLocal provides someText,
staticSomeIntCompositionLocal provides 0
) {
@@ -247,7 +247,7 @@
assertEquals(someText, staticSomeTextCompositionLocal.current)
assertEquals(0, staticSomeIntCompositionLocal.current)
- Providers(
+ CompositionLocalProvider(
staticSomeIntCompositionLocal provides 42
) {
assertEquals(someText, staticSomeTextCompositionLocal.current)
@@ -276,7 +276,7 @@
compose {
invalidates.add(currentRecomposeScope)
- Providers(
+ CompositionLocalProvider(
someTextCompositionLocal provides someText,
someIntCompositionLocal provides 0
) {
@@ -292,7 +292,7 @@
)
assertEquals(0, someIntCompositionLocal.current)
- Providers(
+ CompositionLocalProvider(
someIntCompositionLocal provides 42
) {
assertEquals(
@@ -332,7 +332,7 @@
compose {
invalidates.add(currentRecomposeScope)
- Providers(
+ CompositionLocalProvider(
staticSomeTextCompositionLocal provides someText,
staticSomeIntCompositionLocal provides 0
) {
@@ -349,7 +349,7 @@
assertEquals(someText, staticSomeTextCompositionLocal.current)
assertEquals(0, staticSomeIntCompositionLocal.current)
- Providers(
+ CompositionLocalProvider(
staticSomeIntCompositionLocal provides 42
) {
assertEquals(someText, staticSomeTextCompositionLocal.current)
@@ -384,7 +384,7 @@
compose {
invalidates.add(currentRecomposeScope)
- Providers(
+ CompositionLocalProvider(
staticSomeTextCompositionLocal provides someText,
staticSomeIntCompositionLocal provides 0
) {
@@ -432,7 +432,7 @@
val someStaticString = staticCompositionLocalOf { "Default" }
var shouldRead = false
compose {
- Providers(
+ CompositionLocalProvider(
someStaticString provides "Provided A"
) {
Observe {
@@ -470,7 +470,7 @@
compose {
Observe {
invalidates.add(currentRecomposeScope)
- Providers(
+ CompositionLocalProvider(
someDataCompositionLocal provides SomeData("provided")
) {
ReadSomeDataCompositionLocal(someDataCompositionLocal)
@@ -508,9 +508,7 @@
val ref = Ref<CompositionContext>()
narrowInvalidateForReference(ref = ref)
return {
-// @OptIn(ExperimentalComposeApi::class)
// Composition(
-// container,
// UiApplier(container),
// ref.value
// ).apply {
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/DisposeTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/DisposeTests.kt
index 80f82f6..3588e98 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/DisposeTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/DisposeTests.kt
@@ -20,7 +20,6 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
import junit.framework.TestCase
-import org.junit.After
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -28,11 +27,6 @@
@MediumTest
@RunWith(AndroidJUnit4::class)
class DisposeTests : BaseComposeTest() {
- @After
- fun teardown() {
- clearRoots()
- }
-
@get:Rule
override val activityRule = makeTestActivityRule()
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/EffectsTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/EffectsTests.kt
index e581451..d461899 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/EffectsTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/EffectsTests.kt
@@ -24,7 +24,6 @@
import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertNull
import junit.framework.TestCase.assertTrue
-import org.junit.After
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
@@ -40,11 +39,6 @@
}
}
- @After
- fun teardown() {
- clearRoots()
- }
-
@get:Rule
override val activityRule = makeTestActivityRule()
@@ -565,7 +559,7 @@
}
compose {
- Providers(Foo provides current) {
+ CompositionLocalProvider(Foo provides current) {
Bar()
}
}.then { activity ->
@@ -593,7 +587,7 @@
@Composable fun SimpleComposable() {
scope = currentRecomposeScope
- Providers(MyCompositionLocal provides compositionLocalValue++) {
+ CompositionLocalProvider(MyCompositionLocal provides compositionLocalValue++) {
SimpleComposable2()
Button(id = 123)
}
@@ -637,7 +631,7 @@
@Composable fun SimpleComposable() {
scope = currentRecomposeScope
- Providers(MyCompositionLocal provides compositionLocalValue++) {
+ CompositionLocalProvider(MyCompositionLocal provides compositionLocalValue++) {
SimpleComposable2()
Button(id = 123)
}
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/NewCodeGenTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/NewCodeGenTests.kt
index 1f14e0a..16e0ab0 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/NewCodeGenTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/NewCodeGenTests.kt
@@ -22,7 +22,6 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
import junit.framework.TestCase
-import org.junit.After
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
@@ -32,11 +31,6 @@
@RunWith(AndroidJUnit4::class)
class NewCodeGenTests : BaseComposeTest() {
- @After
- fun teardown() {
- clearRoots()
- }
-
@get:Rule
override val activityRule = makeTestActivityRule()
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/RecomposerTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/RecomposerTests.kt
index 5d973575..342b4d4 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/RecomposerTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/RecomposerTests.kt
@@ -32,7 +32,6 @@
import kotlinx.coroutines.launch
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.test.runBlockingTest
-import org.junit.After
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
@@ -42,10 +41,6 @@
@MediumTest
@RunWith(AndroidJUnit4::class)
class RecomposerTests : BaseComposeTest() {
- @After
- fun teardown() {
- clearRoots()
- }
@get:Rule
override val activityRule = makeTestActivityRule()
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/RestartTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/RestartTests.kt
index 6bd78a7..42b9ba8 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/RestartTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/RestartTests.kt
@@ -21,7 +21,6 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
import junit.framework.TestCase
-import org.junit.After
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
@@ -34,11 +33,6 @@
@RunWith(AndroidJUnit4::class)
class RestartTests : BaseComposeTest() {
- @After
- fun teardown() {
- clearRoots()
- }
-
@get:Rule
override val activityRule = makeTestActivityRule()
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/SuspendingEffectsTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/SuspendingEffectsTests.kt
index 75c706f..c0e428e 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/SuspendingEffectsTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/SuspendingEffectsTests.kt
@@ -23,7 +23,6 @@
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
-import org.junit.After
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -38,11 +37,6 @@
@RunWith(AndroidJUnit4::class)
class SuspendingEffectsTests : BaseComposeTest() {
- @After
- fun teardown() {
- clearRoots()
- }
-
@get:Rule
override val activityRule = makeTestActivityRule()
diff --git a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/CompositionLocalSamples.kt b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/CompositionLocalSamples.kt
index e9c0fc3..5369df3 100644
--- a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/CompositionLocalSamples.kt
+++ b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/CompositionLocalSamples.kt
@@ -20,7 +20,7 @@
import androidx.annotation.Sampled
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
@Sampled
@@ -32,7 +32,7 @@
fun compositionLocalProvider() {
@Composable
fun App(user: User) {
- Providers(ActiveUser provides user) {
+ CompositionLocalProvider(ActiveUser provides user) {
SomeScreen()
}
}
diff --git a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/CustomTreeCompositionSamples.kt b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/CustomTreeCompositionSamples.kt
index 085ea1c..cca5ce0 100644
--- a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/CustomTreeCompositionSamples.kt
+++ b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/CustomTreeCompositionSamples.kt
@@ -66,7 +66,7 @@
parent: CompositionContext,
content: @Composable () -> Unit
): Composition {
- return Composition(this, NodeApplier(this), parent).apply {
+ return Composition(NodeApplier(this), parent).apply {
setContent(content)
}
}
diff --git a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotSamples.kt b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotSamples.kt
index 2bf9ecf..2d0cc51 100644
--- a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotSamples.kt
+++ b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotSamples.kt
@@ -22,7 +22,7 @@
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshots.Snapshot
-import androidx.compose.runtime.snapshots.snapshotFlow
+import androidx.compose.runtime.snapshotFlow
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
diff --git a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/KeySourceInfo.kt b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/KeySourceInfo.kt
deleted file mode 100644
index d2b2dc1..0000000
--- a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/KeySourceInfo.kt
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2019 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.compose.runtime
-
-internal val keyInfo = mutableMapOf<Int, String>()
-
-private fun findSourceKey(key: Any): Int? =
- when (key) {
- is Int -> key
- is JoinedKey -> {
- key.left?.let { findSourceKey(it) } ?: key.right?.let { findSourceKey(it) }
- }
- else -> null
- }
-
-internal actual fun recordSourceKeyInfo(key: Any) {
- val sk = findSourceKey(key)
- sk?.let {
- keyInfo.getOrPut(
- sk,
- {
- val stack = Thread.currentThread().stackTrace
- // On Android the frames looks like:
- // 0: getThreadStackTrace() (native method)
- // 1: getStackTrace()
- // 2: recordSourceKeyInfo()
- // 3: start()
- // 4: start()
- // 5: startRestartGroup() or startReplaceableGroup() or startNode() or startDefaults()
- // 6: <calling method>
- // On a desktop VM this looks like:
- // 0: getStackTrace()
- // 1: recordSourceKey()
- // 2: start()
- // 3: startRestartGroup() or startReplaceableGroup() or startNode() or startDefaults()
- // 4: non-inline call/emit?
- // 4 or 5: <calling method>
- val frame = stack
- .drop(3) // The first 3 elements are never interesting to us
- .dropWhile { it.className.startsWith("androidx.compose.runtime.Composer") } // Drop all
- // start*
- .drop(1) // Drop non-inline call/emit
- .dropWhile { it.lineNumber == -1 } // Drop if we do not have source info
- .first()
- "${frame.className}.${frame.methodName} (${frame.fileName}:${frame.lineNumber})"
- }
- )
- }
-}
-
-@InternalComposeApi
-actual fun keySourceInfoOf(key: Any): String? = keyInfo[key]
-
-@InternalComposeApi
-actual fun resetSourceInfo() { keyInfo.clear() }
\ No newline at end of file
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composables.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composables.kt
new file mode 100644
index 0000000..ca520a8
--- /dev/null
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composables.kt
@@ -0,0 +1,300 @@
+/*
+ * Copyright 2019 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.compose.runtime
+
+/**
+ * Remember the value produced by [calculation]. [calculation] will only be evaluated during the composition.
+ * Recomposition will always return the value produced by composition.
+ */
+@OptIn(ComposeCompilerApi::class)
+@Composable
+inline fun <T> remember(calculation: @DisallowComposableCalls () -> T): T =
+ currentComposer.cache(false, calculation)
+
+/**
+ * Remember the value returned by [calculation] if [key1] is equal to the previous composition,
+ * otherwise produce and remember a new value by calling [calculation].
+ */
+@OptIn(ComposeCompilerApi::class)
+@Composable
+inline fun <T> remember(
+ key1: Any?,
+ calculation: @DisallowComposableCalls () -> T
+): T {
+ return currentComposer.cache(currentComposer.changed(key1), calculation)
+}
+
+/**
+ * Remember the value returned by [calculation] if [key1] and [key2] are equal to the previous
+ * composition, otherwise produce and remember a new value by calling [calculation].
+ */
+@OptIn(ComposeCompilerApi::class)
+@Composable
+inline fun <T> remember(
+ key1: Any?,
+ key2: Any?,
+ calculation: @DisallowComposableCalls () -> T
+): T {
+ return currentComposer.cache(
+ currentComposer.changed(key1) or currentComposer.changed(key2),
+ calculation
+ )
+}
+
+/**
+ * Remember the value returned by [calculation] if [key1], [key2] and [key3] are equal to the
+ * previous composition, otherwise produce and remember a new value by calling [calculation].
+ */
+@OptIn(ComposeCompilerApi::class)
+@Composable
+inline fun <T> remember(
+ key1: Any?,
+ key2: Any?,
+ key3: Any?,
+ calculation: @DisallowComposableCalls () -> T
+): T {
+ return currentComposer.cache(
+ currentComposer.changed(key1) or
+ currentComposer.changed(key2) or
+ currentComposer.changed(key3),
+ calculation
+ )
+}
+
+/**
+ * Remember the value returned by [calculation] if all values of [keys] are equal to the previous
+ * composition, otherwise produce and remember a new value by calling [calculation].
+ */
+@OptIn(ComposeCompilerApi::class)
+@Composable
+inline fun <T> remember(
+ vararg keys: Any?,
+ calculation: @DisallowComposableCalls () -> T
+): T {
+ var invalid = false
+ for (key in keys) invalid = invalid or currentComposer.changed(key)
+ return currentComposer.cache(invalid, calculation)
+}
+
+/**
+ * [key] is a utility composable that is used to "group" or "key" a block of execution inside of a
+ * composition. This is sometimes needed for correctness inside of control-flow that may cause a
+ * given composable invocation to execute more than once during composition.
+ *
+ * The value for a key *does not need to be globally unique*, and needs only be unique amongst the
+ * invocations of [key] *at that point* in composition.
+ *
+ * For instance, consider the following example:
+ *
+ * @sample androidx.compose.runtime.samples.LocallyUniqueKeys
+ *
+ * Even though there are users with the same id composed in both the top and the bottom loop,
+ * because they are different calls to [key], there is no need to create compound keys.
+ *
+ * The key must be unique for each element in the collection, however, or children and local state
+ * might be reused in unintended ways.
+ *
+ * For instance, consider the following example:
+ *
+ * @sample androidx.compose.runtime.samples.NotAlwaysUniqueKeys
+ *
+ * This example assumes that `parent.id` is a unique key for each item in the collection,
+ * but this is only true if it is fair to assume that a parent will only ever have a single child,
+ * which may not be the case. Instead, it may be more correct to do the following:
+ *
+ * @sample androidx.compose.runtime.samples.MoreCorrectUniqueKeys
+ *
+ * A compound key can be created by passing in multiple arguments:
+ *
+ * @sample androidx.compose.runtime.samples.TwoInputsKeySample
+ *
+ * @param keys The set of values to be used to create a compound key. These will be compared to
+ * their previous values using [equals] and [hashCode]
+ * @param block The composable children for this group.
+ */
+@Composable
+inline fun <T> key(
+ @Suppress("UNUSED_PARAMETER")
+ vararg keys: Any?,
+ block: @Composable () -> T
+) = block()
+
+/**
+ * TODO(lmr): provide documentation
+ */
+val currentComposer: Composer
+ @Composable get() { throw NotImplementedError("Implemented as an intrinsic") }
+
+/**
+ * Returns an object which can be used to invalidate the current scope at this point in composition.
+ * This object can be used to manually cause recompositions.
+ */
+val currentRecomposeScope: RecomposeScope
+ @ReadOnlyComposable
+ @OptIn(InternalComposeApi::class)
+ @Composable get() {
+ val scope = currentComposer.recomposeScope ?: error("no recompose scope found")
+ currentComposer.recordUsed(scope)
+ return scope
+ }
+
+/**
+ * This a hash value used to coordinate map externally stored state to the composition. For
+ * example, this is used by saved instance state to preserve state across activity lifetime
+ * boundaries.
+ *
+ * This value is not likely to be unique but is not guaranteed unique. There are known cases,
+ * such as for loops without a [key], where the runtime does not have enough information to
+ * make the compound key hash unique.
+ */
+val currentCompositeKeyHash: Int
+ @Composable
+ @OptIn(InternalComposeApi::class)
+ get() = currentComposer.compoundKeyHash
+
+/**
+ * Emits a node into the composition of type [T].
+ *
+ * This function will throw a runtime exception if [E] is not a subtype of the applier of the
+ * [currentComposer].
+ *
+ * @sample androidx.compose.runtime.samples.CustomTreeComposition
+ *
+ * @param factory A function which will create a new instance of [T]. This function is NOT
+ * guaranteed to be called in place.
+ * @param update A function to perform updates on the node. This will run every time emit is
+ * executed. This function is called in place and will be inlined.
+ *
+ * @see Updater
+ * @see Applier
+ * @see Composition
+ */
+@OptIn(ComposeCompilerApi::class)
+@Composable inline fun <T : Any, reified E : Applier<*>> ComposeNode(
+ noinline factory: () -> T,
+ update: @DisallowComposableCalls Updater<T>.() -> Unit
+) {
+ if (currentComposer.applier !is E) invalidApplier()
+ currentComposer.startNode()
+ if (currentComposer.inserting) {
+ currentComposer.createNode { factory() }
+ } else {
+ currentComposer.useNode()
+ }
+ Updater<T>(currentComposer).update()
+ currentComposer.endNode()
+}
+
+/**
+ * Emits a node into the composition of type [T]. Nodes emitted inside of [content] will become
+ * children of the emitted node.
+ *
+ * This function will throw a runtime exception if [E] is not a subtype of the applier of the
+ * [currentComposer].
+ *
+ * @sample androidx.compose.runtime.samples.CustomTreeComposition
+ *
+ * @param factory A function which will create a new instance of [T]. This function is NOT
+ * guaranteed to be called in place.
+ * @param update A function to perform updates on the node. This will run every time emit is
+ * executed. This function is called in place and will be inlined.
+ * @param content the composable content that will emit the "children" of this node.
+ *
+ * @see Updater
+ * @see Applier
+ * @see Composition
+ */
+@OptIn(ComposeCompilerApi::class)
+@Composable
+inline fun <T : Any?, reified E : Applier<*>> ComposeNode(
+ noinline factory: () -> T,
+ update: @DisallowComposableCalls Updater<T>.() -> Unit,
+ content: @Composable () -> Unit
+) {
+ if (currentComposer.applier !is E) invalidApplier()
+ currentComposer.startNode()
+ if (currentComposer.inserting) {
+ currentComposer.createNode(factory)
+ } else {
+ currentComposer.useNode()
+ }
+ Updater<T>(currentComposer).update()
+ content()
+ currentComposer.endNode()
+}
+
+/**
+ * Emits a node into the composition of type [T]. Nodes emitted inside of [content] will become
+ * children of the emitted node.
+ *
+ * This function will throw a runtime exception if [E] is not a subtype of the applier of the
+ * [currentComposer].
+ *
+ * @sample androidx.compose.runtime.samples.CustomTreeComposition
+ *
+ * @param factory A function which will create a new instance of [T]. This function is NOT
+ * guaranteed to be called in place.
+ * @param update A function to perform updates on the node. This will run every time emit is
+ * executed. This function is called in place and will be inlined.
+ * @param skippableUpdate A function to perform updates on the node. Unlike [update], this
+ * function is Composable and will therefore be skipped unless it has been invalidated by some
+ * other mechanism. This can be useful to perform expensive calculations for updating the node
+ * where the calculations are likely to have the same inputs over time, so the function's
+ * execution can be skipped.
+ * @param content the composable content that will emit the "children" of this node.
+ *
+ * @see Updater
+ * @see SkippableUpdater
+ * @see Applier
+ * @see Composition
+ */
+@OptIn(ComposeCompilerApi::class)
+@Composable @ReadOnlyComposable
+inline fun <T, reified E : Applier<*>> ComposeNode(
+ noinline factory: () -> T,
+ update: @DisallowComposableCalls Updater<T>.() -> Unit,
+ noinline skippableUpdate: @Composable SkippableUpdater<T>.() -> Unit,
+ content: @Composable () -> Unit
+) {
+ if (currentComposer.applier !is E) invalidApplier()
+ currentComposer.startNode()
+ if (currentComposer.inserting) {
+ currentComposer.createNode(factory)
+ } else {
+ currentComposer.useNode()
+ }
+ Updater<T>(currentComposer).update()
+ SkippableUpdater<T>(currentComposer).skippableUpdate()
+ currentComposer.startReplaceableGroup(0x7ab4aae9)
+ content()
+ currentComposer.endReplaceableGroup()
+ currentComposer.endNode()
+}
+
+@PublishedApi
+internal fun invalidApplier(): Unit = error("Invalid applier")
+
+/**
+ * An Effect to construct a [CompositionContext] at the current point of composition. This can be
+ * used to run a separate composition in the context of the current one, preserving
+ * [CompositionLocal]s and propagating invalidations. When this call leaves the composition, the
+ * context is invalidated.
+ */
+@OptIn(InternalComposeApi::class)
+@Composable fun rememberCompositionContext(): CompositionContext {
+ return currentComposer.buildContext()
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeNode.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeNode.kt
index 3a17aca..ebad0f0 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeNode.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeNode.kt
@@ -16,125 +16,3 @@
@file:OptIn(ComposeCompilerApi::class, ExperimentalComposeApi::class)
package androidx.compose.runtime
-
-/**
- * Emits a node into the composition of type [T].
- *
- * This function will throw a runtime exception if [E] is not a subtype of the applier of the
- * [currentComposer].
- *
- * @sample androidx.compose.runtime.samples.CustomTreeComposition
- *
- * @param factory A function which will create a new instance of [T]. This function is NOT
- * guaranteed to be called in place.
- * @param update A function to perform updates on the node. This will run every time emit is
- * executed. This function is called in place and will be inlined.
- *
- * @see Updater
- * @see Applier
- * @see Composition
- */
-@OptIn(ComposeCompilerApi::class)
-@Composable inline fun <T : Any, reified E : Applier<*>> ComposeNode(
- noinline factory: () -> T,
- update: @DisallowComposableCalls Updater<T>.() -> Unit
-) {
- if (currentComposer.applier !is E) invalidApplier()
- currentComposer.startNode()
- if (currentComposer.inserting) {
- currentComposer.createNode { factory() }
- } else {
- currentComposer.useNode()
- }
- Updater<T>(currentComposer).update()
- currentComposer.endNode()
-}
-
-/**
- * Emits a node into the composition of type [T]. Nodes emitted inside of [content] will become
- * children of the emitted node.
- *
- * This function will throw a runtime exception if [E] is not a subtype of the applier of the
- * [currentComposer].
- *
- * @sample androidx.compose.runtime.samples.CustomTreeComposition
- *
- * @param factory A function which will create a new instance of [T]. This function is NOT
- * guaranteed to be called in place.
- * @param update A function to perform updates on the node. This will run every time emit is
- * executed. This function is called in place and will be inlined.
- * @param content the composable content that will emit the "children" of this node.
- *
- * @see Updater
- * @see Applier
- * @see Composition
- */
-@OptIn(ComposeCompilerApi::class)
-@Composable
-inline fun <T : Any?, reified E : Applier<*>> ComposeNode(
- noinline factory: () -> T,
- update: @DisallowComposableCalls Updater<T>.() -> Unit,
- content: @Composable () -> Unit
-) {
- if (currentComposer.applier !is E) invalidApplier()
- currentComposer.startNode()
- if (currentComposer.inserting) {
- currentComposer.createNode(factory)
- } else {
- currentComposer.useNode()
- }
- Updater<T>(currentComposer).update()
- content()
- currentComposer.endNode()
-}
-
-/**
- * Emits a node into the composition of type [T]. Nodes emitted inside of [content] will become
- * children of the emitted node.
- *
- * This function will throw a runtime exception if [E] is not a subtype of the applier of the
- * [currentComposer].
- *
- * @sample androidx.compose.runtime.samples.CustomTreeComposition
- *
- * @param factory A function which will create a new instance of [T]. This function is NOT
- * guaranteed to be called in place.
- * @param update A function to perform updates on the node. This will run every time emit is
- * executed. This function is called in place and will be inlined.
- * @param skippableUpdate A function to perform updates on the node. Unlike [update], this
- * function is Composable and will therefore be skipped unless it has been invalidated by some
- * other mechanism. This can be useful to perform expensive calculations for updating the node
- * where the calculations are likely to have the same inputs over time, so the function's
- * execution can be skipped.
- * @param content the composable content that will emit the "children" of this node.
- *
- * @see Updater
- * @see SkippableUpdater
- * @see Applier
- * @see Composition
- */
-@OptIn(ComposeCompilerApi::class)
-@Composable @ReadOnlyComposable
-inline fun <T, reified E : Applier<*>> ComposeNode(
- noinline factory: () -> T,
- update: @DisallowComposableCalls Updater<T>.() -> Unit,
- noinline skippableUpdate: @Composable SkippableUpdater<T>.() -> Unit,
- content: @Composable () -> Unit
-) {
- if (currentComposer.applier !is E) invalidApplier()
- currentComposer.startNode()
- if (currentComposer.inserting) {
- currentComposer.createNode(factory)
- } else {
- currentComposer.useNode()
- }
- Updater<T>(currentComposer).update()
- SkippableUpdater<T>(currentComposer).skippableUpdate()
- currentComposer.startReplaceableGroup(0x7ab4aae9)
- content()
- currentComposer.endReplaceableGroup()
- currentComposer.endNode()
-}
-
-@PublishedApi
-internal fun invalidApplier(): Unit = error("Invalid applier")
\ No newline at end of file
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
index 1d5751f..616c6f2 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
@@ -23,6 +23,7 @@
import androidx.compose.runtime.collection.IdentityScopeMap
import androidx.compose.runtime.tooling.LocalInspectionTables
+import androidx.compose.runtime.tooling.CompositionData
import kotlinx.collections.immutable.PersistentMap
import kotlinx.collections.immutable.persistentHashMapOf
import kotlin.coroutines.CoroutineContext
@@ -249,7 +250,7 @@
}
/**
- * An instance to hold a value provided by [Providers] and is created by the
+ * An instance to hold a value provided by [CompositionLocalProvider] and is created by the
* [ProvidableCompositionLocal.provides] infixed operator. If [canOverride] is `false`, the
* provided value will not overwrite a potentially already existing value in the scope.
*/
@@ -805,7 +806,7 @@
* A Compose internal function. DO NOT call directly.
*
* Provide the given values for the associated [CompositionLocal] keys. This is the primitive
- * function used to implement [Providers].
+ * function used to implement [CompositionLocalProvider].
*
* @param values an array of value to provider key pairs.
*/
@@ -923,18 +924,6 @@
}
/**
- * This a hash value used to coordinate map externally stored state to the composition. For
- * example, this is used by saved instance state to preserve state across activity lifetime
- * boundaries.
- *
- * This value is not likely to be unique but is not guaranteed unique. There are known cases,
- * such as for loops without a [key], where the runtime does not have enough information to
- * make the compound key hash unique.
- */
-@Composable
-fun currentCompositeKeyHash(): Int = currentComposer.compoundKeyHash
-
-/**
* Implementation of a composer for a mutable tree.
*/
internal class ComposerImpl(
@@ -964,7 +953,6 @@
private var groupNodeCountStack = IntStack()
private var nodeCountOverrides: IntArray? = null
private var nodeCountVirtualOverrides: HashMap<Int, Int>? = null
- private var collectKeySources = false
private var collectParameterInformation = false
private var nodeExpected = false
private val observations = IdentityScopeMap<RecomposeScopeImpl>()
@@ -1140,7 +1128,6 @@
parentProvider = parentContext.getCompositionLocalScope()
providersInvalidStack.push(providersInvalid.asInt())
providersInvalid = changed(parentProvider)
- collectKeySources = parentContext.collectingKeySources
collectParameterInformation = parentContext.collectingParameterInformation
resolveCompositionLocal(LocalInspectionTables, parentProvider)?.let {
it.add(slotTable)
@@ -1211,15 +1198,6 @@
private set
/**
- * Start collecting key source information. This enables enables the tool API to be able to
- * determine the source location of where groups and nodes are created.
- */
- @InternalComposeApi
- fun collectKeySourceInformation() {
- collectKeySources = true
- }
-
- /**
* Start collecting parameter information. This enables the tools API to always be able to
* determine the parameter values of composable calls.
*/
@@ -1888,7 +1866,6 @@
ref = CompositionContextHolder(
CompositionContextImpl(
compoundKeyHash,
- collectKeySources,
collectParameterInformation
)
)
@@ -1957,8 +1934,6 @@
if (inserting) {
reader.beginEmpty()
val startIndex = writer.currentGroup
- if (collectKeySources)
- recordSourceKeyInfo(key)
when {
isNode -> writer.startNode(Composer.Empty)
data != null -> writer.startData(key, objectKey ?: Composer.Empty, data)
@@ -2029,9 +2004,6 @@
// inserted into in the table.
reader.beginEmpty()
inserting = true
- if (collectKeySources)
- recordSourceKeyInfo(key)
-
ensureWriter()
writer.beginInsert()
val startIndex = writer.currentGroup
@@ -3008,7 +2980,6 @@
private inner class CompositionContextImpl(
override val compoundHashKey: Int,
- override val collectingKeySources: Boolean,
override val collectingParameterInformation: Boolean
) : CompositionContext() {
var inspectionTables: MutableSet<MutableSet<CompositionData>>? = null
@@ -3444,10 +3415,6 @@
private fun Boolean.asInt() = if (this) 1 else 0
private fun Int.asBool() = this != 0
-val currentComposer: Composer @Composable get() {
- throw NotImplementedError("Implemented as an intrinsic")
-}
-
internal fun invokeComposable(composer: Composer, composable: @Composable () -> Unit) {
@Suppress("UNCHECKED_CAST")
val realFn = composable as Function2<Composer, Int, Unit>
@@ -3528,40 +3495,34 @@
internal const val invocationKey = 200
@PublishedApi
-@Suppress("HiddenTypeParameter")
-internal val invocation = OpaqueKey("provider")
+internal val invocation: Any = OpaqueKey("provider")
@PublishedApi
internal const val providerKey = 201
@PublishedApi
-@Suppress("HiddenTypeParameter")
-internal val provider = OpaqueKey("provider")
+internal val provider: Any = OpaqueKey("provider")
@PublishedApi
internal const val compositionLocalMapKey = 202
@PublishedApi
-@Suppress("HiddenTypeParameter")
-internal val compositionLocalMap = OpaqueKey("compositionLocalMap")
+internal val compositionLocalMap: Any = OpaqueKey("compositionLocalMap")
@PublishedApi
internal const val providerValuesKey = 203
@PublishedApi
-@Suppress("HiddenTypeParameter")
-internal val providerValues = OpaqueKey("providerValues")
+internal val providerValues: Any = OpaqueKey("providerValues")
@PublishedApi
internal const val providerMapsKey = 204
@PublishedApi
-@Suppress("HiddenTypeParameter")
-internal val providerMaps = OpaqueKey("providers")
+internal val providerMaps: Any = OpaqueKey("providers")
@PublishedApi
internal const val referenceKey = 206
@PublishedApi
-@Suppress("HiddenTypeParameter")
-internal val reference = OpaqueKey("reference")
+internal val reference: Any = OpaqueKey("reference")
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
index 7bd3164..8778ddf 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
@@ -148,43 +148,6 @@
* [CompositionContext] can be provided to make the composition behave as a sub-composition of
* the parent or a [Recomposer] can be provided.
*
- * It is important to call [Composition.dispose] whenever this [key] is no longer needed in
- * order to release resources.
- *
- * @sample androidx.compose.runtime.samples.CustomTreeComposition
- *
- * @param key The object this composition will be tied to. Only one [Composition] will be created
- * for a given [key]. If the same [key] is passed in subsequent calls, the same [Composition]
- * instance will be returned.
- * @param applier The [Applier] instance to be used in the composition.
- * @param parent The parent composition reference, if applicable. Default is null.
- * @param onCreated A function which will be executed only when the Composition is created.
- *
- * @see Applier
- * @see Composition
- * @see Recomposer
- */
-@ExperimentalComposeApi
-fun Composition(
- key: Any,
- applier: Applier<*>,
- parent: CompositionContext,
- onCreated: () -> Unit = {}
-): Composition = Compositions.findOrCreate(key) {
- CompositionImpl(
- parent,
- applier,
- Compositions.onDisposed(key) }
- ).also {
- onCreated()
- }
-}
-
-/**
- * This method is the way to initiate a composition. Optionally, a [parent]
- * [CompositionContext] can be provided to make the composition behave as a sub-composition of
- * the parent or a [Recomposer] can be provided.
- *
* It is important to call [Composition.dispose] this composer is no longer needed in order to
* release resources.
*
@@ -197,7 +160,6 @@
* @see Composition
* @see Recomposer
*/
-@ExperimentalComposeApi
fun Composition(
applier: Applier<*>,
parent: CompositionContext
@@ -242,7 +204,7 @@
* @param applier The applier to use to manage the tree built by the composer.
* @param onDispose A callback to be triggered when [dispose] is called.
*/
-private class CompositionImpl(
+internal class CompositionImpl(
private val parent: CompositionContext,
applier: Applier<*>,
private val onDispose: (() -> Unit)? = null
@@ -319,35 +281,6 @@
}
/**
- * Keeps all the active compositions.
- * This object is thread-safe.
- */
-private object Compositions {
- private val holdersMap = WeakHashMap<Any, CompositionImpl>()
-
- fun findOrCreate(root: Any, create: () -> CompositionImpl): CompositionImpl =
- synchronized(holdersMap) {
- holdersMap[root] ?: create().also { holdersMap[root] = it }
- }
-
- fun onDisposed(root: Any) {
- synchronized(holdersMap) {
- holdersMap.remove(root)
- }
- }
-
- fun clear() {
- synchronized(holdersMap) {
- holdersMap.clear()
- }
- }
-
- fun collectAll(): List<CompositionImpl> = synchronized(holdersMap) {
- holdersMap.values.toList()
- }
-}
-
-/**
* Apply Code Changes will invoke the two functions before and after a code swap.
*
* This forces the whole view hierarchy to be redrawn to invoke any code change that was
@@ -357,40 +290,21 @@
*/
private class HotReloader {
companion object {
- private var state = mutableListOf<Pair<CompositionImpl, @Composable () -> Unit>>()
-
- @TestOnly
- fun clearRoots() {
- Compositions.clear()
- }
-
// Called before Dex Code Swap
@Suppress("UNUSED_PARAMETER")
- private fun saveStateAndDispose(context: Any) {
- state.clear()
- val holders = Compositions.collectAll()
- holders.mapTo(state) { it to it.composable }
- holders.filter { it.isRoot }.forEach { it.setContent({}) }
+ private fun saveStateAndDispose(context: Any): Any {
+ return Recomposer.saveStateAndDisposeForHotReload()
}
// Called after Dex Code Swap
@Suppress("UNUSED_PARAMETER")
- private fun loadStateAndCompose(context: Any) {
- val roots = mutableListOf<CompositionImpl>()
- state.forEach { (composition, composable) ->
- composition.composable = composable
- if (composition.isRoot) {
- roots.add(composition)
- }
- }
- roots.forEach { it.setContent(it.composable) }
- state.clear()
+ private fun loadStateAndCompose(token: Any) {
+ Recomposer.loadStateAndComposeForHotReload(token)
}
@TestOnly
internal fun simulateHotReload(context: Any) {
- saveStateAndDispose(context)
- loadStateAndCompose(context)
+ loadStateAndCompose(saveStateAndDispose(context))
}
}
}
@@ -400,9 +314,3 @@
*/
@TestOnly
fun simulateHotReload(context: Any) = HotReloader.simulateHotReload(context)
-
-/**
- * @suppress
- */
-@TestOnly
-fun clearRoots() = HotReloader.clearRoots()
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionContext.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionContext.kt
index e3a21da..9e7458f 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionContext.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionContext.kt
@@ -16,22 +16,12 @@
package androidx.compose.runtime
+import androidx.compose.runtime.tooling.CompositionData
import kotlinx.collections.immutable.persistentHashMapOf
import kotlin.coroutines.CoroutineContext
private val EmptyCompositionLocalMap: CompositionLocalMap = persistentHashMapOf()
-/**
- * An Effect to construct a [CompositionContext] at the current point of composition. This can be
- * used to run a separate composition in the context of the current one, preserving
- * [CompositionLocal]s and propagating invalidations. When this call leaves the composition, the
- * context is invalidated.
- */
-@OptIn(InternalComposeApi::class)
-@Composable fun rememberCompositionContext(): CompositionContext {
- return currentComposer.buildContext()
-}
-
@Deprecated(
"Renamed to rememberCompositionContext",
ReplaceWith(
@@ -58,7 +48,6 @@
@OptIn(InternalComposeApi::class)
abstract class CompositionContext internal constructor() {
internal abstract val compoundHashKey: Int
- internal abstract val collectingKeySources: Boolean
internal abstract val collectingParameterInformation: Boolean
internal abstract val effectCoroutineContext: CoroutineContext
internal abstract fun composeInitial(
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionLocal.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionLocal.kt
index 49aaf4f..a4c7161 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionLocal.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionLocal.kt
@@ -38,7 +38,7 @@
*
* @sample androidx.compose.runtime.samples.createCompositionLocal
*
- * Somewhere up the tree, a [Providers] component can be used, which provides a value for the
+ * Somewhere up the tree, a [CompositionLocalProvider] component can be used, which provides a value for the
* [CompositionLocal]. This would often be at the "root" of a tree, but could be anywhere, and can
* also be used in multiple places to override the provided value for a sub-tree.
*
@@ -64,7 +64,7 @@
internal abstract fun provided(value: T): State<T>
/**
- * Return the value provided by the nearest [Providers] component that invokes, directly or
+ * Return the value provided by the nearest [CompositionLocalProvider] component that invokes, directly or
* indirectly, the composable function that uses this property.
*
* @sample androidx.compose.runtime.samples.consumeCompositionLocal
@@ -77,19 +77,19 @@
}
/**
- * A [ProvidableCompositionLocal] can be used in [Providers] to provide values.
+ * A [ProvidableCompositionLocal] can be used in [CompositionLocalProvider] to provide values.
*
* @see compositionLocalOf
* @see staticCompositionLocalOf
* @see CompositionLocal
- * @see Providers
+ * @see CompositionLocalProvider
*/
@Stable
abstract class ProvidableCompositionLocal<T> internal constructor(defaultFactory: (() -> T)?) :
CompositionLocal<T> (defaultFactory) {
/**
- * Associates a [CompositionLocal] key to a value in a call to [Providers].
+ * Associates a [CompositionLocal] key to a value in a call to [CompositionLocalProvider].
*
* @see CompositionLocal
* @see ProvidableCompositionLocal
@@ -98,7 +98,7 @@
infix fun provides(value: T) = ProvidedValue(this, value, true)
/**
- * Associates a [CompositionLocal] key to a value in a call to [Providers] if the key does not
+ * Associates a [CompositionLocal] key to a value in a call to [CompositionLocalProvider] if the key does not
* already have an associated value.
*
* @see CompositionLocal
@@ -141,8 +141,8 @@
}
/**
- * Create a [CompositionLocal] key that can be provided using [Providers]. Changing the value
- * provided during recomposition will invalidate the children of [Providers] that read the value
+ * Create a [CompositionLocal] key that can be provided using [CompositionLocalProvider]. Changing the value
+ * provided during recomposition will invalidate the children of [CompositionLocalProvider] that read the value
* using [CompositionLocal.current].
*
* @param policy a policy to determine when a [CompositionLocal] is considered changed. See
@@ -160,8 +160,8 @@
): ProvidableCompositionLocal<T> = DynamicProvidableCompositionLocal(policy, defaultFactory)
/**
- * Create a [CompositionLocal] key that can be provided using [Providers]. Changing the value
- * provided will cause the entire tree below [Providers] to be recomposed, disabling skipping of
+ * Create a [CompositionLocal] key that can be provided using [CompositionLocalProvider]. Changing the value
+ * provided will cause the entire tree below [CompositionLocalProvider] to be recomposed, disabling skipping of
* composable calls.
*
* A static [CompositionLocal] should be only be used when the value provided is highly unlikely to
@@ -174,8 +174,8 @@
StaticProvidableCompositionLocal(defaultFactory)
/**
- * [Providers] binds values to [ProvidableCompositionLocal] keys. Reading the [CompositionLocal]
- * using [CompositionLocal.current] will return the value provided in [Providers]'s [values]
+ * [CompositionLocalProvider] binds values to [ProvidableCompositionLocal] keys. Reading the [CompositionLocal]
+ * using [CompositionLocal.current] will return the value provided in [CompositionLocalProvider]'s [values]
* parameter for all composable functions called directly or indirectly in the [content] lambda.
*
* @sample androidx.compose.runtime.samples.compositionLocalProvider
@@ -186,7 +186,7 @@
*/
@Composable
@OptIn(InternalComposeApi::class)
-fun Providers(vararg values: ProvidedValue<*>, content: @Composable () -> Unit) {
+fun CompositionLocalProvider(vararg values: ProvidedValue<*>, content: @Composable () -> Unit) {
currentComposer.startProviders(values)
content()
currentComposer.endProviders()
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/DerivedState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/DerivedState.kt
deleted file mode 100644
index 865f4c1..0000000
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/DerivedState.kt
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2020 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.compose.runtime
-
-import androidx.compose.runtime.snapshots.Snapshot
-import androidx.compose.runtime.snapshots.StateObject
-import androidx.compose.runtime.snapshots.StateRecord
-import androidx.compose.runtime.snapshots.newWritableRecord
-import androidx.compose.runtime.snapshots.readable
-import androidx.compose.runtime.snapshots.sync
-
-@OptIn(ExperimentalComposeApi::class)
-private class DerivedSnapshotState<T>(private val calculation: () -> T) : StateObject, State<T> {
- private var first: ResultRecord<T> = ResultRecord()
- private class ResultRecord<T> : StateRecord() {
- var dependencies: HashSet<StateObject>? = null
- var result: T? = null
- var resultHash: Int = 0
-
- override fun assign(value: StateRecord) {
- @Suppress("UNCHECKED_CAST")
- val other = value as ResultRecord<T>
- dependencies = other.dependencies
- result = other.result
- resultHash = other.resultHash
- }
-
- override fun create(): StateRecord = ResultRecord<T>()
-
- fun isValid(snapshot: Snapshot): Boolean =
- result != null && resultHash == readableHash(snapshot)
-
- fun readableHash(snapshot: Snapshot): Int {
- var hash = 7
- val dependencies = sync { dependencies }
- if (dependencies != null)
- for (stateObject in dependencies) {
- val record = stateObject.firstStateRecord.readable(stateObject, snapshot)
- hash = 31 * hash + identityHashCode(record)
- hash = 31 * hash + record.snapshotId
- }
- return hash
- }
- }
-
- private fun value(snapshot: Snapshot, calculation: () -> T): T {
- val readable = first.readable(this, snapshot)
- if (readable.isValid(snapshot)) {
- @Suppress("UNCHECKED_CAST")
- return readable.result as T
- }
- val newDependencies = HashSet<StateObject>()
- val result = Snapshot.observe(
- {
- if (it is StateObject) newDependencies.add(it)
- },
- null, calculation
- )
-
- sync {
- val writable = first.newWritableRecord(this, snapshot)
- writable.dependencies = newDependencies
- writable.resultHash = writable.readableHash(snapshot)
- writable.result = result
- }
-
- snapshot.notifyObjectsInitialized()
-
- return result
- }
-
- override val firstStateRecord: StateRecord get() = first
-
- override fun prependStateRecord(value: StateRecord) {
- @Suppress("UNCHECKED_CAST")
- first = value as ResultRecord<T>
- }
-
- override val value: T get() = value(Snapshot.current, calculation)
-}
-
-/**
- * Creates a [State] object whose [State.value] is the result of [calculation]. The result of
- * calculation will be cached in such a way that calling [State.value] repeatedly will not cause
- * [calculation] to be executed multiple times, but reading [State.value] will cause all [State]
- * objects that got read during the [calculation] to be read in the current [Snapshot], meaning
- * that this will correctly subscribe to the derived state objects if the value is being read in
- * an observed context such as a [Composable] function.
- *
- * @sample androidx.compose.runtime.samples.DerivedStateSample
- *
- * @param calculation the calculation to create the value this state object represents.
- */
-fun <T> derivedStateOf(calculation: () -> T): State<T> = DerivedSnapshotState(calculation)
\ No newline at end of file
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SideEffect.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Effects.kt
similarity index 85%
rename from compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SideEffect.kt
rename to compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Effects.kt
index 60380c6..4534748 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SideEffect.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Effects.kt
@@ -21,6 +21,7 @@
import kotlinx.coroutines.Job
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
+import kotlin.coroutines.EmptyCoroutineContext
/**
* Schedule [effect] to run when the current composition completes successfully and applies
@@ -395,3 +396,77 @@
val applyContext = currentComposer.applyCoroutineContext
remember(*keys) { LaunchedEffectImpl(applyContext, block) }
}
+
+@PublishedApi
+internal class CompositionScopedCoroutineScopeCanceller(
+ val coroutineScope: CoroutineScope
+) : RememberObserver {
+ override fun onRemembered() {
+ // Nothing to do
+ }
+
+ override fun onForgotten() {
+ coroutineScope.cancel()
+ }
+
+ override fun onAbandoned() {
+ coroutineScope.cancel()
+ }
+}
+
+@PublishedApi
+@OptIn(ExperimentalComposeApi::class, InternalComposeApi::class)
+internal fun createCompositionCoroutineScope(
+ coroutineContext: CoroutineContext,
+ composer: Composer
+) = if (coroutineContext[Job] != null) {
+ CoroutineScope(
+ Job().apply {
+ completeExceptionally(
+ IllegalArgumentException(
+ "CoroutineContext supplied to " +
+ "rememberCoroutineScope may not include a parent job"
+ )
+ )
+ }
+ )
+} else {
+ val applyContext = composer.applyCoroutineContext
+ CoroutineScope(applyContext + Job(applyContext[Job]) + coroutineContext)
+}
+
+/**
+ * Return a [CoroutineScope] bound to this point in the composition using the optional
+ * [CoroutineContext] provided by [getContext]. [getContext] will only be called once and the same
+ * [CoroutineScope] instance will be returned across recompositions.
+ *
+ * This scope will be [cancelled][CoroutineScope.cancel] when this call leaves the composition.
+ * The [CoroutineContext] returned by [getContext] may not contain a [Job] as this scope is
+ * considered to be a child of the composition.
+ *
+ * The default dispatcher of this scope if one is not provided by the context returned by
+ * [getContext] will be the applying dispatcher of the composition's [Recomposer].
+ *
+ * Use this scope to launch jobs in response to callback events such as clicks or other user
+ * interaction where the response to that event needs to unfold over time and be cancelled if the
+ * composable managing that process leaves the composition. Jobs should never be launched into
+ * **any** coroutine scope as a side effect of composition itself. For scoped ongoing jobs
+ * initiated by composition, see [LaunchedEffect].
+ *
+ * This function will not throw if preconditions are not met, as composable functions do not yet
+ * fully support exceptions. Instead the returned scope's [CoroutineScope.coroutineContext] will
+ * contain a failed [Job] with the associated exception and will not be capable of launching
+ * child jobs.
+ */
+@Composable
+inline fun rememberCoroutineScope(
+ getContext: @DisallowComposableCalls () -> CoroutineContext = { EmptyCoroutineContext }
+): CoroutineScope {
+ val composer = currentComposer
+ val wrapper = remember {
+ CompositionScopedCoroutineScopeCanceller(
+ createCompositionCoroutineScope(getContext(), composer)
+ )
+ }
+ return wrapper.coroutineScope
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Expect.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Expect.kt
index e363360..2189a52 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Expect.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Expect.kt
@@ -26,8 +26,6 @@
internal fun <T> ThreadLocal() = ThreadLocal<T?> { null }
-expect class WeakHashMap<K, V>() : MutableMap<K, V>
-
internal expect fun identityHashCode(instance: Any?): Int
@PublishedApi
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/FlowAdapter.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/FlowAdapter.kt
deleted file mode 100644
index 3f95aeb..0000000
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/FlowAdapter.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2020 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.compose.runtime
-
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.StateFlow
-import kotlinx.coroutines.flow.collect
-import kotlinx.coroutines.withContext
-import kotlin.coroutines.CoroutineContext
-import kotlin.coroutines.EmptyCoroutineContext
-
-/**
- * Collects values from this [StateFlow] and represents its latest value via [State].
- * The [StateFlow.value] is used as an initial value. Every time there would be new value posted
- * into the [StateFlow] the returned [State] will be updated causing recomposition of every
- * [State.value] usage.
- *
- * @sample androidx.compose.runtime.samples.StateFlowSample
- *
- * @param context [CoroutineContext] to use for collecting.
- */
-@ExperimentalCoroutinesApi
-@Composable
-fun <T> StateFlow<T>.collectAsState(
- context: CoroutineContext = EmptyCoroutineContext
-): State<T> = collectAsState(value, context)
-
-/**
- * Collects values from this [Flow] and represents its latest value via [State]. Every time there
- * would be new value posted into the [Flow] the returned [State] will be updated causing
- * recomposition of every [State.value] usage.
- *
- * @sample androidx.compose.runtime.samples.FlowWithInitialSample
- *
- * @param context [CoroutineContext] to use for collecting.
- */
-@Composable
-fun <T : R, R> Flow<T>.collectAsState(
- initial: R,
- context: CoroutineContext = EmptyCoroutineContext
-): State<R> = produceState(initial, this, context) {
- if (context == EmptyCoroutineContext) {
- collect { value = it }
- } else withContext(context) {
- collect { value = it }
- }
-}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/JoinedKey.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/JoinedKey.kt
index 348a4cf..4adf6c1 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/JoinedKey.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/JoinedKey.kt
@@ -20,17 +20,3 @@
val left: Any?,
val right: Any?
)
-
-@InternalComposeApi
-fun isJoinedKey(key: Any?) = key is JoinedKey
-@InternalComposeApi
-fun joinedKeyLeft(key: Any?): Any? = when (key) {
- is JoinedKey -> key.left
- else -> null
-}
-
-@InternalComposeApi
-fun joinedKeyRight(key: Any?): Any? = when (key) {
- is JoinedKey -> key.right
- else -> null
-}
\ No newline at end of file
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Key.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Key.kt
deleted file mode 100644
index 164fc37..0000000
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Key.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2019 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.compose.runtime
-
-/**
- * [key] is a utility composable that is used to "group" or "key" a block of execution inside of a
- * composition. This is sometimes needed for correctness inside of control-flow that may cause a
- * given composable invocation to execute more than once during composition.
- *
- * The value for a key *does not need to be globally unique*, and needs only be unique amongst the
- * invocations of [key] *at that point* in composition.
- *
- * For instance, consider the following example:
- *
- * @sample androidx.compose.runtime.samples.LocallyUniqueKeys
- *
- * Even though there are users with the same id composed in both the top and the bottom loop,
- * because they are different calls to [key], there is no need to create compound keys.
- *
- * The key must be unique for each element in the collection, however, or children and local state
- * might be reused in unintended ways.
- *
- * For instance, consider the following example:
- *
- * @sample androidx.compose.runtime.samples.NotAlwaysUniqueKeys
- *
- * This example assumes that `parent.id` is a unique key for each item in the collection,
- * but this is only true if it is fair to assume that a parent will only ever have a single child,
- * which may not be the case. Instead, it may be more correct to do the following:
- *
- * @sample androidx.compose.runtime.samples.MoreCorrectUniqueKeys
- *
- * A compound key can be created by passing in multiple arguments:
- *
- * @sample androidx.compose.runtime.samples.TwoInputsKeySample
- *
- * @param keys The set of values to be used to create a compound key. These will be compared to
- * their previous values using [equals] and [hashCode]
- * @param block The composable children for this group.
- */
-@Composable
-inline fun <T> key(
- @Suppress("UNUSED_PARAMETER")
- vararg keys: Any?,
- block: @Composable () -> T
-) = block()
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/KeySourceInfo.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/KeySourceInfo.kt
deleted file mode 100644
index 2b79383..0000000
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/KeySourceInfo.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2019 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.compose.runtime
-
-internal expect fun recordSourceKeyInfo(key: Any)
-
-@InternalComposeApi
-expect fun keySourceInfoOf(key: Any): String?
-
-@InternalComposeApi
-expect fun resetSourceInfo()
\ No newline at end of file
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/MutableState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/MutableState.kt
deleted file mode 100644
index da35fbe..0000000
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/MutableState.kt
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright 2019 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.compose.runtime
-
-import androidx.compose.runtime.snapshots.MutableSnapshot
-import androidx.compose.runtime.snapshots.Snapshot
-import androidx.compose.runtime.snapshots.SnapshotMutableState
-import androidx.compose.runtime.snapshots.SnapshotStateList
-import androidx.compose.runtime.snapshots.SnapshotStateMap
-import androidx.compose.runtime.snapshots.StateObject
-import androidx.compose.runtime.snapshots.StateRecord
-import androidx.compose.runtime.snapshots.readable
-import androidx.compose.runtime.snapshots.withCurrent
-import androidx.compose.runtime.snapshots.writable
-import kotlin.reflect.KProperty
-
-/**
- * Return a new [MutableState] initialized with the passed in [value]
- *
- * The MutableState class is a single value holder whose reads and writes are observed by
- * Compose. Additionally, writes to it are transacted as part of the [Snapshot] system.
- *
- * @param value the initial value for the [MutableState]
- * @param policy a policy to controls how changes are handled in mutable snapshots.
- *
- * @sample androidx.compose.runtime.samples.SimpleStateSample
- * @sample androidx.compose.runtime.samples.DestructuredStateSample
- * @sample androidx.compose.runtime.samples.observeUserSample
- * @sample androidx.compose.runtime.samples.stateSample
- *
- * @see State
- * @see MutableState
- * @see SnapshotMutationPolicy
- */
-fun <T> mutableStateOf(
- value: T,
- policy: SnapshotMutationPolicy<T> = structuralEqualityPolicy()
-): MutableState<T> = SnapshotMutableStateImpl(value, policy)
-
-/**
- * A value holder where reads to the [value] property during the execution of a [Composable]
- * function, the current [RecomposeScope] will be subscribed to changes of that value.
- *
- * @see [MutableState]
- * @see [mutableStateOf]
- */
-@Stable
-interface State<T> {
- val value: T
-}
-
-/**
- * Permits property delegation of `val`s using `by` for [State].
- *
- * @sample androidx.compose.runtime.samples.DelegatedReadOnlyStateSample
- */
-@Suppress("NOTHING_TO_INLINE")
-inline operator fun <T> State<T>.getValue(thisObj: Any?, property: KProperty<*>): T = value
-
-/**
- * A mutable value holder where reads to the [value] property during the execution of a [Composable]
- * function, the current [RecomposeScope] will be subscribed to changes of that value. When the
- * [value] property is written to and changed, a recomposition of any subscribed [RecomposeScope]s
- * will be scheduled. If [value] is written to with the same value, no recompositions will be
- * scheduled.
- *
- * @see [State]
- * @see [mutableStateOf]
- */
-@Stable
-interface MutableState<T> : State<T> {
- override var value: T
- operator fun component1(): T
- operator fun component2(): (T) -> Unit
-}
-
-/**
- * Permits property delegation of `var`s using `by` for [MutableState].
- *
- * @sample androidx.compose.runtime.samples.DelegatedStateSample
- */
-@Suppress("NOTHING_TO_INLINE")
-inline operator fun <T> MutableState<T>.setValue(thisObj: Any?, property: KProperty<*>, value: T) {
- this.value = value
-}
-
-/**
- * A single value holder whose reads and writes are observed by Compose.
- *
- * Additionally, writes to it are transacted as part of the [Snapshot] system.
- *
- * @property value the wrapped value
- * @property policy a policy to control how changes are handled in a mutable snapshot.
- *
- * @see mutableStateOf
- * @see SnapshotMutationPolicy
- */
-@OptIn(ExperimentalComposeApi::class)
-private class SnapshotMutableStateImpl<T>(
- value: T,
- override val policy: SnapshotMutationPolicy<T>
-) : StateObject, SnapshotMutableState<T> {
- @Suppress("UNCHECKED_CAST")
- override var value: T
- get() = next.readable(this).value
- set(value) = next.withCurrent {
- if (!policy.equivalent(it.value, value)) {
- next.writable(this) { this.value = value }
- }
- }
-
- private var next: StateStateRecord<T> = StateStateRecord(value)
-
- override val firstStateRecord: StateRecord
- get() = next
-
- override fun prependStateRecord(value: StateRecord) {
- @Suppress("UNCHECKED_CAST")
- next = value as StateStateRecord<T>
- }
-
- @Suppress("UNCHECKED_CAST")
- override fun mergeRecords(
- previous: StateRecord,
- current: StateRecord,
- applied: StateRecord
- ): StateRecord? {
- val previousRecord = previous as StateStateRecord<T>
- val currentRecord = current as StateStateRecord<T>
- val appliedRecord = applied as StateStateRecord<T>
- return if (policy.equivalent(currentRecord.value, appliedRecord.value))
- current
- else {
- val merged = policy.merge(
- previousRecord.value,
- currentRecord.value,
- appliedRecord.value
- )
- if (merged != null) {
- appliedRecord.create().also {
- (it as StateStateRecord<T>).value = merged
- }
- } else {
- null
- }
- }
- }
-
- private class StateStateRecord<T>(myValue: T) : StateRecord() {
- override fun assign(value: StateRecord) {
- @Suppress("UNCHECKED_CAST")
- this.value = (value as StateStateRecord<T>).value
- }
-
- override fun create(): StateRecord = StateStateRecord(value)
-
- var value: T = myValue
- }
-
- /**
- * The componentN() operators allow state objects to be used with the property destructuring
- * syntax
- *
- * var (foo, setFoo) = remember { mutableStateOf(0) }
- * setFoo(123) // set
- * foo == 123 // get
- */
- override operator fun component1(): T = value
-
- override operator fun component2(): (T) -> Unit = { value = it }
-}
-
-/**
- * A policy to control how the result of [mutableStateOf] report and merge changes to
- * the state object.
- *
- * A mutation policy can be passed as an parameter to [mutableStateOf], and [compositionLocalOf].
- *
- * Typically, one of the stock policies should be used such as [referentialEqualityPolicy],
- * [structuralEqualityPolicy], or [neverEqualPolicy]. However, a custom mutation policy can be
- * created by implementing this interface, such as a counter policy,
- *
- * @sample androidx.compose.runtime.samples.counterSample
- */
-interface SnapshotMutationPolicy<T> {
- /**
- * Determine if setting a state value's are equivalent and should be treated as equal. If
- * [equivalent] returns `true` the new value is not considered a change.
- */
- fun equivalent(a: T, b: T): Boolean
-
- /**
- * Merge conflicting changes in snapshots. This is only called if [current] and [applied] are
- * not [equivalent]. If a valid merged value can be calculated then it should be returned.
- *
- * For example, if the state object holds an immutable data class with multiple fields,
- * and [applied] has changed fields that are unmodified by [current] it might be valid to return
- * a new copy of the data class that combines that changes from both [current] and [applied]
- * allowing a snapshot to apply that would have otherwise failed.
- *
- * @sample androidx.compose.runtime.samples.counterSample
- */
- @ExperimentalComposeApi
- fun merge(previous: T, current: T, applied: T): T? = null
-}
-
-/**
- * A policy to treat values of a [MutableState] as equivalent if they are referentially (===) equal.
- *
- * Setting [MutableState.value] to its current referentially (===) equal value is not considered
- * a change. When applying a [MutableSnapshot], if the snapshot changes the value to the
- * equivalent value the parent snapshot has is not considered a conflict.
- */
-@Suppress("UNCHECKED_CAST")
-fun <T> referentialEqualityPolicy(): SnapshotMutationPolicy<T> =
- ReferentialEqualityPolicy as SnapshotMutationPolicy<T>
-
-private object ReferentialEqualityPolicy : SnapshotMutationPolicy<Any?> {
- override fun equivalent(a: Any?, b: Any?) = a === b
-}
-
-/**
- * A policy to treat values of a [MutableState] as equivalent if they are structurally (==) equal.
- *
- * Setting [MutableState.value] to its current structurally (==) equal value is not considered
- * a change. When applying a [MutableSnapshot], if the snapshot changes the value to the
- * equivalent value the parent snapshot has is not considered a conflict.
- */
-@Suppress("UNCHECKED_CAST")
-fun <T> structuralEqualityPolicy(): SnapshotMutationPolicy<T> =
- StructuralEqualityPolicy as SnapshotMutationPolicy<T>
-
-private object StructuralEqualityPolicy : SnapshotMutationPolicy<Any?> {
- override fun equivalent(a: Any?, b: Any?) = a == b
-}
-
-/**
- * A policy never treat values of a [MutableState] as equivalent.
- *
- * Setting [MutableState.value] will always be considered a change. When applying a
- * [MutableSnapshot] that changes the state will always conflict with other snapshots that change
- * the same state.
- */
-@Suppress("UNCHECKED_CAST")
-fun <T> neverEqualPolicy(): SnapshotMutationPolicy<T> =
- NeverEqualPolicy as SnapshotMutationPolicy<T>
-
-private object NeverEqualPolicy : SnapshotMutationPolicy<Any?> {
- override fun equivalent(a: Any?, b: Any?) = false
-}
-
-/**
- * Create a instance of MutableList<T> that is observable and can be snapshot.
- *
- * @sample androidx.compose.runtime.samples.stateListSample
- *
- * @see mutableStateOf
- * @see mutableListOf
- * @see MutableList
- * @see Snapshot.takeSnapshot
- */
-fun <T> mutableStateListOf() = SnapshotStateList<T>()
-
-/**
- * Create an instance of MutableList<T> that is observable and can be snapshot.
- *
- * @see mutableStateOf
- * @see mutableListOf
- * @see MutableList
- * @see Snapshot.takeSnapshot
- */
-fun <T> mutableStateListOf(vararg elements: T) =
- SnapshotStateList<T>().also { it.addAll(elements.toList()) }
-
-/**
- * Create an instance of MutableList<T> from a collection that is observerable and can be snapshot.
- */
-fun <T> Collection<T>.toMutableStateList() = SnapshotStateList<T>().also { it.addAll(this) }
-
-/**
- * Create a instance of MutableSet<K, V> that is observable and can be snapshot.
- *
- * @sample androidx.compose.runtime.samples.stateMapSample
- *
- * @see mutableStateOf
- * @see mutableMapOf
- * @see MutableMap
- * @see Snapshot.takeSnapshot
- */
-fun <K, V> mutableStateMapOf() = SnapshotStateMap<K, V>()
-
-/**
- * Create a instance of MutableMap<K, V> that is observable and can be snapshot.
- *
- * @see mutableStateOf
- * @see mutableMapOf
- * @see MutableMap
- * @see Snapshot.takeSnapshot
- */
-fun <K, V> mutableStateMapOf(vararg pairs: Pair<K, V>) =
- SnapshotStateMap<K, V>().apply { putAll(pairs.toMap()) }
-
-/**
- * Create an instance of MutableMap<K, V> from a collection of pairs that is observable and can be
- * snapshot.
- */
-fun <K, V> Iterable<Pair<K, V>>.toMutableStateMap() =
- SnapshotStateMap<K, V>().also { it.putAll(this.toMap()) }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ProduceState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ProduceState.kt
deleted file mode 100644
index 0bda5bc..0000000
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ProduceState.kt
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-@file:OptIn(ExperimentalTypeInference::class)
-
-package androidx.compose.runtime
-
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.suspendCancellableCoroutine
-import kotlin.coroutines.CoroutineContext
-import kotlin.experimental.ExperimentalTypeInference
-
-/**
- * Receiver scope for use with [produceState].
- */
-interface ProduceStateScope<T> : MutableState<T>, CoroutineScope {
- /**
- * Await the disposal of this producer whether it left the composition,
- * the source changed, or an error occurred. Always runs [onDispose] before resuming.
- *
- * This method is useful when configuring callback-based state producers that do not suspend,
- * for example:
- *
- * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
- */
- suspend fun awaitDispose(onDispose: () -> Unit): Nothing
-}
-
-private class ProduceStateScopeImpl<T>(
- state: MutableState<T>,
- override val coroutineContext: CoroutineContext
-) : ProduceStateScope<T>, MutableState<T> by state {
-
- override suspend fun awaitDispose(onDispose: () -> Unit): Nothing {
- try {
- suspendCancellableCoroutine<Nothing> { }
- } finally {
- onDispose()
- }
- }
-}
-
-/**
- * Return an observable [snapshot][androidx.compose.runtime.snapshots.Snapshot] [State] that
- * produces values over time without a defined data source.
- *
- * [producer] is launched when [produceState] enters the composition and is cancelled when
- * [produceState] leaves the composition. [producer] should use [ProduceStateScope.value]
- * to set new values on the returned [State].
- *
- * The returned [State] conflates values; no change will be observable if
- * [ProduceStateScope.value] is used to set a value that is [equal][Any.equals] to its old value,
- * and observers may only see the latest value if several values are set in rapid succession.
- *
- * [produceState] may be used to observe either suspending or non-suspending sources of external
- * data, for example:
- *
- * @sample androidx.compose.runtime.samples.ProduceState
- *
- * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
- */
-@Composable
-fun <T> produceState(
- initialValue: T,
- @BuilderInference producer: suspend ProduceStateScope<T>.() -> Unit
-): State<T> {
- val result = remember { mutableStateOf(initialValue) }
- LaunchedEffect(Unit) {
- ProduceStateScopeImpl(result, coroutineContext).producer()
- }
- return result
-}
-
-/**
- * Return an observable [snapshot][androidx.compose.runtime.snapshots.Snapshot] [State] that
- * produces values over time from [key1].
- *
- * [producer] is launched when [produceState] enters the composition and is cancelled when
- * [produceState] leaves the composition. If [key1] changes, a running [producer] will be
- * cancelled and re-launched for the new source. [producer] should use [ProduceStateScope.value]
- * to set new values on the returned [State].
- *
- * The returned [State] conflates values; no change will be observable if
- * [ProduceStateScope.value] is used to set a value that is [equal][Any.equals] to its old value,
- * and observers may only see the latest value if several values are set in rapid succession.
- *
- * [produceState] may be used to observe either suspending or non-suspending sources of external
- * data, for example:
- *
- * @sample androidx.compose.runtime.samples.ProduceState
- *
- * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
- */
-@Composable
-fun <T> produceState(
- initialValue: T,
- key1: Any?,
- @BuilderInference producer: suspend ProduceStateScope<T>.() -> Unit
-): State<T> {
- val result = remember { mutableStateOf(initialValue) }
- LaunchedEffect(key1) {
- ProduceStateScopeImpl(result, coroutineContext).producer()
- }
- return result
-}
-
-/**
- * Return an observable [snapshot][androidx.compose.runtime.snapshots.Snapshot] [State] that
- * produces values over time from [key1] and [key2].
- *
- * [producer] is launched when [produceState] enters the composition and is cancelled when
- * [produceState] leaves the composition. If [key1] or [key2] change, a running [producer]
- * will be cancelled and re-launched for the new source. [producer] should use
- * [ProduceStateScope.value] to set new values on the returned [State].
- *
- * The returned [State] conflates values; no change will be observable if
- * [ProduceStateScope.value] is used to set a value that is [equal][Any.equals] to its old value,
- * and observers may only see the latest value if several values are set in rapid succession.
- *
- * [produceState] may be used to observe either suspending or non-suspending sources of external
- * data, for example:
- *
- * @sample androidx.compose.runtime.samples.ProduceState
- *
- * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
- */
-@Composable
-fun <T> produceState(
- initialValue: T,
- key1: Any?,
- key2: Any?,
- @BuilderInference producer: suspend ProduceStateScope<T>.() -> Unit
-): State<T> {
- val result = remember { mutableStateOf(initialValue) }
- LaunchedEffect(key1, key2) {
- ProduceStateScopeImpl(result, coroutineContext).producer()
- }
- return result
-}
-
-/**
- * Return an observable [snapshot][androidx.compose.runtime.snapshots.Snapshot] [State] that
- * produces values over time from [key1], [key2] and [key3].
- *
- * [producer] is launched when [produceState] enters the composition and is cancelled when
- * [produceState] leaves the composition. If [key1], [key2] or [key3] change, a running
- * [producer] will be cancelled and re-launched for the new source. [producer should use
- * [ProduceStateScope.value] to set new values on the returned [State].
- *
- * The returned [State] conflates values; no change will be observable if
- * [ProduceStateScope.value] is used to set a value that is [equal][Any.equals] to its old value,
- * and observers may only see the latest value if several values are set in rapid succession.
- *
- * [produceState] may be used to observe either suspending or non-suspending sources of external
- * data, for example:
- *
- * @sample androidx.compose.runtime.samples.ProduceState
- *
- * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
- */
-@Composable
-fun <T> produceState(
- initialValue: T,
- key1: Any?,
- key2: Any?,
- key3: Any?,
- @BuilderInference producer: suspend ProduceStateScope<T>.() -> Unit
-): State<T> {
- val result = remember { mutableStateOf(initialValue) }
- LaunchedEffect(key1, key2, key3) {
- ProduceStateScopeImpl(result, coroutineContext).producer()
- }
- return result
-}
-
-/**
- * Return an observable [snapshot][androidx.compose.runtime.snapshots.Snapshot] [State] that
- * produces values over time from [keys].
- *
- * [producer] is launched when [produceState] enters the composition and is cancelled when
- * [produceState] leaves the composition. If [keys] change, a running [producer] will be
- * cancelled and re-launched for the new source. [producer] should use [ProduceStateScope.value]
- * to set new values on the returned [State].
- *
- * The returned [State] conflates values; no change will be observable if
- * [ProduceStateScope.value] is used to set a value that is [equal][Any.equals] to its old value,
- * and observers may only see the latest value if several values are set in rapid succession.
- *
- * [produceState] may be used to observe either suspending or non-suspending sources of external
- * data, for example:
- *
- * @sample androidx.compose.runtime.samples.ProduceState
- *
- * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
- */
-@Composable
-fun <T> produceState(
- initialValue: T,
- vararg keys: Any?,
- @BuilderInference producer: suspend ProduceStateScope<T>.() -> Unit
-): State<T> {
- val result = remember { mutableStateOf(initialValue) }
- @Suppress("CHANGING_ARGUMENTS_EXECUTION_ORDER_FOR_NAMED_VARARGS")
- LaunchedEffect(keys = keys) {
- ProduceStateScopeImpl(result, coroutineContext).producer()
- }
- return result
-}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt
index b549625..b7d9b30 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt
@@ -28,19 +28,6 @@
}
/**
- * Returns an object which can be used to invalidate the current scope at this point in composition.
- * This object can be used to manually cause recompositions.
- */
-val currentRecomposeScope: RecomposeScope
- @ReadOnlyComposable
- @OptIn(InternalComposeApi::class)
- @Composable get() {
- val scope = currentComposer.recomposeScope ?: error("no recompose scope found")
- currentComposer.recordUsed(scope)
- return scope
- }
-
-/**
* A RecomposeScope is created for a region of the composition that can be recomposed independently
* of the rest of the composition. The composer will position the slot table to the location
* stored in [anchor] and call [block] when recomposition is requested. It is created by
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
index dc6d320..2897a2d 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
@@ -21,6 +21,7 @@
import androidx.compose.runtime.snapshots.Snapshot
import androidx.compose.runtime.snapshots.SnapshotApplyResult
import androidx.compose.runtime.snapshots.fastForEach
+import androidx.compose.runtime.tooling.CompositionData
import kotlinx.collections.immutable.persistentSetOf
import kotlinx.coroutines.CancellableContinuation
import kotlinx.coroutines.CancellationException
@@ -286,6 +287,33 @@
get() = this@Recomposer.hasPendingWork
override val changeCount: Long
get() = this@Recomposer.changeCount
+ fun saveStateAndDisposeForHotReload(): List<HotReloadable> {
+ val compositions = synchronized(stateLock) { knownCompositions.toList() }
+ return compositions
+ .mapNotNull { it as? CompositionImpl }
+ .map { HotReloadable(it).apply { clearContent() } }
+ }
+ }
+
+ private class HotReloadable(
+ private val composition: CompositionImpl
+ ) {
+ private var composable: @Composable () -> Unit = composition.composable
+ fun clearContent() {
+ if (composition.isRoot) {
+ composition.setContent { }
+ }
+ }
+
+ fun resetContent() {
+ composition.composable = composable
+ }
+
+ fun recompose() {
+ if (composition.isRoot) {
+ composition.setContent(composable)
+ }
+ }
}
private val recomposerInfo = RecomposerInfoImpl()
@@ -609,10 +637,6 @@
internal override val compoundHashKey: Int
get() = RecomposerCompoundHashKey
- // Collecting key sources happens at the level of a composer; starts as false
- internal override val collectingKeySources: Boolean
- get() = false
-
// Collecting parameter happens at the level of a composer; starts as false
internal override val collectingParameterInformation: Boolean
get() = false
@@ -643,7 +667,7 @@
companion object {
- private val _runningRecomposers = MutableStateFlow(persistentSetOf<RecomposerInfo>())
+ private val _runningRecomposers = MutableStateFlow(persistentSetOf<RecomposerInfoImpl>())
/**
* An observable [Set] of [RecomposerInfo]s for currently
@@ -653,7 +677,7 @@
val runningRecomposers: StateFlow<Set<RecomposerInfo>>
get() = _runningRecomposers
- private fun addRunning(info: RecomposerInfo) {
+ private fun addRunning(info: RecomposerInfoImpl) {
while (true) {
val old = _runningRecomposers.value
val new = old.add(info)
@@ -661,12 +685,27 @@
}
}
- private fun removeRunning(info: RecomposerInfo) {
+ private fun removeRunning(info: RecomposerInfoImpl) {
while (true) {
val old = _runningRecomposers.value
val new = old.remove(info)
if (old === new || _runningRecomposers.compareAndSet(old, new)) break
}
}
+
+ internal fun saveStateAndDisposeForHotReload(): Any {
+ // NOTE: when we move composition/recomposition onto multiple threads, we will want
+ // to ensure that we pause recompositions before this call.
+ return _runningRecomposers.value.flatMap { it.saveStateAndDisposeForHotReload() }
+ }
+
+ internal fun loadStateAndComposeForHotReload(token: Any) {
+ // NOTE: when we move composition/recomposition onto multiple threads, we will want
+ // to ensure that we pause recompositions before this call.
+ @Suppress("UNCHECKED_CAST")
+ val holders = token as List<HotReloadable>
+ holders.forEach { it.resetContent() }
+ holders.forEach { it.recompose() }
+ }
}
}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Remember.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Remember.kt
deleted file mode 100644
index b52a33c..0000000
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Remember.kt
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright 2019 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.compose.runtime
-
-/**
- * Remember the value produced by [calculation]. [calculation] will only be evaluated during the composition.
- * Recomposition will always return the value produced by composition.
- */
-@OptIn(ComposeCompilerApi::class)
-@Composable
-inline fun <T> remember(calculation: @DisallowComposableCalls () -> T): T =
- currentComposer.cache(false, calculation)
-
-/**
- * Remember the value returned by [calculation] if [key1] is equal to the previous composition,
- * otherwise produce and remember a new value by calling [calculation].
- */
-@OptIn(ComposeCompilerApi::class)
-@Composable
-inline fun <T> remember(
- key1: Any?,
- calculation: @DisallowComposableCalls () -> T
-): T {
- return currentComposer.cache(currentComposer.changed(key1), calculation)
-}
-
-/**
- * Remember the value returned by [calculation] if [key1] and [key2] are equal to the previous
- * composition, otherwise produce and remember a new value by calling [calculation].
- */
-@OptIn(ComposeCompilerApi::class)
-@Composable
-inline fun <T> remember(
- key1: Any?,
- key2: Any?,
- calculation: @DisallowComposableCalls () -> T
-): T {
- return currentComposer.cache(
- currentComposer.changed(key1) or currentComposer.changed(key2),
- calculation
- )
-}
-
-/**
- * Remember the value returned by [calculation] if [key1], [key2] and [key3] are equal to the
- * previous composition, otherwise produce and remember a new value by calling [calculation].
- */
-@OptIn(ComposeCompilerApi::class)
-@Composable
-inline fun <T> remember(
- key1: Any?,
- key2: Any?,
- key3: Any?,
- calculation: @DisallowComposableCalls () -> T
-): T {
- return currentComposer.cache(
- currentComposer.changed(key1) or
- currentComposer.changed(key2) or
- currentComposer.changed(key3),
- calculation
- )
-}
-
-/**
- * Remember the value returned by [calculation] if all values of [keys] are equal to the previous
- * composition, otherwise produce and remember a new value by calling [calculation].
- */
-@OptIn(ComposeCompilerApi::class)
-@Composable
-inline fun <T> remember(
- vararg keys: Any?,
- calculation: @DisallowComposableCalls () -> T
-): T {
- var invalid = false
- for (key in keys) invalid = invalid or currentComposer.changed(key)
- return currentComposer.cache(invalid, calculation)
-}
-
-/**
- * [remember] a [mutableStateOf] [newValue] and update its value to [newValue] on each
- * recomposition of the [rememberUpdatedState] call.
- *
- * [rememberUpdatedState] should be used when parameters or values computed during composition
- * are referenced by a long-lived lambda or object expression. Recomposition will update the
- * resulting [State] without recreating the long-lived lambda or object, allowing that object to
- * persist without cancelling and resubscribing, or relaunching a long-lived operation that may
- * be expensive or prohibitive to recreate and restart.
- * This may be common when working with [DisposableEffect] or [LaunchedEffect], for example:
- *
- * @sample androidx.compose.runtime.samples.rememberUpdatedStateSampleWithDisposableEffect
- *
- * [LaunchedEffect]s often describe state machines that should not be reset and restarted if a
- * parameter or event callback changes, but they should have the current value available when
- * needed. For example:
- *
- * @sample androidx.compose.runtime.samples.rememberUpdatedStateSampleWithLaunchedTask
- *
- * By using [rememberUpdatedState] a composable function can update these operations in progress.
- */
-@Suppress("NOTHING_TO_INLINE")
-@Composable
-inline fun <T> rememberUpdatedState(newValue: T): State<T> = remember {
- mutableStateOf(newValue)
-}.apply { value = newValue }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt
index d27445e..11be24c 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt
@@ -17,8 +17,10 @@
@file:OptIn(InternalComposeApi::class)
package androidx.compose.runtime
+import androidx.compose.runtime.tooling.CompositionData
import kotlin.math.max
import kotlin.math.min
+import androidx.compose.runtime.tooling.CompositionGroup
// Nomenclature -
// Address - an absolute offset into the array ignoring its gap. See Index below.
@@ -2560,7 +2562,7 @@
this[address * Group_Fields_Size + Size_Offset] = value
}
-fun IntArray.slice(indices: Iterable<Int>): List<Int> {
+private fun IntArray.slice(indices: Iterable<Int>): List<Int> {
val list = mutableListOf<Int>()
for (index in indices) {
list.add(get(index))
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotState.kt
new file mode 100644
index 0000000..7de8bb0
--- /dev/null
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotState.kt
@@ -0,0 +1,782 @@
+/*
+ * Copyright 2019 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.
+ */
+
+@file:OptIn(ExperimentalTypeInference::class)
+package androidx.compose.runtime
+
+import androidx.compose.runtime.snapshots.MutableSnapshot
+import androidx.compose.runtime.snapshots.Snapshot
+import androidx.compose.runtime.snapshots.SnapshotMutableState
+import androidx.compose.runtime.snapshots.SnapshotStateList
+import androidx.compose.runtime.snapshots.SnapshotStateMap
+import androidx.compose.runtime.snapshots.StateObject
+import androidx.compose.runtime.snapshots.StateRecord
+import androidx.compose.runtime.snapshots.newWritableRecord
+import androidx.compose.runtime.snapshots.readable
+import androidx.compose.runtime.snapshots.sync
+import androidx.compose.runtime.snapshots.withCurrent
+import androidx.compose.runtime.snapshots.writable
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.channels.Channel
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.collect
+import kotlinx.coroutines.flow.flow
+import kotlinx.coroutines.suspendCancellableCoroutine
+import kotlinx.coroutines.withContext
+import kotlin.coroutines.CoroutineContext
+import kotlin.coroutines.EmptyCoroutineContext
+import kotlin.experimental.ExperimentalTypeInference
+import kotlin.reflect.KProperty
+
+/**
+ * Return a new [MutableState] initialized with the passed in [value]
+ *
+ * The MutableState class is a single value holder whose reads and writes are observed by
+ * Compose. Additionally, writes to it are transacted as part of the [Snapshot] system.
+ *
+ * @param value the initial value for the [MutableState]
+ * @param policy a policy to controls how changes are handled in mutable snapshots.
+ *
+ * @sample androidx.compose.runtime.samples.SimpleStateSample
+ * @sample androidx.compose.runtime.samples.DestructuredStateSample
+ * @sample androidx.compose.runtime.samples.observeUserSample
+ * @sample androidx.compose.runtime.samples.stateSample
+ *
+ * @see State
+ * @see MutableState
+ * @see SnapshotMutationPolicy
+ */
+fun <T> mutableStateOf(
+ value: T,
+ policy: SnapshotMutationPolicy<T> = structuralEqualityPolicy()
+): MutableState<T> = SnapshotMutableStateImpl(value, policy)
+
+/**
+ * A value holder where reads to the [value] property during the execution of a [Composable]
+ * function, the current [RecomposeScope] will be subscribed to changes of that value.
+ *
+ * @see [MutableState]
+ * @see [mutableStateOf]
+ */
+@Stable
+interface State<T> {
+ val value: T
+}
+
+/**
+ * Permits property delegation of `val`s using `by` for [State].
+ *
+ * @sample androidx.compose.runtime.samples.DelegatedReadOnlyStateSample
+ */
+@Suppress("NOTHING_TO_INLINE")
+inline operator fun <T> State<T>.getValue(thisObj: Any?, property: KProperty<*>): T = value
+
+/**
+ * A mutable value holder where reads to the [value] property during the execution of a [Composable]
+ * function, the current [RecomposeScope] will be subscribed to changes of that value. When the
+ * [value] property is written to and changed, a recomposition of any subscribed [RecomposeScope]s
+ * will be scheduled. If [value] is written to with the same value, no recompositions will be
+ * scheduled.
+ *
+ * @see [State]
+ * @see [mutableStateOf]
+ */
+@Stable
+interface MutableState<T> : State<T> {
+ override var value: T
+ operator fun component1(): T
+ operator fun component2(): (T) -> Unit
+}
+
+/**
+ * Permits property delegation of `var`s using `by` for [MutableState].
+ *
+ * @sample androidx.compose.runtime.samples.DelegatedStateSample
+ */
+@Suppress("NOTHING_TO_INLINE")
+inline operator fun <T> MutableState<T>.setValue(thisObj: Any?, property: KProperty<*>, value: T) {
+ this.value = value
+}
+
+/**
+ * A single value holder whose reads and writes are observed by Compose.
+ *
+ * Additionally, writes to it are transacted as part of the [Snapshot] system.
+ *
+ * @property value the wrapped value
+ * @property policy a policy to control how changes are handled in a mutable snapshot.
+ *
+ * @see mutableStateOf
+ * @see SnapshotMutationPolicy
+ */
+private class SnapshotMutableStateImpl<T>(
+ value: T,
+ override val policy: SnapshotMutationPolicy<T>
+) : StateObject, SnapshotMutableState<T> {
+ @Suppress("UNCHECKED_CAST")
+ override var value: T
+ get() = next.readable(this).value
+ set(value) = next.withCurrent {
+ if (!policy.equivalent(it.value, value)) {
+ next.writable(this) { this.value = value }
+ }
+ }
+
+ private var next: StateStateRecord<T> = StateStateRecord(value)
+
+ override val firstStateRecord: StateRecord
+ get() = next
+
+ override fun prependStateRecord(value: StateRecord) {
+ @Suppress("UNCHECKED_CAST")
+ next = value as StateStateRecord<T>
+ }
+
+ @Suppress("UNCHECKED_CAST")
+ override fun mergeRecords(
+ previous: StateRecord,
+ current: StateRecord,
+ applied: StateRecord
+ ): StateRecord? {
+ val previousRecord = previous as StateStateRecord<T>
+ val currentRecord = current as StateStateRecord<T>
+ val appliedRecord = applied as StateStateRecord<T>
+ return if (policy.equivalent(currentRecord.value, appliedRecord.value))
+ current
+ else {
+ val merged = policy.merge(
+ previousRecord.value,
+ currentRecord.value,
+ appliedRecord.value
+ )
+ if (merged != null) {
+ appliedRecord.create().also {
+ (it as StateStateRecord<T>).value = merged
+ }
+ } else {
+ null
+ }
+ }
+ }
+
+ private class StateStateRecord<T>(myValue: T) : StateRecord() {
+ override fun assign(value: StateRecord) {
+ @Suppress("UNCHECKED_CAST")
+ this.value = (value as StateStateRecord<T>).value
+ }
+
+ override fun create(): StateRecord = StateStateRecord(value)
+
+ var value: T = myValue
+ }
+
+ /**
+ * The componentN() operators allow state objects to be used with the property destructuring
+ * syntax
+ *
+ * var (foo, setFoo) = remember { mutableStateOf(0) }
+ * setFoo(123) // set
+ * foo == 123 // get
+ */
+ override operator fun component1(): T = value
+
+ override operator fun component2(): (T) -> Unit = { value = it }
+}
+
+/**
+ * A policy to control how the result of [mutableStateOf] report and merge changes to
+ * the state object.
+ *
+ * A mutation policy can be passed as an parameter to [mutableStateOf], and [compositionLocalOf].
+ *
+ * Typically, one of the stock policies should be used such as [referentialEqualityPolicy],
+ * [structuralEqualityPolicy], or [neverEqualPolicy]. However, a custom mutation policy can be
+ * created by implementing this interface, such as a counter policy,
+ *
+ * @sample androidx.compose.runtime.samples.counterSample
+ */
+interface SnapshotMutationPolicy<T> {
+ /**
+ * Determine if setting a state value's are equivalent and should be treated as equal. If
+ * [equivalent] returns `true` the new value is not considered a change.
+ */
+ fun equivalent(a: T, b: T): Boolean
+
+ /**
+ * Merge conflicting changes in snapshots. This is only called if [current] and [applied] are
+ * not [equivalent]. If a valid merged value can be calculated then it should be returned.
+ *
+ * For example, if the state object holds an immutable data class with multiple fields,
+ * and [applied] has changed fields that are unmodified by [current] it might be valid to return
+ * a new copy of the data class that combines that changes from both [current] and [applied]
+ * allowing a snapshot to apply that would have otherwise failed.
+ *
+ * @sample androidx.compose.runtime.samples.counterSample
+ */
+ fun merge(previous: T, current: T, applied: T): T? = null
+}
+
+/**
+ * A policy to treat values of a [MutableState] as equivalent if they are referentially (===) equal.
+ *
+ * Setting [MutableState.value] to its current referentially (===) equal value is not considered
+ * a change. When applying a [MutableSnapshot], if the snapshot changes the value to the
+ * equivalent value the parent snapshot has is not considered a conflict.
+ */
+@Suppress("UNCHECKED_CAST")
+fun <T> referentialEqualityPolicy(): SnapshotMutationPolicy<T> =
+ ReferentialEqualityPolicy as SnapshotMutationPolicy<T>
+
+private object ReferentialEqualityPolicy : SnapshotMutationPolicy<Any?> {
+ override fun equivalent(a: Any?, b: Any?) = a === b
+}
+
+/**
+ * A policy to treat values of a [MutableState] as equivalent if they are structurally (==) equal.
+ *
+ * Setting [MutableState.value] to its current structurally (==) equal value is not considered
+ * a change. When applying a [MutableSnapshot], if the snapshot changes the value to the
+ * equivalent value the parent snapshot has is not considered a conflict.
+ */
+@Suppress("UNCHECKED_CAST")
+fun <T> structuralEqualityPolicy(): SnapshotMutationPolicy<T> =
+ StructuralEqualityPolicy as SnapshotMutationPolicy<T>
+
+private object StructuralEqualityPolicy : SnapshotMutationPolicy<Any?> {
+ override fun equivalent(a: Any?, b: Any?) = a == b
+}
+
+/**
+ * A policy never treat values of a [MutableState] as equivalent.
+ *
+ * Setting [MutableState.value] will always be considered a change. When applying a
+ * [MutableSnapshot] that changes the state will always conflict with other snapshots that change
+ * the same state.
+ */
+@Suppress("UNCHECKED_CAST")
+fun <T> neverEqualPolicy(): SnapshotMutationPolicy<T> =
+ NeverEqualPolicy as SnapshotMutationPolicy<T>
+
+private object NeverEqualPolicy : SnapshotMutationPolicy<Any?> {
+ override fun equivalent(a: Any?, b: Any?) = false
+}
+
+/**
+ * Create a instance of MutableList<T> that is observable and can be snapshot.
+ *
+ * @sample androidx.compose.runtime.samples.stateListSample
+ *
+ * @see mutableStateOf
+ * @see mutableListOf
+ * @see MutableList
+ * @see Snapshot.takeSnapshot
+ */
+fun <T> mutableStateListOf() = SnapshotStateList<T>()
+
+/**
+ * Create an instance of MutableList<T> that is observable and can be snapshot.
+ *
+ * @see mutableStateOf
+ * @see mutableListOf
+ * @see MutableList
+ * @see Snapshot.takeSnapshot
+ */
+fun <T> mutableStateListOf(vararg elements: T) =
+ SnapshotStateList<T>().also { it.addAll(elements.toList()) }
+
+/**
+ * Create an instance of MutableList<T> from a collection that is observerable and can be snapshot.
+ */
+fun <T> Collection<T>.toMutableStateList() = SnapshotStateList<T>().also { it.addAll(this) }
+
+/**
+ * Create a instance of MutableSet<K, V> that is observable and can be snapshot.
+ *
+ * @sample androidx.compose.runtime.samples.stateMapSample
+ *
+ * @see mutableStateOf
+ * @see mutableMapOf
+ * @see MutableMap
+ * @see Snapshot.takeSnapshot
+ */
+fun <K, V> mutableStateMapOf() = SnapshotStateMap<K, V>()
+
+/**
+ * Create a instance of MutableMap<K, V> that is observable and can be snapshot.
+ *
+ * @see mutableStateOf
+ * @see mutableMapOf
+ * @see MutableMap
+ * @see Snapshot.takeSnapshot
+ */
+fun <K, V> mutableStateMapOf(vararg pairs: Pair<K, V>) =
+ SnapshotStateMap<K, V>().apply { putAll(pairs.toMap()) }
+
+/**
+ * Create an instance of MutableMap<K, V> from a collection of pairs that is observable and can be
+ * snapshot.
+ */
+@Suppress("unused")
+fun <K, V> Iterable<Pair<K, V>>.toMutableStateMap() =
+ SnapshotStateMap<K, V>().also { it.putAll(this.toMap()) }
+
+@OptIn(ExperimentalComposeApi::class)
+private class DerivedSnapshotState<T>(private val calculation: () -> T) : StateObject, State<T> {
+ private var first: ResultRecord<T> = ResultRecord()
+ private class ResultRecord<T> : StateRecord() {
+ var dependencies: HashSet<StateObject>? = null
+ var result: T? = null
+ var resultHash: Int = 0
+
+ override fun assign(value: StateRecord) {
+ @Suppress("UNCHECKED_CAST")
+ val other = value as ResultRecord<T>
+ dependencies = other.dependencies
+ result = other.result
+ resultHash = other.resultHash
+ }
+
+ override fun create(): StateRecord = ResultRecord<T>()
+
+ fun isValid(snapshot: Snapshot): Boolean =
+ result != null && resultHash == readableHash(snapshot)
+
+ fun readableHash(snapshot: Snapshot): Int {
+ var hash = 7
+ val dependencies = sync { dependencies }
+ if (dependencies != null)
+ for (stateObject in dependencies) {
+ val record = stateObject.firstStateRecord.readable(stateObject, snapshot)
+ hash = 31 * hash + identityHashCode(record)
+ hash = 31 * hash + record.snapshotId
+ }
+ return hash
+ }
+ }
+
+ private fun value(snapshot: Snapshot, calculation: () -> T): T {
+ val readable = first.readable(this, snapshot)
+ if (readable.isValid(snapshot)) {
+ @Suppress("UNCHECKED_CAST")
+ return readable.result as T
+ }
+ val newDependencies = HashSet<StateObject>()
+ val result = Snapshot.observe(
+ {
+ if (it is StateObject) newDependencies.add(it)
+ },
+ null, calculation
+ )
+
+ sync {
+ val writable = first.newWritableRecord(this, snapshot)
+ writable.dependencies = newDependencies
+ writable.resultHash = writable.readableHash(snapshot)
+ writable.result = result
+ }
+
+ snapshot.notifyObjectsInitialized()
+
+ return result
+ }
+
+ override val firstStateRecord: StateRecord get() = first
+
+ override fun prependStateRecord(value: StateRecord) {
+ @Suppress("UNCHECKED_CAST")
+ first = value as ResultRecord<T>
+ }
+
+ override val value: T get() = value(Snapshot.current, calculation)
+}
+
+/**
+ * Creates a [State] object whose [State.value] is the result of [calculation]. The result of
+ * calculation will be cached in such a way that calling [State.value] repeatedly will not cause
+ * [calculation] to be executed multiple times, but reading [State.value] will cause all [State]
+ * objects that got read during the [calculation] to be read in the current [Snapshot], meaning
+ * that this will correctly subscribe to the derived state objects if the value is being read in
+ * an observed context such as a [Composable] function.
+ *
+ * @sample androidx.compose.runtime.samples.DerivedStateSample
+ *
+ * @param calculation the calculation to create the value this state object represents.
+ */
+fun <T> derivedStateOf(calculation: () -> T): State<T> = DerivedSnapshotState(calculation)
+
+/**
+ * Receiver scope for use with [produceState].
+ */
+interface ProduceStateScope<T> : MutableState<T>, CoroutineScope {
+ /**
+ * Await the disposal of this producer whether it left the composition,
+ * the source changed, or an error occurred. Always runs [onDispose] before resuming.
+ *
+ * This method is useful when configuring callback-based state producers that do not suspend,
+ * for example:
+ *
+ * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
+ */
+ suspend fun awaitDispose(onDispose: () -> Unit): Nothing
+}
+
+private class ProduceStateScopeImpl<T>(
+ state: MutableState<T>,
+ override val coroutineContext: CoroutineContext
+) : ProduceStateScope<T>, MutableState<T> by state {
+
+ override suspend fun awaitDispose(onDispose: () -> Unit): Nothing {
+ try {
+ suspendCancellableCoroutine<Nothing> { }
+ } finally {
+ onDispose()
+ }
+ }
+}
+
+/**
+ * Return an observable [snapshot][androidx.compose.runtime.snapshots.Snapshot] [State] that
+ * produces values over time without a defined data source.
+ *
+ * [producer] is launched when [produceState] enters the composition and is cancelled when
+ * [produceState] leaves the composition. [producer] should use [ProduceStateScope.value]
+ * to set new values on the returned [State].
+ *
+ * The returned [State] conflates values; no change will be observable if
+ * [ProduceStateScope.value] is used to set a value that is [equal][Any.equals] to its old value,
+ * and observers may only see the latest value if several values are set in rapid succession.
+ *
+ * [produceState] may be used to observe either suspending or non-suspending sources of external
+ * data, for example:
+ *
+ * @sample androidx.compose.runtime.samples.ProduceState
+ *
+ * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
+ */
+@Composable
+fun <T> produceState(
+ initialValue: T,
+ @BuilderInference producer: suspend ProduceStateScope<T>.() -> Unit
+): State<T> {
+ val result = remember { mutableStateOf(initialValue) }
+ LaunchedEffect(Unit) {
+ ProduceStateScopeImpl(result, coroutineContext).producer()
+ }
+ return result
+}
+
+/**
+ * Return an observable [snapshot][androidx.compose.runtime.snapshots.Snapshot] [State] that
+ * produces values over time from [key1].
+ *
+ * [producer] is launched when [produceState] enters the composition and is cancelled when
+ * [produceState] leaves the composition. If [key1] changes, a running [producer] will be
+ * cancelled and re-launched for the new source. [producer] should use [ProduceStateScope.value]
+ * to set new values on the returned [State].
+ *
+ * The returned [State] conflates values; no change will be observable if
+ * [ProduceStateScope.value] is used to set a value that is [equal][Any.equals] to its old value,
+ * and observers may only see the latest value if several values are set in rapid succession.
+ *
+ * [produceState] may be used to observe either suspending or non-suspending sources of external
+ * data, for example:
+ *
+ * @sample androidx.compose.runtime.samples.ProduceState
+ *
+ * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
+ */
+@Composable
+fun <T> produceState(
+ initialValue: T,
+ key1: Any?,
+ @BuilderInference producer: suspend ProduceStateScope<T>.() -> Unit
+): State<T> {
+ val result = remember { mutableStateOf(initialValue) }
+ LaunchedEffect(key1) {
+ ProduceStateScopeImpl(result, coroutineContext).producer()
+ }
+ return result
+}
+
+/**
+ * Return an observable [snapshot][androidx.compose.runtime.snapshots.Snapshot] [State] that
+ * produces values over time from [key1] and [key2].
+ *
+ * [producer] is launched when [produceState] enters the composition and is cancelled when
+ * [produceState] leaves the composition. If [key1] or [key2] change, a running [producer]
+ * will be cancelled and re-launched for the new source. [producer] should use
+ * [ProduceStateScope.value] to set new values on the returned [State].
+ *
+ * The returned [State] conflates values; no change will be observable if
+ * [ProduceStateScope.value] is used to set a value that is [equal][Any.equals] to its old value,
+ * and observers may only see the latest value if several values are set in rapid succession.
+ *
+ * [produceState] may be used to observe either suspending or non-suspending sources of external
+ * data, for example:
+ *
+ * @sample androidx.compose.runtime.samples.ProduceState
+ *
+ * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
+ */
+@Composable
+fun <T> produceState(
+ initialValue: T,
+ key1: Any?,
+ key2: Any?,
+ @BuilderInference producer: suspend ProduceStateScope<T>.() -> Unit
+): State<T> {
+ val result = remember { mutableStateOf(initialValue) }
+ LaunchedEffect(key1, key2) {
+ ProduceStateScopeImpl(result, coroutineContext).producer()
+ }
+ return result
+}
+
+/**
+ * Return an observable [snapshot][androidx.compose.runtime.snapshots.Snapshot] [State] that
+ * produces values over time from [key1], [key2] and [key3].
+ *
+ * [producer] is launched when [produceState] enters the composition and is cancelled when
+ * [produceState] leaves the composition. If [key1], [key2] or [key3] change, a running
+ * [producer] will be cancelled and re-launched for the new source. [producer should use
+ * [ProduceStateScope.value] to set new values on the returned [State].
+ *
+ * The returned [State] conflates values; no change will be observable if
+ * [ProduceStateScope.value] is used to set a value that is [equal][Any.equals] to its old value,
+ * and observers may only see the latest value if several values are set in rapid succession.
+ *
+ * [produceState] may be used to observe either suspending or non-suspending sources of external
+ * data, for example:
+ *
+ * @sample androidx.compose.runtime.samples.ProduceState
+ *
+ * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
+ */
+@Composable
+fun <T> produceState(
+ initialValue: T,
+ key1: Any?,
+ key2: Any?,
+ key3: Any?,
+ @BuilderInference producer: suspend ProduceStateScope<T>.() -> Unit
+): State<T> {
+ val result = remember { mutableStateOf(initialValue) }
+ LaunchedEffect(key1, key2, key3) {
+ ProduceStateScopeImpl(result, coroutineContext).producer()
+ }
+ return result
+}
+
+/**
+ * Return an observable [snapshot][androidx.compose.runtime.snapshots.Snapshot] [State] that
+ * produces values over time from [keys].
+ *
+ * [producer] is launched when [produceState] enters the composition and is cancelled when
+ * [produceState] leaves the composition. If [keys] change, a running [producer] will be
+ * cancelled and re-launched for the new source. [producer] should use [ProduceStateScope.value]
+ * to set new values on the returned [State].
+ *
+ * The returned [State] conflates values; no change will be observable if
+ * [ProduceStateScope.value] is used to set a value that is [equal][Any.equals] to its old value,
+ * and observers may only see the latest value if several values are set in rapid succession.
+ *
+ * [produceState] may be used to observe either suspending or non-suspending sources of external
+ * data, for example:
+ *
+ * @sample androidx.compose.runtime.samples.ProduceState
+ *
+ * @sample androidx.compose.runtime.samples.ProduceStateAwaitDispose
+ */
+@Composable
+fun <T> produceState(
+ initialValue: T,
+ vararg keys: Any?,
+ @BuilderInference producer: suspend ProduceStateScope<T>.() -> Unit
+): State<T> {
+ val result = remember { mutableStateOf(initialValue) }
+ @Suppress("CHANGING_ARGUMENTS_EXECUTION_ORDER_FOR_NAMED_VARARGS")
+ LaunchedEffect(keys = keys) {
+ ProduceStateScopeImpl(result, coroutineContext).producer()
+ }
+ return result
+}
+
+/**
+ * [remember] a [mutableStateOf] [newValue] and update its value to [newValue] on each
+ * recomposition of the [rememberUpdatedState] call.
+ *
+ * [rememberUpdatedState] should be used when parameters or values computed during composition
+ * are referenced by a long-lived lambda or object expression. Recomposition will update the
+ * resulting [State] without recreating the long-lived lambda or object, allowing that object to
+ * persist without cancelling and resubscribing, or relaunching a long-lived operation that may
+ * be expensive or prohibitive to recreate and restart.
+ * This may be common when working with [DisposableEffect] or [LaunchedEffect], for example:
+ *
+ * @sample androidx.compose.runtime.samples.rememberUpdatedStateSampleWithDisposableEffect
+ *
+ * [LaunchedEffect]s often describe state machines that should not be reset and restarted if a
+ * parameter or event callback changes, but they should have the current value available when
+ * needed. For example:
+ *
+ * @sample androidx.compose.runtime.samples.rememberUpdatedStateSampleWithLaunchedTask
+ *
+ * By using [rememberUpdatedState] a composable function can update these operations in progress.
+ */
+@Composable
+fun <T> rememberUpdatedState(newValue: T): State<T> = remember {
+ mutableStateOf(newValue)
+}.apply { value = newValue }
+
+/**
+ * Collects values from this [StateFlow] and represents its latest value via [State].
+ * The [StateFlow.value] is used as an initial value. Every time there would be new value posted
+ * into the [StateFlow] the returned [State] will be updated causing recomposition of every
+ * [State.value] usage.
+ *
+ * @sample androidx.compose.runtime.samples.StateFlowSample
+ *
+ * @param context [CoroutineContext] to use for collecting.
+ */
+@Composable
+fun <T> StateFlow<T>.collectAsState(
+ context: CoroutineContext = EmptyCoroutineContext
+): State<T> = collectAsState(value, context)
+
+/**
+ * Collects values from this [Flow] and represents its latest value via [State]. Every time there
+ * would be new value posted into the [Flow] the returned [State] will be updated causing
+ * recomposition of every [State.value] usage.
+ *
+ * @sample androidx.compose.runtime.samples.FlowWithInitialSample
+ *
+ * @param context [CoroutineContext] to use for collecting.
+ */
+@Composable
+fun <T : R, R> Flow<T>.collectAsState(
+ initial: R,
+ context: CoroutineContext = EmptyCoroutineContext
+): State<R> = produceState(initial, this, context) {
+ if (context == EmptyCoroutineContext) {
+ collect { value = it }
+ } else withContext(context) {
+ collect { value = it }
+ }
+}
+
+/**
+ * Create a [Flow] from observable [Snapshot] state. (e.g. state holders returned by
+ * [mutableStateOf][androidx.compose.runtime.mutableStateOf].)
+ *
+ * [snapshotFlow] creates a [Flow] that runs [block] when collected and emits the result,
+ * recording any snapshot state that was accessed. While collection continues, if a new [Snapshot]
+ * is applied that changes state accessed by [block], the flow will run [block] again,
+ * re-recording the snapshot state that was accessed.
+ * If the result of [block] is not [equal to][Any.equals] the previous result, the flow will emit
+ * that new result. (This behavior is similar to that of
+ * [Flow.distinctUntilChanged][kotlinx.coroutines.flow.distinctUntilChanged].) Collection will
+ * continue indefinitely unless it is explicitly cancelled or limited by the use of other [Flow]
+ * operators.
+ *
+ * @sample androidx.compose.runtime.samples.snapshotFlowSample
+ *
+ * [block] is run in a **read-only** [Snapshot] and may not modify snapshot data. If [block]
+ * attempts to modify snapshot data, flow collection will fail with [IllegalStateException].
+ *
+ * [block] may run more than once for equal sets of inputs or only once after many rapid
+ * snapshot changes; it should be idempotent and free of side effects.
+ *
+ * When working with [Snapshot] state it is useful to keep the distinction between **events** and
+ * **state** in mind. [snapshotFlow] models snapshot changes as events, but events **cannot** be
+ * effectively modeled as observable state. Observable state is a lossy compression of the events
+ * that produced that state.
+ *
+ * An observable **event** happens at a point in time and is discarded. All registered observers
+ * at the time the event occurred are notified. All individual events in a stream are assumed
+ * to be relevant and may build on one another; repeated equal events have meaning and therefore
+ * a registered observer must observe all events without skipping.
+ *
+ * Observable **state** raises change events when the state changes from one value to a new,
+ * unequal value. State change events are **conflated;** only the most recent state matters.
+ * Observers of state changes must therefore be **idempotent;** given the same state value the
+ * observer should produce the same result. It is valid for a state observer to both skip
+ * intermediate states as well as run multiple times for the same state and the result should
+ * be the same.
+ */
+fun <T> snapshotFlow(
+ block: () -> T
+): Flow<T> = flow {
+ // Objects read the last time block was run
+ val readSet = mutableSetOf<Any>()
+ val readObserver: (Any) -> Unit = { readSet.add(it) }
+
+ // This channel may not block or lose data on an offer call.
+ val appliedChanges = Channel<Set<Any>>(Channel.UNLIMITED)
+
+ // Register the apply observer before running for the first time
+ // so that we don't miss updates.
+ val unregisterApplyObserver = Snapshot.registerApplyObserver { changed, _ ->
+ appliedChanges.offer(changed)
+ }
+
+ try {
+ var lastValue = Snapshot.takeSnapshot(readObserver).run {
+ try {
+ enter(block)
+ } finally {
+ dispose()
+ }
+ }
+ emit(lastValue)
+
+ while (true) {
+ var found = false
+ var changedObjects = appliedChanges.receive()
+
+ // Poll for any other changes before running block to minimize the number of
+ // additional times it runs for the same data
+ while (true) {
+ // Assumption: readSet will typically be smaller than changed
+ found = found || readSet.intersects(changedObjects)
+ changedObjects = appliedChanges.poll() ?: break
+ }
+
+ if (found) {
+ readSet.clear()
+ val newValue = Snapshot.takeSnapshot(readObserver).run {
+ try {
+ enter(block)
+ } finally {
+ dispose()
+ }
+ }
+
+ if (newValue != lastValue) {
+ lastValue = newValue
+ emit(newValue)
+ }
+ }
+ }
+ } finally {
+ unregisterApplyObserver.dispose()
+ }
+}
+
+/**
+ * Return `true` if there are any elements shared between `this` and [other]
+ */
+private fun <T> Set<T>.intersects(other: Set<T>): Boolean =
+ if (size < other.size) any { it in other } else other.any { it in this }
\ No newline at end of file
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SuspendingEffects.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SuspendingEffects.kt
deleted file mode 100644
index 4f4ba72..0000000
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SuspendingEffects.kt
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-// TODO(b/158105080): make part of ComposeRuntime
-@file:OptIn(InternalComposeApi::class)
-package androidx.compose.runtime
-
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Job
-import kotlinx.coroutines.cancel
-import kotlin.coroutines.CoroutineContext
-import kotlin.coroutines.EmptyCoroutineContext
-
-@PublishedApi
-internal class CompositionScopedCoroutineScopeCanceller(
- val coroutineScope: CoroutineScope
-) : RememberObserver {
- override fun onRemembered() {
- // Nothing to do
- }
-
- override fun onForgotten() {
- coroutineScope.cancel()
- }
-
- override fun onAbandoned() {
- coroutineScope.cancel()
- }
-}
-
-@PublishedApi
-@OptIn(ExperimentalComposeApi::class)
-internal fun createCompositionCoroutineScope(
- coroutineContext: CoroutineContext,
- composer: Composer
-) = if (coroutineContext[Job] != null) {
- CoroutineScope(
- Job().apply {
- completeExceptionally(
- IllegalArgumentException(
- "CoroutineContext supplied to " +
- "rememberCoroutineScope may not include a parent job"
- )
- )
- }
- )
-} else {
- val applyContext = composer.applyCoroutineContext
- CoroutineScope(applyContext + Job(applyContext[Job]) + coroutineContext)
-}
-
-/**
- * Return a [CoroutineScope] bound to this point in the composition using the optional
- * [CoroutineContext] provided by [getContext]. [getContext] will only be called once and the same
- * [CoroutineScope] instance will be returned across recompositions.
- *
- * This scope will be [cancelled][CoroutineScope.cancel] when this call leaves the composition.
- * The [CoroutineContext] returned by [getContext] may not contain a [Job] as this scope is
- * considered to be a child of the composition.
- *
- * The default dispatcher of this scope if one is not provided by the context returned by
- * [getContext] will be the applying dispatcher of the composition's [Recomposer].
- *
- * Use this scope to launch jobs in response to callback events such as clicks or other user
- * interaction where the response to that event needs to unfold over time and be cancelled if the
- * composable managing that process leaves the composition. Jobs should never be launched into
- * **any** coroutine scope as a side effect of composition itself. For scoped ongoing jobs
- * initiated by composition, see [LaunchedEffect].
- *
- * This function will not throw if preconditions are not met, as composable functions do not yet
- * fully support exceptions. Instead the returned scope's [CoroutineScope.coroutineContext] will
- * contain a failed [Job] with the associated exception and will not be capable of launching
- * child jobs.
- */
-@Composable
-inline fun rememberCoroutineScope(
- getContext: @DisallowComposableCalls () -> CoroutineContext = { EmptyCoroutineContext }
-): CoroutineScope {
- val composer = currentComposer
- val wrapper = remember {
- CompositionScopedCoroutineScopeCanceller(
- createCompositionCoroutineScope(getContext(), composer)
- )
- }
- return wrapper.coroutineScope
-}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityScopeMap.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityScopeMap.kt
index 8a9cec8..6947fb1 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityScopeMap.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityScopeMap.kt
@@ -23,7 +23,6 @@
* Maps values to a set of scopes using the [identityHashCode] for both the value and the
* scope for uniqueness.
*/
-@Suppress("NOTHING_TO_INLINE")
@OptIn(ExperimentalContracts::class)
internal class IdentityScopeMap<T : Any> {
/**
@@ -57,6 +56,7 @@
/**
* Returns the value at the given [index] order in the map.
*/
+ @Suppress("NOTHING_TO_INLINE")
private inline fun valueAt(index: Int): Any {
return values[valueOrder[index]]!!
}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/ComposableLambda.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/ComposableLambda.kt
index d1583aa..6bcb3e0 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/ComposableLambda.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/ComposableLambda.kt
@@ -44,39 +44,13 @@
* multiple levels of composable functions.
*/
@Stable
-@ComposeCompilerApi
+@OptIn(ComposeCompilerApi::class)
/* ktlint-disable parameter-list-wrapping */ // TODO(https://github.com/pinterest/ktlint/issues/921): reenable
-class ComposableLambda<
- P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16,
- P17, P18, R>(
+internal class ComposableLambdaImpl(
val key: Int,
private val tracked: Boolean,
private val sourceInformation: String?
-) :
- Function2<Composer, Int, R>,
- Function3<P1, Composer, Int, R>,
- Function4<P1, P2, Composer, Int, R>,
- Function5<P1, P2, P3, Composer, Int, R>,
- Function6<P1, P2, P3, P4, Composer, Int, R>,
- Function7<P1, P2, P3, P4, P5, Composer, Int, R>,
- Function8<P1, P2, P3, P4, P5, P6, Composer, Int, R>,
- Function9<P1, P2, P3, P4, P5, P6, P7, Composer, Int, R>,
- Function10<P1, P2, P3, P4, P5, P6, P7, P8, Composer, Int, R>,
- Function11<P1, P2, P3, P4, P5, P6, P7, P8, P9, Composer, Int, R>,
- Function13<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, Composer, Int, Int, R>,
- Function14<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, Composer, Int, Int, R>,
- Function15<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, Composer, Int, Int, R>,
- Function16<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Composer, Int, Int, R>,
- Function17<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, Composer, Int,
- Int, R>,
- Function18<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, Composer,
- Int, Int, R>,
- Function19<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16,
- Composer, Int, Int, R>,
- Function20<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17,
- Composer, Int, Int, R>,
- Function21<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18,
- Composer, Int, Int, R> {
+) : ComposableLambda {
private var _block: Any? = null
private var scope: RecomposeScope? = null
private var scopes: MutableList<RecomposeScope>? = null
@@ -139,25 +113,25 @@
}
}
- override operator fun invoke(c: Composer, changed: Int): R {
+ override operator fun invoke(c: Composer, changed: Int): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed or if (c.changed(this)) differentBits(0) else sameBits(0)
- val result = (_block as (c: Composer, changed: Int) -> R)(c, dirty)
+ val result = (_block as (c: Composer, changed: Int) -> Any?)(c, dirty)
c.endRestartGroup()?.updateScope(this as (Composer, Int) -> Unit)
return result
}
- override operator fun invoke(p1: P1, c: Composer, changed: Int): R {
+ override operator fun invoke(p1: Any?, c: Composer, changed: Int): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed or if (c.changed(this)) differentBits(1) else sameBits(1)
val result = (
_block as (
- p1: P1,
+ p1: Any?,
c: Composer,
changed: Int
- ) -> R
+ ) -> Any?
)(
p1,
c,
@@ -167,11 +141,11 @@
return result
}
- override operator fun invoke(p1: P1, p2: P2, c: Composer, changed: Int): R {
+ override operator fun invoke(p1: Any?, p2: Any?, c: Composer, changed: Int): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed or if (c.changed(this)) differentBits(2) else sameBits(2)
- val result = (_block as (p1: P1, p2: P2, c: Composer, changed: Int) -> R)(
+ val result = (_block as (p1: Any?, p2: Any?, c: Composer, changed: Int) -> Any?)(
p1,
p2,
c,
@@ -181,18 +155,18 @@
return result
}
- override operator fun invoke(p1: P1, p2: P2, p3: P3, c: Composer, changed: Int): R {
+ override operator fun invoke(p1: Any?, p2: Any?, p3: Any?, c: Composer, changed: Int): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed or if (c.changed(this)) differentBits(3) else sameBits(3)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
c: Composer,
changed: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -205,25 +179,25 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
c: Composer,
changed: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed or if (c.changed(this)) differentBits(4) else sameBits(4)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
c: Composer,
changed: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -239,27 +213,27 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
c: Composer,
changed: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed or if (c.changed(this)) differentBits(5) else sameBits(5)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
c: Composer,
changed: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -276,29 +250,29 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
c: Composer,
changed: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed or if (c.changed(this)) differentBits(6) else sameBits(6)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
c: Composer,
changed: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -316,31 +290,31 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
c: Composer,
changed: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed or if (c.changed(this)) differentBits(7) else sameBits(7)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
c: Composer,
changed: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -359,33 +333,33 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
c: Composer,
changed: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed or if (c.changed(this)) differentBits(8) else sameBits(8)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
c: Composer,
changed: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -405,35 +379,35 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
c: Composer,
changed: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed or if (c.changed(this)) differentBits(9) else sameBits(9)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
c: Composer,
changed: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -454,39 +428,39 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
c: Composer,
changed: Int,
changed1: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed1 or if (c.changed(this)) differentBits(10) else sameBits(10)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
c: Composer,
changed: Int,
changed1: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -509,41 +483,41 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
c: Composer,
changed: Int,
changed1: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed1 or if (c.changed(this)) differentBits(11) else sameBits(11)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
c: Composer,
changed: Int,
changed1: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -567,43 +541,43 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
c: Composer,
changed: Int,
changed1: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed1 or if (c.changed(this)) differentBits(12) else sameBits(12)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
c: Composer,
changed: Int,
changed1: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -628,45 +602,45 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
c: Composer,
changed: Int,
changed1: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed1 or if (c.changed(this)) differentBits(13) else sameBits(13)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
c: Composer,
changed: Int,
changed1: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -709,47 +683,47 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
- p14: P14,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
+ p14: Any?,
c: Composer,
changed: Int,
changed1: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed1 or if (c.changed(this)) differentBits(14) else sameBits(14)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
- p14: P14,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
+ p14: Any?,
c: Composer,
changed: Int,
changed1: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -794,49 +768,49 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
- p14: P14,
- p15: P15,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
+ p14: Any?,
+ p15: Any?,
c: Composer,
changed: Int,
changed1: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed1 or if (c.changed(this)) differentBits(15) else sameBits(15)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
- p14: P14,
- p15: P15,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
+ p14: Any?,
+ p15: Any?,
c: Composer,
changed: Int,
changed1: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -883,51 +857,51 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
- p14: P14,
- p15: P15,
- p16: P16,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
+ p14: Any?,
+ p15: Any?,
+ p16: Any?,
c: Composer,
changed: Int,
changed1: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed1 or if (c.changed(this)) differentBits(16) else sameBits(16)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
- p14: P14,
- p15: P15,
- p16: P16,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
+ p14: Any?,
+ p15: Any?,
+ p16: Any?,
c: Composer,
changed: Int,
changed1: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -976,53 +950,53 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
- p14: P14,
- p15: P15,
- p16: P16,
- p17: P17,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
+ p14: Any?,
+ p15: Any?,
+ p16: Any?,
+ p17: Any?,
c: Composer,
changed: Int,
changed1: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed1 or if (c.changed(this)) differentBits(17) else sameBits(17)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
- p14: P14,
- p15: P15,
- p16: P16,
- p17: P17,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
+ p14: Any?,
+ p15: Any?,
+ p16: Any?,
+ p17: Any?,
c: Composer,
changed: Int,
changed1: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -1073,55 +1047,55 @@
}
override operator fun invoke(
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
- p14: P14,
- p15: P15,
- p16: P16,
- p17: P17,
- p18: P18,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
+ p14: Any?,
+ p15: Any?,
+ p16: Any?,
+ p17: Any?,
+ p18: Any?,
c: Composer,
changed: Int,
changed1: Int
- ): R {
+ ): Any? {
c.startRestartGroup(key, sourceInformation)
trackRead(c)
val dirty = changed1 or if (c.changed(this)) differentBits(18) else sameBits(18)
val result = (
_block as (
- p1: P1,
- p2: P2,
- p3: P3,
- p4: P4,
- p5: P5,
- p6: P6,
- p7: P7,
- p8: P8,
- p9: P9,
- p10: P10,
- p11: P11,
- p12: P12,
- p13: P13,
- p14: P14,
- p15: P15,
- p16: P16,
- p17: P17,
- p18: P18,
+ p1: Any?,
+ p2: Any?,
+ p3: Any?,
+ p4: Any?,
+ p5: Any?,
+ p6: Any?,
+ p7: Any?,
+ p8: Any?,
+ p9: Any?,
+ p10: Any?,
+ p11: Any?,
+ p12: Any?,
+ p13: Any?,
+ p14: Any?,
+ p15: Any?,
+ p16: Any?,
+ p17: Any?,
+ p18: Any?,
c: Composer,
changed: Int,
changed1: Int
- ) -> R
+ ) -> Any?
)(
p1,
p2,
@@ -1181,9 +1155,38 @@
)
)
-@OptIn(ComposeCompilerApi::class)
-private typealias CLambda = ComposableLambda<Any, Any, Any, Any, Any, Any, Any, Any, Any, Any,
- Any, Any, Any, Any, Any, Any, Any, Any, Any>
+@ComposeCompilerApi
+@Stable
+interface ComposableLambda :
+ Function2<Composer, Int, Any?>,
+ Function3<Any?, Composer, Int, Any?>,
+ Function4<Any?, Any?, Composer, Int, Any?>,
+ Function5<Any?, Any?, Any?, Composer, Int, Any?>,
+ Function6<Any?, Any?, Any?, Any?, Composer, Int, Any?>,
+ Function7<Any?, Any?, Any?, Any?, Any?, Composer, Int, Any?>,
+ Function8<Any?, Any?, Any?, Any?, Any?, Any?, Composer, Int, Any?>,
+ Function9<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Composer, Int, Any?>,
+ Function10<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Composer, Int, Any?>,
+ Function11<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Composer, Int, Any?>,
+ Function13<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Composer, Int, Int,
+ Any?>,
+ Function14<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Composer, Int, Int,
+ Any?>,
+ Function15<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Composer,
+ Int, Int, Any?>,
+ Function16<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?,
+ Composer, Int, Int, Any?>,
+ Function17<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?,
+ Composer, Int,
+ Int, Any?>,
+ Function18<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?,
+ Any?, Composer, Int, Int, Any?>,
+ Function19<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?,
+ Any?, Any?, Composer, Int, Int, Any?>,
+ Function20<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?,
+ Any?, Any?, Any?, Composer, Int, Int, Any?>,
+ Function21<Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?,
+ Any?, Any?, Any?, Any?, Composer, Int, Int, Any?>
@Suppress("unused")
@ComposeCompilerApi
@@ -1193,15 +1196,15 @@
tracked: Boolean,
sourceInformation: String?,
block: Any
-): CLambda {
+): ComposableLambda {
composer.startReplaceableGroup(key)
val slot = composer.rememberedValue()
val result = if (slot === Composer.Empty) {
- val value = CLambda(key, tracked, sourceInformation)
+ val value = ComposableLambdaImpl(key, tracked, sourceInformation)
composer.updateRememberedValue(value)
value
} else {
- slot as CLambda
+ slot as ComposableLambdaImpl
}
result.update(block)
composer.endReplaceableGroup()
@@ -1210,5 +1213,10 @@
@Suppress("unused")
@ComposeCompilerApi
-fun composableLambdaInstance(key: Int, tracked: Boolean, sourceInformation: String?, block: Any) =
- CLambda(key, tracked, sourceInformation).apply { update(block) }
+fun composableLambdaInstance(
+ key: Int,
+ tracked: Boolean,
+ sourceInformation: String?,
+ block: Any
+): ComposableLambda =
+ ComposableLambdaImpl(key, tracked, sourceInformation).apply { update(block) }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/LiveLiteral.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/LiveLiteral.kt
index b00fb76..4398df4 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/LiveLiteral.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/LiveLiteral.kt
@@ -30,6 +30,7 @@
* @param offset The startOffset of the literal in the source file at the time of compilation.
*/
@ComposeCompilerApi
+@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
annotation class LiveLiteralInfo(
val key: String,
@@ -43,6 +44,7 @@
* @param file The file path of the file the associate LiveLiterals class was produced for
*/
@ComposeCompilerApi
+@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class LiveLiteralFileInfo(
val file: String
@@ -51,15 +53,30 @@
private val liveLiteralCache = HashMap<String, MutableState<Any?>>()
@InternalComposeApi
+@ComposeCompilerApi
var isLiveLiteralsEnabled: Boolean = false
private set
+/**
+ * When called, all live literals will start to use their values backed by [MutableState].
+ *
+ * Caution: This API is intended to be used by tooling only. Use at your own risk.
+ */
@InternalComposeApi
+@OptIn(ComposeCompilerApi::class)
fun enableLiveLiterals() {
isLiveLiteralsEnabled = true
}
+/**
+ * Constructs a [State] object identified by the provided global [key] and initialized to the
+ * provided [value]. This value may then be updated from tooling with the
+ * [updateLiveLiteralValue] API. Only a single [State] object will be created for any given [key].
+ *
+ * Caution: This API is intended to be used by tooling only. Use at your own risk.
+ */
@InternalComposeApi
+@ComposeCompilerApi
fun <T> liveLiteral(key: String, value: T): State<T> {
@Suppress("UNCHECKED_CAST")
return liveLiteralCache.getOrPut(key) {
@@ -67,6 +84,9 @@
} as State<T>
}
+/**
+ * Updates the value of a [State] object that was created by [liveLiteral] with the same key.
+ */
@InternalComposeApi
fun updateLiveLiteralValue(key: String, value: Any?) {
var needToUpdate = true
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/StabilityInferred.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/StabilityInferred.kt
index 79881de..1fc13dd 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/StabilityInferred.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/StabilityInferred.kt
@@ -28,6 +28,7 @@
* indicates that the stability of the annotated class should be calculated as a combination of
* the stability of the class itself and the stability of that type parameter.
*/
-@Retention(AnnotationRetention.BINARY)
@ComposeCompilerApi
+@Target(AnnotationTarget.CLASS)
+@Retention(AnnotationRetention.BINARY)
annotation class StabilityInferred(val parameters: Int)
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotFlow.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotFlow.kt
index 7cce4a6..c6533cc 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotFlow.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotFlow.kt
@@ -17,113 +17,6 @@
package androidx.compose.runtime.snapshots
import androidx.compose.runtime.ExperimentalComposeApi
-import kotlinx.coroutines.channels.Channel
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.flow
-
-/**
- * Create a [Flow] from observable [Snapshot] state. (e.g. state holders returned by
- * [mutableStateOf][androidx.compose.runtime.mutableStateOf].)
- *
- * [snapshotFlow] creates a [Flow] that runs [block] when collected and emits the result,
- * recording any snapshot state that was accessed. While collection continues, if a new [Snapshot]
- * is applied that changes state accessed by [block], the flow will run [block] again,
- * re-recording the snapshot state that was accessed.
- * If the result of [block] is not [equal to][Any.equals] the previous result, the flow will emit
- * that new result. (This behavior is similar to that of
- * [Flow.distinctUntilChanged][kotlinx.coroutines.flow.distinctUntilChanged].) Collection will
- * continue indefinitely unless it is explicitly cancelled or limited by the use of other [Flow]
- * operators.
- *
- * @sample androidx.compose.runtime.samples.snapshotFlowSample
- *
- * [block] is run in a **read-only** [Snapshot] and may not modify snapshot data. If [block]
- * attempts to modify snapshot data, flow collection will fail with [IllegalStateException].
- *
- * [block] may run more than once for equal sets of inputs or only once after many rapid
- * snapshot changes; it should be idempotent and free of side effects.
- *
- * When working with [Snapshot] state it is useful to keep the distinction between **events** and
- * **state** in mind. [snapshotFlow] models snapshot changes as events, but events **cannot** be
- * effectively modeled as observable state. Observable state is a lossy compression of the events
- * that produced that state.
- *
- * An observable **event** happens at a point in time and is discarded. All registered observers
- * at the time the event occurred are notified. All individual events in a stream are assumed
- * to be relevant and may build on one another; repeated equal events have meaning and therefore
- * a registered observer must observe all events without skipping.
- *
- * Observable **state** raises change events when the state changes from one value to a new,
- * unequal value. State change events are **conflated;** only the most recent state matters.
- * Observers of state changes must therefore be **idempotent;** given the same state value the
- * observer should produce the same result. It is valid for a state observer to both skip
- * intermediate states as well as run multiple times for the same state and the result should
- * be the same.
- */
-fun <T> snapshotFlow(
- block: () -> T
-): Flow<T> = flow {
- // Objects read the last time block was run
- val readSet = mutableSetOf<Any>()
- val readObserver: (Any) -> Unit = { readSet.add(it) }
-
- // This channel may not block or lose data on an offer call.
- val appliedChanges = Channel<Set<Any>>(Channel.UNLIMITED)
-
- // Register the apply observer before running for the first time
- // so that we don't miss updates.
- val unregisterApplyObserver = Snapshot.registerApplyObserver { changed, _ ->
- appliedChanges.offer(changed)
- }
-
- try {
- var lastValue = Snapshot.takeSnapshot(readObserver).run {
- try {
- enter(block)
- } finally {
- dispose()
- }
- }
- emit(lastValue)
-
- while (true) {
- var found = false
- var changedObjects = appliedChanges.receive()
-
- // Poll for any other changes before running block to minimize the number of
- // additional times it runs for the same data
- while (true) {
- // Assumption: readSet will typically be smaller than changed
- found = found || readSet.intersects(changedObjects)
- changedObjects = appliedChanges.poll() ?: break
- }
-
- if (found) {
- readSet.clear()
- val newValue = Snapshot.takeSnapshot(readObserver).run {
- try {
- enter(block)
- } finally {
- dispose()
- }
- }
-
- if (newValue != lastValue) {
- lastValue = newValue
- emit(newValue)
- }
- }
- }
- } finally {
- unregisterApplyObserver.dispose()
- }
-}
-
-/**
- * Return `true` if there are any elements shared between `this` and [other]
- */
-private fun <T> Set<T>.intersects(other: Set<T>): Boolean =
- if (size < other.size) any { it in other } else other.any { it in this }
/**
* Take a [MutableSnapshot] and run [block] within it. When [block] returns successfully,
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionData.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/tooling/CompositionData.kt
similarity index 96%
rename from compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionData.kt
rename to compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/tooling/CompositionData.kt
index 53aa673..630f878 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionData.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/tooling/CompositionData.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 The Android Open Source Project
+ * Copyright 2021 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.runtime
+package androidx.compose.runtime.tooling
/**
* A [CompositionData] is the data tracked by the composer during composition.
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/tooling/InspectionTables.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/tooling/InspectionTables.kt
index 6382a8f..2f30c41 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/tooling/InspectionTables.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/tooling/InspectionTables.kt
@@ -16,7 +16,6 @@
package androidx.compose.runtime.tooling
-import androidx.compose.runtime.CompositionData
import androidx.compose.runtime.InternalComposeApi
import androidx.compose.runtime.staticCompositionLocalOf
diff --git a/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/ActualDesktop.kt b/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/ActualDesktop.kt
index c494970..06f7e35 100644
--- a/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/ActualDesktop.kt
+++ b/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/ActualDesktop.kt
@@ -29,63 +29,6 @@
}
}
-internal val keyInfo = mutableMapOf<Int, String>()
-
-private fun findSourceKey(key: Any): Int? =
- when (key) {
- is Int -> key
- is JoinedKey -> {
- key.left?.let { findSourceKey(it) } ?: key.right?.let { findSourceKey(it) }
- }
- else -> null
- }
-
-// TODO(igotti): likely incorrect for the desktop.
-internal actual fun recordSourceKeyInfo(key: Any) {
- val sk = findSourceKey(key)
- sk?.let {
- keyInfo.getOrPut(
- sk,
- {
- val stack = Thread.currentThread().stackTrace
- // On Android the frames looks like:
- // 0: getThreadStackTrace() (native method)
- // 1: getStackTrace()
- // 2: recordSourceKey()
- // 3: start()
- // 4: startGroup() or startNode()
- // 5: non-inline call/emit?
- // 5 or 6: <calling method>
- // On a desktop VM this looks like:
- // 0: getStackTrace()
- // 1: recordSourceKey()
- // 2: start()
- // 3: startGroup() or startNode()
- // 4: non-inline call/emit?
- // 4 or 5: <calling method>
- // If the stack method at 4 is startGroup assume we want 5 instead.
- val frameNumber = stack[4].let {
- if (it.methodName == "startGroup" || it.methodName == "startNode") 5 else 4
- }
- val frame = stack[frameNumber].let {
- if (it.methodName == "call" || it.methodName == "emit")
- stack[frameNumber + 1]
- else
- stack[frameNumber]
- }
- "${frame.className}.${frame.methodName} (${frame.fileName}:${frame.lineNumber})"
- }
- )
- }
-}
-
-@InternalComposeApi
-actual fun keySourceInfoOf(key: Any): String? = keyInfo[key]
-
-actual fun resetSourceInfo() {
- keyInfo.clear()
-}
-
// TODO(igotti): do we need actual processing for those?
actual annotation class CheckResult(actual val suggest: String)
diff --git a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/ActualJvm.kt b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/ActualJvm.kt
index e61fdc6..63a02e2 100644
--- a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/ActualJvm.kt
+++ b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/ActualJvm.kt
@@ -35,8 +35,6 @@
}
}
-internal actual typealias WeakHashMap<K, V> = java.util.WeakHashMap<K, V>
-
internal actual fun identityHashCode(instance: Any?): Int = System.identityHashCode(instance)
@PublishedApi
diff --git a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/ComposableLambdaN.kt b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/ComposableLambdaN.kt
index b20af51..dcda03e 100644
--- a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/ComposableLambdaN.kt
+++ b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/ComposableLambdaN.kt
@@ -26,13 +26,13 @@
private const val SLOTS_PER_INT = 10
@Stable
-@ComposeCompilerApi
-class ComposableLambdaN<R>(
+@OptIn(ComposeCompilerApi::class)
+internal class ComposableLambdaNImpl(
val key: Int,
private val tracked: Boolean,
private val sourceInformation: String?,
override val arity: Int
-) : FunctionN<R> {
+) : ComposableLambdaN {
private var _block: Any? = null
fun update(block: Any, composer: Composer?) {
@@ -56,7 +56,7 @@
return realParams
}
- override fun invoke(vararg args: Any?): R {
+ override fun invoke(vararg args: Any?): Any? {
val realParams = realParamCount(args.size)
val c = args[realParams] as Composer
val allArgsButLast = args.slice(0 until args.size - 1).toTypedArray()
@@ -70,7 +70,7 @@
c.recordReadOf(this)
}
@Suppress("UNCHECKED_CAST")
- val result = (_block as FunctionN<*>)(*allArgsButLast, dirty) as R
+ val result = (_block as FunctionN<*>)(*allArgsButLast, dirty)
c.endRestartGroup()?.updateScope { nc, _ ->
val params = args.slice(0 until realParams).toTypedArray()
@Suppress("UNUSED_VARIABLE")
@@ -87,6 +87,10 @@
}
}
+@Stable
+@ComposeCompilerApi
+interface ComposableLambdaN : FunctionN<Any?>
+
@Suppress("unused")
@ComposeCompilerApi
fun composableLambdaN(
@@ -96,16 +100,16 @@
sourceInformation: String?,
arity: Int,
block: Any
-): ComposableLambdaN<*> {
+): ComposableLambdaN {
composer.startReplaceableGroup(key)
val slot = composer.rememberedValue()
val result = if (slot === Composer.Empty) {
- val value = ComposableLambdaN<Any>(key, tracked, sourceInformation, arity)
+ val value = ComposableLambdaNImpl(key, tracked, sourceInformation, arity)
composer.updateRememberedValue(value)
value
} else {
@Suppress("UNCHECKED_CAST")
- slot as ComposableLambdaN<Any>
+ slot as ComposableLambdaNImpl
}
result.update(block, composer)
composer.endReplaceableGroup()
@@ -117,11 +121,12 @@
fun composableLambdaNInstance(
key: Int,
tracked: Boolean,
+ sourceInformation: String?,
arity: Int,
block: Any
-): ComposableLambdaN<*> = ComposableLambdaN<Any>(
+): ComposableLambdaN = ComposableLambdaNImpl(
key,
tracked,
- null,
+ sourceInformation,
arity
).apply { update(block, null) }
diff --git a/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/CompositionTests.kt b/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/CompositionTests.kt
index 8ffeca4c..96ebd0d 100644
--- a/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/CompositionTests.kt
+++ b/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/CompositionTests.kt
@@ -44,7 +44,6 @@
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.runBlockingTest
-import kotlin.test.AfterTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals
@@ -57,12 +56,6 @@
@OptIn(ExperimentalComposeApi::class, InternalComposeApi::class)
@Suppress("unused")
class CompositionTests {
-
- @AfterTest
- fun teardown() {
- clearRoots()
- }
-
@Test
fun simple() = compositionTest {
compose {
diff --git a/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/snapshots/SnapshotFlowTests.kt b/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/SnapshotFlowTests.kt
similarity index 91%
rename from compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/snapshots/SnapshotFlowTests.kt
rename to compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/SnapshotFlowTests.kt
index 5c9a611..e12fb21 100644
--- a/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/snapshots/SnapshotFlowTests.kt
+++ b/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/SnapshotFlowTests.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 The Android Open Source Project
+ * Copyright 2021 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.
@@ -14,12 +14,9 @@
* limitations under the License.
*/
-package androidx.compose.runtime.snapshots
+package androidx.compose.runtime
-import androidx.compose.runtime.ExperimentalComposeApi
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.setValue
+import androidx.compose.runtime.snapshots.Snapshot
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
diff --git a/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/mock/CompositionTest.kt b/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/mock/CompositionTest.kt
index 67a7da2..7c1814d 100644
--- a/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/mock/CompositionTest.kt
+++ b/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/mock/CompositionTest.kt
@@ -48,7 +48,7 @@
check(!composed) { "Compose should only be called once" }
composed = true
root = View().apply { name = "root" }
- val composition = Composition(root, ViewApplier(root), recomposer)
+ val composition = Composition(ViewApplier(root), recomposer)
this.composition = composition
composition.setContent(block)
}
diff --git a/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/CompositionDataTests.kt b/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/tooling/CompositionDataTests.kt
similarity index 95%
rename from compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/CompositionDataTests.kt
rename to compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/tooling/CompositionDataTests.kt
index 20ee054..42c8edf 100644
--- a/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/CompositionDataTests.kt
+++ b/compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/tooling/CompositionDataTests.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 The Android Open Source Project
+ * Copyright 2021 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.
@@ -14,8 +14,13 @@
* limitations under the License.
*/
-package androidx.compose.runtime
+package androidx.compose.runtime.tooling
+import androidx.compose.runtime.InternalComposeApi
+import androidx.compose.runtime.SlotTable
+import androidx.compose.runtime.group
+import androidx.compose.runtime.insert
+import androidx.compose.runtime.nodeGroup
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
diff --git a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/ComposeInspectionRule.kt b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/ComposeInspectionRule.kt
index 4670f72..61ed7f6 100644
--- a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/ComposeInspectionRule.kt
+++ b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/ComposeInspectionRule.kt
@@ -18,7 +18,7 @@
import android.app.Activity
import android.view.inspector.WindowInspector
-import androidx.compose.runtime.CompositionData
+import androidx.compose.runtime.tooling.CompositionData
import androidx.compose.ui.R
import androidx.compose.ui.platform.ViewRootForTest
import androidx.inspection.testing.InspectorTester
diff --git a/compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/compose/ui/test/junit4/StateRestorationTester.kt b/compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/compose/ui/test/junit4/StateRestorationTester.kt
index 7602ef9..5aef10f 100644
--- a/compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/compose/ui/test/junit4/StateRestorationTester.kt
+++ b/compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/compose/ui/test/junit4/StateRestorationTester.kt
@@ -17,7 +17,7 @@
package androidx.compose.ui.test.junit4
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -83,7 +83,7 @@
"a SaveableStateRegistry implementation via LocalSaveableStateRegistry"
}
val restorationRegistry = remember { RestorationRegistry(original) }
- Providers(LocalSaveableStateRegistry provides restorationRegistry) {
+ CompositionLocalProvider(LocalSaveableStateRegistry provides restorationRegistry) {
if (restorationRegistry.shouldEmitChildren) {
content(restorationRegistry)
}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/SendSwipeTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/SendSwipeTest.kt
index 6e407b2..3838ccd 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/SendSwipeTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/SendSwipeTest.kt
@@ -26,7 +26,7 @@
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
@@ -167,7 +167,7 @@
val touchSlop = TestTouchSlop
val scrollState = ScrollState(initial = 0f)
rule.setContent {
- Providers(LocalViewConfiguration provides FakeViewConfiguration) {
+ CompositionLocalProvider(LocalViewConfiguration provides FakeViewConfiguration) {
with(LocalDensity.current) {
// Scrollable with a viewport the size of 10 boxes
Column(
diff --git a/compose/ui/ui-tooling-data/api/current.txt b/compose/ui/ui-tooling-data/api/current.txt
index 3a629b7..14c7473 100644
--- a/compose/ui/ui-tooling-data/api/current.txt
+++ b/compose/ui/ui-tooling-data/api/current.txt
@@ -70,7 +70,7 @@
}
public final class SlotTreeKt {
- method @androidx.compose.ui.tooling.data.UiToolingDataApi public static androidx.compose.ui.tooling.data.Group asTree(androidx.compose.runtime.CompositionData);
+ method @androidx.compose.ui.tooling.data.UiToolingDataApi public static androidx.compose.ui.tooling.data.Group asTree(androidx.compose.runtime.tooling.CompositionData);
method @androidx.compose.ui.tooling.data.UiToolingDataApi public static String? getPosition(androidx.compose.ui.tooling.data.Group);
}
diff --git a/compose/ui/ui-tooling-data/api/public_plus_experimental_current.txt b/compose/ui/ui-tooling-data/api/public_plus_experimental_current.txt
index 3a629b7..14c7473 100644
--- a/compose/ui/ui-tooling-data/api/public_plus_experimental_current.txt
+++ b/compose/ui/ui-tooling-data/api/public_plus_experimental_current.txt
@@ -70,7 +70,7 @@
}
public final class SlotTreeKt {
- method @androidx.compose.ui.tooling.data.UiToolingDataApi public static androidx.compose.ui.tooling.data.Group asTree(androidx.compose.runtime.CompositionData);
+ method @androidx.compose.ui.tooling.data.UiToolingDataApi public static androidx.compose.ui.tooling.data.Group asTree(androidx.compose.runtime.tooling.CompositionData);
method @androidx.compose.ui.tooling.data.UiToolingDataApi public static String? getPosition(androidx.compose.ui.tooling.data.Group);
}
diff --git a/compose/ui/ui-tooling-data/api/restricted_current.txt b/compose/ui/ui-tooling-data/api/restricted_current.txt
index 3a629b7..14c7473 100644
--- a/compose/ui/ui-tooling-data/api/restricted_current.txt
+++ b/compose/ui/ui-tooling-data/api/restricted_current.txt
@@ -70,7 +70,7 @@
}
public final class SlotTreeKt {
- method @androidx.compose.ui.tooling.data.UiToolingDataApi public static androidx.compose.ui.tooling.data.Group asTree(androidx.compose.runtime.CompositionData);
+ method @androidx.compose.ui.tooling.data.UiToolingDataApi public static androidx.compose.ui.tooling.data.Group asTree(androidx.compose.runtime.tooling.CompositionData);
method @androidx.compose.ui.tooling.data.UiToolingDataApi public static String? getPosition(androidx.compose.ui.tooling.data.Group);
}
diff --git a/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/BoundsTest.kt b/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/BoundsTest.kt
index 0d82800..39ad39e 100644
--- a/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/BoundsTest.kt
+++ b/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/BoundsTest.kt
@@ -21,11 +21,9 @@
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Text
-import androidx.compose.runtime.InternalComposeApi
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.resetSourceInfo
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalDensity
@@ -35,7 +33,6 @@
import androidx.test.filters.LargeTest
import androidx.test.filters.MediumTest
import org.junit.Assert
-import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.util.concurrent.CountDownLatch
@@ -48,12 +45,6 @@
fun Group.all(): Collection<Group> =
listOf(this) + this.children.flatMap { it.all() }
- @Before
- fun reset() {
- @OptIn(InternalComposeApi::class)
- resetSourceInfo()
- }
-
@Test
fun testBounds() {
val slotTableRecord = CompositionDataRecord.create()
diff --git a/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/Inspectable.kt b/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/Inspectable.kt
index b6b8d50..cd30be8 100644
--- a/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/Inspectable.kt
+++ b/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/Inspectable.kt
@@ -17,9 +17,9 @@
package androidx.compose.ui.tooling.data
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.CompositionData
+import androidx.compose.runtime.tooling.CompositionData
import androidx.compose.runtime.InternalComposeApi
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.currentComposer
import androidx.compose.runtime.tooling.LocalInspectionTables
import androidx.compose.ui.platform.LocalInspectionMode
@@ -61,7 +61,7 @@
currentComposer.collectParameterInformation()
val store = (compositionDataRecord as CompositionDataRecordImpl).store
store.add(currentComposer.compositionData)
- Providers(
+ CompositionLocalProvider(
LocalInspectionMode provides true,
LocalInspectionTables provides store,
content = content
diff --git a/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/ToolingTest.kt b/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/ToolingTest.kt
index b9c95d9..84c58f8 100644
--- a/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/ToolingTest.kt
+++ b/compose/ui/ui-tooling-data/src/androidTest/java/androidx/compose/ui/tooling/data/ToolingTest.kt
@@ -22,7 +22,7 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.CompositionData
+import androidx.compose.runtime.tooling.CompositionData
import androidx.compose.ui.Modifier
import androidx.compose.ui.R
import androidx.compose.ui.layout.onGloballyPositioned
diff --git a/compose/ui/ui-tooling-data/src/main/java/androidx/compose/ui/tooling/data/SlotTree.kt b/compose/ui/ui-tooling-data/src/main/java/androidx/compose/ui/tooling/data/SlotTree.kt
index aba023e..d15cd5a 100644
--- a/compose/ui/ui-tooling-data/src/main/java/androidx/compose/ui/tooling/data/SlotTree.kt
+++ b/compose/ui/ui-tooling-data/src/main/java/androidx/compose/ui/tooling/data/SlotTree.kt
@@ -16,8 +16,8 @@
package androidx.compose.ui.tooling.data
-import androidx.compose.runtime.CompositionData
-import androidx.compose.runtime.CompositionGroup
+import androidx.compose.runtime.tooling.CompositionData
+import androidx.compose.runtime.tooling.CompositionGroup
import androidx.compose.ui.layout.LayoutInfo
import androidx.compose.ui.layout.ModifierInfo
import androidx.compose.ui.layout.positionInWindow
diff --git a/compose/ui/ui-tooling/src/androidTest/java/androidx/compose/ui/tooling/inspector/LayoutInspectorTreeTest.kt b/compose/ui/ui-tooling/src/androidTest/java/androidx/compose/ui/tooling/inspector/LayoutInspectorTreeTest.kt
index 3f9735c..64c3020 100644
--- a/compose/ui/ui-tooling/src/androidTest/java/androidx/compose/ui/tooling/inspector/LayoutInspectorTreeTest.kt
+++ b/compose/ui/ui-tooling/src/androidTest/java/androidx/compose/ui/tooling/inspector/LayoutInspectorTreeTest.kt
@@ -32,8 +32,6 @@
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Call
import androidx.compose.material.icons.filled.FavoriteBorder
-import androidx.compose.runtime.InternalComposeApi
-import androidx.compose.runtime.resetSourceInfo
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
@@ -75,8 +73,6 @@
@Before
fun before() {
- @OptIn(InternalComposeApi::class)
- resetSourceInfo()
density = Density(activity)
view = activityTestRule.activity.findViewById<ViewGroup>(android.R.id.content)
isDebugInspectorInfoEnabled = true
diff --git a/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/Inspectable.kt b/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/Inspectable.kt
index 94dba74..516d0e2 100644
--- a/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/Inspectable.kt
+++ b/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/Inspectable.kt
@@ -17,9 +17,9 @@
package androidx.compose.ui.tooling
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.CompositionData
+import androidx.compose.runtime.tooling.CompositionData
import androidx.compose.runtime.InternalComposeApi
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.currentComposer
import androidx.compose.runtime.tooling.LocalInspectionTables
import androidx.compose.ui.platform.LocalInspectionMode
@@ -61,7 +61,7 @@
currentComposer.collectParameterInformation()
val store = (compositionDataRecord as CompositionDataRecordImpl).store
store.add(currentComposer.compositionData)
- Providers(
+ CompositionLocalProvider(
LocalInspectionMode provides true,
LocalInspectionTables provides store,
content = content
diff --git a/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/inspector/LayoutInspectorTree.kt b/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/inspector/LayoutInspectorTree.kt
index c7a8c27..19f8ed8 100644
--- a/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/inspector/LayoutInspectorTree.kt
+++ b/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/inspector/LayoutInspectorTree.kt
@@ -17,7 +17,7 @@
package androidx.compose.ui.tooling.inspector
import android.view.View
-import androidx.compose.runtime.CompositionData
+import androidx.compose.runtime.tooling.CompositionData
import androidx.compose.runtime.InternalComposeApi
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.layout.GraphicLayerInfo
@@ -70,7 +70,7 @@
"remember",
"Inspectable",
"Layout",
- "Providers",
+ "CompositionLocalProvider",
"SelectionContainer",
"SelectionLayout"
)
diff --git a/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/inspector/ParameterFactory.kt b/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/inspector/ParameterFactory.kt
index 2d68c95..f586339 100644
--- a/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/inspector/ParameterFactory.kt
+++ b/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/inspector/ParameterFactory.kt
@@ -62,10 +62,6 @@
private const val MAX_RECURSIONS = 10
private const val MAX_ITERABLE = 25
-@OptIn(ComposeCompilerApi::class)
-private typealias CLambda =
- ComposableLambda<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>
-
/**
* Factory of [NodeParameter]s.
*
@@ -269,11 +265,12 @@
try {
recursions++
createFromConstant(name, value)?.let { return it }
+ @OptIn(ComposeCompilerApi::class)
return when (value) {
is AnnotatedString -> NodeParameter(name, ParameterType.String, value.text)
is BaselineShift -> createFromBaselineShift(name, value)
is Boolean -> NodeParameter(name, ParameterType.Boolean, value)
- is CLambda -> createFromCLambda(name, value)
+ is ComposableLambda -> createFromCLambda(name, value)
is Color -> NodeParameter(name, ParameterType.Color, value.toArgb())
is CornerSize -> createFromCornerSize(name, value)
is Double -> NodeParameter(name, ParameterType.Double, value)
@@ -318,7 +315,8 @@
return NodeParameter(name, ParameterType.String, converted)
}
- private fun createFromCLambda(name: String, value: CLambda): NodeParameter? = try {
+ @OptIn(ComposeCompilerApi::class)
+ private fun createFromCLambda(name: String, value: ComposableLambda): NodeParameter? = try {
val lambda = value.javaClass.getDeclaredField("_block")
.apply { isAccessible = true }
.get(value)
diff --git a/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/preview/ComposeViewAdapter.kt b/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/preview/ComposeViewAdapter.kt
index 2eb7758..46d40c2 100644
--- a/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/preview/ComposeViewAdapter.kt
+++ b/compose/ui/ui-tooling/src/main/java/androidx/compose/ui/tooling/preview/ComposeViewAdapter.kt
@@ -30,7 +30,7 @@
import androidx.compose.runtime.AtomicReference
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Composition
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.currentComposer
import androidx.compose.runtime.mutableStateOf
@@ -387,7 +387,7 @@
// We need to replace the FontResourceLoader to avoid using ResourcesCompat.
// ResourcesCompat can not load fonts within Layoutlib and, since Layoutlib always runs
// the latest version, we do not need it.
- Providers(LocalFontLoader provides LayoutlibFontResourceLoader(context)) {
+ CompositionLocalProvider(LocalFontLoader provides LayoutlibFontResourceLoader(context)) {
Inspectable(slotTableRecord, content)
}
}
diff --git a/compose/ui/ui-viewbinding/src/androidTest/java/androidx/compose/ui/viewinterop/AndroidViewBindingTest.kt b/compose/ui/ui-viewbinding/src/androidTest/java/androidx/compose/ui/viewinterop/AndroidViewBindingTest.kt
index 5677a58..3bab754 100644
--- a/compose/ui/ui-viewbinding/src/androidTest/java/androidx/compose/ui/viewinterop/AndroidViewBindingTest.kt
+++ b/compose/ui/ui-viewbinding/src/androidTest/java/androidx/compose/ui/viewinterop/AndroidViewBindingTest.kt
@@ -18,7 +18,7 @@
import android.os.Build
import androidx.compose.foundation.layout.size
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.testutils.assertPixels
import androidx.compose.ui.Modifier
@@ -94,7 +94,7 @@
val size = 50.dp
val density = Density(3f)
val sizeIpx = with(density) { size.roundToPx() }
- Providers(LocalDensity provides density) {
+ CompositionLocalProvider(LocalDensity provides density) {
AndroidViewBinding(
TestLayoutBinding::inflate,
Modifier.size(size).onGloballyPositioned {
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidLayoutDrawTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidLayoutDrawTest.kt
index 4517af7..8bead58 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidLayoutDrawTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidLayoutDrawTest.kt
@@ -39,7 +39,7 @@
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ExperimentalComposeApi
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Stable
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
@@ -1999,7 +1999,7 @@
val layoutDirection = Ref<LayoutDirection>()
activityTestRule.runOnUiThreadIR {
activity.setContent {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
FixedSize(
size = 50,
modifier = Modifier.drawBehind {
@@ -2032,7 +2032,7 @@
}
activityTestRule.runOnUiThreadIR {
activity.setContent {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
FixedSize(
size = 50,
modifier = layoutModifier
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/ClipDrawTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/ClipDrawTest.kt
index 72baabc..d43ec0a 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/ClipDrawTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/ClipDrawTest.kt
@@ -19,7 +19,7 @@
import android.graphics.Bitmap
import android.os.Build
import androidx.activity.compose.setContent
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.AtLeastSize
import androidx.compose.ui.Modifier
@@ -485,7 +485,7 @@
rule.runOnUiThreadIR {
activity.setContent {
- Providers(LocalLayoutDirection provides direction.value) {
+ CompositionLocalProvider(LocalLayoutDirection provides direction.value) {
AtLeastSize(
size = 30,
modifier = Modifier.fillColor(Color.Green)
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/DrawModifierTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/DrawModifierTest.kt
index fc75a60..7aa4733 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/DrawModifierTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/DrawModifierTest.kt
@@ -19,7 +19,7 @@
import android.os.Build
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -275,7 +275,7 @@
var layoutDirection by mutableStateOf(LayoutDirection.Ltr)
var realLayoutDirection: LayoutDirection? = null
rule.setContent {
- Providers(LocalLayoutDirection provides layoutDirection) {
+ CompositionLocalProvider(LocalLayoutDirection provides layoutDirection) {
AtLeastSize(
size = 10,
modifier = Modifier.drawWithCache {
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/PainterModifierTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/PainterModifierTest.kt
index e0d42ae..ae8e1b7 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/PainterModifierTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/PainterModifierTest.kt
@@ -25,7 +25,7 @@
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.testutils.assertPixels
import androidx.compose.ui.AlignTopLeft
import androidx.compose.ui.Alignment
@@ -679,7 +679,7 @@
) {
val p = TestPainter(containerWidth, containerHeight)
val layoutDirection = if (rtl) LayoutDirection.Rtl else LayoutDirection.Ltr
- Providers(LocalLayoutDirection provides layoutDirection) {
+ CompositionLocalProvider(LocalLayoutDirection provides layoutDirection) {
AtLeastSize(
modifier = Modifier.background(Color.White)
.paint(p, alpha = alpha, colorFilter = colorFilter),
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LayoutDensityTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LayoutDensityTest.kt
index 4571566..090a215 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LayoutDensityTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LayoutDensityTest.kt
@@ -16,7 +16,7 @@
package androidx.compose.ui.layout
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
@@ -45,7 +45,7 @@
var measureScopeDensity = 0f
var measureScopeFontScale = 0f
rule.setContent {
- Providers(LocalDensity provides Density(localDensity, localFontScale)) {
+ CompositionLocalProvider(LocalDensity provides Density(localDensity, localFontScale)) {
Layout({}) { _, _ ->
measureScopeDensity = density
measureScopeFontScale = fontScale
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RtlLayoutTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RtlLayoutTest.kt
index 63911ae..85655db 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RtlLayoutTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RtlLayoutTest.kt
@@ -22,7 +22,7 @@
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.preferredWidth
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.FixedSize
import androidx.compose.ui.Modifier
@@ -178,7 +178,7 @@
layout(100, 100) {}
}
}
- Providers(LocalLayoutDirection provides direction.value) {
+ CompositionLocalProvider(LocalLayoutDirection provides direction.value) {
Layout(children) { measurables, constraints ->
layout(100, 100) {
measurables.first().measure(constraints).placeRelative(0, 0)
@@ -203,7 +203,7 @@
activityTestRule.runOnUiThread {
activity.setContent {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Layout(content = {}) { _, _ ->
resultLayoutDirection.value = layoutDirection
latch.countDown()
@@ -225,7 +225,7 @@
activityTestRule.runOnUiThread {
activity.setContent {
@OptIn(ExperimentalLayout::class)
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Layout(
content = {},
modifier = Modifier.preferredWidth(IntrinsicSize.Max),
@@ -257,9 +257,11 @@
activityTestRule.runOnUiThread {
activity.setContent {
val initialLayoutDirection = LocalLayoutDirection.current
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Box {
- Providers(LocalLayoutDirection provides initialLayoutDirection) {
+ CompositionLocalProvider(
+ LocalLayoutDirection provides initialLayoutDirection
+ ) {
Layout({}) { _, _ ->
resultLayoutDirection.value = layoutDirection
latch.countDown()
@@ -280,7 +282,7 @@
absolutePositioning: Boolean,
testLayoutDirection: LayoutDirection
) {
- Providers(LocalLayoutDirection provides testLayoutDirection) {
+ CompositionLocalProvider(LocalLayoutDirection provides testLayoutDirection) {
Layout(
content = {
FixedSize(size, modifier = Modifier.saveLayoutInfo(position[0], countDownLatch))
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
index 3c760bc..9238ea7 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
@@ -24,7 +24,7 @@
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.background
@@ -461,7 +461,7 @@
val size = 50.dp
val density = Density(3f)
val sizeIpx = with(density) { size.roundToPx() }
- Providers(LocalDensity provides density) {
+ CompositionLocalProvider(LocalDensity provides density) {
SubcomposeLayout(
Modifier.size(size).onGloballyPositioned {
assertThat(it.size).isEqualTo(IntSize(sizeIpx, sizeIpx))
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/HotReloadTests.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/HotReloadTests.kt
index 732c5aa4..b84b840 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/HotReloadTests.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/HotReloadTests.kt
@@ -22,7 +22,6 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
-import androidx.compose.runtime.clearRoots
import androidx.compose.runtime.simulateHotReload
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
@@ -34,7 +33,6 @@
import androidx.compose.ui.test.onNodeWithTag
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
-import org.junit.After
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
@@ -45,11 +43,6 @@
@MediumTest
@RunWith(AndroidJUnit4::class)
class HotReloadTests {
- @After
- fun teardown() {
- clearRoots()
- }
-
@get:Rule
val rule = createAndroidComposeRule<TestActivity>()
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/WrapperTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/WrapperTest.kt
index 60710f9..24ea421 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/WrapperTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/WrapperTest.kt
@@ -19,7 +19,7 @@
import androidx.activity.compose.setContent
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.currentRecomposeScope
@@ -156,7 +156,7 @@
val frameLayout = FrameLayout(it)
it.setContent {
val compositionLocal = compositionLocalOf<Float>()
- Providers(compositionLocal provides 1f) {
+ CompositionLocalProvider(compositionLocal provides 1f) {
val composition = rememberCompositionContext()
AndroidView({ frameLayout })
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/ColorResourcesTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/ColorResourcesTest.kt
index 4f7e4e3..e0ec921 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/ColorResourcesTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/ColorResourcesTest.kt
@@ -16,7 +16,7 @@
package androidx.compose.ui.res
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.test.R
@@ -41,7 +41,7 @@
val context = InstrumentationRegistry.getInstrumentation().targetContext
rule.setContent {
- Providers(LocalContext provides context) {
+ CompositionLocalProvider(LocalContext provides context) {
assertThat(colorResource(R.color.color_resource))
.isEqualTo(Color(0x12345678))
}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/PrimitiveResourcesTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/PrimitiveResourcesTest.kt
index d5e84d3..3703ff2 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/PrimitiveResourcesTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/PrimitiveResourcesTest.kt
@@ -16,7 +16,7 @@
package androidx.compose.ui.res
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.test.R
import androidx.compose.ui.test.junit4.createComposeRule
@@ -41,7 +41,7 @@
val context = InstrumentationRegistry.getInstrumentation().targetContext
rule.setContent {
- Providers(LocalContext provides context) {
+ CompositionLocalProvider(LocalContext provides context) {
assertThat(integerResource(R.integer.integer_value)).isEqualTo(123)
}
}
@@ -52,7 +52,7 @@
val context = InstrumentationRegistry.getInstrumentation().targetContext
rule.setContent {
- Providers(LocalContext provides context) {
+ CompositionLocalProvider(LocalContext provides context) {
assertThat(integerArrayResource(R.array.integer_array))
.isEqualTo(intArrayOf(234, 345))
}
@@ -64,7 +64,7 @@
val context = InstrumentationRegistry.getInstrumentation().targetContext
rule.setContent {
- Providers(LocalContext provides context) {
+ CompositionLocalProvider(LocalContext provides context) {
assertThat(booleanResource(R.bool.boolean_value)).isTrue()
}
}
@@ -75,7 +75,7 @@
val context = InstrumentationRegistry.getInstrumentation().targetContext
rule.setContent {
- Providers(LocalContext provides context) {
+ CompositionLocalProvider(LocalContext provides context) {
assertThat(dimensionResource(R.dimen.dimension_value)).isEqualTo(32.dp)
}
}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/StringResourcesTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/StringResourcesTest.kt
index 2016bb2..4eea4c1 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/StringResourcesTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/StringResourcesTest.kt
@@ -16,7 +16,7 @@
package androidx.compose.ui.res
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.test.R
import androidx.compose.ui.test.junit4.createComposeRule
@@ -53,7 +53,7 @@
fun stringResource_not_localized_defaultLocale() {
val context = InstrumentationRegistry.getInstrumentation().targetContext
rule.setContent {
- Providers(LocalContext provides context) {
+ CompositionLocalProvider(LocalContext provides context) {
assertThat(stringResource(R.string.not_localized)).isEqualTo(NotLocalizedText)
}
}
@@ -70,7 +70,7 @@
)
rule.setContent {
- Providers(LocalContext provides spanishContext) {
+ CompositionLocalProvider(LocalContext provides spanishContext) {
assertThat(stringResource(R.string.not_localized)).isEqualTo(NotLocalizedText)
}
}
@@ -80,7 +80,7 @@
fun stringResource_localized_defaultLocale() {
val context = InstrumentationRegistry.getInstrumentation().targetContext
rule.setContent {
- Providers(LocalContext provides context) {
+ CompositionLocalProvider(LocalContext provides context) {
assertThat(stringResource(R.string.localized))
.isEqualTo(DefaultLocalizedText)
}
@@ -98,7 +98,7 @@
)
rule.setContent {
- Providers(LocalContext provides spanishContext) {
+ CompositionLocalProvider(LocalContext provides spanishContext) {
assertThat(stringResource(R.string.localized))
.isEqualTo(SpanishLocalizedText)
}
@@ -109,7 +109,7 @@
fun stringResource_not_localized_format_defaultLocale() {
val context = InstrumentationRegistry.getInstrumentation().targetContext
rule.setContent {
- Providers(LocalContext provides context) {
+ CompositionLocalProvider(LocalContext provides context) {
assertThat(stringResource(R.string.not_localized_format, FormatValue))
.isEqualTo(NotLocalizedFormatText)
}
@@ -127,7 +127,7 @@
)
rule.setContent {
- Providers(LocalContext provides spanishContext) {
+ CompositionLocalProvider(LocalContext provides spanishContext) {
assertThat(stringResource(R.string.not_localized_format, FormatValue))
.isEqualTo(NotLocalizedFormatText)
}
@@ -138,7 +138,7 @@
fun stringResource_localized_format_defaultLocale() {
val context = InstrumentationRegistry.getInstrumentation().targetContext
rule.setContent {
- Providers(LocalContext provides context) {
+ CompositionLocalProvider(LocalContext provides context) {
assertThat(stringResource(R.string.localized_format, FormatValue))
.isEqualTo(DefaultLocalizedFormatText)
}
@@ -156,7 +156,7 @@
)
rule.setContent {
- Providers(LocalContext provides spanishContext) {
+ CompositionLocalProvider(LocalContext provides spanishContext) {
assertThat(stringResource(R.string.localized_format, FormatValue))
.isEqualTo(SpanishLocalizedFormatText)
}
@@ -168,7 +168,7 @@
val context = InstrumentationRegistry.getInstrumentation().targetContext
rule.setContent {
- Providers(LocalContext provides context) {
+ CompositionLocalProvider(LocalContext provides context) {
assertThat(stringArrayResource(R.array.string_array))
.isEqualTo(arrayOf("string1", "string2"))
}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/AndroidViewTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/AndroidViewTest.kt
index 8ec79c5..4c54bbe 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/AndroidViewTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/AndroidViewTest.kt
@@ -30,7 +30,7 @@
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@@ -334,7 +334,7 @@
val size = 50.dp
val density = Density(3f)
val sizeIpx = with(density) { size.roundToPx() }
- Providers(LocalDensity provides density) {
+ CompositionLocalProvider(LocalDensity provides density) {
AndroidView(
{ FrameLayout(it) },
Modifier.size(size).onGloballyPositioned {
@@ -371,7 +371,7 @@
val ambient = compositionLocalOf { "unset" }
var childComposedAmbientValue = "uncomposed"
rule.setContent {
- Providers(ambient provides "setByParent") {
+ CompositionLocalProvider(ambient provides "setByParent") {
AndroidView(
viewBlock = {
ComposeView(it).apply {
@@ -393,7 +393,7 @@
var childViewLayoutDirection: Int = Int.MIN_VALUE
var childCompositionLayoutDirection: LayoutDirection? = null
rule.setContent {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
AndroidView(
viewBlock = {
FrameLayout(it).apply {
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogTest.kt
index 28c244e..33718a9 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogTest.kt
@@ -17,7 +17,7 @@
import androidx.compose.foundation.clickable
import androidx.compose.foundation.text.BasicText
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -260,7 +260,7 @@
val compositionLocal = compositionLocalOf<Float>()
var value = 0f
rule.setContent {
- Providers(compositionLocal provides 1f) {
+ CompositionLocalProvider(compositionLocal provides 1f) {
Dialog( {
value = compositionLocal.current
}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupAlignmentTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupAlignmentTest.kt
index ef0e67d..537c3fc 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupAlignmentTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupAlignmentTest.kt
@@ -18,7 +18,7 @@
import android.view.View
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.Layout
@@ -319,7 +319,7 @@
// position of the parent to be (0, 0)
TestAlign {
val layoutDirection = if (isRtl) LayoutDirection.Rtl else LayoutDirection.Ltr
- Providers(LocalLayoutDirection provides layoutDirection) {
+ CompositionLocalProvider(LocalLayoutDirection provides layoutDirection) {
SimpleContainer(width = parentWidthDp, height = parentHeightDp) {
PopupTestTag(testTag) {
Popup(alignment = alignment, offset = offset) {
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupTest.kt
index 62d2bd5..6c499de 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupTest.kt
@@ -21,7 +21,7 @@
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.layout.width
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@@ -209,7 +209,7 @@
val compositionLocal = compositionLocalOf<Float>()
var value = 0f
rule.setContent {
- Providers(compositionLocal provides 1f) {
+ CompositionLocalProvider(compositionLocal provides 1f) {
Popup {
value = compositionLocal.current
}
@@ -224,7 +224,7 @@
fun preservesLayoutDirection() {
var value = LayoutDirection.Ltr
rule.setContent {
- Providers(LocalLayoutDirection provides LayoutDirection.Rtl) {
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Popup {
value = LocalLayoutDirection.current
}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidCompositionLocals.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidCompositionLocals.kt
index 7b0203c..fa2cfce 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidCompositionLocals.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidCompositionLocals.kt
@@ -24,7 +24,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.ExperimentalComposeApi
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@@ -116,7 +116,7 @@
}
}
- Providers(
+ CompositionLocalProvider(
LocalConfiguration provides configuration,
LocalContext provides context,
LocalLifecycleOwner provides viewTreeOwners.lifecycleOwner,
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.kt
index b612224..c332f6f 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.kt
@@ -24,11 +24,11 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Composition
import androidx.compose.runtime.CompositionContext
-import androidx.compose.runtime.CompositionData
+import androidx.compose.runtime.tooling.CompositionData
import androidx.compose.runtime.ExperimentalComposeApi
import androidx.compose.runtime.InternalComposeApi
import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Recomposer
import androidx.compose.runtime.currentComposer
import androidx.compose.runtime.tooling.LocalInspectionTables
@@ -48,17 +48,13 @@
// instead.
@MainThread
@OptIn(ExperimentalComposeApi::class)
-internal actual fun subcomposeInto(
+internal actual fun createSubcomposition(
container: LayoutNode,
- parent: CompositionContext,
- composable: @Composable () -> Unit
+ parent: CompositionContext
): Composition = Composition(
- container,
UiApplier(container),
parent
-).apply {
- setContent(composable)
-}
+)
/**
* Composes the given composable into the given activity. The [content] will become the root view
@@ -137,8 +133,7 @@
)
enableDebugInspectorInfo()
}
- @OptIn(ExperimentalComposeApi::class)
- val original = Composition(owner.root, UiApplier(owner.root), parent)
+ val original = Composition(UiApplier(owner.root), parent)
val wrapped = owner.view.getTag(R.id.wrapped_composition_tag)
as? WrappedComposition
?: WrappedComposition(owner, original).also {
@@ -201,7 +196,7 @@
LaunchedEffect(owner) { owner.keyboardVisibilityEventLoop() }
LaunchedEffect(owner) { owner.boundsUpdatesEventLoop() }
- Providers(LocalInspectionTables provides inspectionTable) {
+ CompositionLocalProvider(LocalInspectionTables provides inspectionTable) {
ProvideAndroidCompositionLocals(owner, content)
}
}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/window/AndroidPopup.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/window/AndroidPopup.kt
index 43685f1..9bcc554 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/window/AndroidPopup.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/window/AndroidPopup.kt
@@ -31,7 +31,7 @@
import androidx.compose.runtime.CompositionContext
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.Immutable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.derivedStateOf
@@ -260,7 +260,7 @@
@Composable
internal fun PopupTestTag(tag: String, content: @Composable () -> Unit) {
- Providers(LocalPopupTestTag provides tag, content = content)
+ CompositionLocalProvider(LocalPopupTestTag provides tag, content = content)
}
// TODO(soboleva): Look at module dependencies so that we can get code reuse between
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/VectorCompose.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/VectorCompose.kt
index f22b101..414a86e 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/VectorCompose.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/VectorCompose.kt
@@ -18,8 +18,6 @@
import androidx.compose.runtime.AbstractApplier
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Composition
-import androidx.compose.runtime.CompositionContext
import androidx.compose.runtime.ExperimentalComposeApi
import androidx.compose.runtime.ComposeNode
import androidx.compose.ui.graphics.Brush
@@ -96,21 +94,6 @@
)
}
-@Suppress("NAME_SHADOWING")
-internal fun composeVector(
- container: VectorComponent,
- parent: CompositionContext,
- composable: @Composable (viewportWidth: Float, viewportHeight: Float) -> Unit
-): Composition = Composition(
- container,
- VectorApplier(container.root),
- parent
-).apply {
- setContent {
- composable(container.viewportWidth, container.viewportHeight)
- }
-}
-
class VectorApplier(root: VNode) : AbstractApplier<VNode>(root) {
override fun insertTopDown(index: Int, instance: VNode) {
current.asGroup().insertAt(index, instance)
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/VectorPainter.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/VectorPainter.kt
index 75a691a..c4b52b1 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/VectorPainter.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/VectorPainter.kt
@@ -17,6 +17,8 @@
package androidx.compose.ui.graphics.vector
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.Composition
+import androidx.compose.runtime.CompositionContext
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.getValue
@@ -136,6 +138,28 @@
}
}
+ private var composition: Composition? = null
+
+ private fun composeVector(
+ parent: CompositionContext,
+ composable: @Composable (viewportWidth: Float, viewportHeight: Float) -> Unit
+ ): Composition {
+ val existing = composition
+ val next = if (existing == null || existing.isDisposed) {
+ Composition(
+ VectorApplier(vector.root),
+ parent
+ )
+ } else {
+ existing
+ }
+ composition = next
+ next.setContent {
+ composable(vector.viewportWidth, vector.viewportHeight)
+ }
+ return next
+ }
+
private var isDirty by mutableStateOf(true)
@Composable
@@ -151,7 +175,6 @@
this.viewportHeight = viewportHeight
}
val composition = composeVector(
- vector,
rememberCompositionContext(),
content
)
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/SubcomposeLayout.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/SubcomposeLayout.kt
index 172fe2d..1aa86b1 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/SubcomposeLayout.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/SubcomposeLayout.kt
@@ -34,7 +34,7 @@
import androidx.compose.ui.node.MeasureBlocks
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalLayoutDirection
-import androidx.compose.ui.platform.subcomposeInto
+import androidx.compose.ui.platform.createSubcomposition
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.LayoutDirection
@@ -161,6 +161,7 @@
node.withNoSnapshotReadObservation {
val content = nodeState.content
nodeState.composition = subcomposeInto(
+ existing = nodeState.composition,
container = node,
parent = compositionContext ?: error("parent composition reference not set"),
// Do not optimize this by passing nodeState.content directly; the additional
@@ -171,6 +172,22 @@
}
}
+ private fun subcomposeInto(
+ existing: Composition?,
+ container: LayoutNode,
+ parent: CompositionContext,
+ composable: @Composable () -> Unit
+ ): Composition {
+ return if (existing == null || existing.isDisposed) {
+ createSubcomposition(container, parent)
+ } else {
+ existing
+ }
+ .apply {
+ setContent(composable)
+ }
+ }
+
private fun disposeAfterIndex(currentIndex: Int) {
val root = root!!
for (i in currentIndex until root.foldedChildren.size) {
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/CompositionLocals.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/CompositionLocals.kt
index 17c23db..383ca62 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/CompositionLocals.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/CompositionLocals.kt
@@ -18,7 +18,7 @@
import androidx.compose.animation.core.AnimationClockObservable
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.autofill.Autofill
@@ -125,7 +125,7 @@
uriHandler: UriHandler,
content: @Composable () -> Unit
) {
- Providers(
+ CompositionLocalProvider(
LocalAnimationClock provides animationClock,
LocalAutofill provides owner.autofill,
LocalAutofillTree provides owner.autofillTree,
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Subcomposition.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Subcomposition.kt
index b64641b..0942d88 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Subcomposition.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Subcomposition.kt
@@ -15,14 +15,12 @@
*/
package androidx.compose.ui.platform
-import androidx.compose.runtime.Composable
import androidx.compose.runtime.Composition
import androidx.compose.runtime.CompositionContext
import androidx.compose.ui.node.LayoutNode
/*@MainThread*/
-internal expect fun subcomposeInto(
+internal expect fun createSubcomposition(
container: LayoutNode,
- parent: CompositionContext,
- composable: @Composable () -> Unit
+ parent: CompositionContext
): Composition
\ No newline at end of file
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/WindowInfo.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/WindowInfo.kt
index 88db96d..8402df7 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/WindowInfo.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/WindowInfo.kt
@@ -22,7 +22,7 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.rememberUpdatedState
-import androidx.compose.runtime.snapshots.snapshotFlow
+import androidx.compose.runtime.snapshotFlow
import kotlinx.coroutines.flow.collect
/**
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/AppWindow.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/AppWindow.kt
index 4867f4f..615764d 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/AppWindow.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/AppWindow.kt
@@ -17,7 +17,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionContext
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.ui.platform.Keyboard
import androidx.compose.ui.unit.IntOffset
@@ -409,7 +409,7 @@
content: @Composable () -> Unit
) {
window.setContent(parentComposition) {
- Providers(
+ CompositionLocalProvider(
LocalAppWindow provides this,
LocalLayerContainer provides window,
content = content
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/ComposePanel.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/ComposePanel.kt
index bd82a4e..550feb08 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/ComposePanel.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/desktop/ComposePanel.kt
@@ -16,7 +16,7 @@
package androidx.compose.desktop
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import java.awt.Color
import java.awt.Component
import java.awt.event.ComponentAdapter
@@ -66,7 +66,7 @@
private fun initContent() {
if (layer != null && content != null) {
layer!!.setContent {
- Providers(
+ CompositionLocalProvider(
LocalLayerContainer provides this,
content = content!!
)
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/TestComposeWindow.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/TestComposeWindow.kt
index 48293cd..28603b8 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/TestComposeWindow.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/TestComposeWindow.kt
@@ -17,7 +17,7 @@
package androidx.compose.ui.platform
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.input.mouse.MouseScrollEvent
@@ -103,7 +103,7 @@
val owner = DesktopOwner(owners, density)
owner.setContent {
- Providers(
+ CompositionLocalProvider(
DesktopPlatformAmbient provides desktopPlatform
) {
content()
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/Wrapper.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/Wrapper.kt
index ff1b444..84777ff 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/Wrapper.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/Wrapper.kt
@@ -18,8 +18,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Composition
import androidx.compose.runtime.CompositionContext
-import androidx.compose.runtime.ExperimentalComposeApi
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.node.LayoutNode
@@ -30,14 +29,13 @@
* If null then default root composition will be used.
* @param content A `@Composable` function declaring the UI contents
*/
-@OptIn(ExperimentalComposeApi::class)
internal fun DesktopOwner.setContent(
parent: CompositionContext? = null,
content: @Composable () -> Unit
): Composition {
GlobalSnapshotManager.ensureStarted()
- val composition = Composition(root, DesktopUiApplier(root), parent ?: container.recomposer)
+ val composition = Composition(DesktopUiApplier(root), parent ?: container.recomposer)
composition.setContent {
ProvideDesktopAmbients(this) {
content()
@@ -55,7 +53,7 @@
@OptIn(ExperimentalComposeUiApi::class)
@Composable
private fun ProvideDesktopAmbients(owner: DesktopOwner, content: @Composable () -> Unit) {
- Providers(
+ CompositionLocalProvider(
DesktopOwnersAmbient provides owner.container,
SelectionTrackerAmbient provides owner.selectionTracker
) {
@@ -68,15 +66,10 @@
}
}
-@OptIn(ExperimentalComposeApi::class)
-internal actual fun subcomposeInto(
+internal actual fun createSubcomposition(
container: LayoutNode,
- parent: CompositionContext,
- composable: @Composable () -> Unit
+ parent: CompositionContext
): Composition = Composition(
- container,
DesktopUiApplier(container),
parent
-).apply {
- setContent(composable)
-}
\ No newline at end of file
+)
\ No newline at end of file
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/RenderingTestScope.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/RenderingTestScope.kt
index f374ad0..66e3e5e 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/RenderingTestScope.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/RenderingTestScope.kt
@@ -17,7 +17,7 @@
package androidx.compose.ui.platform
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import kotlinx.coroutines.CompletableDeferred
@@ -82,7 +82,7 @@
owner?.dispose()
val owner = DesktopOwner(owners)
owner.setContent {
- Providers(DesktopPlatformAmbient provides platform) {
+ CompositionLocalProvider(DesktopPlatformAmbient provides platform) {
content()
}
}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/DesktopPopupTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/DesktopPopupTest.kt
index e3e1a48..fc78c0d 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/DesktopPopupTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/DesktopPopupTest.kt
@@ -16,7 +16,7 @@
package androidx.compose.ui.window
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.DisposableEffect
@@ -42,7 +42,7 @@
var actualAmbientValue = 0
rule.setContent {
- Providers(ambient provides 3) {
+ CompositionLocalProvider(ambient provides 3) {
Popup {
actualAmbientValue = ambient.current
}
@@ -81,7 +81,7 @@
var densityInsidePopup = 0f
rule.setContent {
- Providers(LocalDensity provides density) {
+ CompositionLocalProvider(LocalDensity provides density) {
Popup {
densityInsidePopup = LocalDensity.current.density
}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/ComposedModifierTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/ComposedModifierTest.kt
index 417f745..f44013d 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/ComposedModifierTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/ComposedModifierTest.kt
@@ -211,7 +211,6 @@
block: @Composable () -> Unit
): Composition {
return Composition(
- Any(),
EmptyApplier(),
recomposer
).apply {
diff --git a/lifecycle/lifecycle-viewmodel-compose/src/androidTest/java/androidx/lifecycle/viewmodel/compose/ViewModelTest.kt b/lifecycle/lifecycle-viewmodel-compose/src/androidTest/java/androidx/lifecycle/viewmodel/compose/ViewModelTest.kt
index ce0e504..d07f871 100644
--- a/lifecycle/lifecycle-viewmodel-compose/src/androidTest/java/androidx/lifecycle/viewmodel/compose/ViewModelTest.kt
+++ b/lifecycle/lifecycle-viewmodel-compose/src/androidTest/java/androidx/lifecycle/viewmodel/compose/ViewModelTest.kt
@@ -16,7 +16,7 @@
package androidx.lifecycle.viewmodel.compose
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.lifecycle.HasDefaultViewModelProviderFactory
@@ -42,7 +42,9 @@
public fun viewModelCreatedViaDefaultFactory() {
val owner = FakeViewModelStoreOwner()
rule.setContent {
- Providers(LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner) {
+ CompositionLocalProvider(
+ LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner
+ ) {
viewModel<TestViewModel>()
}
}
@@ -55,7 +57,9 @@
val owner = FakeViewModelStoreOwner()
var createdInComposition: Any? = null
rule.setContent {
- Providers(LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner) {
+ CompositionLocalProvider(
+ LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner
+ ) {
createdInComposition = viewModel<TestViewModel>()
}
}
@@ -70,7 +74,9 @@
val owner = FakeViewModelStoreOwner()
var createdInComposition: Any? = null
rule.setContent {
- Providers(LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner) {
+ CompositionLocalProvider(
+ LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner
+ ) {
createdInComposition = viewModel<TestViewModel>()
}
}
@@ -85,7 +91,9 @@
val owner = FakeViewModelStoreOwner()
var createdInComposition: Any? = null
rule.setContent {
- Providers(LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner) {
+ CompositionLocalProvider(
+ LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner
+ ) {
createdInComposition =
viewModel<TestViewModel>(key = "test")
}
@@ -101,7 +109,9 @@
val owner = FakeViewModelStoreOwner()
val customFactory = FakeViewModelProviderFactory()
rule.setContent {
- Providers(LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner) {
+ CompositionLocalProvider(
+ LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner
+ ) {
viewModel<TestViewModel>(factory = customFactory)
}
}
@@ -114,7 +124,9 @@
val owner = FakeViewModelStoreOwner()
val customFactory = FakeViewModelProviderFactory()
rule.setContent {
- Providers(LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner) {
+ CompositionLocalProvider(
+ LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner
+ ) {
viewModel<TestViewModel>(factory = customFactory)
}
}
@@ -128,7 +140,9 @@
var createdInComposition: Any? = null
val customFactory = FakeViewModelProviderFactory()
rule.setContent {
- Providers(LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner) {
+ CompositionLocalProvider(
+ LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner
+ ) {
createdInComposition = viewModel<TestViewModel>()
}
}
@@ -144,7 +158,9 @@
var createdInComposition: Any? = null
val customFactory = FakeViewModelProviderFactory()
rule.setContent {
- Providers(LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner) {
+ CompositionLocalProvider(
+ LocalViewModelStoreOwner.asProvidableCompositionLocal() provides owner
+ ) {
createdInComposition =
viewModel<TestViewModel>(key = "test")
}
diff --git a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
index af1f6f8..3fa7bd2 100644
--- a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
+++ b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
@@ -19,7 +19,7 @@
import androidx.activity.compose.LocalOnBackPressedDispatcherOwner
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
-import androidx.compose.runtime.Providers
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.SaveableStateHolder
import androidx.compose.runtime.saveable.rememberSaveableStateHolder
@@ -112,7 +112,7 @@
if (destination is ComposeNavigator.Destination) {
// while in the scope of the composable, we provide the navBackStackEntry as the
// ViewModelStoreOwner and LifecycleOwner
- Providers(
+ CompositionLocalProvider(
LocalViewModelStoreOwner.asProvidableCompositionLocal()
provides currentNavBackStackEntry,
@Suppress("DEPRECATION") // To be removed when we remove the one from compose:ui