Составить среду выполнения
androidx.compose.runtime
androidx.compose.runtime.rxjava2
androidx.compose.runtime.rxjava3
androidx.compose.runtime.savable
androidx.compose.runtime.snapshots
( См. справочную документацию API для всех пакетов Compose )
Последнее обновление | Стабильный релиз | Кандидат на релиз | Бета-версия | Альфа-релиз |
---|---|---|---|---|
30 июля 2025 г. | 1.8.3 | 1.9.0-rc01 | - | - |
Структура
Compose — это комбинация из 7 идентификаторов групп Maven в androidx
. Каждая группа содержит определённый набор функций, каждый из которых сопровождается собственным набором заметок о выпуске.
В этой таблице объясняются группы и ссылки на каждый набор заметок о выпуске.
Группа | Описание |
---|---|
compose.animation | Создавайте анимацию в своих приложениях Jetpack Compose, чтобы обогатить пользовательский опыт. |
compose.компилятор | Преобразуйте функции @Composable и включите оптимизацию с помощью плагина компилятора Kotlin. |
compose.foundation | Создавайте приложения Jetpack Compose с помощью готовых строительных блоков и расширяйте базу для создания собственных элементов системы проектирования. |
сочинить.материал | Создавайте пользовательские интерфейсы Jetpack Compose с помощью готовых компонентов Material Design. Это высокоуровневая точка входа в Compose, предназначенная для предоставления компонентов, соответствующих описанным на сайте www.material.io. |
compose.material3 | Создавайте пользовательские интерфейсы Jetpack Compose с компонентами Material Design 3 — следующим этапом развития Material Design. Material 3 включает в себя обновлённые темы и компоненты, а также функции персонализации Material You, такие как динамическая подсветка, и разработан для соответствия новому визуальному стилю и пользовательскому интерфейсу Android 12. |
compose.runtime | Основные строительные блоки модели программирования Compose и управления состоянием, а также основная среда выполнения для целевого плагина компилятора Compose. |
compose.ui | Основные компоненты пользовательского интерфейса, необходимые для взаимодействия с устройством, включая макет, рисование и ввод. |
Объявление зависимостей
Чтобы добавить зависимость от Compose, необходимо добавить репозиторий Google Maven в свой проект. Подробнее см. в репозитории Google Maven .
Добавьте зависимости для необходимых артефактов в файл build.gradle
вашего приложения или модуля:
Groovy
dependencies { implementation "androidx.compose.runtime:runtime:1.8.3" implementation "androidx.compose.runtime:runtime-livedata:1.8.3" implementation "androidx.compose.runtime:runtime-rxjava2:1.8.3" } android { buildFeatures { compose true } composeOptions { kotlinCompilerExtensionVersion = "1.5.15" } kotlinOptions { jvmTarget = "1.8" } }
Kotlin
dependencies { implementation("androidx.compose.runtime:runtime:1.8.3") implementation("androidx.compose.runtime:runtime-livedata:1.8.3") implementation("androidx.compose.runtime:runtime-rxjava2:1.8.3") } android { buildFeatures { compose = true } composeOptions { kotlinCompilerExtensionVersion = "1.5.15" } kotlinOptions { jvmTarget = "1.8" } }
Дополнительные сведения о зависимостях см. в разделе Добавление зависимостей сборки .
Обратная связь
Ваши отзывы помогают улучшить Jetpack. Сообщите нам, если вы обнаружите новые проблемы или у вас есть идеи по улучшению этой библиотеки. Пожалуйста, ознакомьтесь с уже существующими проблемами в этой библиотеке, прежде чем создавать новую. Вы можете проголосовать за существующую проблему, нажав на кнопку со звёздочкой.
Более подробную информацию см. в документации по системе отслеживания проблем .
Версия трассировки выполнения 1.7
Версия 1.7.0-rc01
18 сентября 2024 г.
Выпущена androidx.compose.runtime:runtime-tracing:1.7.0-rc01
. Версия 1.7.0-rc01 содержит следующие коммиты .
Версия трассировки выполнения 1.0
Версия 1.0.0-beta01
29 ноября 2023 г.
Выпущена androidx.compose.runtime:runtime-tracing:1.0.0-beta01
. Версия 1.0.0-beta01 содержит следующие коммиты.
Версия 1.0.0-альфа05
15 ноября 2023 г.
Выпущена androidx.compose.runtime:runtime-tracing:1.0.0-alpha05
. Версия 1.0.0-alpha05 содержит следующие коммиты.
Исправления ошибок
- Зависимости закреплены за самыми низкими поддерживаемыми стабильными версиями (т. е. compose-runtime и tracing-perfetto). Это устраняет проблему, из-за которой compose-runtime-tracing добавлял в приложение более новую версию compose-runtime.
Версия 1.0.0-альфа04
23 августа 2023 г.
Выпущена androidx.compose.runtime:runtime-tracing:1.0.0-alpha04
. Версия 1.0.0-alpha04 содержит следующие коммиты.
Новые функции
- Совместимость с последними версиями Benchmark и Tracing Perfetto, что обеспечивает поддержку Composition Tracing при запуске приложения (холодный запуск), например, в AndroidX Benchmark и Android Studio (начиная с Hedgehog Beta 2).
Изменения API
- Переименован
androidx.tracing.perfetto.Trace
вandroidx.tracing.perfetto.PerfettoSdkTrace
. ( I44af8 ) - Обеспечение соответствия API Tracing Perfetto SDK требованиям
android.os.Trace
. ( I73ba0 , b/282199917 ) - Предпосылки для трассировки при запуске приложения. ( Iad890 )
- Объединены экспериментальные и публичные файлы API ( I0f2e1 , b/278769092 )
Версия 1.0.0-альфа02
8 февраля 2023 г.
Выпущена androidx.compose.runtime:runtime-tracing:1.0.0-alpha02
. Версия 1.0.0-alpha02 содержит следующие коммиты.
Новые функции
- Функциональных изменений нет. Многочисленные оптимизации производительности в зависимостях нижестоящего уровня
androidx.tracing:tracing-perfetto*
.
Версия 1.0.0-альфа01
7 сентября 2022 г.
Выпущена androidx.compose.runtime:runtime-tracing:1.0.0-alpha01
. Версия 1.0.0-alpha01 содержит следующие коммиты.
Новые функции
-
androidx.compose.runtime:runtime-tracing
— это библиотека, которая, при наличии поддерживающего её инструментария (скоро появится), позволяет реализовать расширенную трассировку в приложении Compose. Первоначальный релиз — 1.0.0-alpha01.
Версия 1.9
Версия 1.9.0-rc01
30 июля 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.9.0-rc01
. Версия 1.9.0-rc01 содержит следующие коммиты .
Исправления ошибок
- Обновляет наблюдателя регистрации композиции, который будет вызываться перед первоначальной композицией. ( I4adca , b/430600932 )
Версия 1.9.0-beta03
16 июля 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.9.0-beta03
. Версия 1.9.0-beta03 содержит следующие коммиты .
Версия 1.9.0-beta02
2 июля 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.9.0-beta02
. Версия 1.9.0-beta02 содержит следующие коммиты .
Исправления ошибок
- Уменьшено время жизни ссылок на значения в таблице слотов между композициями. В некоторых случаях ссылка в таблице слотов может существовать на кадр дольше, чем необходимо. ( I49e74 , b/418516940 )
- Удалить Kotlin mangle для методов горячей перезагрузки. ( Ic56a3 , b/426871325 )
Версия 1.9.0-beta01
18 июня 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.9.0-beta01
. Версия 1.9.0-beta01 содержит следующие коммиты .
Изменения API
- Добавлен инструментальный API для анализа исходной информации, добавленной компилятором Compose. ( Iceaf9 , b/408492167 )
-
SnapshotStateSet
теперь реализуетParcelable
на Android, теперь его можно использовать как частьrememberSaveable { ... }
. ( I755dd , b/378623803 ) -
SnapshotStateList
теперь реализуетParcelable
на Android, теперь его можно использовать как частьrememberSaveable { ... }
. ( Id18be , b/378623803 ) -
movableContentOf()
теперь отмечен аннотацией@RememberInComposition
, что позволяет lint выявлять некорректные использования ( I2738d ). - Обновленный API экспериментальных наблюдателей состава позволяет проводить более комплексное наблюдение за причинами перекомпозиции ( I32b6a ).
- Измените
setDiagnosticStackTraceEnabled
на экспериментальный, чтобы учесть будущую разработку этой функции. ( I11db3 ) - Метод
currentCompositeKeyHash
теперь устарел. Вместо него используйтеcurrentCompositeKeyHashCode
. Новый API кодирует тот же хеш с большим количеством бит, что экспоненциально снижает вероятность того, что две случайные несвязанные группы в иерархии композиции будут иметь одинаковый хеш-ключ. ( I4cb6a , b/177562901 ) - Для проектов, выпущенных с использованием Kotlin 2.0, требуется использование KGP 2.0.0 или более поздней версии ( Idb6b5 ).
-
@Stable
,@Immutable
и@StableMarker
были перенесены в runtime-annotation (для совместимости). Теперь вы можете использовать runtime-annotation, если хотите использовать эти аннотации из библиотек, не зависящих от Compose. ( I23a16 ) - Перегрузка
rememberSaveable
, принимающаяKSerializer
, переименована вrememberSerializable
. Это изменение разъясняет её предназначение сkotlinx.serialization
. Поддержка общих классовkotlinx.Serializable
непосредственно вrememberSaveable
потребовала бы параметра типаreified
, что нарушило бы совместимость с исходным кодом, поскольку потребовало бы от всех точек вызова предоставлять информацию о типе reified во время компиляции. ( Idb875 , I38627 , b/376028110 )
Исправления ошибок
- Композиции, созданные с отменённым контентом, который можно приостановить, должны быть удалены. Теперь это проверяется композицией и приводит к сбою при повторном использовании. ( I2daa5 , b/406792785 )
- Исправлена приостанавливаемая композиция: теперь она больше не отправляет ложное сообщение
onForgotten
для запоминания наблюдателей при её удалении.RememberObservers
в отменённой приостанавливаемой композиции следует отправлять только сообщение onAbandoned. ( I26f54 ) - Исправлена проблема с перемещаемым содержимым, из-за которой аннулирования, поступающие на поздних этапах обработки перемещаемого содержимого, добавляются в компоновщик, но эти аннулирования не обновляются при перемещении содержимого, что приводит к повторной компоновке содержимого в неправильном месте. ( Icd2fa , b/409439507 )
- Исправлена ошибка, из-за которой перемещаемое содержимое становилось недействительным после его создания, но до перемещения. ( I99eac , b/229001114 )
- Вызов
remove()
итератора списка, созданногоSnapshotStateList
, после вызоваprevious()
мог удалить не тот элемент из списка и не соответствовал тому, что делаетArrayList
для той же последовательности вызовов. ( I05ab7 , b/417493222 ) - Исправлена проблема с порядком выполнения при отправке
onForgotton
, которая могла, например, привести к выполнениюonDispose
удаляемых эффектов в неправильном порядке. ( Ic1c91 , b/417450712 ) - Исправление для повторного использования обработки состояния в приостанавливаемой композиции ( Ife96e , b/404058957 )
- Исправлено повторное использование состояния, когда композиция была приостановлена и перезапущена, но некоторые ранее приостановленные состояния требовали повторной компоновки, поскольку некоторые считанные состояния изменились, пока композиция была приостановлена. ( I441d1 , b/416209738 )
- Завершено исправление ошибки приостановки композиции (запомните отправку) для ошибки b/404058957. Предыдущее исправление было неполным. ( I1afd4 , b/404058957 )
-
OffsetApplier
теперь корректно переопределяетapply()
, появившийся в приостанавливаемой композиции. Отсутствие этого метода могло привести к возникновению исключения при приостанавливаемой композиции при обновлении виртуальных узлов. ( Idbf31 , b/409291131 ) - Исправлена взаимоблокировка, которая могла повлиять на пользователей Molecule, если приостановленный вызов
FrameClock.withFrameNanos
отменялся во время отправки кадра. ( I89cab , b/407027032 ) - Recomposer может простаивать с перемещаемым контентом ( Ie5416 , b/409267170 )
- Порядок, в котором
onReuse
иonDeactivate
могли быть инвертированы во время композиции с возможностью паузы. Теперь они гарантированно выполняются в порядкеonDeactivate
/onReuse
. ( I996e4 , b/404058957 ) - Исправлена отправка наблюдателей запоминания в приостановленной композиции, чтобы избежать отправки запомненных/забытых в том же применении ( I570b2 , b/404645679 , b/407931790 ).
-
LifecycleRegistry
переведен в небезопасный режим в Compose Multiplatform, чтобы отключить проверкиMainThread
и исправить проблемы с потоками. Подробности см. в CMP-8227 . ( Icee87 )
Внешний вклад
- Исправлена ошибка, затрагивающая пользователей Molecule, из-за которой использование
RecompositionMode.Immediate
могло приводить к пропуску перекомпозиций. ( I9f3a9 , b/419527812 ) - Выведены геттеры
PausableComposition
isApplied
иisCancelled
, которые позволяют проверять состояниеPausableComposition
. ( I994aa ) - Добавлен
AnnotationTarget.FUNCTION
в аннотациюFunctionKeyMeta
. ( I08021 )
Версия 1.9.0-альфа04
4 июня 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.9.0-alpha04
. Версия 1.9.0-alpha04 содержит следующие коммиты .
Изменения API
-
SnapshotStateSet
теперь реализует Parcelable на Android, теперь его можно использовать как частьrememberSaveable { ... }
. ( I755dd , b/378623803 ) -
SnapshotStateList
теперь реализует Parcelable на Android, теперь его можно использовать как частьrememberSaveable { ... }
. ( Id18be , b/378623803 ) -
movableContentOf()
теперь отмечен аннотацией@RememberInComposition
, что позволяет lint выявлять некорректные использования ( I2738d ). - Обновленный API экспериментальных наблюдателей состава позволяет проводить более комплексное наблюдение за причинами перекомпозиции ( I32b6a ).
Исправления ошибок
- Исправлена проблема с порядком выполнения при отправке
onForgotton
, которая могла, например, привести к выполнениюonDispose
удаляемых эффектов в неправильном порядке. ( Ic1c91 , b/417450712 ) - Исправление для повторного использования обработки состояния в приостанавливаемой композиции ( Ife96e , b/404058957 )
- Исправлена небольшая ошибка, делающая обнаружение изменяемых коллекций совместимым как для K1, так и для K2 ( Ie4878 ).
- Исправлена небольшая ошибка, позволяющая сделать поиск аннотаций в переопределенных методах доступа к свойствам совместимым как для K1, так и для K2 ( I9900d ).
Внешний вклад
- Исправлена ошибка, затрагивающая пользователей Molecule, из-за которой использование
RecompositionMode.Immediate
могло приводить к пропуску перекомпозиций. ( I9f3a9 , b/419527812 ) - Выведены геттеры
PausableComposition
isApplied иisCancelled
, которые позволяют проверять состояниеPausableComposition
. ( I994aa )
Версия 1.9.0-альфа03
20 мая 2025 г.
Выпущена androidx.compose.runtime:runtime-*:1.9.0-alpha03
. Версия 1.9.0-alpha03 содержит следующие коммиты .
Изменения API
- Измените
setDiagnosticStackTraceEnabled
на экспериментальный, чтобы учесть будущую разработку этой функции. ( I11db3 )
Исправления ошибок
- Исправлено повторное использование состояния, когда композиция была приостановлена и перезапущена, но некоторые ранее приостановленные состояния требовали повторной компоновки, поскольку некоторые считанные состояния изменились, пока композиция была приостановлена. ( I441d1 , b/416209738 )
- Завершено исправление ошибки приостановки композиции (запомните отправку) для ошибки b/404058957. Предыдущее исправление было неполным. ( I1afd4 , b/404058957 )
-
SaveableStateHolder.SaveableStateProvider
теперь предоставляетLocalSavedStateRegistryOwner
для своего содержимого через композицию. ( Ia2761 , b/413108878 ) -
androidx.compose.runtime.saveable
теперь зависит отandroidx.lifecycle.runtime.compose
. ( I53228 , b/413108878 )
Версия 1.9.0-альфа02
7 мая 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.9.0-alpha02
. Версия 1.9.0-alpha02 содержит следующие коммиты .
Изменения API
- Устаревший параметр
rememberSaveable
с пользовательским «ключом». Он обходит позиционную область видимости, что приводит к ошибкам состояния и несогласованному поведению (например, непреднамеренному совместному использованию или потере состояния, проблемам во вложенныхLazyLayouts
). Удалите параметр «ключ», чтобы использовать позиционную область видимости для согласованного состояния с локальной областью видимости. Подробнее см. полное сообщение о коммите . ( I5e6ff , b/357685851 )
Исправления ошибок
-
OffsetApplier
теперь корректно переопределяетapply()
, появившийся в приостанавливаемой композиции. Отсутствие этого метода могло привести к тому, что приостанавливаемая композиция могла выдавать исключение при обновлении виртуальных узлов. ( Idbf31 , b/409291131 ) - Исправлена взаимоблокировка, которая могла повлиять на пользователей Molecule, если приостановленный вызов
FrameClock.withFrameNanos
отменялся во время отправки кадра. ( I89cab , b/407027032 ) - Recomposer может перейти в режим ожидания, пока состояние перемещаемого содержимого всё ещё ожидает сброса. Обычно этого не происходит, поскольку состояние перемещаемого содержимого сбрасывается в основном цикле Recomposer. Однако это может произойти в приостановленной композиции, когда перемещаемое содержимое сбрасывается во время
resume()
( Ie5416 , b/409267170 ). - Порядок, в котором
onReuse
иonDeactivate
могли быть инвертированы во время композиции с возможностью паузы. Теперь они гарантированно выполняются в порядкеonDeactivate/onReuse
. ( I996e4 , b/404058957 )
Версия 1.9.0-альфа01
23 апреля 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.9.0-alpha01
. Версия 1.9.0-alpha01 содержит следующие коммиты .
Изменения поведения
- Для проверок lint, поставляемых вместе с Compose, теперь требуется версия AGP не ниже 8.8.2. Если вы не можете обновить AGP, вы можете обновить Lint самостоятельно, указав
android.experimental.lint.version=8.8.2
(или более новую версию) в файлеgradle.properties
. Для запуска проверок lint Compose в среде IDE требуется Android Studio Ladybug или более новая версия.
Изменения API
- Метод
currentCompositeKeyHash
теперь устарел. Вместо него используйтеcurrentCompositeKeyHashCode
. Новый API кодирует тот же хеш с большим количеством бит, что экспоненциально снижает вероятность того, что две случайные несвязанные группы в иерархии композиции будут иметь одинаковый хеш-ключ. ( I4cb6a , b/177562901 ) - Для проектов, выпущенных с использованием Kotlin 2.0, требуется использование KGP 2.0.0 или более поздней версии ( Idb6b5 ).
-
@Stable
,@Immutable
и@StableMarker
были перенесены в runtime-annotation (для совместимости). Теперь вы можете использовать runtime-annotation, если хотите использовать эти аннотации из библиотек, не зависящих от Compose. ( I23a16 ) - Удалены
onCreating
иonDisposing
, поскольку они устарели и переименованы вonPreCreate
иonPreDispose
. Это изменение завершает переименование. ( I97461 ) - Предоставьте локальную композицию, которая позволяет прикрепить трассировку стека композиции на основе расположения узла композиции в композиции. ( Ie0bda , b/354163858 )
- Ввести диагностические трассировки стека Compose на основе исходной информации, хранящейся в композиции. ( I3db9f , b/354163858 )
- Отменить использование
runWithTimingDisabled
в пользуrunWithMeasurementDisabled
, который более чётко описывает поведение — все метрики приостанавливаются. Кроме того, предоставить доступ к суперклассуMicrobenchmarkScope
, поскольку повторное объявление функцииrunWithMeasurementDisabled
для открытия доступа невозможно, так как она встроена. ( I9e23b , b/389149423 , b/149979716 ) - Добавляет
@FrequentlyChangingValue
: аннотацию, которая может отмечать функции и методы получения свойств, указывая, что их не следует вызывать непосредственно внутри композиции, так как это может привести к частым перекомпоновкам. Например, для отметки значений положения прокрутки и значений анимации. Предупреждения выдаются соответствующей проверкой lint. ( I83630 , b/234042500 ) - Добавляет
@RememberInComposition
: аннотацию, которая может помечать конструкторы, функции и геттеры свойств, указывая, что их нельзя вызывать напрямую внутри композиции без сохранения. Соответствующая проверка линта выявит ошибки. Эта аннотация может использоваться для пометки объявлений, возвращающих изменяемые объекты с сохранением состояния, объекты, идентичность которых важно сохранять между композициями, или объекты, создание экземпляров которых требует больших затрат и которые следует кэшировать между композициями. ( Ie7db0 ) - Добавлена новая перегрузка
rememberSaveable
, поддерживающаяKSerializer
для типобезопасного сохранения состояния с использованием сериализации KotlinX. Существующий API на основеSaver
продолжает поддерживаться. ( Iea4ab , b/376028110 )
Исправления ошибок
- Исправлена отправка наблюдателей запоминания в приостановленной композиции, чтобы избежать отправки запомненных/забытых в том же применении ( I570b2 , b/404645679 , b/407931790 ).
- Методы
SnapshotObserver
onCreating переименованы вonPreCreate
иonDisposing
вonPreDispose
в соответствии с рекомендациями API. Предыдущие методы устарели, а новые методы по умолчанию вызывают старые, поэтому существующие реализации этого интерфейса продолжат работать до тех пор, пока они не будут удалены. Эти методы будут удалены в альфа-версии 1.9.0 в следующем CL, который выйдет вскоре после этой. Они будут удалены из бета-версии 1.8 до версии 1.8 stable. ( I6d753 ) - Исправлена ошибка, из-за которой запомненные значения могли быть ошибочно забыты и пересчитаны при повторном составлении исключенной группы, которая появляется после перемещаемой группы ( I62cab , b/383769314 ).
- Добавлена поддержка трассировок стека компоновки в
LaunchedEffect
иrememberCoroutineScope
( I705c0 , b/354163858 ). - Для проверки lint в Compose теперь требуется AGP версии не ниже 8.8.2 из командной строки и как минимум Android Studio Ladybug для поддержки IDE. Если вы используете более старую версию AGP, вы можете установить
android.experimental.lint.version=8.8.2
в gradle.properties, чтобы обновить версию Lint, не затрагивая AGP. ( I6f2a8 )
Внешний вклад
- Добавлен
AnnotationTarget.FUNCTION
в аннотациюFunctionKeyMeta
. ( I08021 )
Версия 1.8
Версия 1.8.3
18 июня 2025 г.
Выпущена androidx.compose.runtime:runtime-*:1.8.3
. Версия 1.8.3 содержит следующие коммиты .
Версия 1.8.2
20 мая 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.2
. Версия 1.8.2 содержит следующие коммиты .
Версия 1.8.1
7 мая 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.1
. Версия 1.8.1 содержит следующие коммиты .
Версия 1.8.0
23 апреля 2025 г.
Выпущена androidx.compose.runtime:runtime-*:1.8.0
. Версия 1.8.0 содержит следующие коммиты .
Версия 1.8.0-rc03
9 апреля 2025 г.
Выпущена androidx.compose.runtime:runtime-*:1.8.0-rc03
. Версия 1.8.0-rc03 содержит следующие коммиты .
Версия 1.8.0-rc02
26 марта 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-rc02
. Версия 1.8.0-rc02 содержит следующие коммиты .
Версия 1.8.0-rc01
12 марта 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-rc01
. Версия 1.8.0-rc01 содержит следующие коммиты .
Изменения API
- Методы
SnapshotObserver
onCreating переименованы вonPreCreate
иonDisposing
вonPreDispose
в соответствии с рекомендациями API. Предыдущие методы устарели, а новые методы по умолчанию вызывают старые, поэтому существующие реализации этого интерфейса продолжат работать до тех пор, пока они не будут удалены. Эти методы будут удалены в альфа-версии 1.9.0 в следующем CL, который выйдет вскоре после этой. Они будут удалены из бета-версии 1.8 до версии 1.8 stable. ( I6d753 )
Версия 1.8.0-beta03
26 февраля 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-beta03
. Версия 1.8.0-beta03 содержит следующие коммиты .
Версия 1.8.0-beta02
12 февраля 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-beta02
. Версия 1.8.0-beta02 содержит следующие коммиты .
Исправления ошибок
- Повторно выдать пойманное исключение в приостановленной композиции. ( 384486d )
Версия 1.8.0-beta01
29 января 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-beta01
. Версия 1.8.0-beta01 содержит следующие коммиты .
Изменения API
- Исправлена ошибка, из-за которой создание объекта throwable во время композиции, не выходящего за рамки Exception, могло привести к ошибке «Ожидаемая композиция не была применена». ( I356be , b/382094412 )
Версия 1.8.0-альфа08
15 января 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-alpha08
. Версия 1.8.0-alpha08 содержит следующие коммиты .
Версия 1.8.0-альфа07
11 декабря 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-alpha07
. Версия 1.8.0-alpha07 содержит следующие коммиты .
Изменения API
- Добавлен инструментальный API, который помогает инспектору макета сопоставлять подкомпозиции с родительской композицией в случаях, когда узел не используется для объединения композиций. ( I4ce3d )
- Арифметические операции и специальные константы для
SnapshotId
теперь внутренние, а не публичные. При необходимости надSnasphotId
можно выполнять арифметические операции, преобразовав его вInt
илиLong
с помощьюtoInt()
илиtoLong()
соответственно. ( Ic3a57 )
Внешний вклад
- Оптимизируйте хранилище для параметров
movableContentOf
. ( ed87177 )
Версия 1.8.0-альфа06
13 ноября 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-alpha06
. Версия 1.8.0-alpha06 содержит следующие коммиты .
Изменения API
- Изменения в API
PausableComposition
. Эти критические изменения относятся к предыдущим версиям 1.8.0-alpha (начиная с 1.8.0-alpha02), но, поскольку это новые API в версии 1.8.0, обратная совместимость не поддерживается, поскольку API всё ещё находятся в стадии альфа-тестирования. ( I39819 ) - Добавляет инструментальные API для наблюдения за созданием новых композиций в Recomposer ( Iaeb7e )
- Добавлен
snapshotId
типаLong
вSnapshot
и объявлен устаревшимid
. Идентификатор снимка изменён сInt
наLong
, чтобы избежать переполнения идентификатора снимка в системах с очень высокой частотой кадров и длительной анимацией. Тип был сделан ожидаемым/актуальным, чтобы этот тип мог бытьInt
или другим на платформах, не имеющих собственного типаLong
. Платформам, не имеющим собственного типаLong
, например JavaScript, следует избегать высокой частоты кадров (более 1000 кадров в секунду), которая может привести к переполнению дляInt
approx каждые 24 дня. ( I38ac3 , b/374821679 )
Исправления ошибок
- Исправлено
providesDefault
для одногоprovides
. ( aosp/3318540 b/374263387 ) - Оптимизировать
ChangeList
. ( 3318538 )
Версия 1.8.0-альфа05
30 октября 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-alpha05
. Версия 1.8.0-alpha05 содержит следующие коммиты .
Исправления ошибок
- Исправление переполнения стека путем добавления
Int.MAX_VALUE
вSnapshotIdSet
. ( b/370536104 , Ic4179f6 ) - Микрооптимизации времени выполнения ( I50c60 )
- Разрешить R8 удалять отладочные вызовы runtimeCheck ( I8c44 )
- Сделать
compoundKeyOf
итеративным вместо рекурсивного ( I5817f )
Внешний вклад
- Реализовать стеки с помощью списков коллекций ( I7d47c )
Версия 1.8.0-альфа04
16 октября 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-alpha04
. Версия 1.8.0-alpha04 содержит следующие коммиты .
Улучшения производительности
- Укажите идентификатор снимка для записей состояния в конструкторе ( 85c00f )
- Реорганизуйте
SnapshotState***
, чтобы избежать ошибок проверки класса ( 6ee4a6 ) - Исправление правил R8 для предотвращения встраивания броска ( 5beb92 )
- Микрооптимизация операций ( d73c5c )
- Оптимизация распределения
SynchronizedObject
на JVM ( 2b043f )
Версия 1.8.0-альфа03
2 октября 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-alpha03
. Версия 1.8.0-alpha03 содержит следующие коммиты .
Улучшения производительности
- Лениво создайте дочерний контекст для
rememberCoroutineScope
( f61464 )-
rememberCoroutineScope
обычно используется для запуска сопрограмм в ответ на события, происходящие после композиции. В некоторых сценариях эти события могут вообще не произойти, что приводит к дополнительным затратам на создание и отмену заданий без какой-либо выгоды. - Сделайте так, чтобы область, возвращаемая
rememberCoroutineScope
, создавала свойcoroutineContext
лениво при доступе, полностью избегая создания и отмены задания, если область никогда не используется.
-
Версия 1.8.0-альфа02
18 сентября 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-alpha02
. Версия 1.8.0-alpha02 содержит следующие коммиты .
Новые функции
- Добавлена
PausableComposition
, позволяющая создавать подкомпозицию, которую можно приостановить во время композиции и асинхронно применить к ней. Для приостановки требуется поддержка компилятора, которая в настоящее время находится в разработке. ( I3394b )
Версия 1.8.0-альфа01
4 сентября 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.8.0-alpha01
. Версия 1.8.0-alpha01 содержит следующие коммиты .
Версия 1.7
Версия 1.7.8
12 февраля 2025 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.8
. Версия 1.7.8 содержит следующие коммиты .
Версия 1.7.7
29 января 2025 г.
Выпущена версия androidx.compose.runtime:runtime-*:1.7.7
. Изменений по сравнению с версией 1.7.6 нет.
Выпущена androidx.compose.runtime:runtime-*:1.7.6
. Версия 1.7.6 содержит следующие коммиты .
Версия 1.7.5
30 октября 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.5
. Версия 1.7.5 содержит следующие коммиты .
Версия 1.7.4
16 октября 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.4
. Версия 1.7.4 содержит следующие коммиты .
Версия 1.7.3
2 октября 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.3
. Версия 1.7.3 содержит следующие коммиты .
Версия 1.7.2
18 сентября 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.2
. Версия 1.7.2 содержит следующие коммиты .
Версия 1.7.1
10 сентября 2024 г.
- Артефакты Android остались без изменений. Артефакты
-desktop
были удалены, а артефакты-jvmStubs
и-linuxx64Stubs
были добавлены. Ни один из этих целевых объектов не предназначен для использования, они являются заглушками, помогающими работе Jetbrains Compose.
Версия 1.7.0
4 сентября 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0
. Версия 1.7.0 содержит следующие коммиты .
Важные изменения с версии 1.6.0
- Добавлена возможность предоставления локальной композиции, которая вычисляется на основе значений других локальных переменных композиции либо по умолчанию, используя
compositionLocalWithComputedDefault()
, либо путем предоставления лямбда-выражения, используемого для вычисления значения, с использованиемprovidesComputed
вместоprovides
. - Значение локальной переменной композиции можно получить, используя свойство
currentValue
локальной переменной композиции, доступное из лямбда-выражения, вычисляющего значение. Это свойство используется вместоcurrent
, которое доступно только в функциях@Composable
. ( Iadbc0 ) - Вновь созданные объекты состояния сразу же доступны из других снимков, включая глобальный снимок, в их исходном состоянии. Любые последующие изменения не видны до тех пор, пока не будет применен снимок, в котором был создан объект.
- Начальное состояние
mutableStateOf()
, как и их примитивных версий, — это значение, переданное в качестве параметраmutableStateOf()
. Начальное состояниеmutableStateListOf()
иmutableStateMapOf()
— пустое. - Добавлены
Snapshot.isInSnapshot
иSnapshot.PreexistingSnapshotId
, которые используются для того, чтобы объект состояния поддерживал немедленный доступ из глобального снимка после его создания. - Объекты пользовательского состояния могут поддерживать немедленный доступ, следуя шаблону изменений, внесенных во встроенные объекты моментальных снимков. ( I84a17 )
- Включить
nonSkippingGroupOptimization
для библиотек компоновки. Это повышает эффективность генерируемого кода для всех неперезапускаемых компонуемых функций в AndroidX. В будущем мы планируем включить эту функцию по умолчанию. I( acbc08 ) - Отменить авторизацию составных лямбда-выражений в подкомпозициях в одном кадре. ( 98301c )
- Вызовите обратный вызов
onRelease
в том же порядке, что иonForgotten
. ( 2cd790 ) - Включить режим сильного пропуска ( ed1766 )
- Сделать
currentCompoundHashKey
уникальным в большем количестве случаев ( d4a872 )
Версия 1.7.0-rc01
21 августа 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-rc01
. Версия 1.7.0-rc01 содержит следующие коммиты .
Версия 1.7.0-beta07
7 августа 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-beta07
. Версия 1.7.0-beta07 содержит следующие коммиты .
Версия 1.7.0-beta06
24 июля 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-beta06
. Версия 1.7.0-beta06 содержит следующие коммиты .
Версия 1.7.0-beta05
10 июля 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-beta05
. Версия 1.7.0-beta05 содержит следующие коммиты .
Версия 1.7.0-beta04
26 июня 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-beta04
. Версия 1.7.0-beta04 содержит следующие коммиты .
Версия 1.7.0-beta03
12 июня 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-beta03
. Версия 1.7.0-beta03 содержит следующие коммиты .
Версия 1.7.0-beta02
29 мая 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-beta02
. Версия 1.7.0-beta02 содержит следующие коммиты .
Версия 1.7.0-beta01
14 мая 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-beta01
. Версия 1.7.0-beta01 содержит следующие коммиты .
Версия 1.7.0-альфа08
1 мая 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-alpha08
. Версия 1.7.0-alpha08 содержит следующие коммиты .
Версия 1.7.0-альфа07
17 апреля 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-alpha07
. Версия 1.7.0-alpha07 содержит следующие коммиты .
Новые функции
- Добавлена возможность предоставления локальной композиции, которая вычисляется на основе значений других локальных переменных композиции либо по умолчанию, используя
compositionLocalWithComputedDefault()
, либо путем предоставления лямбда-выражения, используемого для вычисления значения, с использованиемprovidesComputed
вместоprovides
. - Значение локальной переменной композиции можно получить, используя свойство
currentValue
локальной переменной композиции, доступное из лямбда-выражения, вычисляющего значение. Это свойство используется вместоcurrent
, которое доступно только в функциях@Composable
. ( Iadbc0 )
Изменения API
- Вновь созданные объекты состояния сразу же доступны из других снимков, включая глобальный снимок, в их исходном состоянии. Любые последующие изменения не видны до тех пор, пока не будет применен снимок, в котором был создан объект.
- Начальное состояние
mutableStateOf()
, как и их примитивных версий, — это значение, переданное в качестве параметраmutableStateOf()
. Начальное состояниеmutableStateListOf()
иmutableStateMapOf()
— пустое. - Добавлены
Snapshot.isInSnapshot
иSnapshot.PreexistingSnapshotId
, которые используются для того, чтобы объект состояния поддерживал немедленный доступ из глобального снимка после его создания. - Объекты пользовательского состояния могут поддерживать немедленный доступ, следуя шаблону изменений, внесенных во встроенные объекты моментальных снимков. ( I84a17 )
Исправления ошибок
- Исправлено слияние
readObserver
во вложенных снимках. Это приводило к недостаточной валидности вложенных производных состояний при использовании внутриsnapshotFlow
. ( Idf138 )
Версия 1.7.0-альфа06
3 апреля 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-alpha06
. Версия 1.7.0-alpha06 содержит следующие коммиты .
Исправления ошибок
- Исправлена обработка отдельных значений
providesDefault
( 538f45 ). - Избежать взаимоблокировки в Recomposer при доступе к кадровым часам ( 07e5c6 )
Версия 1.7.0-альфа05
20 марта 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-alpha05
. Версия 1.7.0-alpha05 содержит следующие коммиты .
Исправления ошибок
- Удалить поздние изменения в деактивированной композиции ( 5950bc )
Версия 1.7.0-альфа04
6 марта 2024 г.
Выпущен androidx.compose.runtime:runtime-*:1.7.0-alpha04
. Версия 1.7.0-alpha04 содержит следующие коммиты .
Улучшения производительности
- Вызвать
Snapshot.current
один раз для каждой оценки производного состояния ( ee7daf ) - Читать
currentRecord
один раз за наблюдение в композиции ( b882b2 ) - Удалить случайное выделение итератора в
snapshotFlow
( 231e56 ) - Включить
nonSkippingGroupOptimization
для библиотек компоновки. Это повышает эффективность генерируемого кода для всех неперезапускаемых компонуемых функций в AndroidX. В будущем мы планируем включить эту функцию по умолчанию. I( acbc08 )
Версия 1.7.0-альфа03
21 февраля 2024 г.
Выпущена androidx.compose.runtime:runtime-*:1.7.0-alpha03
. Версия 1.7.0-alpha03 содержит следующие коммиты.
Изменения API
- Ввести группы замены для улучшения обнаружения изменений ( 0941b5 )
Улучшения производительности
- Улучшить распределение памяти при обнаружении изменений ( 53e7fd )
- Исправлена утечка памяти в композиторе ( 0e097d )
- Используйте
ScopeMap
для передачи недействительных данных при повторной компоновке ( e19a7e ) - Оптимизировать карту аннулирований, чтобы сохранить только производные состояния ( f11c44 )
- Заменить использование
IdentityArraySet
наScatterSet
( db572e ) - Оптимизировать
removeScope
вScopeMap
( bb0530 )
Версия 1.7.0-альфа02
7 февраля 2024 г.
Выпущена androidx.compose.runtime:runtime-*:1.7.0-alpha02
. Версия 1.7.0-alpha02 содержит следующие коммиты.
Исправления ошибок
- Отменить авторизацию составных лямбда-выражений в подкомпозициях в одном кадре. ( 98301c )
- Вызовите обратный вызов
onRelease
в том же порядке, что иonForgotten
. ( 2cd790 ) - Фильтровать измененные состояния, которые не наблюдаются в
snapshotFlow
. ( 796b80 )
Улучшения производительности
- Измените наблюдателя снимка на месте, когда он уже прозрачен. ( f60f30 )
- Оптимизировать
SnapshotIdSet.lowest()
. ( 7ae149 ) - Используйте метод
fold()
без выделения памяти вSnapshotIdSet
. ( 532b7d ) - Удалить распределение итератора ( 83F96B )
Версия 1.7.0-Alpha01
24 января 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-alpha01
выпускается. Версия 1.7.0-Alpha01 содержит эти коммиты.
Оптимизация производительности
- Добавьте возможность создавать слоты после добавления детской группы ( B5960C )
- Оптимизировать модификации записи состояний снимка ( 28C3FE )
- Включить сильный режим прохождения ( ED1766 )
Исправления ошибок
- Учетная запись для параметра по умолчанию Meta In Insinsic Помните ( 096665 )
- Сделать
currentCompoundHashKey
уникальным в большем количестве случаев ( D4A872 ) - Реализуйте группы при выходе из встроенного функционального вызова ( 2A90FC )
Версия 1.6
Версия 1.6.8
12 июня 2024 г.
androidx.compose.runtime:runtime-*:1.6.8
выпускается. Версия 1.6.8 содержит эти коммиты .
Версия 1.6.7
1 мая 2024 г.
androidx.compose.runtime:runtime-*:1.6.7
выпускается. Версия 1.6.7 содержит эти коммиты .
Версия 1.6.6
17 апреля 2024 г.
androidx.compose.runtime:runtime-*:1.6.6
выпускается. Нет изменений с момента последнего релиза.
Версия 1.6.5
3 апреля 2024 г.
androidx.compose.runtime:runtime-*:1.6.5
выпускается. Версия 1.6.5 содержит эти коммиты .
Версия 1.6.4
20 марта 2024 г.
androidx.compose.runtime:runtime-*:1.6.4
выпускается. Версия 1.6.4 содержит эти коммиты .
Версия 1.6.3
6 марта 2024 г.
androidx.compose.runtime:runtime-*:1.6.3
выпускается. Версия 1.6.3 содержит эти коммиты .
Версия 1.6.2
21 февраля 2024 г.
androidx.compose.runtime:runtime-*:1.6.2
выпускается. Версия 1.6.2 содержит эти коммиты.
Версия 1.6.1
7 февраля 2024 г.
androidx.compose.runtime:runtime-*:1.6.1
выпускается. Версия 1.6.1 содержит эти коммиты.
Исправления ошибок
- Позвоните
onRelease
вызов в том же порядке, что иonForgotten
. ( 2CD790 ) - Фильтр изменил состояния, которые не наблюдаются в
snapshotFlow
. ( 796B80 )
Версия 1.6.0
24 января 2024 г.
androidx.compose.runtime:runtime-*:1.6.0
выпускается. Версия 1.6.0 содержит эти коммиты.
Важные изменения с 1.5.0
Новые функции
- Исключения повторения, которые проглатываются во время петли переоборудования ( 4DFF9A )
Оптимизация производительности
- Оптимизировать модификации записи состояний снимка ( 28C3FE )
- Оптимизация
rememberSaveable
( F01D79 ) - Отложение перечитывания производных состояний до тех пор, пока не будут зарегистрированы изменения ( F38099 )
- Улучшение предоставления композиционных локальных значений ( A337EA )
Исправления ошибок
- Утечка памяти таблицы слота ( 73FCFE )
- Пропустить переоборудование подкомпозиций, которые будут удалены. ( IEEB99 , B/254645321 )
- Только триггер
RememberObserver
жизненные циклы, когда он хранится в расчете «Запомнить». ( F6B4DC ) - Ограничьте
$dirty
захват вставленными лямбдами. ( ACFCA0 ) - Исправление подвижного контента Иногда получает неправильный композиция местных жителей. ( 035cd6 )
Версия 1.6.0-RC01
10 января 2024 г.
androidx.compose.runtime:runtime-*:1.6.0-rc01
выпускается. Версия 1.6.0-RC01 содержит эти коммиты.
Версия 1.6.0-бета03
13 декабря 2023 года
androidx.compose.runtime:runtime-*:1.6.0-beta03
выпускается. Версия 1.6.0-BETA03 содержит эти коммиты.
Версия 1.6.0-бета02
29 ноября 2023 года
androidx.compose.runtime:runtime-*:1.6.0-beta02
выпускается. Версия 1.6.0-BETA02 содержит эти коммиты.
Версия 1.6.0-бета01
15 ноября 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-beta01
выпускается. Версия 1.6.0-BETA01 содержит эти коммиты.
Изменения API
- Распространять определенные значения стабильности при аннотации. (274a4c)
Исправления ошибок
- Используйте референциальную политику для состава местного состояния областей сфера в контексте. (83361c)
- Ограничьте грязный захват вставленными лямбдами. (ACFCA0)
- Исправление подвижного контента Иногда получает неправильный композиция местных жителей. (035cd6)
- Используйте более быстрые не выделяющие Hashmaps в
RecomposeScopeImpl
. (D79494) - Используйте
ObjectIntMap
вDerivedState
. (21862E) - Используйте
IntRef
для intSnapshotThreadLocal
вDerivedState
. (04eaf4)
Версия 1.6.0-Alpha08
18 октября 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha08
выпускается. Версия 1.6.0-Alpha08 содержит эти коммиты.
Исправления ошибок
- Только триггер
RememberObserver
жизненные циклы, когда он хранится в расчете «Запомнить». ( F6B4DC ) - Улучшить ассигнования в сортировке сортировки неверно. ( 954D63 )
- Используйте новые, не выделяющие карты в
SnapshotStateObserver
. ( 4303ce ) - Четкие признания при деактивировании композиции деактивируются. ( e001be )
Версия 1.6.0-Alpha07
4 октября 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha07
выпускается. Версия 1.6.0-Alpha07 содержит эти коммиты.
Изменения API
-
SnapshotStateList
теперь отмечается какRandomAccess
, чтобы позволить использовать прямую версию индексации помощников списков. ( I5210c , b/219554654 )
Версия 1.6.0-Alpha06
20 сентября 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha06
выпускается. Версия 1.6.0-Alpha06 содержит эти коммиты.
Версия 1.6.0-Alpha05
6 сентября 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha05
выпускается. Версия 1.6.0-Alpha05 содержит эти коммиты.
Версия 1.6.0-Alpha04
23 августа 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha04
выпускается. Версия 1.6.0-Alpha04 содержит эти коммиты.
Новые функции
- Исключения повторения, которые проглатываются во время петли переоборудования ( 4DFF9A )
Изменения API
- Добавлено метод для дезактивации
ReusableComposition
, удаляя наблюдения, но удерживая узлы на месте. Деактивированная композиция может быть снова активирован, вызываяsetContent
. ( IB7F31 ) - Добавить интерфейс
ReusableComposition
для управления жизненным циклом и повторного использования подкомпозиций. ( I812D1 , B/2528446775 )
Версия 1.6.0-Alpha03
9 августа 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha03
выпускается. Версия 1.6.0-Alpha03 содержит эти коммиты.
Исправления ошибок
- Исправить новую оптимизацию
CompositionLocalProvider
( 3118E88 ) - Управляйте, как подвижные узлы контента разобраны. ( 5e3d59b )
Версия 1.6.0-Alpha02
26 июля 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha02
выпускается. Версия 1.6.0-Alpha02 содержит эти коммиты.
Новые функции и улучшения производительности
- Оптимизация
rememberSaveable
( F01D79 ) - Отложение перечитывания производных состояний до тех пор, пока не будут зарегистрированы изменения ( F38099 )
- Улучшение предоставления композиционных локальных значений ( A337EA )
-
SideEffect
помечен как@ExplicitGroupsComposable
, чтобы избежать генерирования группы. ( I74815 ) - Не сравнивайте локальные карты композиции на повторном использовании ( 782071 )
Изменения API
- Добавлена специальная перегрузка для
CompositionLocalProviders
, которая позволяет избежать накладных расходов, используемых для обеспечения нескольких значений быстрее, но накладных расходов при предоставлении единого значения. ( I6d640 , b/288169379 )
Исправления ошибок
- Утечка памяти таблицы слота ( 73FCFE )
- Исправьте, как мы восстанавливаем
rememberSaveable
когдаstateSaver
возвращает NULL ( 90748C )
Версия 1.6.0-Alpha01
21 июня 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha01
выпускается. Версия 1.6.0-Alpha01 содержит эти коммиты.
Исправления ошибок
- Пропустить переоборудование подкомпозиций, которые будут удалены. ( IEEB99 , B/254645321 )
- Снижение распределения при применении снимков. ( I65c09 )
- Избегайте расчета
readableHash
вDerivedState
, если снимок не был изменен ( 68C565 )
Версия 1.5
Версия 1.5.4
18 октября 2023 г.
androidx.compose.runtime:runtime-*:1.5.4
выпущен. Версия 1.5.4 содержит эти коммиты.
Версия 1.5.3
4 октября 2023 г.
androidx.compose.runtime:runtime-*:1.5.3
выпущен. Версия 1.5.3 содержит эти коммиты.
Версия 1.5.2
27 сентября 2023 г.
androidx.compose.runtime:runtime-*:1.5.2
выпущен. Версия 1.5.2 содержит эти коммиты.
Версия 1.5.1
6 сентября 2023 г.
androidx.compose.runtime:runtime-*:1.5.1
выпускается. Версия 1.5.1 содержит эти коммиты.
Версия 1.5.0
9 августа 2023 г.
androidx.compose.runtime:runtime-*:1.5.0
выпущен. Версия 1.5.0 содержит эти коммиты.
Изменения API
- Удаленные ассигнования по переработке, цветовой анимации и
AndroidComposeView
. ( IB2BFA ) - Добавлена аннотация
@StateFactoryMarker
, чтобы отметить функции, которые создают состояния, и должны быть обернуты в вызовremember
. ( I64550 ) - Добавить примитивные версии состояния и
MutableState
( FB3D89 ) - Добавлен
Snapshot.isApplyObserverNotificationPending
( i672a5 ) - Добавлены примитивные версии
State
API, позволяющие int, long, float и двойные значения отслеживать в объектахState
без штрафов за автобоксинг. Используйте новые заводские методыmutableIntState(Int)
,mutableFloatStateOf(Float)
и т. Д., Чтобы использовать их. ( I48e43 )
Исправления ошибок
- Пропустить переоборудование подкомпозиций, которые будут удалены. ( IEEB99 , B/254645321 )
- Не сохраняйте ссылку на снимок в
ComposerImpl
( 0206F7 ) - Не применяйте композицию дважды ( F5791B )
- Обеспечить недействительную значения не инициализированных полученных состояний ( AA2A92 )
- Позвоните в
onEndChanges
во время композиции. ( 62CC8C ) - Исправить перемещение контента в субкомпозицию ( 4beb41 )
- Исправить потенциальные тупики ( C1A425 и 8EDCE0 )
- Recomposer, созданный для окна Andide, теперь будет блокировать вызовы
withFrameNanos
вместо всей композиции, когда он получает уведомление ON_STOP. Это означает, что Windows, связанные с остановленными активиями, будут продолжать переоценивать для изменений данных, но анимации или любой другой вызывающий абонентwithFrameNanos
будут блокировать. ( Id9e7f , b/2409755572 ) - Выполнить деактивационные обратные вызовы для
LayoutNode
перед утилизацией эффектов 3784073 - Исправлена измененные флаги для перезапущенного лямбдас EA81DF9
- Исправлена регрессия в прямом эфире для композиции с узлами 73FD4D8
- On_stop должен приостановить трансляции кадров .
- Несилировать
SnapshotStateObserver
Scopes для неизменных производных состояний 84D9B1C - Исправьте потенциал мертвого замка при утилизации композиций 28761FC
- Исправьте перемещение контента в подкомпозицию 92D4156
- Исправлена измененные флаги для перезапущенных лямбдас ( 8A03E9 )
- Выполнить дезактивационные обратные вызовы для
LayoutNode
перед утилизацией эффектов ( 8B0FA4 ) - Исправьте
endToMarker()
при окончании групп узлов. ( D71D980 ) - Используйте текущую группу
SlotWriter
для проверки деактивации ( A0B518B ) - Снимите
fill
вSlotTable.moveSlotGapTo()
и переместите его в закрытие ( 81F9935 ) - Исправить отсутствие недействительных, пока движется подвижный контент ( 1D7C024 )
- Исправьте немедленные признания за перемещенное подвижное содержание ( 8676618 )
Улучшения производительности
- Избегайте рассчитывания
readableHash
вDerivedState
, если снимок не был изменен. ( 307102 ) - Снижение распределения ( I65C09 , D7EA77 , 727974 и 445808 )
- Быстрая отмена Compose
CoroutineScopes
( A55362 и BD382F ) - Перезаписать записи о государственных объектах с недоступными государственными записями ( C986960 )
- Используйте композитор правильной области при реализации групп ( 9A5E5B6 )
- Используйте
IdentityArraySet
для хранения недействительных снимков ( 7F60CCA ) - Уменьшить ассигнования для наблюдений за снимками ( 5BC535F )
Версия 1.5.0-RC01
26 июля 2023 г.
androidx.compose.runtime:runtime-*:1.5.0-rc01
выпущен. Версия 1.5.0-RC01 содержит эти коммиты.
Исправления ошибок
Отложение перечитывания производных состояний до тех пор, пока не будут зарегистрированы изменения ( F38099 )
Доступна дополнительная проверка, чтобы рекомендовать Migrating
mutableStateOf()
вызовы в соответствующие специализированные типы для примитивов. Его идентификатор пронзака -AutoboxingStateCreation
. Ранее эта проверка была включена по умолчанию для всех проектов. Чтобы увидеть это предупреждение в редакторе Android Studio и выходе из вашего проекта, измените его серьезность от информационного к предупреждению (или выше), объявивwarning "AutoboxingStateCreation"
внутри Build.Gradle или Build.Gradle.KTS, как показано ( i34F7E ):android { lint { warning "AutoboxingStateCreation" } ... }
Версия 1.5.0-бета03
28 июня 2023 г.
androidx.compose.runtime:runtime-*:1.5.0-beta03
выпускается. Версия 1.5.0-бета03 содержит эти коммиты.
Исправления ошибок
- Пропустить переоборудование подкомпозиций, которые будут удалены. ( IEEB99 , B/254645321 )
Версия 1.5.0-бета02
7 июня 2023 г.
androidx.compose.runtime:runtime-*:1.5.0-beta02
выпускается. Версия 1.5.0-бета02 содержит эти коммиты.
Улучшения производительности
- Избегайте рассчитывания
readableHash
вDerivedState
, если снимок не был изменен. ( 307102 )
Версия 1.5.0-бета01
24 мая 2023 г.
androidx.compose.runtime:runtime-*:1.5.0-beta01
выпускается. Версия 1.5.0-бета01 содержит эти коммиты.
Изменения API
- Удаленные ассигнования по переработке, цветной анимации и
AndroidComposeView
( IB2BFA ) - Добавлена аннотация
@StateFactoryMarker
, чтобы отметить функции, которые создают состояния, и должны быть обернуты в вызовremember
. ( I64550 ) - Добавить примитивные версии состояния и
MutableState
( FB3D89 ) - Добавлен
Snapshot.isApplyObserverNotificationPending
( i672a5 )
Исправления ошибок
- Снижение распределения ( I65C09 , D7EA77 , 727974 и 445808 )
- Не сохраняйте ссылку на снимок в
ComposerImpl
( 0206F7 ) - Быстрая отмена Compose
CoroutineScopes
( A55362 и BD382F ) - Не применяйте композицию дважды ( F5791B )
- Обеспечить недействительную значения не инициализированных полученных состояний ( AA2A92 )
- Позвоните в
onEndChanges
во время композиции. ( 62CC8C ) - Исправить перемещение контента в субкомпозицию ( 4beb41 )
- Исправить потенциальные тупики ( C1A425
- On_stop должен приостановить трансляции кадров .
- Исправлена измененные флаги для перезапущенных лямбдас ( 8A03E9 )
- Выполнить дезактивационные обратные вызовы для
LayoutNode
перед утилизацией эффектов ( 8B0FA4 )
Внешний вклад
- Добавлен
Snapshot.isApplyObserverNotificationPending
( i672a5 )
Версия 1.5.0-Alpha04
10 мая 2023 г.
androidx.compose.runtime:runtime-*:1.5.0-alpha04
выпущен. Версия 1.5.0-Alpha04 содержит эти коммиты.
Изменения API
- Добавлены примитивные версии
State
API, позволяющие int, long, float и двойные значения отслеживать в объектахState
без штрафов за автобоксинг. Используйте новые заводские методыmutableIntState(Int)
,mutableFloatStateOf(Float)
и т. Д., Чтобы использовать их. ( I48e43 )
Исправления ошибок
Позвоните
onEndChanges
во время композиции. Фокусные узлы удаляются во времяComposition.dispose
. Напротив подписки наonEndChanges
для сброса фокуса. ( 03D4A47 )Обеспечить недействительную для неиниализованных значений производного состояния. Каждое производное состояние связано со списком его зависимостей в
SnapshotStateObserver
, используемом для недействительной области, связанных с производным состоянием, когда меняется зависимость. Изменение зависимости зарегистрировано на продвижении снимка, что может произойти после чтения полученного состояния (из -за вызоваSnapshot.notifyObjectsInitialized()
).Предыдущая логика наблюдения за полученным состоянием в
SnapshotStateObserver
очищала старые зависимости, а затем читал новое значение. Это привело к условиям гонки с недействительной, происходящей в очищенном состоянии, где недействительна не была зарегистрирована.Это изменение, полученное в состоянии, чтение и очистка зависимости, обеспечивая, чтобы недействительность всегда происходила в действительном состоянии. ( C472BE6 )
Версия 1.5.0-Alpha03
19 апреля 2023 года
androidx.compose.runtime:runtime-*:1.5.0-alpha03
выпускается. Версия 1.5.0-Alpha03 содержит эти коммиты.
Изменения API
- Recomposer, созданный для окна Andide, теперь будет блокировать вызовы
withFrameNanos
вместо всей композиции, когда он получает уведомление ON_STOP. Это означает, что Windows, связанные с остановленными активиями, будут продолжать переоценивать для изменений данных, но анимации или любой другой вызывающий абонентwithFrameNanos
будут блокировать. ( Id9e7f , b/2409755572 )
Исправления ошибок
- Исправить потенциальный тупик в списке снимков и карта 5C1A425
- Выполнить деактивационные обратные вызовы для
LayoutNode
перед утилизацией эффектов 3784073 - Исправлена измененные флаги для перезапущенного лямбдас EA81DF9
- Исправлена регрессия в прямом эфире для композиции с узлами 73FD4D8
- On_stop должен приостановить трансляции кадров .
- Несилировать
SnapshotStateObserver
Scopes для неизменных производных состояний 84D9B1C - Исправьте потенциал мертвого замка при утилизации композиций 28761FC
- Исправьте перемещение контента в подкомпозицию 92D4156
Версия 1.5.0-Alpha02
5 апреля 2023 года
androidx.compose.runtime:runtime-*:1.5.0-alpha02
выпускается. Версия 1.5.0-Alpha02 содержит эти коммиты.
Новые функции
- Оператор
getValue
Kotlin теперь может быть композицией ( F174F6E )
Исправления ошибок, улучшения производительности
- Перезаписать записи о государственных объектах с недоступными государственными записями ( C986960 )
- Используйте композитор правильной области при реализации групп ( 9A5E5B6 )
- Исправьте
endToMarker()
при окончании групп узлов. ( D71D980 ) - Используйте текущую группу
SlotWriter
для проверки деактивации ( A0B518B ) - Используйте
IdentityArraySet
для хранения недействительных снимков ( 7F60CCA ) - Снимите
fill
вSlotTable.moveSlotGapTo()
и переместите его в закрытие ( 81F9935 ) - Исправить отсутствие недействительных, пока движется подвижный контент ( 1D7C024 )
- Исправьте немедленные признания за перемещенное подвижное содержание ( 8676618 )
- Уменьшить ассигнования для наблюдений за снимками ( 5BC535F )
Версия 1.5.0-Alpha01
22 марта 2023 года
androidx.compose.runtime:runtime-*:1.5.0-alpha01
выпускается. Версия 1.5.0-Alpha01 содержит эти коммиты.
Новые функции
- Добавляет
Modifier.Node#coroutineScope
чтобы позволитьModifier.Nodes
для запуска Coroutines ( i76ef9 ) - Разрешить
Modifier.Nodes
CompositionLocalConsumerModifierNode
( IB44DFCompositionLocals
Версия 1.4
Версия 1.4.3
3 мая 2023 г.
androidx.compose.runtime:runtime-*:1.4.3
выпускается без изменений.
Версия 1.4.2
19 апреля 2023 года
androidx.compose.runtime:runtime-*:1.4.2
выпущен. Версия 1.4.2 содержит эти коммиты.
Исправления ошибок
Исправить потенциальный тупик в списке снимков и карта 2EB6570
Добавление контента в
SnapshotStateList
илиSnapshotStateMap
может столкнуться с тупиком, если модификация одновременно с прямой записи в рекорд состояния. Это стало значительно чаще встречается с изменениями, введенными 93FCAE828B , которые используют прямые записи для выпуска неиспользованных записей.Замок теперь упорядочивается в том, что блокировка снимка никогда не предпринимается, когда удерживается карта или блокировка списка.
Версия 1.4.1
5 апреля 2023 года
androidx.compose.runtime:runtime-*:1.4.1
выпускается. Версия 1.4.1 содержит эти коммиты.
Исправления ошибок
- Исправьте
endToMarker()
при окончании групп узлов. D71D980
Версия 1.4.0
22 марта 2023 года
androidx.compose.runtime:runtime-*:1.4.0
выпускается. Версия 1.4.0 содержит эти коммиты.
Важные изменения с 1.3.0
- Используйте инициализированное значение от
LiveData
для первой композиции 3680E25 - Добавьте
ComposeNodeLifecycleCallback
, чтобы наблюдать жизненный цикл составных узлов. 8B6A258 - Добавить свойство
parameterTypes
вComposableMethod
7b6c7AD
Исправления ошибок и улучшения производительности
- Освободите оба индекса области в
SnapshotStateObserver
29F4A3E - Добавить группы, необходимые в организме Unskippable Lambdas 7D06752
- Улучшение эталонных характеристик памяти состояния снимка 93FCAE8
- Удалить бокс в композиции локальный поиск 0875717
- Используйте правильный ключ для незаконных узлов групп 6388D8D
- Защитите
SnapshotStateObserver
от рекурсивного и одновременного применения 98CB6BA - Добавлена проверка
IdentityArraySet
индекс . - Обновление модуля Compose для использования
ViewTreeLifecycleOwner
расширения 21C2122 - Отправить применить уведомления после повторного заканчиваемого кадра. 98F2641
- Исправить индекс вне границ сбоя при отмене Recomposer 8F8656F
- Всегда заставляйте перекачивать, если родительские поставщики композиции изменили 9526FCC
- Рецимпозиторный толерантность к отмене рабочих мест A55F7ED
- Улучшение допуска по обработке для большого количества композиторов 9B7ED67
- Исправление генерирования закрывающих групп для нелокальных возвратов B6F590C
Версия 1.4.0-RC01
8 марта 2023 г.
androidx.compose.runtime:runtime-*:1.4.0-rc01
выпускается. Версия 1.4.0-RC01 содержит эти коммиты.
Исправления ошибок
Версия 1.4.0-бета02
22 февраля 2023 г.
androidx.compose.runtime:runtime:1.4.0-beta02
и androidx.compose.runtime:runtime-saveable:1.4.0-beta02
выпускаются. Версия 1.4.0-бета02 содержит эти коммиты.
Версия 1.4.0-бета01
8 февраля 2023 г.
androidx.compose.runtime:runtime-*:1.4.0-beta01
выпускается. Версия 1.4.0-бета01 содержит эти коммиты.
Изменения API
- Был добавлен
ComposeNodeLifecycleCallback
, который позволяет наблюдать жизненный цикл композитных узлов ( i3731b ) - Добавлено
@TestOnly
вComposer.disableSourceInformation()
, так как эта функция безопасна только для вызова в тесте. ( I896c8 )
Исправления ошибок
- Удалить бокс в композиции локальные поиски ( 62F66A )
- Улучшение эталонных характеристик памяти состояния снимка ( DFB451 )
Версия 1.4.0-Alpha05
25 января 2023 года
androidx.compose.runtime:runtime:1.4.0-alpha05
и androidx.compose.runtime:runtime-saveable:1.4.0-alpha05
выпускаются. Версия 1.4.0-Alpha05 содержит эти коммиты.
Изменения API
- Больше типа/нуляции встроенных/устаревших функций ( I24F91 )
Версия 1.4.0-Alpha04
11 января 2023 г.
androidx.compose.runtime:runtime-*:1.4.0-alpha04
выпускается. Версия 1.4.0-Alpha04 содержит эти коммиты.
Изменения API
-
TestMonotonicFrameClock
теперь использует правильную экспериментальную аннотацию. ( I95c9e )
Исправления ошибок
- Защитите
SnapshotStateObserver
от рекурсивного и одновременного применения ( D902FB )
Версия 1.4.0-Alpha03
7 декабря 2022 г.
androidx.compose.runtime:runtime-*:1.4.0-alpha03
выпускается. Версия 1.4.0-Alpha03 содержит эти коммиты.
Изменения API
- Добавление нового публичного метода в
ComposableMethod
класса, аналогичныйjava.lang.reflect.Method#getParameterTypes()
( iab0c3 )
Исправления ошибок
- Уведомления о применении снимка теперь отправляются после того, как
Recomposer
заканчивает применение изменений. ( IAD6C0 , B/222093277 )
Версия 1.4.0-Alpha02
9 ноября 2022 года
androidx.compose.runtime:runtime-*:1.4.0-alpha02
выпускается. Версия 1.4.0-Alpha02 содержит эти коммиты.
Версия 1.4.0-Alpha01
24 октября 2022 г.
androidx.compose.runtime:runtime-*:1.4.0-alpha01
выпускается. Версия 1.4.0-Alpha01 содержит эти коммиты.
Изменения API
-
SnapshotStateList
иSnapshotStateMap
теперь имеют явные реализацииtoList()
иtoMap()
, с уважением. Эти методы возвращают свое текущее содержание, не выписывая копию, когда они возвращают внутренние неподвижные данные, используемые для хранения их контента. Это значение может быть использовано, например, для создания потока значений, используяsnapshotFlow
, не требуя копирования данных. ( ICA2BD )
Версия 1.3
Версия 1.3.3
11 января 2023 г.
androidx.compose.runtime:runtime-*:1.3.3
выпущен. Версия 1.3.3 содержит эти коммиты.
- Нет изменений с 1.3.2
Версия 1.3.2
7 декабря 2022 г.
androidx.compose.runtime:runtime-*:1.3.2
выпущен. Версия 1.3.2 содержит эти коммиты.
Исправления ошибок
- Обновлено в поддержку Androidx.compose.ui 1.3.2
Версия 1.3.1
9 ноября 2022 года
androidx.compose.runtime:runtime-*:1.3.1
выпускается. Версия 1.3.1 содержит эти коммиты.
Версия 1.3.0
24 октября 2022 г.
androidx.compose.runtime:runtime-*:1.3.0
выпускается. Версия 1.3.0 содержит эти коммиты.
Важные изменения с 1.2.0
Обработка исключений /
- Чтобы лучше поддерживать живое редактирование, были добавлены API, чтобы обеспечить обработку исключений во время композиции
- Обработка ошибок композиции для горячей перезагрузки
- Обрабатывать живые ошибки редактирования при сохранении/восстановлении
Трассировка композиции
- API -интерфейсы отслеживания времени выполнения были добавлены для поддержки новой трассировки композиции
- Создать композиционные следы запуска/конечного события трассировки
- Повторно добавленный composerkt.traceeventstart (int, string)
Компонируемое отражение API
- Новый API
ComposableMethod
был добавлен для обеспечения более надежных вызовов на основе отражения композиционных API. - Переместите InvokeComposable для составления времени выполнения
- Переработка API для вызова композиционного метода
Исправления времени выполнения
- Исправить ошибочную тестирование диапазона для проверки таблиц слотов для маркеров
- Позвольте подвижному контенту перейти в Subcomposelayout
- Исправить перемещение контента в новом контенте подкомпозиции
Система снимков
- Система снимков получила различные улучшения в отношении управления памятью, производительности и правильности.
- Оптимизировать удаление области в SnapshotStateBserver
- Утилизировать вложенные снимки, созданные из прозрачных снимков
- Фиксированное состояние расы при чтении состояния из глобального снимка
- Поддержка получена в SnapshotStateBserver
- Предотвратить удаление производного состояния от композиции, когда оно читается в других областях
- Используйте IdentityArrayMap вместо HashMap Inside DefiveState
- Обновление наблюдателей, полученных в состоянии, для использования изменяемого вектора
- Обновление SnapshotStateBserver State Cleanup
- Заменить SnapshotStateObserver.Invalidated с помощью ArraySet
- Фиксированное состояние расы при чтении состояния из глобального снимка
- Исправлена использование устаревшей записи в расчете хэша
- Исправить состояние гонки при продвижении глобального снимка
- Ускорение наблюдений
Версия 1.3.0-RC01
5 октября 2022 года
androidx.compose.runtime:runtime-*:1.3.0-rc01
выпускается. Версия 1.3.0-RC01 содержит эти коммиты.
Исправления ошибок
- Фиксированный
ArrayIndexOutOfBoundsException
, поступающий из таблицы слотов ( B/249076084 )
Версия 1.3.0-бета03
21 сентября 2022 г.
androidx.compose.runtime:runtime-*:1.3.0-beta03
выпускается. Версия 1.3.0-бета03 содержит эти коммиты.
Поведение нарушение изменения
- Параметр, чтобы
remember
иrememberCoroutineScope
, где изменяется, чтобы бытьcrossinline
. Это сообщит об ошибке для раннего возврата вместо того, чтобы позволить ранний возврат, который приведет к сообщению о более поздней внутренней ошибке. - Это изменение может потенциально привести к появлению новых ошибок компилятора, требующих удаления нелокальных доходов из Lambdas, переданных в эти функции. ( Ibea62 )
Версия 1.3.0-бета02
7 сентября 2022 г.
androidx.compose.runtime:runtime-*:1.3.0-beta02
выпускается. Версия 1.3.0-бета02 содержит эти коммиты.
Исправления ошибок
- Обновлен API ( i64CA0 )
Версия 1.3.0-бета01
24 августа 2022 года
androidx.compose.runtime:runtime-*:1.3.0-beta01
выпускается. Версия 1.3.0-бета01 содержит эти коммиты.
Изменения API
- Метод
find
был добавлен вCompositionData
, чтобы позволить инструментам разработчика с использованием этого API быстро найти подгруппу композиции, используя ее идентичность. ( I5794f )
Версия 1.3.0-Alpha03
10 августа 2022 г.
androidx.compose.runtime:runtime-*:1.3.0-alpha03
выпускается. Версия 1.3.0-Alpha03 содержит эти коммиты.
Версия 1.3.0-Alpha02
27 июля 2022 г.
androidx.compose.runtime:runtime-*:1.3.0-alpha02
выпускается. Версия 1.3.0-Alpha02 содержит эти коммиты.
Изменения API
- Повторно добавленный
ComposerKt.traceEventStart(Int, String)
для обратной совместимости ( i6e6de )
Версия 1.3.0-Alpha01
29 июня 2022 года
androidx.compose.runtime:runtime-*:1.3.0-alpha01
выпускается. Версия 1.3.0-Alpha01 содержит эти коммиты.
Изменения API
- Функциональность перемещения полезности к времени выполнения ( I4F729 )
Версия 1.2
Версия 1.2.1
10 августа 2022 г.
androidx.compose.runtime:runtime-*:1.2.1
выпускается. Версия 1.2.1 содержит эти коммиты.
Исправления ошибок
- Фиксированная утечка памяти: утилизировать вложенные снимки, созданные из прозрачных снимков B/239603305
Версия 1.2.0
27 июля 2022 г.
androidx.compose.runtime:runtime-*:1.2.0
выпускается. Версия 1.2.0 содержит эти коммиты.
Важные изменения с 1.1.0
У Compose Runtime было несколько функций, представленных в 1.2.0, а также множество стабилизирующих исправлений ошибок. Наиболее значимой новой особенностью было введение API
movableContentOf
, которое можно использовать для включения сложных UX, таких как переходы общих элементов. APImovableContentOf
преобразует композиционную лямбду в лямбду, которая перемещает его состояние и соответствующие узлы в любое новое местоположение, которое она называется. Когда предыдущий вызов покидает композицию, состояние временно сохраняется, и если новый вызов Lambda входит в композицию, то штат и связанные узлы перемещаются в место нового вызова. Если новый вызов не добавляется, состояние удаляется навсегда, и помните, что наблюдатели уведомляются.Если в одной и той же композиции
movableContentOf
называется многократным, новое состояние и узлы создаются для каждого вызова, и, поскольку вызовы оставляют композицию и новые вызовы вводится, состояние перемещается из первых вызовов к вступающим вызовам в порядке, которые они вызываются. Все государство не заявлено новыми вызовами, удаляется навсегда.В дополнение к этому и нескольким другим новым функциям было потрачено много времени, стабилизируя систему выполнения и состояния моментальных снимков. Различные утечки памяти были удалены и оптимизировали пути кода.
Суммированный список изменений можно найти ниже:
Новые функции в 1.2
- Добавить экспериментальный снимок небезопасно/уйти
- Добавить Snapshot.ascontextElement Экспериментальный API
- Введите Snapshot.withoutreadoBservation
- Позвольте состоянию двигаться в рамках композиции
- Отслеживание переобожений в составлении
Производительность в 1.2
- Повышение композиции локальной производительности
- Базовые профили для сочинения должны быть получены с использованием контрольных показателей
Исправления ошибок в 1.2
- Удалить информацию о отслеживании из выпуска Recompose Scopes
- Предотвратить удаление производного состояния от композиции, когда оно читается в других областях
- Используйте более эффективное removeScope () в SnapshotStateBserver
- Очистка зависимости от полученных состояний в композиции
- Исправить CurrentCompositeKeyHash, изменение после внутреннего переоборудования внутри подвижного содержания
- Очистите недействительные композиции во время утилизации
- Исправление прочтения состояния во время переоборудования
- Исправить утечку памяти при наблюдении
- Фиксированный композитный хэш -ключ для модулевых сборов, чтобы быть последовательным
- Исправить угол корпуса, когда композитор будет сбой
- Обеспечить принудительное признание групповых сил переоборудования
- Исправьте ошибку, когда вспомнить, что ввод, восстанавливается в неправильном порядке.
Версия 1.2.0-RC03
29 июня 2022 года
androidx.compose.runtime:runtime-*:1.2.0-rc03
выпускается. Версия 1.2.0-RC03 содержит эти коммиты.
Исправления ошибок
- Полученные наблюдения состояния ранее были безусловно удалены из рекомплексного масштаба и композиции вместе, которые нарушали другие области, которые все еще могут наблюдать за производным состоянием. Это изменение удаляет полученные экземпляры состояния только в том случае, если оно больше не наблюдается другими областями. ( B/236618362 )
Версия 1.2.0-RC02
22 июня 2022 года
androidx.compose.runtime:runtime-*:1.2.0-rc02
выпускается. Версия 1.2.0-RC02 содержит эти коммиты.
Версия 1.2.0-RC01
15 июня 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-rc01
выпускается. Версия 1.2.0-RC01 содержит эти коммиты.
Изменения API
- Интерфейсы в библиотеках Compose теперь созданы с использованием методов интерфейса JDK8 по умолчанию ( I5BCF1 )
Версия 1.2.0-бета03
1 июня 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-beta03
выпускается. Версия 1.2.0-бета03 содержит эти коммиты.
Версия 1.2.0-бета02
18 мая 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-beta02
выпускается. Версия 1.2.0-бета02 содержит эти коммиты.
Версия 1.2.0-бета01
11 мая 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-beta01
выпускается. Версия 1.2.0-бета01 содержит эти коммиты.
Новые функции
- Это первая бета -версия 1.2!
Изменения API
- Добавлен экспериментальный
Snapshot.unsafeEnter/unsafeLeave
( i108f3 ) - Добавлен экспериментальный
Snapshot.asContextElement()
. - Аннотация и аннотации
@ComposableTarget
и аннотации, помеченные@ComposableTargetMarker
теперь могут использоваться в прицеле файла с помощью префикса@file
. Использование целевой аннотации в прицеле файла приведет к тому, что компилятор предполагает, что все композиционные функции в файле предназначены для того, чтобы быть нацеленным на связанный приложение. Например, использование@file:UiComposable
заявляет, что все функции@Composable
нацелены на Compose UI Applier. Функция, которая должна ориентироваться на другого приложения, должна явно предоставить аннотацию целевого маркера для желаемого приложения. ( I40804 )
Версия 1.2.0-Alpha08
20 апреля 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha08
выпускается. Версия 1.2.0-Alpha08 содержит эти коммиты.
Изменения API
- Добавлено
TracingInProgress
к интерфейсуCompositionTracer
. ( IC6F12 ) - Добавить
recomposeScopeIdentity
в композитор ( I0C873 ) - Ограниченное отслеживание API (Composer.SetTracer) для
OptIn(InternalComposeTracingApi)
. ( I9187f ) - Добавлен
ResuableContentHost
, который позволяет лучше контролировать государственное время жизни, созданное для многократного использования контента. Например, если субкомпозиция временно не используется, то содержание может быть деактивировано, что приводит к тому, что все запоминающиеся состояния в композиции будет забыт, например, все одноразовые эффекты. ( I2c0f2 , b/220322704 )
Версия 1.2.0-Alpha07
6 апреля 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha07
выпускается. Версия 1.2.0-Alpha07 содержит эти коммиты.
Изменения API
- Новая функция
Snapshot.withoutReadObservation { ... }
был добавлен. Это позволяет пользователям запускать пропущенную Lambda, не подписываясь на изменения значений состояния, прочитанных в этом блоке. Вы можете найти его полезным в использовании, когда вы хотите извлечь выгоду из поток на основе снимка безопасной записи/чтения, но хотите иметь возможность читать значение, не вызывая ненужного переоборудования или переработки. ( I9f365 , b/214054486 )
Версия 1.2.0-Alpha06
23 марта 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha06
выпускается. Версия 1.2.0-Alpha06 содержит эти коммиты.
Версия 1.2.0-Alpha05
9 марта 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha05
выпускается. Версия 1.2.0-Alpha05 содержит эти коммиты.
Внешний вклад
- Обновлено для использования Cotlinx Coroutines 1.6.0 ( i3366d )
Версия 1.2.0-Alpha04
23 февраля 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha04
выпускается. Версия 1.2.0-Alpha04 содержит эти коммиты.
Изменения API
Добавлен
ComposableTarget
,ComposableTargetMarker
иComposableOpenTarget
, которые позволяют отчетность по времени компиляции, когда композиционная функция называется нацеленным на приложение, которое он не предназначен для использования.В большинстве случаев аннотации могут быть выведены с помощью плагина компилятора Compose, поэтому использование этих аннотаций непосредственно должно быть редким. Случаи, которые нельзя вывести, включают в себя создание и использование пользовательских прикладных, абстрактных композиционных функций (таких как методы интерфейса), поля или глобальные переменные, которые являются композиционными лямбдами (локальные переменные и параметры определяются), или при использовании
ComposeNode
или связанных композиционных функций.Для пользовательских приложений композиционные функции, которые вызывает
ComposeNode
илиReusableComposeNode
необходимо добавить аннотациюCompoableTarget
для функции и любые типы параметров композиции Lambda. Однако рекомендуется создать аннотацию, которая аннотирована с помощьюComposableTargetMarker
, а затем отмеченная аннотация вместоComposableTarget
напрямую. Компонируемая аннотация, помеченнаяComposableTargetMarker
, эквивалентнаComposbleTarget
с полностью квалифицированным именем класса атрибутов в качестве параметра приложения. For an example of usingComposableTargetMarker
seeanroidx.compose.ui.UiComposable
. ( I38f11 )
Version 1.2.0-alpha03
9 февраля 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha03
is released. Version 1.2.0-alpha03 contains these commits.
Изменения API
Added
movableContentOf
which converts a composable lambda into a lambda that moves it state, and corresponding nodes, to any new location it is called. When the previous call leaves the composition the state is temporarily preserved and if a new call to the lambda enters the composition then the state, and associated nodes, are moved to the location of the new call. If no new call is added the state is removed permanently and remember observers are notified.If a
movableContentOf
lambda is called multiple times in the same composition, new state and nodes are created for each call and, as calls leave the composition and new calls enter, the state is moved from the first leaving calls to the entering calls in the order they are called. All state not claimed by new calls is removed permanently. ( Ib4850 )Added a tracing API to composition to enable tools to provide more detailed tracing of composable functions. The compiler now generates calls to the tracing API which include source information. ( Ib0eb5 )
To remove these calls and the associated source information from a release build, add the following Proguard rule:
-assumenosideeffects public class androidx.compose.runtime.ComposerKt { boolean isTraceInProgress(); void traceEventStart(int,java.lang.String); void traceEventEnd(); }
Add
InternalComposeScope
which gives tools the ability to identify a composable during recompositions. ( I07a3f )
Version 1.2.0-alpha02
26 января 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha02
is released. Version 1.2.0-alpha02 contains these commits.
Version 1.2.0-alpha01
January 12, 2022
androidx.compose.runtime:runtime-*:1.2.0-alpha01
is released. Version 1.2.0-alpha01 contains these commits.
Изменения API
- Added
identity
field toCompositionData
for generating invariant ids in the Layout Inspector. ( Ic116e )
Dependency Updates
- Now depends on Kotlin
1.6.10
.
Version 1.1
Версия 1.1.1
23 февраля 2022 г.
androidx.compose.runtime:runtime-*:1.1.1
is released. Version 1.1.1 contains these commits.
Исправления ошибок
- Fix
NullPointerException
atandroidx.compose.ui.platform.RenderNodeLayer.updateDisplayList
( aosp/1947059 , b/206677462 ) - Fix crash caused by clipboard content while reading from clipboard on Android. ( I06020 , b/197769306 )
- Fixed RTL in
LazyVerticalGrid
( aosp/1931080 , b/207510535 )
Версия 1.1.0
9 февраля 2022 г.
androidx.compose.runtime:runtime-*:1.1.0
is released. Version 1.1.0 contains these commits.
Important changes since 1.0.0
- Stable support for the Android 12 Overscroll effect
- Improvements to touch target sizing
- Note that, with respect to Compose 1.0, Material components will expand their layout space to meet Material accessibility guidelines for touch target size . For instance, Button touch target will expand to a minimum size of
48x48dp
, even if you set the Button's size to be smaller. This aligns Compose Material to the same behavior of Material Design Components, providing consistent behavior if you mix Views and Compose. This change also ensures that when you create your UI using Compose Material components, minimum requirements for touch target accessibility will be met. - Stable support for Navigation Rail
- Graduates a number of previously experimental APIs to stable
- Support for newer versions of Kotlin
Version 1.1.0-rc03
26 января 2022 г.
androidx.compose.runtime:runtime-*:1.1.0-rc03
is released. Version 1.1.0-rc03 contains these commits.
Исправления ошибок
- Updated to support Compose Material
1.1.0-rc03
Version 1.1.0-rc01
15 декабря 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-rc01
is released. Version 1.1.0-rc01 contains these commits.
Version 1.1.0-beta04
1 декабря 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-beta04
is released. Version 1.1.0-beta04 contains these commits.
Новые функции
- Updated to be compatible with Kotlin
1.6.0
Version 1.1.0-beta03
17 ноября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-beta03
is released. Version 1.1.0-beta03 contains these commits.
Version 1.1.0-beta02
3 ноября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-beta02
is released. Version 1.1.0-beta02 contains these commits.
Изменения API
- Snapshot code was split up into multiple files, but all still lives in the same JVM class. ( Ic6c98 )
Version 1.1.0-beta01
27 октября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-beta01
is released. Version 1.1.0-beta01 contains these commits.
Version 1.1.0-alpha06
13 октября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-alpha06
is released. Version 1.1.0-alpha06 contains these commits.
Изменения API
- Removed
InternalCompilerApi
from Composer methods that are required to be called cross-module ( I1aa0b ) -
Recomposer.state
has been deprecated and replaced byRecomposer.currentState
to change its type to a StateFlow ( Ic2ab3 , b/197773820 )
Version 1.1.0-alpha05
29 сентября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-alpha05
is released. Version 1.1.0-alpha05 contains these commits.
Version 1.1.0-alpha04
September 15, 2021
androidx.compose.runtime:runtime-*:1.1.0-alpha04
is released. Version 1.1.0-alpha04 contains these commits.
Version 1.1.0-alpha03
1 сентября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-alpha03
is released. Version 1.1.0-alpha03 contains these commits.
Новые функции
- The Compose Compiler now supports older versions of the Compose Runtime (1.0). Prior to this change, the Compose Compiler was only compatible with the Compose Runtime of the same version or later. After this change, the Compose Compiler is compatible with an older version of the Compose Runtime (1.0). ( aosp/1796968 )
- Updated Compose
1.1.0-alpha03
to depend on Kotlin1.5.30
. ( I74545 )
Version 1.1.0-alpha02
18 августа 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-alpha02
is released. Version 1.1.0-alpha02 contains these commits.
Version 1.1.0-alpha01
4 августа 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-alpha01
is released. Version 1.1.0-alpha01 contains these commits.
Версия 1.0
Версия 1.0.5
3 ноября 2021 г.
androidx.compose.runtime:runtime-*:1.0.5
is released. Version 1.0.5 contains these commits.
Исправления ошибок
- Fixed a crash tracking derivedStateOf instances. ( aosp/1792247 )
Version 1.0.4
13 октября 2021 г.
androidx.compose.runtime:runtime-*:1.0.4
is released. Version 1.0.4 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.31
Version 1.0.3
29 сентября 2021 г.
androidx.compose.runtime:runtime-*:1.0.3
is released. Version 1.0.3 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.30
Версия 1.0.2
1 сентября 2021 г.
androidx.compose.runtime:runtime-*:1.0.2
is released. Version 1.0.2 contains these commits.
Updated to support the Compose 1.0.2
release. Compose 1.0.2
is still compatible with Kotlin 1.5.21
.
Version 1.0.1
4 августа 2021 г.
androidx.compose.runtime:runtime-*:1.0.1
is released. Version 1.0.1 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.21
.
Версия 1.0.0
28 июля 2021 г.
androidx.compose.runtime:runtime-*:1.0.0
is released. Version 1.0.0 contains these commits.
Major features of 1.0.0
This is the first stable release of Compose. Please see the official Compose Release blog for more details!
Известные проблемы
If you are using Android Studio Bumblebee Canary 4 or AGP
7.1.0-alpha04
/7.1.0-alpha05
, you may hit the following crash:java.lang.AbstractMethodError: abstract method "void androidx.lifecycle.DefaultLifecycleObserver.onCreate(androidx.lifecycle.LifecycleOwner)"
To fix, temporarily increase your minSdkVersion to 24+ in your
build.gradle
file. This issue will be fixed in the next version of Android Studio Bumblebee and AGP7.1
. ( b/194289155 )
Version 1.0.0-rc02
July 14, 2021
androidx.compose.runtime:runtime-*:1.0.0-rc02
is released. Version 1.0.0-rc02 contains these commits.
- Fixed race conditions in SnapshotStateObserver causing spurratic NullPointerExceptions. ( aosp/1763445 , aosp/1758105 , b/192677711 )
- Fixed issues with runtime snapshots causing
java.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
crashes. ( b/193006595 , b/192570897 )
Version 1.0.0-rc01
July 1, 2021
androidx.compose.runtime:runtime-*:1.0.0-rc01
is released. Version 1.0.0-rc01 contains these commits.
Version 1.0.0-beta09
June 16, 2021
androidx.compose.runtime:runtime-*:1.0.0-beta09
is released. Version 1.0.0-beta09 contains these commits.
Added Profile Rules
This release adds profile rules to the following compose modules ( I14ed6 ):
- androidx.compose.animation
- androidx.compose.animation-core
- androidx.compose.foundation
- androidx.compose.foundation-layout
- androidx.compose.material
- androidx.compose.material-ripple
- androidx.compose.runtime
- androidx.compose.ui
- androidx.compose.ui.geometry
- androidx.compose.ui.graphics
- androidx.compose.ui.text
- androidx.compose.ui.text
- androidx.compose.ui.unit
- androidx.compose.ui.util
What are profile rules?
Profile rules for a library are specified in a text file
baseline-prof.txt
located in thesrc/main
or equivalent directory. The file specifies a rule per line, where a rule in this case is a pattern for matching to methods or classes in the library. The syntax for these rules is a superset of the human-readable ART profile format that is used when usingadb shell profman --dump-classes-and-methods ...
. These rules take one of two forms to target either methods or classes.A method rule will have the following pattern:
<FLAGS><CLASS_DESCRIPTOR>-><METHOD_SIGNATURE>
And a class rule will have the following pattern:
<CLASS_DESCRIPTOR>
Here
<FLAGS>
is one or more of the charactersH
,S
, andP
to indicate whether or not this method should be flagged as "Hot", "Startup", or "Post Startup".The
<CLASS_DESCRIPTOR>
is the descriptor for the class that the targeted method belongs to. For example, the classandroidx.compose.runtime.SlotTable
would have a descriptor ofLandroidx/compose/runtime/SlotTable;
ПолемThe
<METHOD_SIGNATURE>
is the signature of the method, and includes the name, parameter types, and return types of the method. For example, the methodfun isPlaced(): Boolean
onLayoutNode
has the signatureisPlaced()Z
.These patterns can have wildcards (
**
,*
, and?
) in order to have a single rule encompass multiple methods or classes.
What do the rules do?
A method that has the flag
H
indicates that this method is a "hot" method, and should be compiled ahead of time.A method that has the flag
S
indicates that it is a method which is called at startup, and should be compiled ahead of time to avoid the cost of compilation and interpreting the method at startup time.A method that has the flag
P
indicates that it is a method which is called after startup.A class that is present in this file indicates that it is used during startup and should be pre-allocated in the heap to avoid the cost of class loading.
Как это работает?
- Libraries can define these rules which will be packaged in AAR artifacts. When an app is then built which includes these artifacts, these rules are merged together and the merged rules are used to build a compact binary ART profile that is specific to the app. ART can then leverage this profile when the app is installed on devices in order to ahead-of-time compile a specific subset of the application to improve the performance of the application, especially the first run. Note that this will have no effect on debuggable applications.
Version 1.0.0-beta08
2 июня 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta08
is released. Version 1.0.0-beta08 contains these commits.
Изменения API
-
State<T>
is nowState<out T>
( I69049 ) -
ControlledComposition
API change to enable recomposing changes in a recompose single pass. ( Iaafd1 , b/184173932 )
Version 1.0.0-beta07
May 18, 2021
androidx.compose.runtime:runtime-*:1.0.0-beta07
is released. Version 1.0.0-beta07 contains these commits.
Изменения API
- Added new compose compiler APIs that allow the source information generated by the compiler to be removed during source minification. ( Ia34e6 )
Introduces
ReusableContent
which will attempt to reuse the nodes in its content instead of replacing them when the key is changed. When the key is changed the previous values in the slot table for the content is ignored except for the nodes that were generated and the values used to update the nodes.Introduces
ReusableComposeNode
that will reuse the node emitted instead of replacing it as is done forComposeNode
. ( I1dd86 )@ComposeCompilerApi
no longer@RequiresOptIn
( Iab690 )
Исправления ошибок
- LazyColumn/Row will now keep up to 2 previously visible items active (not disposed) even when they are scrolled out already. This allows the component to reuse the active subcompositions when we will need to compose a new item which improves the scrolling performance. ( Ie5555 )
Version 1.0.0-beta06
5 мая 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta06
is released. Version 1.0.0-beta06 contains these commits.
Изменения API
-
@ComposeCompilerApi
no longer@RequiresOptIn
( Iab690 )
Version 1.0.0-beta05
21 апреля 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta05
is released. Version 1.0.0-beta05 contains these commits.
Изменения API
- Removed
@InternalComposeApi
for recording snapshot reads and writes ( Id134d )
Исправления ошибок
- The AndroidManifest files from ui-test-manifest and ui-tooling-data are now compatible with Android 12 ( I6f9de , b/184718994 )
Version 1.0.0-beta04
7 апреля 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta04
is released. Version 1.0.0-beta04 contains these commits.
Исправления ошибок
Prior to this change, local composable functions were skippable based on their parameters. After this change, no local composable functions will skip. This change is done because it is common and expected for local functions to capture parameters from the parent and them skipping is a common source of bugs.
To summarize, consider the example:
@Composable fun Counter(count: Int, onCountChange: (Int) -> Unit) { @Composable fun ShowCount() { Text("Count: $count") } ShowCount() Button(onClick={ onCountChange(count + 1) }) { Text("Increment") } }
Prior to this change, the
ShowCount
composable function would always skip, even after thecount
parameter was updated. This is no longer the case. ( I5648a )Fixed the issue when
rememberSaveable()
was restoring the old value when used with input params ( I1b110 , b/182403380 )
Version 1.0.0-beta03
24 марта 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta03
is released. Version 1.0.0-beta03 contains these commits.
Изменения API
-
DefaultMonotonicFrameClock
is deprecated. CallingwithFrameNanos
orRecomposer.runRecomposeAndApplyChanges
with noMonotonicFrameClock
will now throwIllegalStateException
. ( I4eb0d )
Version 1.0.0-beta02
March 10, 2021
androidx.compose.runtime:runtime-*:1.0.0-beta02
is released. Version 1.0.0-beta02 contains these commits.
Исправления ошибок
- Enforce restrictions on public usage of experimental APIs ( I6aa29 , b/174531520 )
- Fix for broken
rememberSaveable { mutableStateOf(0) }
when used inside a destination of navigation-compose. ( I1312b , b/180042685 , b/180701630 )
Version 1.0.0-beta01
24 февраля 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta01
is released. Version 1.0.0-beta01 contains these commits.
This is the first release of Compose 1.0.0 Beta.
Изменения API
- Add
Recomposer.runRecomposeConcurrentlyAndApplyChanges
experimental API for recomposing invalidated compositions off the main frame loop. ( I342d0 ) - Any composables marked with @ReadOnlyComposable are now compile-time validated to ensure that they only make calls to other @ReadOnlyComposables ( I58961 )
The
defaultFactory
forcompositionLocalOf
andstaticCompositionLocalOf
is now required instead of optional.This changes removes a potential type error for non-nullable types where no default factory was provided. Previously this would provide a null reference for a non-nullable type.
For nullable types consider supplying
{ null }
as the default factory.We do not recommend using locals with non-nullable types unless a sensible default can be provided. If no sensible default exists, the
defaultFactory
lambda should throw an exception. However throwing an exception means that consumers of the local will have an implicit dependency on it being provided that is not enforced by the type system. ( Ifbd2a )Deprecated symbols were removed from the compose runtime ( I3252c )
Deprecated
emptyContent()
is removed. Use{}
instead. ( Idb33f , b/179432510 )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.
- ( I99b7d , b/177245490 )
SnapshotStateObserver is not Experimental anymore ( Id2e6a )
Deleted some previously deprecated APIs ( Ice5da , b/178633932 )
Made the following Material API changes:
- Added contentPadding parameter to Top/BottomAppBar to allow customizing the default padding.
- Reordered parameters in BackdropScaffold to follow API guidelines for required parameters being before optional parameters.
- Moved
icon
parameter in BottomNavigationItem to be afterselected
andonClick
. - Renamed
alwaysShowLabels
parameter in BottomNavigationItem toalwaysShowLabel
. - Renamed
bodyContent
parameters in a few components to justcontent
. - Reordered parameters in
ButtonDefaults.buttonColors()
. Please note that because the type of the parameters have not changed, this will not cause an error in your code - please ensure you are either using named parameters or update the ordering manually, otherwise your code will not work the same as previously. - Added
secondaryVariant
parameter todarkColors()
. This color is typically the same assecondary
in dark theme, but adding for consistency and further customization. - Removed ElevationDefaults and animateElevation() from the public API surface since they were not commonly used / useful.
- Renamed
onValueChangeEnd
inSlider
toonValueChangeFinished
and made it nullable. - Renamed
text
parameter inSnackbar
tocontent
for consistency. - Added
contentPadding
parameter toDropdownMenuItem
to allow customizing the default padding and madecontent
be an extension onRowScope
. - Renamed
ModalDrawerLayout
toModalDrawer
. - Renamed
BottomDrawerLayout
toBottomDrawer
. - ( I1cc66 )
Version 1.0.0-alpha12
10 февраля 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha12
is released. Version 1.0.0-alpha12 contains these commits.
Изменения API
- Support for ViewGroups was removed from UiApplier. The Deprecated emitView composables were removed. ( Ifb214 )
- CompositionReference renamed to CompositionContext ( I53fcb )
- ComponentActivity.setContent has moved to androidx.activity.compose.setContent in the androidx.activity:activity-compose module. ( Icf416 )
- Snapshot API was updated to be more consistent with API guideline as well as hiding internal implementation classes from the public API. ( Id9e32 )
- Renamed Ambients to match the Ambient -> CompositionLocal rename. Ambients used to be named AmbientFoo, now CompositionLocals are named LocalFoo. ( I2d55d )
- Renamed Ambient to CompositionLocal, and ambientOf / staticAmbientOf to compositionLocalOf / staticCompositionLocalOf respectively. This change helps to make the purpose of CompositionLocal more clear: a mechanism for providing / retrieving values local to a composition. CompositionLocal instances should be prefixed with
Local
, such as val LocalFoo = compositionLocalOf { Foo() }. ( Ia55b6 ) - takeMutableSnapshot and takeSnapshot have moved to be companion methods of Snapshot. ( I91f19 )
@ComposableContract
has been deprecated in favor of three more specific annotations.@ComposableContract(restartable = false)
has become@NonRestartableComposable
@ComposableContract(readonly = true)
has become@ReadOnlyComposable
@ComposableContract(preventCapture = true)
has become@DisallowComposableCalls
@ComposableContract(tracked = true)
has been removed. ( I60a9d )emptyContent() and (@Composable () -> Unit).orEmpty() utilities have been deprecated as they no longer have any positive performance impact or value ( I0484d )
snapshotFlow
andwithMutableSnapshot
are no longer experimental ( I6a45f )Recomposers can now be closed. Closed recomposers will continue recomposition until composition child coroutines complete. Recomposer.shutDown renamed to cancel to contrast with close. ( Ib6d76 )
The
compose:runtime-dispatch
artifact is now deprecated. MonotonicFrameClock can now be found in compose:runtime and AndroidUiDispatcher can be found in compose:ui. ( Ib5c36 )The API the Compose compiler plugin targets has been refactored to use an interface instead of a concrete class. The interface also no longer uses a type parameter.
This is an internal change that should not effect source code compatibility but is a binary breaking change. ( I3b922 , b/169406779 )
SnapshotMutableState was introduced ( Icfd03 )
DisposableEffectDisposable was renamed to DisposaleEffectResult ( Ica7c6 )
Removed Recomposer.current(). [Abstract]ComposeView now default to lazily created, window-scoped Recomposers driven by the ViewTreeLifecycleOwner for the window. Recomposition and withFrameNanos-based animation ticks are paused while the host Lifecycle is stopped. ( I38e11 )
Recomposer.runningRecomposers now offers a global StateFlow of read-only RecomposerInfo for observing ongoing composition state in the process. Prefer this API to Recomposer.current(), which is now deprecated. ( If8ebe )
DisposableEffectDisposable was renamed to DisposaleEffectResult ( I3ea68 )
Version 1.0.0-alpha11
January 28, 2021
androidx.compose.runtime:runtime-*:1.0.0-alpha11
is released. Version 1.0.0-alpha11 contains these commits.
Изменения API
- onCommit, onDispose, and onActive have been deprecated in favor of SideEffect and DisposableEffect APIs ( If760e )
- The emit() API and all overloads have been deprecated and renamed to ComposeNode. The APIs are identical, just a different name in order to follow the naming conventions of Compose ( I4137b )
- invalidate and compositionReference() are now deprecated in favor of currentRecomposeScope and rememberCompositionReference respectively. ( I583a8 )
RememberObserver replaces CompositionLifecycleObserver and CompositionLifecycleObserver is now deprecated.
RememberObserver
is a replacement forCompositionLifecycleObserver
with modified semantics and renamed methods. Changing to the new API can be done mechanically for objects that are only remembered once which is, and continues to be, the recommended practice. However, if a reference was remembered more than once in a compositiononRemembered
is called for each reference whereonEnter
is only called once.onEnter
was called multiple time if the object was used in subcompositions, such asWithConstraints
andScaffold
making the singleonEnter
call guarantee unreliable and it was removed forRememberObserver
.RememberObserver
addsonAbandoned
which is called if theRememberObserver
instance is returned from the callback passed toremember
but was not remembered in the composition state and, therefore, will never haveonRemembered
called. This can occur if an exception terminates composition before completing or the composition is discarded because the state is was producing a composition for is no longer current or otherwise is no longer needed. If the instance ofRememberObserver
following the single reference recommendation above is tracking an external resource bothonForgotten
andonAbandoned
each indicate that the resource is no longer needed. If the object is tracking work started or resources allocated inonRemembered
,onAbandoned
can be ignored as it will not be called ifonRemembered
is called. ( I02c36 )Do not mark
collectAsState()
functions as inline ( Ia73e4 )
Исправления ошибок
- WithConstraints was reworked as BoxWithConstraints and moved to foundation.layout. ( I9420b , b/173387208 )
- Leverage TestCoroutineDispatcher in testing ( I532b6 )
Version 1.0.0-alpha10
13 января 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha10
is released. Version 1.0.0-alpha10 contains these commits.
Breaking Change
Restructuring of the internal compiler API allows batching changes to the nodes generated as a result of composition into the "apply changes" phase of composition, after all
@Composable
functions have completed.This is a behavioral breaking change that might affect application code as nodes are no longer available from internal and experimental APIs until after changes have been applied. This can usually be worked around by surrounding code with such dependencies in a
SideEffect
composable to defer execution of the code until after the nodes have been created and initialized. ( I018da )
Изменения API
- Added a way to track if the recomposer has applied changes. ( I1b3e2 )
Expand [Abstract]ComposeView APIs to allow recycling Compose-based views, disposing their composition to recreate again later. Add APIs for installing and discovering window-scoped Recomposers and CompositionReferences for creating child compositions.
Add ViewCompositionStrategy for configuring the composition disposal strategy of [Abstract]ComposeViews; default behavior is dispose on window detach. ( I860ab )
Исправления ошибок
- Recomposer now exposes a Flow of its current state, allowing monitoring its activity and the activity of associated effects. ( Ifb2b9 )
- The native keyEvent can now be accessed through keyEvent.nativeKeyEvent ( I87c57 , b/173086397 )
Version 1.0.0-alpha09
16 декабря 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha09
is released. Version 1.0.0-alpha09 contains these commits.
Изменения API
Removed SlotTable, SlotReader and SlotWriter from the public API. These were marked as InternalComposeAPI previously. Now they are internal to the compose module.
CompositionData and CompositionGroup were added as a replacement for the ui-tooling API to use to extract composition information. These are public but are not intended for use outside the ui-tooling API as they provide the raw information the ui-tooling API interprets ( I31a9c )
The Applier class is no longer considered an ( Id85b0 )
The
Applier
interface has changed to simplify building trees bottom-up instead of top-down.The
insert()
method has been renamed toinsertTopDown()
.A new method,
insertBottomUp()
, was added.An applier either inserts nodes into the tree it is editing using
insertTopDown()
orinsertBottomUp()
depending on which performs better.Some trees, such as
LayoutNode
andView
, are much more efficient to build bottom-up than top-down. Prior to this change, a stack of inserts was required to implement bottom-up which needed to be copied to every applier which needed bottom-up construction for performance. With this change anApplier
overridesinsertBottomUp()
to build a tree bottom-up andinsertTopDown()
to build the tree top-down. ( Icbdc2 )Compose supports property getters that can make composable invocations. Support for this is not going away, but the syntax for declaring a property getter as being @Composable is changing.
The now-deprecated syntax for doing this was by annotating the property itself:
@Composable val someProperty: Int get() = ...
The now-correct syntax for doing this is by annotating the getter of the property:
val someProperty: Int @Composable get() = ...
Both syntaxes will work for some time, but the former deprecated syntax will eventually become a compile error. ( Id9197 )
Исправления ошибок
- AndroidOwner made internal ( Ibcad0 , b/170296980 )
- subcomposeInto(LayoutNode) was made internal ( Id724a )
Version 1.0.0-alpha08
2 декабря 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha08
is released. Version 1.0.0-alpha08 contains these commits.
Изменения API
- Added lint check for composable lambda parameter naming and position, to check for consistency with Compose guidelines. Also migrated some APIs using
children
as the name for their trailing lambda tocontent
, according to the lint check and guidance. ( Iec48e ) - Recomposer no longer accepts an EmbeddingContext; required scheduling dependencies are obtained from the effectCoroutineContext. FrameManager is deprecated; platform integrations should initialize their own global snapshot handling. ( I02369 )
- RestorableStateHolder.withRestorableState function was renamed to RestorableStateProvider ( I66640 )
Исправления ошибок
- Deprecated Ambients named with
Ambient
as their suffix, and replaced them with new properties prefixed with Ambient, following other Ambients and Compose API guidelines. ( I33440 ) - Remove old ui-test module and its stubs ( I3a7cb )
Version 1.0.0-alpha07
November 11, 2020
androidx.compose.runtime:runtime-*:1.0.0-alpha07
is released. Version 1.0.0-alpha07 contains these commits.
Новые функции
Изменения API
- The
@UnionType
annotation has been deprecated ( I57cde ) - provideDefault was added as an alternative to provide for providing ambients, and it can be used to specify ambient values that will only be set when there is no ambient value already provided. ( Id6635 , b/171024925 )
- LaunchedTask was renamed to LaunchedEffect for consistency with the SideEffect and DisposableEffect APIs. LaunchedEffect with no subject params is not permitted in order to encourage best practices. ( Ifd3d4 )
- Applier now has onBeginChanges/onEndChanges callbacks that are invoked when a Composer begins/is finished applying changes to the tree. These may be used for batching resource management if needed. ( Icf476 )
- Recomposer now requires a CoroutineContext at construction ( Ic4610 )
- Changes to the internal SlotTable implementation which should not affect the public API. ( If9828 )
- Deprecated rxjava2 adapters which does not take the initial value were removed ( Idb72f )
Исправления ошибок
- foundation.Text has been deprecated and replaced with material.Text. For a basic, unopinionated text API that does not consume values from a theme, see androidx.compose.foundation.BasicText. ( If64cb )
- BaseTextField has been deprecated. Use BasicTextField instead. ( I896eb )
- Several layout related symbols were moved from androidx.compose.ui to androidx.compose.layout.ui. ( I0fa98 , b/170475424 )
External Contribution
- Added
runtime-rxjava3
module for compose. Similar toruntime-rxjava2
( I02cbf )
Version 1.0.0-alpha06
28 октября 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha06
is released. Version 1.0.0-alpha06 contains these commits.
Изменения API
- Recomposer is now a CompositionReference and a valid composition parent. Explicit Recomposer is now required in fewer places. ( I4036f )
- Added DisposableEffect counterpart API to SideEffect, filling the role of onCommit-with-params but with a required onDispose.
- Added rememberUpdatedState API to publish data from recomposition to ongoing or long-lived processes such as DisposableEffects or LaunchedTasks.
- ( Id50b9 )
- MutableVector now implements RandomAccess ( I85d73 , b/170461551 )
- Added SideEffect composable for applying side effects of composition to objects managed by the composition. SideEffect is intended to replace the onCommit composable. ( Ia77c2 )
- New experimental api RestorableStateHolder. It allows to save the state defined with [savedInstanceState] and [rememberSavedInstanceState] for the subtree before disposing it to make it possible to compose it back next time with the restored state. ( I66884 , b/166586419 )
Исправления ошибок
- Enable transitions in ComposeTestRule; remove option to enable the blinking cursor from ComposeTestRule. ( If0de3 )
Версия 1.0.0-альфа05
14 октября 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha05
is released. Version 1.0.0-alpha05 contains these commits.
Изменения API
- Experimental Modifier.pointerInput suspending input modifier ( Ia77d2 )
- The scrolling performance of LazyColumn/Row is improved by doing less work in subcomposition on every scroll. The new hasInvalidations() method was added for Composition class. hasPendingChanges() method from Recomposer was renamed to hasInvalidations() ( Ib2f32 , b/168293643 , b/167972292 , b/165028371 )
- Add produceState API for launching coroutines from composition that update a single
State<T>
value over time ( Id4a57 ) - launchInComposition renamed to LaunchedTask to match Compose API guidelines ( I99a8e )
- The order of place() calls in custom Layouts now defines the drawing order for the children ( Ibc9f6 )
Версия 1.0.0-альфа04
1 октября 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha04
is released. Version 1.0.0-alpha04 contains these commits.
Изменения API
- Added OwnerScope to allow collection of layout and drawing observation scopes once they are no longer valid. ( Ic4cf8 )
- Added derivedStateOf API to create State objects based on a calculation which may read (and derive from) other State objects ( If758b )
- Added TestOnly API for SnapshotStateObserver ( I6e2a9 )
Исправления ошибок
- foundation.Box was deprecated. Please use foundation.layout.Box instead. ( Ie5950 , b/167680279 )
Версия 1.0.0-альфа03
16 сентября 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha03
is released. Version 1.0.0-alpha03 contains these commits.
Изменения API
-
CompositionCoroutineScope
no longer implementsMonotonicFrameClock
. Callers ofwithFrameNanos
should import the top-level function explicitly. ( Icb642 , b/166778123 )
Исправления ошибок
- Global testing functions such as
onNode
orwaitForIdle
are now deprecated, please migrate to their new counterparts that are defined on ComposeTestRule ( I7f45a ) -
launchInComposition
no longer launches coroutines undispatched ( Ief6af , b/166486000 )
Версия 1.0.0-альфа02
2 сентября 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha02
is released. Version 1.0.0-alpha02 contains these commits.
Изменения API
- Add
snapshotFlow
andwithMutableSnapshot
APIs for consuming and producing Snapshot data changes. ( I3e722 ) The calling convention for composable functions has changed. This is a binary breaking change. All libraries must be recompiled to work with this version of the compose compiler plugin.
This change does not create a source level breaking change as the only APIs that have changed are compiler APIs that have an explicit opt in. ( I7afd2 , b/158123185 )
Removed scheduling methods from EmbeddingContext ( I7b9be )
onPreCommit is deprecated; onCommit now has onPreCommit's behavior.
onCommit and onActive now run in the same choreographer frame that the composition changes committed in rather than at the beginning of the next choreographer frame. ( I70403 )
Версия 1.0.0-альфа01
August 26, 2020
androidx.compose.runtime:runtime-*:1.0.0-alpha01
is released. Version 1.0.0-alpha01 contains these commits.
Version 0.1.0-dev
Version 0.1.0-dev17
19 августа 2020 г.
androidx.compose.runtime:runtime-*:0.1.0-dev17
is released. Version 0.1.0-dev17 contains these commits.
Изменения API
- Custom emits can now declare that one or more of its setters can be skipped and recomposed independently of the emit. ( Ibbd13 )
Removed deprecated FrameManager calls.
Internal compose APIs have been changed to reduce the amount of overhead to track state objects such as
mutableStateof()
( I80ba6 )The
state { ... }
composable is now deprecated in favor of explicit calls toremember { mutableStateOf(...) }
for clarity. This reduces the overall API surface and number of concepts for state management, and matches theby mutableStateOf()
pattern for class property delegation. ( Ia5727 )Flow.collectAsState now determines the default dispatcher from the composition itself rather than defaulting to Dispatchers.Main. ( I9c1d9 )
Crash when something which saves the state was used inside the for loop is fixed. Now having the same key in savedInstanceState() is allowed, api of UiSavedStateRegistry is now adjusted to this new requirement ( I4ab76 , b/160042650 , b/156853976 , b/159026663 , b/154920561 )
Исправления ошибок
-
emitView
was deprecated. UseAndroidView
instead if possible for emitting Views inside Compose. Note that composing Views and ViewGroups directly will not be supported in the future unless these are leaves in the composition tree, case when this can be achieved using AndroidView. ( I29b1e , b/163871221 )
Version 0.1.0-dev16
5 августа 2020 г.
androidx.compose.runtime:runtime-*:0.1.0-dev16
is released. Version 0.1.0-dev16 contains these commits.
Изменения API
The default mutation policy of
mutableStateOf()
,ambientOf()
andsavedInstanceStateOf()
has changed to bestructuralEqualityPolicy()
instead ofreferentialEqualityPolicy()
.The default for deciding if a new value assigned to a
mutableStateOf()
instance is considered a change now defaults to using==
instead of using===
.See https://kotlinlang.org/docs/reference/equality.html
ambientOf()
andsavedInstanceStateOf()
usemutableStateOf()
in their implementations so they were changed to be consistent withmutableStateOf()
.Using structural equality more closely matches developer expectations.
Например,
val state = mutableStateOf(1f)
с последующим,
state.value = 1f
will no longer be consider a change to
state
and uses ofstate
during composition will no longer need to be recomposed.This is a breaking change but, in most cases (such when using classes that do not override
equals()
), this will not have a noticeable effect on an application.Classes that do override
equals()
, such asdata
classes, might see a performance degradation as theirequals()
methods are now, by default, called when assigned to amutableStateOf()
.The previous behavior can be restored by adding the policy parameter
policy = referentialEqualityPolicy()
to calls tomutableStateOf()
,ambientOf()
andsavedInstanceStateOf()
. ( Ic21a7 )Row
andColumn
are now inline function significantly reducing the overhead of using them. ( I75c10 )
Исправления ошибок
- setViewContent was deprecated. setContent should be used instead. ( I7e497 , b/160335130 )
Added MonotonicFrameAnimationClock that enables you to use a MonotonicFrameClock as an AnimationClockObservable to bridge the gap between the new coroutines based clocks and APIs that still use the old callback based clocks.
The MonotonicFrameClock equivalent of ManualAnimationClock is now ManualFrameClock. ( I111c7 , b/161247083 )
Modifier.stateDraggable was completely reworked and renamed to Modifier.swipeable. A new SwipeableState class was introduced, and DrawerState and BottomDrawerState were refactored to inherit from it. [Modal/Bottom]DrawerLayout no longer take an onStateChange parameter. ( I72332 , b/148023068 )
Modifier.plus has been deprecated, use Modifier.then instead. 'Then' has a stronger signal of ordering, while also prohibits to type
Modifier.padding().background() + anotherModifier
, which breaks the chain and harder to read ( Iedd58 , b/161529964 )SubcomposeLayout is added. It is a low level primitive which allows to compose the children during the measuring if we want to use some values available only later during the measure for the subtree composition. For example WithConstraints is not implemented using SubcomposeLayout. ( I25cc8 )
Material FilledTextField was renamed to TextField and foundational TextField was renamed to BaseTextField to make simplest desired API easy to discover and use ( Ia6242 , b/155482676 )
Modifier.drawBackground has been renamed to Modifier.background ( I13677 )
Version 0.1.0-dev15
22 июля 2020 г.
androidx.compose.runtime:runtime-*:0.1.0-dev15
is released. Version 0.1.0-dev15 contains these commits.
Dependencies Update
- To use the
0.1.0-dev15
version of Compose, you will need to update your dependencies according to the new code snippets shown above in Declaring dependencies .
Изменения API
@Model
annotation is now deprecated. Use state and mutableStateOf as alternatives. This deprecation decision was reached after much careful discussion.Оправдание
Rationale includes but is not limited to:
- Reduces API surface area and concepts we need to teach
- More closely aligns with other comparable toolkits (Swift UI, React, Flutter)
- Reversible decision. We can always bring
@Model
back later. - Removes corner-case usage and difficult to answer questions about configuring
@Model
as things we need to handle -
@Model
data classes, equals, hashcode, etc. - How do I have some properties “observed” and others not?
- How do I specify structural vs. referential equality to be used in observation?
- Reduces “magic” in the system. Would reduce the likelihood of someone assuming system was smarter than it is (ie, it knowing how to diff a list)
- Makes the granularity of observation more intuitive.
- Improves refactorability from variable -> property on class
- Potentially opens up possibilities to do hand-crafted State-specific optimizations
- More closely aligns with the rest of the ecosystem and reduces ambiguity towards immutable or us “embracing mutable state”
Заметки о миграции
Almost all existing usages of
@Model
are fairly trivially transformed in one of two ways. The example below has a@Model
class with two properties just for the sake of example, and has it being used in a composable.@Model class Position( var x: Int, var y: Int ) @Composable fun Example() { var p = remember { Position(0, 0) } PositionChanger( position=p, onXChange={ p.x = it } onYChange={ p.y = it } ) }
Alternative 1: Use
State<OriginalClass>
and create copies.This approach is made easier with Kotlin's data classes. Essentially, make all previously
var
properties intoval
properties of a data class, and then usestate
instead ofremember
, and assign the state value to cloned copies of the original using the data classcopy(...)
convenience method.It's important to note that this approach only works when the only mutations to that class were done in the same scope that the
State
instance is created. If the class is internally mutating itself outside of the scope of usage, and you are relying on the observation of that, then the next approach is the one you will want to use.data class Position( val x: Int, val y: Int ) @Composable fun Example() { var p by state { Position(0, 0) } PositionChanger( position=p, onXChange={ p = p.copy(x=it) } onYChange={ p = p.copy(y=it) } ) }
Alternative 2: Use mutableStateOf and property delegates
This approach is made easier with Kotlin's property delegates and the
mutableStateOf
API which allows you to create MutableState instances outside of composition. Essentially, replace allvar
properties of the original class withvar
properties withmutableStateOf
as their property delegate. This has the advantage that the usage of the class will not change at all, only the internal implementation of it. The behavior is not completely identical to the original example though, as each property is now observed/subscribed to individually, so the recompositions you see after this refactor could be more narrow (a good thing).class Position(x: Int, y: Int) { var x by mutableStateOf(x) var y by mutableStateOf(y) } // source of Example is identical to original @Composable fun Example() { var p = remember { Position(0, 0) } PositionChanger( position=p, onXChange={ p.x = it } onYChange={ p.y = it } ) }
( I409e8 , b/152050010 , b/146362815 , b/146342522 , b/143413369 , b/135715219 , b/143263925 , b/139653744 )
Changes the code generation strategy of Compose's compiler. Prior to the change, the compose compiler would transform calls to composable functions. With this change, we now transform the body of a composable function and leave the callsite unaltered (mostly).
This means that most of the logic communicating with the compose runtime happens at the start of the function body, instead of at the callsite.
This should be a source-compatible change for all usage of compose. Most users of compose should not have to update any code as a result of this change.
In order to support this work, the JVM signature of all composable functions has changed. A Composable function accepting a single parameter is transformed into a function accepting 3 parameters, the additional parameters are the Composer, a 'key' integer. a bitmask integer used to propagate metadata through calls.
Compose now also transforms default arguments to a composable function. It does this without introducing an additional synthetic default overload of the function itself, so this change will result in fewer functions being defined.
Known intentional behavioral changes resulting from this:
- Some calls will skip where they wouldn't have previously
- Composable expressions in default argument expressions are now correctly subscribed to and handled
This work included some optimizations: 1. The result of comparisons of parameters are propagated through the call graph to other composable functions. This will result in fewer comparisons at runtime, reduces the slot table size, as well as more skipping of composable functions that were previously not skipped 2. Paremeters which are determined to be “static” at compile time are no longer compared or stored in the runtime. This reduces the number of comparisons and reduces slot table size. 3. Control flow structure of the body of functions is used to minimize the number of groups that are generated. This reduces slot table size and results in less work for the runtime 4. Unused dispatch and receiver parameters to functions are not included in determining skippability of the function if they are not used inside of the body of the function.
Most breaking changes were for APIs that the compiler targets directly, and typical use of compose will not be affected: 1. Composer::startExpr was removed 2. Composer::endExpr was removed 3. Composer::call was deprecated 4. The non-varargs overloads of
key
have been removed. Use thevararg
version going forward. 5. The Pivotal annotation was deprecated. Usekey
as a replacement. 6. ScopeUpdateScope::updateScope was changed to expect a Function3 instead of Function1 7. restartableFunction and restartableFunctionN were updated to include additional compile time parameters ( I60756 , b/143464846 )Added sortWith and removeRange to MutableVector ( Icccf7 )
Added default method implementations for CompositionLifecycleObserver ( I24289 )
Applier now requires a clear() method for disposing compositions ( Ibe697 )
Added asMutableList() to MutableVector to allow it to be passed to public API without having to copy the entire list. ( I298df )
Added rememberCoroutineScope() to obtain a managed CoroutineScope in composition for launching jobs in response to events. ( I0e264 )
MutableVector is a new collection that does not implement any of the standard Collection interface. This collection offers speed above other requirements and is intended to only be used in internal implementations. ( I8ebd6 )
Temporarily removed
StableMutableList
andStableMutableMap
to avoid an issue in the version of Kotlin compose requires. These interfaces will be reintroduced once compose is updated to a version of Kotlin that doesn't have the issue.SnapshotStateList
andSnapshotStateMap
are now public but they will be deprecated onceStableMutableList
andStableMutableMap
are restored. ( Ia7769 )add top-level withFrameNanos function for animation timing ( Ie34c5 )
@Untracked annotation has been deprecated. Replace with @ComposableContract(tracked=false) ( Id211e )
RestartableFunction and associated APIs have been renamed to ComposableLambda, etc. These APIs were targeted only by the compiler so this should not affect source level compatibility normally. The rename was done primarily to communicate what this class is better when it shows up in stack traces ( I7eb25 )
@Composable annotation is no longer valid on classes ( Ia5f02 )
Ambient<T>
is now @Stable instead of @Immutable ( I0b4bb )Prior to this change, the compose compiler plugin would non-trivially intercept calls to constructors inside of a @Composable function if there was an ( I5205a , b/158123804 )
The Recompose composable is no longer a useful abstraction. Most recomposition should happen as a result of MutableState assignments. For anything beyond that, it is recommended that you use the
invalidate
function to trigger a recomposition of the current scope. ( Ifc992 )Observe is no longer a useful abstraction. If you need to replicate it, its implementation can be replicated by just creating a composable function which executes a composable lambda parameter. For example,
@Composable fun Observe(body: @Composable () -> Unit) = body()
( I40d37 )@Direct was deprecated in favor of @ComposableContract(restartable=false) ( If4708 )
Added an adapter for the recently introduced StateFlow which allows as to pre-populate the initial value so the returned State is non-nullable ( I61dd8 , b/156233789 )
Added an adapter for Flow. Example of the usage: val value by flow.collectAsState() ( If2198 , b/153375923 )
[Mutable]State property delegate operators moved to extensions to support Kotlin 1.4 property delegate optimizations. Callers must add imports to continue using
by state { ... }
orby mutableStateOf(...)
. ( I5312c )androidx.compose.ViewComposer has been moved to androidx.ui.node.UiComposer androidx.compose.Emittable has been removed. It was redundant with ComponentNode. androidx.compose.ViewAdapters has been removed. They are no longer a supported use case. Compose.composeInto has been deprecated. Use
setContent
orsetViewContent
instead. Compose.disposeComposition has been deprecated. Use thedispose
method on theComposition
returned bysetContent
instead. androidx.compose.Compose.subcomposeInto has moved to androidx.ui.core.subcomposeInto ComponentNode#emitInsertAt has been renamed to ComponentNode#insertAt ComponentNode#emitRemoveAt has been renamed to ComponentNode#removeAt ComponentNode#emitMode has been renamed to ComponentNode#move ( Idef00 )Updated the
ComposeFlags.COMPOSER_PARAM
flag to betrue
, which will change the code generation strategy for the compose plugin. At a high level, this causes @Composable functions to be generated with an additional synthetic parameter, which is passed through to subsequent @Composable calls in order for the runtime to properly manage execution. This is a significant binary breaking change, however, should preserve source-level compatibility in all sanctioned usage of compose. ( I7971c )Breaking changes to the ambients API. See log and
Ambient<T>
documentation for details ( I4c7ee , b/143769776 )Added ui-livedata - new artifact with an adapter for LiveData. Example of the usage: val value by liveData.observeAsState() ( Ie9e8c , b/150465596 )
Rx adapters without explicit initial value are deprecated. Using null is not always the best default, for example when you have a List it is better to start with emptyList() or any other reasonable default ( I00025 , b/161348384 )
Added ui-rxjava2 - new artifact with adapters for RxJava2. Example of the usage: val value by observable.subscribeAsState() ( Ifab4b , b/153369097 )
savedInstanceState()
can now be used with nullable types ( I6847f , b/153532190 )New listSaver() and mapSaver() to make it easier to write custom Saver objects ( I8cf68 , b/152331508 )
New functions: savedInstanceState() and rememberSavedInstanceState(). They are similar to state() and remember() but have a saved instance state support build in ( If1987 , b/152025209 )
Исправления ошибок
-
runOnIdleCompose
renamed torunOnIdle
( I83607 ) - Made LayoutNode experimental API ( I4f2e9 )
- androidx.ui.foundation.TextFieldValue and androidx.ui.input.EditorValue is deprecated. TextField, FilledTextField and CoreTextField composables that uses that type is also deprecated. Please use androidx.ui.input.TextFieldValue instead ( I4066d , b/155211005 )
- Removed deprecated DrawBackground API in favor of drawBackground extension APIs on Modifier. Refactored color, brush and paint drawBackground implementations to reduce code paths as well as remove requirement for Modifier to be created as part of composition. ( I0343a )
- Updated higher level compose APIs that expose a Canvas to expose CanvasScope instead. This removes the need for consumers to maintain their own Paint objects. For consumers that still require access to a Canvas they can use the drawCanvas extension method which provides a callback to issue drawing commands with the underlying Canvas. ( I80afd )
- WithConstraints trailing lambda API has been changed. Now instead of two params it has a receiver scope which in addition to constraints and layoutDirection provides minWidth, maxWidth, minHeight and maxHeight properties in Dp ( I91b9a , b/149979702 )
- Added symmetric padding modifier. ( I39840 )
- Updated wrapContentWidth and wrapContentHeight to expect vertical or horizontal Alignment rather than any Alignment. The gravity modifier was updated to accept vertical or horizontal Alignment. Row, Column and Stack were updated to support custom continuous Alignments. ( Ib0728 )
- ui-text module is renamed as ui-text-core ( I57dec )
- Improve DrawModifier API:
- Made the receiver scope for draw() ContentDrawScope
- Removed all parameters on draw()
- DrawScope has same interface as former CanvasScope
- ContentDrawScope has drawContent() method ( Ibaced , b/152919067 )
- ColoredRect has been deprecated. Use
Box(Modifier.preferredSize(width, height).drawBackground(color))
instead. ( I499fa , b/152753731 ) - Replaced Modifier plus operator with factory extension functions ( I225e4 )
- RowScope and ColumnScope members are now accessible outside Row and Column. ( I3a641 )
- Renamed LayoutFlexible to LayoutWeight. Renamed tight parameter to fill. ( If4738 )
- WithConstraints got LayoutDirection parameter ( I6d6f7 )
- Renamed background to DrawBackground and make it to be memorized by default ( Ia0bd3 )
- Replaced ButtonStyle with distinct functions and removed text (string) overload. See updated samples for usage information. ( If63ab , b/146478620 , b/146482131 )
-
runOnIdleCompose
andrunOnUiThread
are now global functions instead of methods on ComposeTestRule. ( Icbe8f )
External Contribution
- Remove unneeded API such as Looper and Handler from Compose Runtime porting layer ( I6847d )
- Deprecate
Flow<T>.collectAsState()
with no initial value. UseStateFlow<T>
or pass an explicit initial value instead. ( I63f98 , b/157674865 )
Compose Runtime
androidx.compose.runtime
androidx.compose.runtime.rxjava2
androidx.compose.runtime.rxjava3
androidx.compose.runtime.saveable
androidx.compose.runtime.snapshots
( See the API reference docs for all compose packages )
Последнее обновление | Стабильный релиз | Кандидат на релиз | Бета-версия | Альфа-релиз |
---|---|---|---|---|
30 июля 2025 г. | 1.8.3 | 1.9.0-rc01 | - | - |
Структура
Compose is combination of 7 Maven Group Ids within androidx
. Each Group contains a targeted subset of functionality, each with its own set of release notes.
This table explains the groups and links to each set of release notes.
Группа | Описание |
---|---|
compose.animation | Build animations in their Jetpack Compose applications to enrich the user experience. |
compose.compiler | Transform @Composable functions and enable optimizations with a Kotlin compiler plugin. |
compose.foundation | Write Jetpack Compose applications with ready to use building blocks and extend foundation to build your own design system pieces. |
compose.material | Build Jetpack Compose UIs with ready to use Material Design Components. This is the higher level entry point of Compose, designed to provide components that match those described at www.material.io. |
compose.material3 | Build Jetpack Compose UIs with Material Design 3 Components, the next evolution of Material Design. Material 3 includes updated theming and components and Material You personalization features like dynamic color, and is designed to be cohesive with the new Android 12 visual style and system UI. |
compose.runtime | Fundamental building blocks of Compose's programming model and state management, and core runtime for the Compose Compiler Plugin to target. |
compose.ui | Fundamental components of compose UI needed to interact with the device, including layout, drawing, and input. |
Объявление зависимостей
To add a dependency on Compose, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.
Добавьте зависимости для необходимых артефактов в файл build.gradle
вашего приложения или модуля:
Groovy
dependencies { implementation "androidx.compose.runtime:runtime:1.8.3" implementation "androidx.compose.runtime:runtime-livedata:1.8.3" implementation "androidx.compose.runtime:runtime-rxjava2:1.8.3" } android { buildFeatures { compose true } composeOptions { kotlinCompilerExtensionVersion = "1.5.15" } kotlinOptions { jvmTarget = "1.8" } }
Kotlin
dependencies { implementation("androidx.compose.runtime:runtime:1.8.3") implementation("androidx.compose.runtime:runtime-livedata:1.8.3") implementation("androidx.compose.runtime:runtime-rxjava2:1.8.3") } android { buildFeatures { compose = true } composeOptions { kotlinCompilerExtensionVersion = "1.5.15" } kotlinOptions { jvmTarget = "1.8" } }
Дополнительные сведения о зависимостях см. в разделе Добавление зависимостей сборки .
Обратная связь
Ваши отзывы помогают улучшить Jetpack. Сообщите нам, если вы обнаружите новые проблемы или у вас есть идеи по улучшению этой библиотеки. Пожалуйста, ознакомьтесь с уже существующими проблемами в этой библиотеке, прежде чем создавать новую. Вы можете проголосовать за существующую проблему, нажав на кнопку со звёздочкой.
Более подробную информацию см. в документации по системе отслеживания проблем .
Runtime Tracing Version 1.7
Version 1.7.0-rc01
September 18, 2024
androidx.compose.runtime:runtime-tracing:1.7.0-rc01
is released. Version 1.7.0-rc01 contains these commits .
Runtime Tracing Version 1.0
Version 1.0.0-beta01
November 29, 2023
androidx.compose.runtime:runtime-tracing:1.0.0-beta01
is released. Version 1.0.0-beta01 contains these commits.
Версия 1.0.0-альфа05
15 ноября 2023 г.
androidx.compose.runtime:runtime-tracing:1.0.0-alpha05
is released. Version 1.0.0-alpha05 contains these commits.
Исправления ошибок
- Pinned dependencies to lowest supported stable versions (ie compose-runtime and tracing-perfetto) - fixing an issue where compose-runtime-tracing would bring in a newer version of compose-runtime into the app.
Версия 1.0.0-альфа04
23 августа 2023 г.
androidx.compose.runtime:runtime-tracing:1.0.0-alpha04
is released. Version 1.0.0-alpha04 contains these commits.
Новые функции
- Compatible with latest versions of Benchmark and Tracing Perfetto, enabling support for Composition Tracing at app startup (cold start) eg in AndroidX Benchmark and Android Studio (starting from Hedgehog Beta 2).
Изменения API
- Renamed
androidx.tracing.perfetto.Trace
toandroidx.tracing.perfetto.PerfettoSdkTrace
. ( I44af8 ) - Making Tracing Perfetto SDK APIs consistent with
android.os.Trace
. ( I73ba0 , b/282199917 ) - Prerequisites for tracing at app startup. ( Iad890 )
- Merged experimental and public API files ( I0f2e1 , b/278769092 )
Версия 1.0.0-альфа02
8 февраля 2023 г.
androidx.compose.runtime:runtime-tracing:1.0.0-alpha02
is released. Version 1.0.0-alpha02 contains these commits.
Новые функции
- No functional changes. Multiple performance optimisations in downstream dependencies
androidx.tracing:tracing-perfetto*
.
Версия 1.0.0-альфа01
7 сентября 2022 г.
androidx.compose.runtime:runtime-tracing:1.0.0-alpha01
is released. Version 1.0.0-alpha01 contains these commits.
Новые функции
-
androidx.compose.runtime:runtime-tracing
is a library which - in the presence of tooling supporting it (coming soon) - allows for extended tracing in a Compose app. This initial release is 1.0.0-alpha01.
Версия 1.9
Version 1.9.0-rc01
30 июля 2025 г.
androidx.compose.runtime:runtime-*:1.9.0-rc01
is released. Version 1.9.0-rc01 contains these commits .
Исправления ошибок
- Updates composition registration observer to be called before initial composition. ( I4adca , b/430600932 )
Version 1.9.0-beta03
16 июля 2025 г.
androidx.compose.runtime:runtime-*:1.9.0-beta03
is released. Version 1.9.0-beta03 contains these commits .
Version 1.9.0-beta02
2 июля 2025 г.
androidx.compose.runtime:runtime-*:1.9.0-beta02
is released. Version 1.9.0-beta02 contains these commits .
Исправления ошибок
- Reduced the reference lifetime of values in the slot table between compositions. There are cases where a reference in a slot table could last a frame longer than necessary. ( I49e74 , b/418516940 )
- Remove Kotlin mangle for Hot reload methods. ( Ic56a3 , b/426871325 )
Version 1.9.0-beta01
18 июня 2025 г.
androidx.compose.runtime:runtime-*:1.9.0-beta01
is released. Version 1.9.0-beta01 contains these commits .
Изменения API
- Added a tooling API for parsing source information added by Compose compiler. ( Iceaf9 , b/408492167 )
-
SnapshotStateSet
now implementsParcelable
on Android, it is now supported to be used as partrememberSaveable { ... }
. ( I755dd , b/378623803 ) -
SnapshotStateList
now implementsParcelable
on Android, it is now supported to be used as partrememberSaveable { ... }
. ( Id18be , b/378623803 ) -
movableContentOf()
is now marked with@RememberInComposition
annotation, which allows lint to catch incorrect usages ( I2738d ) - Updated experimental composition observers API to allow for more comprehensive observation of recomposition causes ( I32b6a )
- Change
setDiagnosticStackTraceEnabled
to experimental to account for future development of this feature. ( I11db3 ) -
currentCompositeKeyHash
is now deprecated. UsecurrentCompositeKeyHashCode
instead. The replacement API encodes the same hash with more bits, which exponentially reduces the chance of two random unrelated groups in the composition hierarchy from having the same hash key. ( I4cb6a , b/177562901 ) - Projects released with Kotlin 2.0 require KGP 2.0.0 or newer to be consumed ( Idb6b5 )
-
@Stable
,@Immutable
, and@StableMarker
have been moved to runtime-annotation (in a compatible way). You can now depend on runtime-annotation if you want to use these annotations from libraries that do not depend on compose. ( I23a16 ) - Renamed the
rememberSaveable
overload that accepts aKSerializer
torememberSerializable
. This change clarifies its intended use withkotlinx.serialization
. Supporting generalkotlinx.Serializable
classes directly inrememberSaveable
would require areified
type parameter, which would break source compatibility by requiring all call sites to provide reified type information at compile time. ( Idb875 , I38627 , b/376028110 )
Исправления ошибок
- Compositions that was set with pausable content that was cancelled must be disposed of. This is now checked by the composition and will throw if it is reused. ( I2daa5 , b/406792785 )
- Fixed pausable composition to no longer send a spurious
onForgotten
to remember observers when the pausable composition is disposed of.RememberObservers
in a cancelled pausable composition should only be sent an onAbandoned. ( I26f54 ) - Fixed a movable content issue where invalidations that arrive late stages of the processing movable content are added to the composer but these invalidations are not updated when the content is moved causing the content to be recomposed in the wrong place. ( Icd2fa , b/409439507 )
- Fixed an issue when movable content was invalidated after it was composed but before it was moved. ( I99eac , b/229001114 )
- Calling
remove()
of a list iterator produced bySnapshotStateList
after callingprevious()
could removed the wrong element from the list and didn't match what theArrayList
does for the same sequence of calls. ( I05ab7 , b/417493222 ) - Fixed an ordering issue with the dispatching of
onForgotton
that could, for example, cause theonDispose
of disposable effects to execute in the wrong order. ( Ic1c91 , b/417450712 ) - Fix for for reusing state handling in pausable composition ( Ife96e , b/404058957 )
- Fixed the reusing state when a composition was paused and restarted but some previously paused state needed to be recomposed because some state it read changed while the composition was paused. ( I441d1 , b/416209738 )
- Completed the pausable composition remember dispatch fix for issue b/404058957 previous fix was incomplete. ( I1afd4 , b/404058957 )
-
OffsetApplier
now correctly overridesapply()
which was introduced with pausable composition. Not having this could cause pausable composition to throw an exception when updating virtual nodes. ( Idbf31 , b/409291131 ) - Fixed a deadlock that may affect Molecule users when a suspended call to
FrameClock.withFrameNanos
is cancelled while a frame is being dispatched. ( I89cab , b/407027032 ) - The Recomposer could go idle with movable content ( Ie5416 , b/409267170 )
- The order in which
onReuse
andonDeactivate
could get inverted during pausable composition. They are now guaranteed to occur in order ofonDeactivate
/onReuse
. ( I996e4 , b/404058957 ) - Fix dispatching of remember observers in pausable composition to avoid dispatching remembered/forgotten in the same apply ( I570b2 , b/404645679 , b/407931790 )
- Switched
LifecycleRegistry
to unsafe mode in Compose Multiplatform to disableMainThread
checks and fix threading issues. See CMP-8227 for details. ( Icee87 )
External Contribution
- Fixed a bug affecting Molecule users where using
RecompositionMode.Immediate
could cause missed recompositions. ( I9f3a9 , b/419527812 ) - Exposed
PausableComposition
isApplied
andisCancelled
getters which allow for checking the state of thePausableComposition
. ( I994aa ) - Added
AnnotationTarget.FUNCTION
to theFunctionKeyMeta
annotation. ( I08021 )
Version 1.9.0-alpha04
4 июня 2025 г.
androidx.compose.runtime:runtime-*:1.9.0-alpha04
is released. Version 1.9.0-alpha04 contains these commits .
Изменения API
-
SnapshotStateSet
now implements Parcelable on Android, it is now supported to be used as partrememberSaveable { ... }
. ( I755dd , b/378623803 ) -
SnapshotStateList
now implements Parcelable on Android, it is now supported to be used as partrememberSaveable { ... }
. ( Id18be , b/378623803 ) -
movableContentOf()
is now marked with@RememberInComposition
annotation, which allows lint to catch incorrect usages ( I2738d ) - Updated experimental composition observers API to allow for more comprehensive observation of recomposition causes ( I32b6a )
Исправления ошибок
- Fixed an ordering issue with the dispatching of
onForgotton
that could, for example, cause theonDispose
of disposable effects to execute in the wrong order. ( Ic1c91 , b/417450712 ) - Fix for for reusing state handling in pausable composition ( Ife96e , b/404058957 )
- Minor bug fix to make mutable collection detection compatible for both K1 and K2 ( Ie4878 )
- Minor bug fix to make annotation lookup on overridden property accessors compatible for both K1 and K2 ( I9900d )
External Contribution
- Fixed a bug affecting Molecule users where using
RecompositionMode.Immediate
could cause missed recompositions. ( I9f3a9 , b/419527812 ) - Exposed
PausableComposition
isApplied andisCancelled
getters which allow for checking the state of thePausableComposition
. ( I994aa )
Version 1.9.0-alpha03
20 мая 2025 г.
androidx.compose.runtime:runtime-*:1.9.0-alpha03
is released. Version 1.9.0-alpha03 contains these commits .
Изменения API
- Change
setDiagnosticStackTraceEnabled
to experimental to account for future development of this feature. ( I11db3 )
Исправления ошибок
- Fixed the reusing state when a composition was paused and restarted but some previously paused state needed to be recomposed because some state it read changed while the composition was paused. ( I441d1 , b/416209738 )
- Completed the pausable composition remember dispatch fix for issue b/404058957 previous fix was incomplete. ( I1afd4 , b/404058957 )
-
SaveableStateHolder.SaveableStateProvider
now provides aLocalSavedStateRegistryOwner
to its content via composition. ( Ia2761 , b/413108878 ) -
androidx.compose.runtime.saveable
now depends onandroidx.lifecycle.runtime.compose
. ( I53228 , b/413108878 )
Version 1.9.0-alpha02
7 мая 2025 г.
androidx.compose.runtime:runtime-*:1.9.0-alpha02
is released. Version 1.9.0-alpha02 contains these commits .
Изменения API
- Deprecated
rememberSaveable
with a custom 'key'. It bypasses positional scoping, leading to state bugs and inconsistent behavior (eg, unintentional state sharing or loss, issues in nestedLazyLayouts
). Please remove the 'key' parameter to use positional scoping for consistent, locally-scoped state. See the full commit message for more details. ( I5e6ff , b/357685851 )
Исправления ошибок
-
OffsetApplier
now correctly overridesapply()
which was introduced with pausable composition. Not having this could cause pausable composition to throw throw an exception when updating virtual nodes. ( Idbf31 , b/409291131 ) - Fixed a deadlock that may affect Molecule users when a suspended call to
FrameClock.withFrameNanos
is cancelled while a frame is being dispatched. ( I89cab , b/407027032 ) - The Recomposer could go idle with movable content state still pending to be discarded. This normally does not occur as movable content state is discarded in the main loop of the Recomposer. However, this can occur in pausable composition when the movable content is discarded during
resume()
( Ie5416 , b/409267170 ) - The order in which
onReuse
andonDeactivate
could get inverted during pausable composition. They are now guaranteed to occur in order ofonDeactivate/onReuse
. ( I996e4 , b/404058957 )
Version 1.9.0-alpha01
23 апреля 2025 г.
androidx.compose.runtime:runtime-*:1.9.0-alpha01
is released. Version 1.9.0-alpha01 contains these commits .
Behavior Changes
- Lint checks shipped with Compose now require a minimum AGP version of 8.8.2. If you are unable to upgrade AGP, you can instead upgrade Lint on its own by using
android.experimental.lint.version=8.8.2
(or a newer version) in yourgradle.properties
. To run Compose lint checks inside the IDE, Android Studio Ladybug or newer is required.
Изменения API
-
currentCompositeKeyHash
is now deprecated. UsecurrentCompositeKeyHashCode
instead. The replacement API encodes the same hash with more bits, which exponentially reduces the chance of two random unrelated groups in the composition hierarchy from having the same hash key. ( I4cb6a , b/177562901 ) - Projects released with Kotlin 2.0 require KGP 2.0.0 or newer to be consumed ( Idb6b5 )
-
@Stable
,@Immutable
, and@StableMarker
have been moved to runtime-annotation (in a compatible way). You can now depend on runtime-annotation if you want to use these annotations from libraries that do not depend on compose. ( I23a16 ) - Removes
onCreating
andonDisposing
as they were deprecated and renamed toonPreCreate
andonPreDispose
. This change completes the rename. ( I97461 ) - Expose a composition local that allows to attach a compose stack trace based on a compose node location in composition. ( Ie0bda , b/354163858 )
- Introduce diagnostic Compose stack traces based on source information stored in composition. ( I3db9f , b/354163858 )
- Deprecate
runWithTimingDisabled
in favor ofrunWithMeasurementDisabled
, which more clearly describes the behavior - all metrics are paused. Additionally, expose theMicrobenchmarkScope
superclass since redeclaring therunWithMeasurementDisabled
function to open access isn't possible, since it's inline. ( I9e23b , b/389149423 , b/149979716 ) - Adds
@FrequentlyChangingValue
: an annotation that can mark functions, and property getters, to indicate that they should not be called directly inside composition, as this may cause frequent recompositions. For example, to mark scroll position values and animating values. Warnings are provided by a corresponding lint check. ( I83630 , b/234042500 ) - Adds
@RememberInComposition
: an annotation that can mark constructors, functions, and property getters, to indicate that they must not be called directly inside composition, without being remembered. Errors will be raised by a corresponding lint check. This annotation can be used to mark declarations that return stateful / mutable objects, objects whose identity is important to maintain across compositions, or objects that are expensive to instantiate and should be cached across compositions. ( Ie7db0 ) - Added a new
rememberSaveable
overload that supportsKSerializer
for type-safe state persistence using KotlinX Serialization. The existingSaver
-based API remains supported. ( Iea4ab , b/376028110 )
Исправления ошибок
- Fix dispatching of remember observers in pausable composition to avoid dispatching remembered/forgotten in the same apply ( I570b2 , b/404645679 , b/407931790 )
- Renamed
SnapshotObserver
methods onCreating toonPreCreate
andonDisposing
toonPreDispose
to match API guidelines. The previous methods are deprecated and the new methods default to call the old ones so existing implementations of this interface will continue to work until the methods are removed. These methods will be removed in 1.9.0 alpha in a follow-up CL that will shortly follow this one. They will be removed from 1.8 beta before 1.8 stable. ( I6d753 ) - Fixed an issue where remembered values could incorrectly be forgotten and re-computed when recomposing an elided group that appears after a movable group ( I62cab , b/383769314 )
- Added support for compose stack traces in
LaunchedEffect
andrememberCoroutineScope
( I705c0 , b/354163858 ) - Compose lint checks now require a minimum AGP version of 8.8.2 from command line, and at least Android Studio Ladybug for IDE support. If you are using an older version of AGP, you can set
android.experimental.lint.version=8.8.2
in gradle.properties to upgrade the Lint version, without affecting AGP. ( I6f2a8 )
External Contribution
- Added
AnnotationTarget.FUNCTION
to theFunctionKeyMeta
annotation. ( I08021 )
Версия 1.8
Версия 1.8.3
18 июня 2025 г.
androidx.compose.runtime:runtime-*:1.8.3
is released. Version 1.8.3 contains these commits .
Версия 1.8.2
20 мая 2025 г.
androidx.compose.runtime:runtime-*:1.8.2
is released. Version 1.8.2 contains these commits .
Version 1.8.1
7 мая 2025 г.
androidx.compose.runtime:runtime-*:1.8.1
is released. Version 1.8.1 contains these commits .
Version 1.8.0
23 апреля 2025 г.
androidx.compose.runtime:runtime-*:1.8.0
is released. Version 1.8.0 contains these commits .
Version 1.8.0-rc03
9 апреля 2025 г.
androidx.compose.runtime:runtime-*:1.8.0-rc03
is released. Version 1.8.0-rc03 contains these commits .
Version 1.8.0-rc02
26 марта 2025 г.
androidx.compose.runtime:runtime-*:1.8.0-rc02
is released. Version 1.8.0-rc02 contains these commits .
Version 1.8.0-rc01
March 12, 2025
androidx.compose.runtime:runtime-*:1.8.0-rc01
is released. Version 1.8.0-rc01 contains these commits .
Изменения API
- Renamed
SnapshotObserver
methods onCreating toonPreCreate
andonDisposing
toonPreDispose
to match API guidelines. The previous methods are deprecated and the new methods default to call the old ones so existing implementations of this interface will continue to work until the methods are removed. These methods will be removed in 1.9.0 alpha in a follow-up CL that will shortly follow this one. They will be removed from 1.8 beta before 1.8 stable. ( I6d753 )
Version 1.8.0-beta03
26 февраля 2025 г.
androidx.compose.runtime:runtime-*:1.8.0-beta03
is released. Version 1.8.0-beta03 contains these commits .
Version 1.8.0-beta02
12 февраля 2025 г.
androidx.compose.runtime:runtime-*:1.8.0-beta02
is released. Version 1.8.0-beta02 contains these commits .
Исправления ошибок
- Rethrow caught exception in pausable composition .( 384486d )
Version 1.8.0-beta01
29 января 2025 г.
androidx.compose.runtime:runtime-*:1.8.0-beta01
is released. Version 1.8.0-beta01 contains these commits .
Изменения API
- Fixes an issue where raising a throwable during composition that does not extend from Exception may lead to a 'Pending composition has not been applied' error. ( I356be , b/382094412 )
Version 1.8.0-alpha08
15 января 2025 г.
androidx.compose.runtime:runtime-*:1.8.0-alpha08
is released. Version 1.8.0-alpha08 contains these commits .
Version 1.8.0-alpha07
11 декабря 2024 г.
androidx.compose.runtime:runtime-*:1.8.0-alpha07
is released. Version 1.8.0-alpha07 contains these commits .
Изменения API
- Added tooling API that helps the layout inspector to correlate subcompositions to the parent composition in cases where a node is not used to bridge the compositions together. ( I4ce3d )
- Made the arithmetic and special constants for
SnapshotId
internal instead of public. Arithmetic can be performed on aSnasphotId
, if necessary, by converting it to aInt
orLong
by usingtoInt()
ortoLong()
respectively. ( Ic3a57 )
External Contribution
- Optimize storage for
movableContentOf
parameters. ( ed87177 )
Version 1.8.0-alpha06
13 ноября 2024 г.
androidx.compose.runtime:runtime-*:1.8.0-alpha06
is released. Version 1.8.0-alpha06 contains these commits .
Изменения API
- Changes to the
PausableComposition
API. These breaking changes with respect to previous releases of 1.8.0-alpha (since 1.8.0-alpha02) but, as these are new APIs in 1.8.0, backwards compatibility is not maintained as the APIs are still in alpha. ( I39819 ) - Adds tooling APIs to observe the creation of new compositions within a Recomposer ( Iaeb7e )
- Added
snapshotId
, of typeLong
, toSnapshot
and deprecatedid
. The ID of a snapshot changed from aInt
to aLong
to avoid the snapshot ID from overflowing on systems with very high frame rates and long running animations. The type was made expect/actual to allow this type to beInt
, or other type, on platforms that don't have a nativeLong
type. Platforms that do not have a nativeLong
, such as JavaScript, should avoid high frame rates (over 1000 FPS) which would cause an overflow forInt
approximate every 24 days. ( I38ac3 , b/374821679 )
Исправления ошибок
- Fixed
providesDefault
for a singleprovides
. ( aosp/3318540 b/374263387 ) - Optimize
ChangeList
. ( 3318538 )
Version 1.8.0-alpha05
October 30, 2024
androidx.compose.runtime:runtime-*:1.8.0-alpha05
is released. Version 1.8.0-alpha05 contains these commits .
Исправления ошибок
- Fix stack overflow adding
Int.MAX_VALUE
toSnapshotIdSet
. ( b/370536104 , Ic4179f6 ) - Runtime micro-optimizations ( I50c60 )
- Allow R8 to remove debugging runtimeCheck calls ( I8c44 )
- Make
compoundKeyOf
iterative instead of recursive ( I5817f )
External Contribution
- Implement stacks with collection lists ( I7d47c )
Version 1.8.0-alpha04
16 октября 2024 г.
androidx.compose.runtime:runtime-*:1.8.0-alpha04
is released. Version 1.8.0-alpha04 contains these commits .
Улучшения производительности
- Provide snapshot id for state records in constructor ( 85c00f )
- Refactor
SnapshotState***
to avoid class verification errors ( 6ee4a6 ) - Fix R8 rules to prevent throw inlining ( 5beb92 )
- Micro-optimize Operations ( d73c5c )
- Optimize
SynchronizedObject
allocations on JVM ( 2b043f )
Version 1.8.0-alpha03
October 2, 2024
androidx.compose.runtime:runtime-*:1.8.0-alpha03
is released. Version 1.8.0-alpha03 contains these commits .
Улучшения производительности
- Lazily create child context for
rememberCoroutineScope
( f61464 )-
rememberCoroutineScope
is typically used to launch coroutines in response to events that happen post-composition. In some scenarios these events may never occur, leading to added costs of Job creation and cancellation without any benefit. - Make the scope returned by
rememberCoroutineScope
create itscoroutineContext
lazily when accessed, avoiding job creation and cancellation entirely if the scope is never used.
-
Version 1.8.0-alpha02
September 18, 2024
androidx.compose.runtime:runtime-*:1.8.0-alpha02
is released. Version 1.8.0-alpha02 contains these commits .
Новые функции
- Added
PausableComposition
which allows creating a subcomposition that can be paused during composition and and applied asynchronously to the composition. Compiler support is required for pausing which is currently in development. ( I3394b )
Version 1.8.0-alpha01
4 сентября 2024 г.
androidx.compose.runtime:runtime-*:1.8.0-alpha01
is released. Version 1.8.0-alpha01 contains these commits .
Version 1.7
Версия 1.7.8
12 февраля 2025 г.
androidx.compose.runtime:runtime-*:1.7.8
is released. Version 1.7.8 contains these commits .
Версия 1.7.7
29 января 2025 г.
androidx.compose.runtime:runtime-*:1.7.7
is released. No changes from 1.7.6.
androidx.compose.runtime:runtime-*:1.7.6
is released. Version 1.7.6 contains these commits .
Version 1.7.5
October 30, 2024
androidx.compose.runtime:runtime-*:1.7.5
is released. Version 1.7.5 contains these commits .
Версия 1.7.4
16 октября 2024 г.
androidx.compose.runtime:runtime-*:1.7.4
is released. Version 1.7.4 contains these commits .
Версия 1.7.3
October 2, 2024
androidx.compose.runtime:runtime-*:1.7.3
is released. Version 1.7.3 contains these commits .
Версия 1.7.2
September 18, 2024
androidx.compose.runtime:runtime-*:1.7.2
is released. Version 1.7.2 contains these commits .
Версия 1.7.1
10 сентября 2024 г.
- No changes to Android artifacts.
-desktop
artifacts were removed and-jvmStubs
and-linuxx64Stubs
artifacts were added. None of these targets are meant to be used, they are placeholders to help Jetbrains Compose efforts.
Version 1.7.0
4 сентября 2024 г.
androidx.compose.runtime:runtime-*:1.7.0
is released. Version 1.7.0 contains these commits .
Important changes since 1.6.0
- Added the ability to provide a composition local that is computed based on the values of other composition locals either by default, using
compositionLocalWithComputedDefault()
or by supplying a lambda to use to compute the value by usingprovidesComputed
instead ofprovides
. - The value of a composition local can be obtained by using the
currentValue
property of the composition local accessible from within the lambda computing the value. This is used instead ofcurrent
which is only accessible in@Composable
functions. ( Iadbc0 ) - Newly created state objects are immediately accessible from other snapshots, including the global snapshot, with their initial state. Any subsequent modifications are not visible until the snapshot in which the object was created is applied.
- The initial state of
mutableStateOf()
, as well as their primitive versions, is the value passed in as a parameter tomutableStateOf()
. The initial state ofmutableStateListOf()
andmutableStateMapOf()
is empty. - Added
Snapshot.isInSnapshot
andSnapshot.PreexistingSnapshotId
that are used to enable a state object to support being immediately accessible from the global snapshot upon its creation. - Custom state objects can support being immediately accessible by following the pattern of changes made to the built-in snapshot objects. ( I84a17 )
- Enable
nonSkippingGroupOptimization
for compose libraries. This causes the generated code for all non-restartable composable functions in androidx to be more efficient. In the future we plan to enable this by default. I( acbc08 ) - Invalidate composable lambdas in subcompositions on the same frame. ( 98301c )
- Call
onRelease
callback in the same order asonForgotten
. ( 2cd790 ) - Enable strong skipping mode ( ed1766 )
- Make
currentCompoundHashKey
unique in more cases ( d4a872 )
Version 1.7.0-rc01
21 августа 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-rc01
is released. Version 1.7.0-rc01 contains these commits .
Version 1.7.0-beta07
7 августа 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-beta07
is released. Version 1.7.0-beta07 contains these commits .
Version 1.7.0-beta06
24 июля 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-beta06
is released. Version 1.7.0-beta06 contains these commits .
Version 1.7.0-beta05
10 июля 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-beta05
is released. Version 1.7.0-beta05 contains these commits .
Version 1.7.0-beta04
26 июня 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-beta04
is released. Version 1.7.0-beta04 contains these commits .
Version 1.7.0-beta03
12 июня 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-beta03
is released. Version 1.7.0-beta03 contains these commits .
Version 1.7.0-beta02
29 мая 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-beta02
is released. Version 1.7.0-beta02 contains these commits .
Version 1.7.0-beta01
14 мая 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-beta01
is released. Version 1.7.0-beta01 contains these commits .
Version 1.7.0-alpha08
1 мая 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-alpha08
is released. Version 1.7.0-alpha08 contains these commits .
Version 1.7.0-alpha07
17 апреля 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-alpha07
is released. Version 1.7.0-alpha07 contains these commits .
Новые функции
- Added the ability to provide a composition local that is computed based on the values of other composition locals either by default, using
compositionLocalWithComputedDefault()
or by supplying a lambda to use to compute the value by usingprovidesComputed
instead ofprovides
. - The value of a composition local can be obtained by using the
currentValue
property of the composition local accessible from within the lambda computing the value. This is used instead ofcurrent
which is only accessible in@Composable
functions. ( Iadbc0 )
Изменения API
- Newly created state objects are immediately accessible from other snapshots, including the global snapshot, with their initial state. Any subsequent modifications are not visible until the snapshot in which the object was created is applied.
- The initial state of
mutableStateOf()
, as well as their primitive versions, is the value passed in as a parameter tomutableStateOf()
. The initial state ofmutableStateListOf()
andmutableStateMapOf()
is empty. - Added
Snapshot.isInSnapshot
andSnapshot.PreexistingSnapshotId
that are used to enable a state object to support being immediately accessible from the global snapshot upon its creation. - Custom state objects can support being immediately accessible by following the pattern of changes made to the built-in snapshot objects. ( I84a17 )
Исправления ошибок
- Fixed merging of
readObserver
in nested snapshots. This caused nested derived states to under-invalidate when used inside asnapshotFlow
. ( Idf138 )
Version 1.7.0-alpha06
3 апреля 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-alpha06
is released. Version 1.7.0-alpha06 contains these commits .
Исправления ошибок
- Fix provide single values handling
providesDefault
( 538f45 ) - Avoid a deadlock in the Recomposer accessing the frame clock ( 07e5c6 )
Version 1.7.0-alpha05
20 марта 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-alpha05
is released. Version 1.7.0-alpha05 contains these commits .
Исправления ошибок
- Clear late changes on deactivated composition ( 5950bc )
Version 1.7.0-alpha04
6 марта 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-alpha04
is released. Version 1.7.0-alpha04 contains these commits .
Улучшения производительности
- Call
Snapshot.current
once per derived state evaluation ( ee7daf ) - Read
currentRecord
once per observation in composition ( b882b2 ) - Remove accidental iterator allocation in
snapshotFlow
( 231e56 ) - Enable
nonSkippingGroupOptimization
for compose libraries. This causes the generated code for all non-restartable composable functions in androidx to be more efficient. In the future we plan to enable this by default. I( acbc08 )
Version 1.7.0-alpha03
21 февраля 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-alpha03
is released. Version 1.7.0-alpha03 contains these commits.
Изменения API
- Introduce a replace groups to improve detecting changes ( 0941b5 )
Улучшения производительности
- Improve memory allocation when detecting changes ( 53e7fd )
- Fix a memory leak in the composer ( 0e097d )
- Use
ScopeMap
to pass invalidations when recomposing ( e19a7e ) - Optimize invalidations map to only keep derived states ( f11c44 )
- Replace
IdentityArraySet
usages withScatterSet
( db572e ) - Optimize
removeScope
inScopeMap
( bb0530 )
Version 1.7.0-alpha02
7 февраля 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-alpha02
is released. Version 1.7.0-alpha02 contains these commits.
Исправления ошибок
- Invalidate composable lambdas in subcompositions on the same frame. ( 98301c )
- Call
onRelease
callback in the same order asonForgotten
. ( 2cd790 ) - Filter changed states that are not observed in
snapshotFlow
. ( 796b80 )
Улучшения производительности
- Modify snapshot observer in place when it is already transparent. ( f60f30 )
- Optimize
SnapshotIdSet.lowest()
. ( 7ae149 ) - Use an allocation-free
fold()
inSnapshotIdSet
. ( 532b7d ) - Remove iterator allocation ( 83f96b )
Version 1.7.0-alpha01
24 января 2024 г.
androidx.compose.runtime:runtime-*:1.7.0-alpha01
is released. Version 1.7.0-alpha01 contains these commits.
Performance Optimizations
- Add the ability to create slots after a child group has been added ( b5960c )
- Optimize recording modifications of snapshot states ( 28c3fe )
- Enable strong skipping mode ( ed1766 )
Исправления ошибок
- Account for default parameter meta in intrinsic remember ( 096665 )
- Make
currentCompoundHashKey
unique in more cases ( d4a872 ) - Realize groups when exiting inline function call ( 2a90fc )
Версия 1.6
Версия 1.6.8
12 июня 2024 г.
androidx.compose.runtime:runtime-*:1.6.8
is released. Version 1.6.8 contains these commits .
Версия 1.6.7
1 мая 2024 г.
androidx.compose.runtime:runtime-*:1.6.7
is released. Version 1.6.7 contains these commits .
Версия 1.6.6
17 апреля 2024 г.
androidx.compose.runtime:runtime-*:1.6.6
is released. No changes since the last release.
Версия 1.6.5
3 апреля 2024 г.
androidx.compose.runtime:runtime-*:1.6.5
is released. Version 1.6.5 contains these commits .
Version 1.6.4
20 марта 2024 г.
androidx.compose.runtime:runtime-*:1.6.4
is released. Version 1.6.4 contains these commits .
Версия 1.6.3
6 марта 2024 г.
androidx.compose.runtime:runtime-*:1.6.3
is released. Version 1.6.3 contains these commits .
Версия 1.6.2
21 февраля 2024 г.
androidx.compose.runtime:runtime-*:1.6.2
is released. Version 1.6.2 contains these commits.
Версия 1.6.1
7 февраля 2024 г.
androidx.compose.runtime:runtime-*:1.6.1
is released. Version 1.6.1 contains these commits.
Исправления ошибок
- Call
onRelease
callback in the same order asonForgotten
. ( 2cd790 ) - Filter changed states that are not observed in
snapshotFlow
. ( 796b80 )
Version 1.6.0
24 января 2024 г.
androidx.compose.runtime:runtime-*:1.6.0
is released. Version 1.6.0 contains these commits.
Important changes since 1.5.0
Новые функции
- Re-throw exceptions that are swallowed during recomposition loop ( 4dff9a )
Performance Optimizations
- Optimize recording modifications of snapshot states ( 28c3fe )
- Optimize
rememberSaveable
( f01d79 ) - Defer re-reading derived states until changes are recorded ( f38099 )
- Improve providing composition local values ( a337ea )
Исправления ошибок
- Fix slot table memory leak ( 73fcfe )
- Skip recomposition of subcompositions that will be removed. ( Ieeb99 , b/254645321 )
- Only trigger
RememberObserver
lifecycles when it is stored in remember calculation. ( f6b4dc ) - Restrict
$dirty
capture to inline lambdas. ( acfca0 ) - Fix moveable content sometimes receiving the wrong composition locals. ( 035cd6 )
Version 1.6.0-rc01
10 января 2024 г.
androidx.compose.runtime:runtime-*:1.6.0-rc01
is released. Version 1.6.0-rc01 contains these commits.
Version 1.6.0-beta03
13 декабря 2023 года
androidx.compose.runtime:runtime-*:1.6.0-beta03
is released. Version 1.6.0-beta03 contains these commits.
Version 1.6.0-beta02
November 29, 2023
androidx.compose.runtime:runtime-*:1.6.0-beta02
is released. Version 1.6.0-beta02 contains these commits.
Version 1.6.0-beta01
15 ноября 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-beta01
is released. Version 1.6.0-beta01 contains these commits.
Изменения API
- Propagate Certain stability values in annotation. (274a4c)
Исправления ошибок
- Use referential policy for composition local scope state in context. (83361c)
- Restrict $dirty capture to inline lambdas. (acfca0)
- Fix moveable content sometimes receiving the wrong composition locals. (035cd6)
- Use faster non-allocating hashmaps in
RecomposeScopeImpl
. (d79494) - Use
ObjectIntMap
inDerivedState
. (21862e) - Use
IntRef
for intSnapshotThreadLocal
inDerivedState
. (04eaf4)
Version 1.6.0-alpha08
18 октября 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha08
is released. Version 1.6.0-alpha08 contains these commits.
Исправления ошибок
- Only trigger
RememberObserver
lifecycles when it is stored in remember calculation. ( f6b4dc ) - Improve allocations in invalidations list sorting. ( 954d63 )
- Use new non-allocating maps in
SnapshotStateObserver
. ( 4303ce ) - Clear invalidations when composition is deactivated. ( e001be )
Version 1.6.0-alpha07
4 октября 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha07
is released. Version 1.6.0-alpha07 contains these commits.
Изменения API
-
SnapshotStateList
is now marked asRandomAccess
to enable the direct indexing version of list helpers to be used. ( I5210c , b/219554654 )
Version 1.6.0-alpha06
20 сентября 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha06
is released. Version 1.6.0-alpha06 contains these commits.
Version 1.6.0-alpha05
6 сентября 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha05
is released. Version 1.6.0-alpha05 contains these commits.
Version 1.6.0-alpha04
23 августа 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha04
is released. Version 1.6.0-alpha04 contains these commits.
Новые функции
- Re-throw exceptions that are swallowed during recomposition loop ( 4dff9a )
Изменения API
- Added a method to deactivate
ReusableComposition
, removing observations but keeping nodes in place. The deactivated composition can be activated again by callingsetContent
. ( Ib7f31 ) - Add
ReusableComposition
interface for managing lifecycle and reuse of subcompositions. ( I812d1 , b/252846775 )
Version 1.6.0-alpha03
9 августа 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha03
is released. Version 1.6.0-alpha03 contains these commits.
Исправления ошибок
- Fix new
CompositionLocalProvider
optimization ( 3118e88 ) - Correct how movable content nodes are disassembled. ( 5e3d59b )
Version 1.6.0-alpha02
26 июля 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha02
is released. Version 1.6.0-alpha02 contains these commits.
New Features & Performance Enhancements
- Optimize
rememberSaveable
( f01d79 ) - Defer re-reading derived states until changes are recorded ( f38099 )
- Improve providing composition local values ( a337ea )
-
SideEffect
is marked as@ExplicitGroupsComposable
to avoid generating a group. ( I74815 ) - Avoid comparing composition local maps on reuse ( 782071 )
Изменения API
- Added a special case overload for
CompositionLocalProviders
that avoids overhead used to make providing multiple values faster but is overhead when providing a single value. ( I6d640 , b/288169379 )
Исправления ошибок
- Fix slot table memory leak ( 73fcfe )
- Fix how we restore
rememberSaveable
whenstateSaver
returns null ( 90748c )
Version 1.6.0-alpha01
21 июня 2023 г.
androidx.compose.runtime:runtime-*:1.6.0-alpha01
is released. Version 1.6.0-alpha01 contains these commits.
Исправления ошибок
- Skip recomposition of subcompositions that will be removed. ( Ieeb99 , b/254645321 )
- Reduced allocations when applying snapshots. ( I65c09 )
- Avoid calculating
readableHash
inDerivedState
if snapshot wasn't modified ( 68c565 )
Версия 1.5
Версия 1.5.4
18 октября 2023 г.
androidx.compose.runtime:runtime-*:1.5.4
is released. Version 1.5.4 contains these commits.
Version 1.5.3
4 октября 2023 г.
androidx.compose.runtime:runtime-*:1.5.3
is released. Version 1.5.3 contains these commits.
Version 1.5.2
27 сентября 2023 г.
androidx.compose.runtime:runtime-*:1.5.2
is released. Version 1.5.2 contains these commits.
Версия 1.5.1
6 сентября 2023 г.
androidx.compose.runtime:runtime-*:1.5.1
is released. Version 1.5.1 contains these commits.
Version 1.5.0
9 августа 2023 г.
androidx.compose.runtime:runtime-*:1.5.0
is released. Version 1.5.0 contains these commits.
Изменения API
- Removed allocations in recomposition, color animations, and
AndroidComposeView
. ( Ib2bfa ) - Added a
@StateFactoryMarker
annotation, to mark functions that create states and must be wrapped in aremember
call. ( I64550 ) - Add primitive versions of State and
MutableState
( fb3d89 ) - Added
Snapshot.isApplyObserverNotificationPending
( I672a5 ) - Added primitive versions of the
State
API, allowing Int, Long, Float, and Double values to be tracked inState
objects without incurring penalties for autoboxing. Use the new factory methodsmutableIntState(Int)
,mutableFloatStateOf(Float)
, etc in order to use these. ( I48e43 )
Исправления ошибок
- Skip recomposition of subcompositions that will be removed. ( Ieeb99 , b/254645321 )
- Don't retain snapshot reference in
ComposerImpl
( 0206f7 ) - Don't apply composition twice ( f5791b )
- Ensure invalidation for non-initialized derived state values ( aa2a92 )
- Call
onEndChanges
during composition dispose. ( 62cc8c ) - Fix moving content into a sub-composition ( 4beb41 )
- Fix potential deadlocks ( c1a425 and 8edce0 )
- The recomposer created for an Android window will now only block calls to
withFrameNanos
instead of all composition when it receives an ON_STOP notification. This means windows associated with stopped activites will continue to recompose for data changes but the animations, or any other caller ofwithFrameNanos
, will block. ( Id9e7f , b/240975572 ) - Execute deactivation callbacks for
LayoutNode
before disposing effects 3784073 - Fix changed flags for restarted lambdas ea81df9
- Fix live edit regression for Composable with nodes 73fd4d8
- ON_STOP should pause the frame clock broadcasts instead of composition ae276f1
- Invalidate
SnapshotStateObserver
scopes for unchanged derived states 84d9b1c - Fix potential dead-lock when disposing compositions 28761fc
- Fix moving content into a sub-composition 92d4156
- Fix changed flags for restarted lambdas ( 8a03e9 )
- Execute deactivation callbacks for
LayoutNode
before disposing effects ( 8b0fa4 ) - Fix
endToMarker()
when ending node groups. ( d71d980 ) - Use current
SlotWriter
group for check on deactivation ( a0b518b ) - Remove the
fill
inSlotTable.moveSlotGapTo()
and move it to close ( 81f9935 ) - Fix missing invalidations while movable content is moving ( 1d7c024 )
- Fix immediate invalidations for moved movable content ( 8676618 )
Улучшения производительности
- Avoid calculating
readableHash
inDerivedState
if snapshot wasn't modified. ( 307102 ) - Reduced allocations ( I65c09 , d7ea77 , 727974 , and 445808 )
- Quick cancellation of compose
CoroutineScopes
( a55362 and bd382f ) - Overwrite records of state objects with inaccessible state records ( c986960 )
- Use composer of the correct scope when realizing groups ( 9a5e5b6 )
- Use
IdentityArraySet
to store snapshot invalidations ( 7f60cca ) - Reduce allocations for snapshot observations ( 5bc535f )
Version 1.5.0-rc01
26 июля 2023 г.
androidx.compose.runtime:runtime-*:1.5.0-rc01
is released. Version 1.5.0-rc01 contains these commits.
Исправления ошибок
Defer re-reading derived states until changes are recorded ( f38099 )
An optional inspection to recommend migrating
mutableStateOf()
calls to their corresponding specialized types for primitives is available. Its lint ID isAutoboxingStateCreation
. Previously, this inspection was enabled by default for all projects. To see this warning in Android Studio's editor and your project's lint outputs, change its severity from informational to warning (or higher) by declaringwarning "AutoboxingStateCreation"
inside your module's build.gradle or build.gradle.kts configuration as shown ( I34f7e ):android { lint { warning "AutoboxingStateCreation" } ... }
Version 1.5.0-beta03
28 июня 2023 г.
androidx.compose.runtime:runtime-*:1.5.0-beta03
is released. Version 1.5.0-beta03 contains these commits.
Исправления ошибок
- Skip recomposition of subcompositions that will be removed. ( Ieeb99 , b/254645321 )
Version 1.5.0-beta02
7 июня 2023 г.
androidx.compose.runtime:runtime-*:1.5.0-beta02
is released. Version 1.5.0-beta02 contains these commits.
Улучшения производительности
- Avoid calculating
readableHash
inDerivedState
if snapshot wasn't modified. ( 307102 )
Version 1.5.0-beta01
24 мая 2023 г.
androidx.compose.runtime:runtime-*:1.5.0-beta01
is released. Version 1.5.0-beta01 contains these commits.
Изменения API
- Removed allocations in recomposition, color animations, and
AndroidComposeView
( Ib2bfa ) - Added a
@StateFactoryMarker
annotation, to mark functions that create states and must be wrapped in aremember
call. ( I64550 ) - Add primitive versions of State and
MutableState
( fb3d89 ) - Added
Snapshot.isApplyObserverNotificationPending
( I672a5 )
Исправления ошибок
- Reduced allocations ( I65c09 , d7ea77 , 727974 , and 445808 )
- Don't retain snapshot reference in
ComposerImpl
( 0206f7 ) - Quick cancellation of compose
CoroutineScopes
( a55362 and bd382f ) - Don't apply composition twice ( f5791b )
- Ensure invalidation for non-initialized derived state values ( aa2a92 )
- Call
onEndChanges
during composition dispose. ( 62cc8c ) - Fix moving content into a sub-composition ( 4beb41 )
- Fix potential deadlocks ( c1a425
- ON_STOP should pause the frame clock broadcasts instead of composition ( f4a2d1 )
- Fix changed flags for restarted lambdas ( 8a03e9 )
- Execute deactivation callbacks for
LayoutNode
before disposing effects ( 8b0fa4 )
External Contribution
- Added
Snapshot.isApplyObserverNotificationPending
( I672a5 )
Version 1.5.0-alpha04
10 мая 2023 г.
androidx.compose.runtime:runtime-*:1.5.0-alpha04
is released. Version 1.5.0-alpha04 contains these commits.
Изменения API
- Added primitive versions of the
State
API, allowing Int, Long, Float, and Double values to be tracked inState
objects without incurring penalties for autoboxing. Use the new factory methodsmutableIntState(Int)
,mutableFloatStateOf(Float)
, etc in order to use these. ( I48e43 )
Исправления ошибок
Call
onEndChanges
during composition dispose. Focus nodes removed duringComposition.dispose
are subscribing toonEndChanges
to reset focus.( 03d4a47 )Ensure invalidation for non-initialized derived state values. Each derived state is associated with a list of its dependencies in
SnapshotStateObserver
, used to invalidate scopes associated with derived state whenever dependency changes. The dependency change is registered on snapshot advance, which can happen after derived state read (due to the call toSnapshot.notifyObjectsInitialized()
).Previous derived state observation logic in
SnapshotStateObserver
was cleaning up old dependencies, then reading new value. This resulted in a race condition with invalidation happening in a cleaned up state, where dependency invalidation wasn't registered.This change reorders derived state read and dependency cleanup, ensuring that invalidation always happens in a valid state. ( c472be6 )
Version 1.5.0-alpha03
April 19, 2023
androidx.compose.runtime:runtime-*:1.5.0-alpha03
is released. Version 1.5.0-alpha03 contains these commits.
Изменения API
- The recomposer created for an Android window will now only block calls to
withFrameNanos
instead of all composition when it receives an ON_STOP notification. This means windows associated with stopped activites will continue to recompose for data changes but the animations, or any other caller ofwithFrameNanos
, will block. ( Id9e7f , b/240975572 )
Исправления ошибок
- Fix potential deadlock in snapshot list and map 5c1a425
- Execute deactivation callbacks for
LayoutNode
before disposing effects 3784073 - Fix changed flags for restarted lambdas ea81df9
- Fix live edit regression for Composable with nodes 73fd4d8
- ON_STOP should pause the frame clock broadcasts instead of composition ae276f1
- Invalidate
SnapshotStateObserver
scopes for unchanged derived states 84d9b1c - Fix potential dead-lock when disposing compositions 28761fc
- Fix moving content into a sub-composition 92d4156
Version 1.5.0-alpha02
April 5, 2023
androidx.compose.runtime:runtime-*:1.5.0-alpha02
is released. Version 1.5.0-alpha02 contains these commits.
Новые функции
- Kotlin's
getValue
operator can now be composable ( f174f6e )
Bug Fixes, Performance Improvements
- Overwrite records of state objects with inaccessible state records ( c986960 )
- Use composer of the correct scope when realizing groups ( 9a5e5b6 )
- Fix
endToMarker()
when ending node groups. ( d71d980 ) - Use current
SlotWriter
group for check on deactivation ( a0b518b ) - Use
IdentityArraySet
to store snapshot invalidations ( 7f60cca ) - Remove the
fill
inSlotTable.moveSlotGapTo()
and move it to close ( 81f9935 ) - Fix missing invalidations while movable content is moving ( 1d7c024 )
- Fix immediate invalidations for moved movable content ( 8676618 )
- Reduce allocations for snapshot observations ( 5bc535f )
Version 1.5.0-alpha01
March 22, 2023
androidx.compose.runtime:runtime-*:1.5.0-alpha01
is released. Version 1.5.0-alpha01 contains these commits.
Новые функции
- Adds
Modifier.Node#coroutineScope
to allowModifier.Nodes
to launch coroutines ( I76ef9 ) - Allow
Modifier.Nodes
to readCompositionLocals
by implementing theCompositionLocalConsumerModifierNode
interface. ( Ib44df )
Версия 1.4
Version 1.4.3
3 мая 2023 г.
androidx.compose.runtime:runtime-*:1.4.3
is released with no changes.
Версия 1.4.2
April 19, 2023
androidx.compose.runtime:runtime-*:1.4.2
is released. Version 1.4.2 contains these commits.
Исправления ошибок
Fix potential deadlock in snapshot list and map 2eb6570
Adding content to a
SnapshotStateList
orSnapshotStateMap
can encounter a deadlock if the modification is concurrent with a direct write to the state record. This was made significantly more likely to be encountered with the changes introduced by 93fcae828b that uses direct writes to release unused records.The locks are now ordered in that a snapshot lock is never attempted to be taken when a map or list lock is held.
Версия 1.4.1
April 5, 2023
androidx.compose.runtime:runtime-*:1.4.1
is released. Version 1.4.1 contains these commits.
Исправления ошибок
- Fix
endToMarker()
when ending node groups. d71d980
Версия 1.4.0
March 22, 2023
androidx.compose.runtime:runtime-*:1.4.0
is released. Version 1.4.0 contains these commits.
Important changes since 1.3.0
- Use initialized value from
LiveData
for first composition 3680e25 - Add
ComposeNodeLifecycleCallback
to observe lifecycle of compose nodes. 8b6a258 - Add
parameterTypes
property toComposableMethod
7b6c7ad
Bug Fixes & Performance Improvements
- Clear both scope indexes in
SnapshotStateObserver
29f4a3e - Add groups needed in the body of unskippable lambdas 7d06752
- Improve memory reference characteristics of Snapshot state 93fcae8
- Remove boxing in composition local lookups 0875717
- Use correct key for non-reusable nodes groups 6388d8d
- Protect
SnapshotStateObserver
from recursive and concurrent applies 98cb6ba - Added a check-index-bounds check in the
IdentityArraySet
"get" method 35a77d3 - Update compose module to use
ViewTreeLifecycleOwner
extensions 21c2122 - Send apply notifications after Recomposer finishes frame. 98f2641
- Fix index out of bounds crash when cancelling the Recomposer 8f8656f
- Always force recompose if parent providers of Composition have changed 9526fcc
- Recomposer tolerance for cancelled Jobs a55f7ed
- Improve handling invalidations for large number of composers 9b7ed67
- Fix generating closing groups for non-local returns b6f590c
Version 1.4.0-rc01
8 марта 2023 г.
androidx.compose.runtime:runtime-*:1.4.0-rc01
is released. Version 1.4.0-rc01 contains these commits.
Исправления ошибок
Version 1.4.0-beta02
22 февраля 2023 г.
androidx.compose.runtime:runtime:1.4.0-beta02
and androidx.compose.runtime:runtime-saveable:1.4.0-beta02
are released. Version 1.4.0-beta02 contains these commits.
Version 1.4.0-beta01
8 февраля 2023 г.
androidx.compose.runtime:runtime-*:1.4.0-beta01
is released. Version 1.4.0-beta01 contains these commits.
Изменения API
-
ComposeNodeLifecycleCallback
was added which allows to observe lifecycle of Compose nodes ( I3731b ) - Added
@TestOnly
toComposer.disableSourceInformation()
as this function is only safe to call in a test. ( I896c8 )
Исправления ошибок
- Remove boxing in composition local lookups ( 62f66a )
- Improve memory reference characteristics of Snapshot state ( dfb451 )
Version 1.4.0-alpha05
January 25, 2023
androidx.compose.runtime:runtime:1.4.0-alpha05
and androidx.compose.runtime:runtime-saveable:1.4.0-alpha05
are released. Version 1.4.0-alpha05 contains these commits.
Изменения API
- More type/nullability of inline/deprecated-hidden functions ( I24f91 )
Version 1.4.0-alpha04
11 января 2023 г.
androidx.compose.runtime:runtime-*:1.4.0-alpha04
is released. Version 1.4.0-alpha04 contains these commits.
Изменения API
-
TestMonotonicFrameClock
now uses correct experimental annotation. ( I95c9e )
Исправления ошибок
- Protect
SnapshotStateObserver
from recursive and concurrent applies ( d902fb )
Version 1.4.0-alpha03
7 декабря 2022 г.
androidx.compose.runtime:runtime-*:1.4.0-alpha03
is released. Version 1.4.0-alpha03 contains these commits.
Изменения API
- adding a new public method to
ComposableMethod
class analogous tojava.lang.reflect.Method#getParameterTypes()
( Iab0c3 )
Исправления ошибок
- Snapshot apply notifications are now sent after the
Recomposer
finishes applying changes. ( Iad6c0 , b/222093277 )
Version 1.4.0-alpha02
November 9, 2022
androidx.compose.runtime:runtime-*:1.4.0-alpha02
is released. Version 1.4.0-alpha02 contains these commits.
Version 1.4.0-alpha01
24 октября 2022 г.
androidx.compose.runtime:runtime-*:1.4.0-alpha01
is released. Version 1.4.0-alpha01 contains these commits.
Изменения API
-
SnapshotStateList
andSnapshotStateMap
now have explicit implementaions oftoList()
andtoMap()
, respectfully. These methods return their current content without peforming a copy as they return the internal immutable data used to store their content. This value can be used, for example, to produce a flow of values usingsnapshotFlow
without requiring copying of the data. ( Ica2bd )
Версия 1.3
Version 1.3.3
11 января 2023 г.
androidx.compose.runtime:runtime-*:1.3.3
is released. Version 1.3.3 contains these commits.
- No changes since 1.3.2
Версия 1.3.2
7 декабря 2022 г.
androidx.compose.runtime:runtime-*:1.3.2
is released. Version 1.3.2 contains these commits.
Исправления ошибок
- Updated to support androidx.compose.ui 1.3.2
Версия 1.3.1
November 9, 2022
androidx.compose.runtime:runtime-*:1.3.1
is released. Version 1.3.1 contains these commits.
Версия 1.3.0
24 октября 2022 г.
androidx.compose.runtime:runtime-*:1.3.0
is released. Version 1.3.0 contains these commits.
Important changes since 1.2.0
Exception Handling / Live Edit Support
- In order to better support live edit, APIs were added to enable handling of exceptions during composition
- Composition error handling for hot reload
- Handle live edit errors on save/restore
Composition Tracing
- Runtime tracing APIs were added in order to support new composition tracing tooling
- Generate composable trace event start/end calls
- Re-added ComposerKt.traceEventStart(Int, String)
Composable Reflection APIs
- A new
ComposableMethod
API was added to allow for more reliable reflection-based invocations of composable APIs. - Move invokeComposable to compose runtime
- Rework API to invoke composable method
Runtime Fixes
- Fix faulty range test for slot table checking for markers
- Allow movable content to move into and out of SubcomposeLayout
- Fix moving content to new content of a subcomposition
Snapshot System
- The snapshot system got various improvements around memory management, performance, and correctness.
- Optimize scope removal in SnapshotStateObserver
- Dispose nested snapshots created from transparent snapshots
- Fixed race condition when reading state from the global snapshot
- Support DerivedState in SnapshotStateObserver
- Prevent removing derived state from composition when it is read in other scopes
- Use IdentityArrayMap instead of HashMap inside DerivedState
- Update derived state observers to use mutable vector
- Update SnapshotStateObserver state cleanup
- Replace SnapshotStateObserver.invalidated with ArraySet
- Fixed race condition when reading state from the global snapshot
- Fix use of stale record in DerivedState hash calculation
- Fix race condition when advancing the global snapshot
- Speed up scope observations cleanup in SnapshotStateObserver
Version 1.3.0-rc01
October 5, 2022
androidx.compose.runtime:runtime-*:1.3.0-rc01
is released. Version 1.3.0-rc01 contains these commits.
Исправления ошибок
- Fixed
ArrayIndexOutOfBoundsException
coming from the slot table ( b/249076084 )
Version 1.3.0-beta03
21 сентября 2022 г.
androidx.compose.runtime:runtime-*:1.3.0-beta03
is released. Version 1.3.0-beta03 contains these commits.
Behavior Breaking Change
- The parameter to
remember
andrememberCoroutineScope
where changed to becrossinline
. This will report an error for early returns instead of allowing an early return which will cause a later internal error to be reported. - This change can potentially lead to new compiler errors to be reported requiring non-local returns to be removed from the lambdas passed to these functions. ( Ibea62 )
Version 1.3.0-beta02
7 сентября 2022 г.
androidx.compose.runtime:runtime-*:1.3.0-beta02
is released. Version 1.3.0-beta02 contains these commits.
Исправления ошибок
- Updated API ( I64ca0 )
Version 1.3.0-beta01
August 24, 2022
androidx.compose.runtime:runtime-*:1.3.0-beta01
is released. Version 1.3.0-beta01 contains these commits.
Изменения API
- A
find
method was added toCompositionData
to allow developer tools using this API to quickly find a sub-group of composition using its identity. ( I5794f )
Version 1.3.0-alpha03
10 августа 2022 г.
androidx.compose.runtime:runtime-*:1.3.0-alpha03
is released. Version 1.3.0-alpha03 contains these commits.
Version 1.3.0-alpha02
27 июля 2022 г.
androidx.compose.runtime:runtime-*:1.3.0-alpha02
is released. Version 1.3.0-alpha02 contains these commits.
Изменения API
- Re-added
ComposerKt.traceEventStart(Int, String)
for backwards compatibility ( I6e6de )
Version 1.3.0-alpha01
June 29, 2022
androidx.compose.runtime:runtime-*:1.3.0-alpha01
is released. Version 1.3.0-alpha01 contains these commits.
Изменения API
- Moving utility functionality to runtime ( I4f729 )
Версия 1.2
Версия 1.2.1
10 августа 2022 г.
androidx.compose.runtime:runtime-*:1.2.1
is released. Version 1.2.1 contains these commits.
Исправления ошибок
- Fixed memory leak: dispose of nested snapshots created from transparent snapshots b/239603305
Version 1.2.0
27 июля 2022 г.
androidx.compose.runtime:runtime-*:1.2.0
is released. Version 1.2.0 contains these commits.
Important changes since 1.1.0
Compose Runtime had a handful of features introduced in 1.2.0, along with many stabilizing bug fixes. The most significant new feature was the introduction of the
movableContentOf
API , which can be used to enable complex UX such as shared element transitions. ThemovableContentOf
API converts a composable lambda into a lambda that moves it state, and corresponding nodes, to any new location it is called. When the previous call leaves the composition the state is temporarily preserved and if a new call to the lambda enters the composition then the state, and associated Nodes, are moved to the location of the new call. If no new call is added the state is removed permanently and remember observers are notified.If a
movableContentOf
lambda is called multiple times in the same composition, new state and nodes are created for each call and, as calls leave the composition and new calls enter, the state is moved from the first leaving calls to the entering calls in the order they are called. All state not claimed by new calls is removed permanently.In addition to this and a few other new features, much time was spent stabilizing the runtime and Snapshot state system. Various memory leaks were removed and code paths optimized.
A summarized list of the changes can be found below:
New Features in 1.2
- Add experimental snapshot unsafeEnter/Leave
- Add Snapshot.asContextElement experimental API
- Introduce Snapshot.withoutReadObservation
- Allow state to move within a composition
- Tracing of Recompositions in Compose
Performance in 1.2
- Improve composition local performance
- Baseline profiles for compose should be derived using benchmarks
Bug Fixes in 1.2
- Remove tracking information from release recompose scopes
- Prevent removing derived state from composition when it is read in other scopes
- Use more efficient removeScope() in SnapshotStateObserver
- Clean up derived state dependencies in composition
- Fix currentCompositeKeyHash changing after inner recomposition inside movable content
- Clean up invalidated compositions during disposal
- Fix derive state read during recomposition
- Fix memory leak when observing derived state objects
- Fixed movableContent composite hash key to be consistent
- Fix corner a case where the composer would crash
- Ensure forced invalidation of a group forces recomposition
- Fix bug when rememberSaveable with input is restored in the wrong order
Version 1.2.0-rc03
June 29, 2022
androidx.compose.runtime:runtime-*:1.2.0-rc03
is released. Version 1.2.0-rc03 contains these commits.
Исправления ошибок
- Derived state observations were previously unconditionally removed from the recompose scope and composition together, which broke other scopes which might be still observing derived state. This change only removes derived state instances if it is no longer observed by other scopes. ( b/236618362 )
Version 1.2.0-rc02
June 22, 2022
androidx.compose.runtime:runtime-*:1.2.0-rc02
is released. Version 1.2.0-rc02 contains these commits.
Version 1.2.0-rc01
15 июня 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-rc01
is released. Version 1.2.0-rc01 contains these commits.
Изменения API
- Interfaces in compose libraries are now built using jdk8 default interface methods ( I5bcf1 )
Version 1.2.0-beta03
1 июня 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-beta03
is released. Version 1.2.0-beta03 contains these commits.
Version 1.2.0-beta02
18 мая 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-beta02
is released. Version 1.2.0-beta02 contains these commits.
Version 1.2.0-beta01
11 мая 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-beta01
is released. Version 1.2.0-beta01 contains these commits.
Новые функции
- This is the first beta release of 1.2!
Изменения API
- Added experimental
Snapshot.unsafeEnter/unsafeLeave
( I108f3 ) - Added experimental
Snapshot.asContextElement()
API ( Iff072 ) - The
@ComposableTarget
annotation and annotations marked by@ComposableTargetMarker
can now be used at the file scope using the@file
prefix. Using a target annotation at the file scope will cause the compiler to assume all composable functions in the file are intended to be target the associated applier. For example, using@file:UiComposable
declares that all@Composable
functions target the Compose UI applier. A function that needs to target another applier must explicitly supply the target marker annotation for the desired applier. ( I40804 )
Version 1.2.0-alpha08
20 апреля 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha08
is released. Version 1.2.0-alpha08 contains these commits.
Изменения API
- Added
TracingInProgress
to theCompositionTracer
interface. ( Ic6f12 ) - Add
recomposeScopeIdentity
to Composer ( I0c873 ) - Restricted tracing APIs (Composer.setTracer) to
OptIn(InternalComposeTracingApi)
. ( I9187f ) - Added
ResuableContentHost
which allows better control over the lifetime of state created for reusable content. For example, if a sub-composition is temporarily not in use then the content can be deactivated causing all the remembered state in the composition to be forgotten triggering, for example, all disposable effects. ( I2c0f2 , b/220322704 )
Version 1.2.0-alpha07
6 апреля 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha07
is released. Version 1.2.0-alpha07 contains these commits.
Изменения API
- New function
Snapshot.withoutReadObservation { ... }
was added. It allows users to run the passed lambda without subscribing to the changes of the state values read during this block. You could find it useful in use cases when you want to benefit from the snapshot based thread safe write/reads, but want to be able to read the value without causing unnecessary recomposition or remeasure. ( I9f365 , b/214054486 )
Version 1.2.0-alpha06
23 марта 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha06
is released. Version 1.2.0-alpha06 contains these commits.
Version 1.2.0-alpha05
9 марта 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha05
is released. Version 1.2.0-alpha05 contains these commits.
External Contribution
- Updated to use Kotlinx coroutines 1.6.0 ( I3366d )
Version 1.2.0-alpha04
23 февраля 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha04
is released. Version 1.2.0-alpha04 contains these commits.
Изменения API
Added
ComposableTarget
,ComposableTargetMarker
andComposableOpenTarget
that allows compile time reporting of when a composable function is called targeting an applier it was not designed to use.In most cases the annotations can be inferred by the compose compiler plugin so using these annotation directly should be rare . The cases that cannot be inferred include creating and using a custom applier, abstract composable functions (such as interface methods), fields or global variables that are composable lambdas (local variables and parameters are inferred), or when using
ComposeNode
or a related composable functions.For custom appliers the composable functions that calls
ComposeNode
orReusableComposeNode
need to add aCompoableTarget
annotation for the function and any composable lambda parameter types. It is recommended, however, to create an annotation that is annotated withComposableTargetMarker
and then the marked annotation be used instead ofComposableTarget
directly. A composable annotation marked withComposableTargetMarker
is equivalent to aComposbleTarget
with the fully qualified name of the attribute class as the applier parameter. For an example of usingComposableTargetMarker
seeanroidx.compose.ui.UiComposable
. ( I38f11 )
Version 1.2.0-alpha03
9 февраля 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha03
is released. Version 1.2.0-alpha03 contains these commits.
Изменения API
Added
movableContentOf
which converts a composable lambda into a lambda that moves it state, and corresponding nodes, to any new location it is called. When the previous call leaves the composition the state is temporarily preserved and if a new call to the lambda enters the composition then the state, and associated nodes, are moved to the location of the new call. If no new call is added the state is removed permanently and remember observers are notified.If a
movableContentOf
lambda is called multiple times in the same composition, new state and nodes are created for each call and, as calls leave the composition and new calls enter, the state is moved from the first leaving calls to the entering calls in the order they are called. All state not claimed by new calls is removed permanently. ( Ib4850 )Added a tracing API to composition to enable tools to provide more detailed tracing of composable functions. The compiler now generates calls to the tracing API which include source information. ( Ib0eb5 )
To remove these calls and the associated source information from a release build, add the following Proguard rule:
-assumenosideeffects public class androidx.compose.runtime.ComposerKt { boolean isTraceInProgress(); void traceEventStart(int,java.lang.String); void traceEventEnd(); }
Add
InternalComposeScope
which gives tools the ability to identify a composable during recompositions. ( I07a3f )
Version 1.2.0-alpha02
26 января 2022 г.
androidx.compose.runtime:runtime-*:1.2.0-alpha02
is released. Version 1.2.0-alpha02 contains these commits.
Version 1.2.0-alpha01
January 12, 2022
androidx.compose.runtime:runtime-*:1.2.0-alpha01
is released. Version 1.2.0-alpha01 contains these commits.
Изменения API
- Added
identity
field toCompositionData
for generating invariant ids in the Layout Inspector. ( Ic116e )
Dependency Updates
- Now depends on Kotlin
1.6.10
.
Version 1.1
Версия 1.1.1
23 февраля 2022 г.
androidx.compose.runtime:runtime-*:1.1.1
is released. Version 1.1.1 contains these commits.
Исправления ошибок
- Fix
NullPointerException
atandroidx.compose.ui.platform.RenderNodeLayer.updateDisplayList
( aosp/1947059 , b/206677462 ) - Fix crash caused by clipboard content while reading from clipboard on Android. ( I06020 , b/197769306 )
- Fixed RTL in
LazyVerticalGrid
( aosp/1931080 , b/207510535 )
Версия 1.1.0
9 февраля 2022 г.
androidx.compose.runtime:runtime-*:1.1.0
is released. Version 1.1.0 contains these commits.
Important changes since 1.0.0
- Stable support for the Android 12 Overscroll effect
- Improvements to touch target sizing
- Note that, with respect to Compose 1.0, Material components will expand their layout space to meet Material accessibility guidelines for touch target size . For instance, Button touch target will expand to a minimum size of
48x48dp
, even if you set the Button's size to be smaller. This aligns Compose Material to the same behavior of Material Design Components, providing consistent behavior if you mix Views and Compose. This change also ensures that when you create your UI using Compose Material components, minimum requirements for touch target accessibility will be met. - Stable support for Navigation Rail
- Graduates a number of previously experimental APIs to stable
- Support for newer versions of Kotlin
Version 1.1.0-rc03
26 января 2022 г.
androidx.compose.runtime:runtime-*:1.1.0-rc03
is released. Version 1.1.0-rc03 contains these commits.
Исправления ошибок
- Updated to support Compose Material
1.1.0-rc03
Version 1.1.0-rc01
15 декабря 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-rc01
is released. Version 1.1.0-rc01 contains these commits.
Version 1.1.0-beta04
1 декабря 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-beta04
is released. Version 1.1.0-beta04 contains these commits.
Новые функции
- Updated to be compatible with Kotlin
1.6.0
Version 1.1.0-beta03
17 ноября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-beta03
is released. Version 1.1.0-beta03 contains these commits.
Version 1.1.0-beta02
3 ноября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-beta02
is released. Version 1.1.0-beta02 contains these commits.
Изменения API
- Snapshot code was split up into multiple files, but all still lives in the same JVM class. ( Ic6c98 )
Version 1.1.0-beta01
27 октября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-beta01
is released. Version 1.1.0-beta01 contains these commits.
Version 1.1.0-alpha06
13 октября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-alpha06
is released. Version 1.1.0-alpha06 contains these commits.
Изменения API
- Removed
InternalCompilerApi
from Composer methods that are required to be called cross-module ( I1aa0b ) -
Recomposer.state
has been deprecated and replaced byRecomposer.currentState
to change its type to a StateFlow ( Ic2ab3 , b/197773820 )
Version 1.1.0-alpha05
29 сентября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-alpha05
is released. Version 1.1.0-alpha05 contains these commits.
Version 1.1.0-alpha04
September 15, 2021
androidx.compose.runtime:runtime-*:1.1.0-alpha04
is released. Version 1.1.0-alpha04 contains these commits.
Version 1.1.0-alpha03
1 сентября 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-alpha03
is released. Version 1.1.0-alpha03 contains these commits.
Новые функции
- The Compose Compiler now supports older versions of the Compose Runtime (1.0). Prior to this change, the Compose Compiler was only compatible with the Compose Runtime of the same version or later. After this change, the Compose Compiler is compatible with an older version of the Compose Runtime (1.0). ( aosp/1796968 )
- Updated Compose
1.1.0-alpha03
to depend on Kotlin1.5.30
. ( I74545 )
Version 1.1.0-alpha02
18 августа 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-alpha02
is released. Version 1.1.0-alpha02 contains these commits.
Version 1.1.0-alpha01
4 августа 2021 г.
androidx.compose.runtime:runtime-*:1.1.0-alpha01
is released. Version 1.1.0-alpha01 contains these commits.
Версия 1.0
Версия 1.0.5
3 ноября 2021 г.
androidx.compose.runtime:runtime-*:1.0.5
is released. Version 1.0.5 contains these commits.
Исправления ошибок
- Fixed a crash tracking derivedStateOf instances. ( aosp/1792247 )
Version 1.0.4
13 октября 2021 г.
androidx.compose.runtime:runtime-*:1.0.4
is released. Version 1.0.4 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.31
Version 1.0.3
29 сентября 2021 г.
androidx.compose.runtime:runtime-*:1.0.3
is released. Version 1.0.3 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.30
Версия 1.0.2
1 сентября 2021 г.
androidx.compose.runtime:runtime-*:1.0.2
is released. Version 1.0.2 contains these commits.
Updated to support the Compose 1.0.2
release. Compose 1.0.2
is still compatible with Kotlin 1.5.21
.
Version 1.0.1
4 августа 2021 г.
androidx.compose.runtime:runtime-*:1.0.1
is released. Version 1.0.1 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.21
.
Версия 1.0.0
28 июля 2021 г.
androidx.compose.runtime:runtime-*:1.0.0
is released. Version 1.0.0 contains these commits.
Major features of 1.0.0
This is the first stable release of Compose. Please see the official Compose Release blog for more details!
Известные проблемы
If you are using Android Studio Bumblebee Canary 4 or AGP
7.1.0-alpha04
/7.1.0-alpha05
, you may hit the following crash:java.lang.AbstractMethodError: abstract method "void androidx.lifecycle.DefaultLifecycleObserver.onCreate(androidx.lifecycle.LifecycleOwner)"
To fix, temporarily increase your minSdkVersion to 24+ in your
build.gradle
file. This issue will be fixed in the next version of Android Studio Bumblebee and AGP7.1
. ( b/194289155 )
Version 1.0.0-rc02
July 14, 2021
androidx.compose.runtime:runtime-*:1.0.0-rc02
is released. Version 1.0.0-rc02 contains these commits.
- Fixed race conditions in SnapshotStateObserver causing spurratic NullPointerExceptions. ( aosp/1763445 , aosp/1758105 , b/192677711 )
- Fixed issues with runtime snapshots causing
java.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
crashes. ( b/193006595 , b/192570897 )
Version 1.0.0-rc01
July 1, 2021
androidx.compose.runtime:runtime-*:1.0.0-rc01
is released. Version 1.0.0-rc01 contains these commits.
Version 1.0.0-beta09
June 16, 2021
androidx.compose.runtime:runtime-*:1.0.0-beta09
is released. Version 1.0.0-beta09 contains these commits.
Added Profile Rules
This release adds profile rules to the following compose modules ( I14ed6 ):
- androidx.compose.animation
- androidx.compose.animation-core
- androidx.compose.foundation
- androidx.compose.foundation-layout
- androidx.compose.material
- androidx.compose.material-ripple
- androidx.compose.runtime
- androidx.compose.ui
- androidx.compose.ui.geometry
- androidx.compose.ui.graphics
- androidx.compose.ui.text
- androidx.compose.ui.text
- androidx.compose.ui.unit
- androidx.compose.ui.util
What are profile rules?
Profile rules for a library are specified in a text file
baseline-prof.txt
located in thesrc/main
or equivalent directory. The file specifies a rule per line, where a rule in this case is a pattern for matching to methods or classes in the library. The syntax for these rules is a superset of the human-readable ART profile format that is used when usingadb shell profman --dump-classes-and-methods ...
. These rules take one of two forms to target either methods or classes.A method rule will have the following pattern:
<FLAGS><CLASS_DESCRIPTOR>-><METHOD_SIGNATURE>
And a class rule will have the following pattern:
<CLASS_DESCRIPTOR>
Here
<FLAGS>
is one or more of the charactersH
,S
, andP
to indicate whether or not this method should be flagged as "Hot", "Startup", or "Post Startup".The
<CLASS_DESCRIPTOR>
is the descriptor for the class that the targeted method belongs to. For example, the classandroidx.compose.runtime.SlotTable
would have a descriptor ofLandroidx/compose/runtime/SlotTable;
ПолемThe
<METHOD_SIGNATURE>
is the signature of the method, and includes the name, parameter types, and return types of the method. For example, the methodfun isPlaced(): Boolean
onLayoutNode
has the signatureisPlaced()Z
.These patterns can have wildcards (
**
,*
, and?
) in order to have a single rule encompass multiple methods or classes.
What do the rules do?
A method that has the flag
H
indicates that this method is a "hot" method, and should be compiled ahead of time.A method that has the flag
S
indicates that it is a method which is called at startup, and should be compiled ahead of time to avoid the cost of compilation and interpreting the method at startup time.A method that has the flag
P
indicates that it is a method which is called after startup.A class that is present in this file indicates that it is used during startup and should be pre-allocated in the heap to avoid the cost of class loading.
Как это работает?
- Libraries can define these rules which will be packaged in AAR artifacts. When an app is then built which includes these artifacts, these rules are merged together and the merged rules are used to build a compact binary ART profile that is specific to the app. ART can then leverage this profile when the app is installed on devices in order to ahead-of-time compile a specific subset of the application to improve the performance of the application, especially the first run. Note that this will have no effect on debuggable applications.
Version 1.0.0-beta08
2 июня 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta08
is released. Version 1.0.0-beta08 contains these commits.
Изменения API
-
State<T>
is nowState<out T>
( I69049 ) -
ControlledComposition
API change to enable recomposing changes in a recompose single pass. ( Iaafd1 , b/184173932 )
Version 1.0.0-beta07
May 18, 2021
androidx.compose.runtime:runtime-*:1.0.0-beta07
is released. Version 1.0.0-beta07 contains these commits.
Изменения API
- Added new compose compiler APIs that allow the source information generated by the compiler to be removed during source minification. ( Ia34e6 )
Introduces
ReusableContent
which will attempt to reuse the nodes in its content instead of replacing them when the key is changed. When the key is changed the previous values in the slot table for the content is ignored except for the nodes that were generated and the values used to update the nodes.Introduces
ReusableComposeNode
that will reuse the node emitted instead of replacing it as is done forComposeNode
. ( I1dd86 )@ComposeCompilerApi
no longer@RequiresOptIn
( Iab690 )
Исправления ошибок
- LazyColumn/Row will now keep up to 2 previously visible items active (not disposed) even when they are scrolled out already. This allows the component to reuse the active subcompositions when we will need to compose a new item which improves the scrolling performance. ( Ie5555 )
Version 1.0.0-beta06
5 мая 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta06
is released. Version 1.0.0-beta06 contains these commits.
Изменения API
-
@ComposeCompilerApi
no longer@RequiresOptIn
( Iab690 )
Version 1.0.0-beta05
21 апреля 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta05
is released. Version 1.0.0-beta05 contains these commits.
Изменения API
- Removed
@InternalComposeApi
for recording snapshot reads and writes ( Id134d )
Исправления ошибок
- The AndroidManifest files from ui-test-manifest and ui-tooling-data are now compatible with Android 12 ( I6f9de , b/184718994 )
Version 1.0.0-beta04
7 апреля 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta04
is released. Version 1.0.0-beta04 contains these commits.
Исправления ошибок
Prior to this change, local composable functions were skippable based on their parameters. After this change, no local composable functions will skip. This change is done because it is common and expected for local functions to capture parameters from the parent and them skipping is a common source of bugs.
To summarize, consider the example:
@Composable fun Counter(count: Int, onCountChange: (Int) -> Unit) { @Composable fun ShowCount() { Text("Count: $count") } ShowCount() Button(onClick={ onCountChange(count + 1) }) { Text("Increment") } }
Prior to this change, the
ShowCount
composable function would always skip, even after thecount
parameter was updated. This is no longer the case. ( I5648a )Fixed the issue when
rememberSaveable()
was restoring the old value when used with input params ( I1b110 , b/182403380 )
Version 1.0.0-beta03
24 марта 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta03
is released. Version 1.0.0-beta03 contains these commits.
Изменения API
-
DefaultMonotonicFrameClock
is deprecated. CallingwithFrameNanos
orRecomposer.runRecomposeAndApplyChanges
with noMonotonicFrameClock
will now throwIllegalStateException
. ( I4eb0d )
Version 1.0.0-beta02
March 10, 2021
androidx.compose.runtime:runtime-*:1.0.0-beta02
is released. Version 1.0.0-beta02 contains these commits.
Исправления ошибок
- Enforce restrictions on public usage of experimental APIs ( I6aa29 , b/174531520 )
- Fix for broken
rememberSaveable { mutableStateOf(0) }
when used inside a destination of navigation-compose. ( I1312b , b/180042685 , b/180701630 )
Version 1.0.0-beta01
24 февраля 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-beta01
is released. Version 1.0.0-beta01 contains these commits.
This is the first release of Compose 1.0.0 Beta.
Изменения API
- Add
Recomposer.runRecomposeConcurrentlyAndApplyChanges
experimental API for recomposing invalidated compositions off the main frame loop. ( I342d0 ) - Any composables marked with @ReadOnlyComposable are now compile-time validated to ensure that they only make calls to other @ReadOnlyComposables ( I58961 )
The
defaultFactory
forcompositionLocalOf
andstaticCompositionLocalOf
is now required instead of optional.This changes removes a potential type error for non-nullable types where no default factory was provided. Previously this would provide a null reference for a non-nullable type.
For nullable types consider supplying
{ null }
as the default factory.We do not recommend using locals with non-nullable types unless a sensible default can be provided. If no sensible default exists, the
defaultFactory
lambda should throw an exception. However throwing an exception means that consumers of the local will have an implicit dependency on it being provided that is not enforced by the type system. ( Ifbd2a )Deprecated symbols were removed from the compose runtime ( I3252c )
Deprecated
emptyContent()
is removed. Use{}
instead. ( Idb33f , b/179432510 )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.
- ( I99b7d , b/177245490 )
SnapshotStateObserver is not Experimental anymore ( Id2e6a )
Deleted some previously deprecated APIs ( Ice5da , b/178633932 )
Made the following Material API changes:
- Added contentPadding parameter to Top/BottomAppBar to allow customizing the default padding.
- Reordered parameters in BackdropScaffold to follow API guidelines for required parameters being before optional parameters.
- Moved
icon
parameter in BottomNavigationItem to be afterselected
andonClick
. - Renamed
alwaysShowLabels
parameter in BottomNavigationItem toalwaysShowLabel
. - Renamed
bodyContent
parameters in a few components to justcontent
. - Reordered parameters in
ButtonDefaults.buttonColors()
. Please note that because the type of the parameters have not changed, this will not cause an error in your code - please ensure you are either using named parameters or update the ordering manually, otherwise your code will not work the same as previously. - Added
secondaryVariant
parameter todarkColors()
. This color is typically the same assecondary
in dark theme, but adding for consistency and further customization. - Removed ElevationDefaults and animateElevation() from the public API surface since they were not commonly used / useful.
- Renamed
onValueChangeEnd
inSlider
toonValueChangeFinished
and made it nullable. - Renamed
text
parameter inSnackbar
tocontent
for consistency. - Added
contentPadding
parameter toDropdownMenuItem
to allow customizing the default padding and madecontent
be an extension onRowScope
. - Renamed
ModalDrawerLayout
toModalDrawer
. - Renamed
BottomDrawerLayout
toBottomDrawer
. - ( I1cc66 )
Version 1.0.0-alpha12
10 февраля 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha12
is released. Version 1.0.0-alpha12 contains these commits.
Изменения API
- Support for ViewGroups was removed from UiApplier. The Deprecated emitView composables were removed. ( Ifb214 )
- CompositionReference renamed to CompositionContext ( I53fcb )
- ComponentActivity.setContent has moved to androidx.activity.compose.setContent in the androidx.activity:activity-compose module. ( Icf416 )
- Snapshot API was updated to be more consistent with API guideline as well as hiding internal implementation classes from the public API. ( Id9e32 )
- Renamed Ambients to match the Ambient -> CompositionLocal rename. Ambients used to be named AmbientFoo, now CompositionLocals are named LocalFoo. ( I2d55d )
- Renamed Ambient to CompositionLocal, and ambientOf / staticAmbientOf to compositionLocalOf / staticCompositionLocalOf respectively. This change helps to make the purpose of CompositionLocal more clear: a mechanism for providing / retrieving values local to a composition. CompositionLocal instances should be prefixed with
Local
, such as val LocalFoo = compositionLocalOf { Foo() }. ( Ia55b6 ) - takeMutableSnapshot and takeSnapshot have moved to be companion methods of Snapshot. ( I91f19 )
@ComposableContract
has been deprecated in favor of three more specific annotations.@ComposableContract(restartable = false)
has become@NonRestartableComposable
@ComposableContract(readonly = true)
has become@ReadOnlyComposable
@ComposableContract(preventCapture = true)
has become@DisallowComposableCalls
@ComposableContract(tracked = true)
has been removed. ( I60a9d )emptyContent() and (@Composable () -> Unit).orEmpty() utilities have been deprecated as they no longer have any positive performance impact or value ( I0484d )
snapshotFlow
andwithMutableSnapshot
are no longer experimental ( I6a45f )Recomposers can now be closed. Closed recomposers will continue recomposition until composition child coroutines complete. Recomposer.shutDown renamed to cancel to contrast with close. ( Ib6d76 )
The
compose:runtime-dispatch
artifact is now deprecated. MonotonicFrameClock can now be found in compose:runtime and AndroidUiDispatcher can be found in compose:ui. ( Ib5c36 )The API the Compose compiler plugin targets has been refactored to use an interface instead of a concrete class. The interface also no longer uses a type parameter.
This is an internal change that should not effect source code compatibility but is a binary breaking change. ( I3b922 , b/169406779 )
SnapshotMutableState was introduced ( Icfd03 )
DisposableEffectDisposable was renamed to DisposaleEffectResult ( Ica7c6 )
Removed Recomposer.current(). [Abstract]ComposeView now default to lazily created, window-scoped Recomposers driven by the ViewTreeLifecycleOwner for the window. Recomposition and withFrameNanos-based animation ticks are paused while the host Lifecycle is stopped. ( I38e11 )
Recomposer.runningRecomposers now offers a global StateFlow of read-only RecomposerInfo for observing ongoing composition state in the process. Prefer this API to Recomposer.current(), which is now deprecated. ( If8ebe )
DisposableEffectDisposable was renamed to DisposaleEffectResult ( I3ea68 )
Version 1.0.0-alpha11
January 28, 2021
androidx.compose.runtime:runtime-*:1.0.0-alpha11
is released. Version 1.0.0-alpha11 contains these commits.
Изменения API
- onCommit, onDispose, and onActive have been deprecated in favor of SideEffect and DisposableEffect APIs ( If760e )
- The emit() API and all overloads have been deprecated and renamed to ComposeNode. The APIs are identical, just a different name in order to follow the naming conventions of Compose ( I4137b )
- invalidate and compositionReference() are now deprecated in favor of currentRecomposeScope and rememberCompositionReference respectively. ( I583a8 )
RememberObserver replaces CompositionLifecycleObserver and CompositionLifecycleObserver is now deprecated.
RememberObserver
is a replacement forCompositionLifecycleObserver
with modified semantics and renamed methods. Changing to the new API can be done mechanically for objects that are only remembered once which is, and continues to be, the recommended practice. However, if a reference was remembered more than once in a compositiononRemembered
is called for each reference whereonEnter
is only called once.onEnter
was called multiple time if the object was used in subcompositions, such asWithConstraints
andScaffold
making the singleonEnter
call guarantee unreliable and it was removed forRememberObserver
.RememberObserver
addsonAbandoned
which is called if theRememberObserver
instance is returned from the callback passed toremember
but was not remembered in the composition state and, therefore, will never haveonRemembered
called. This can occur if an exception terminates composition before completing or the composition is discarded because the state is was producing a composition for is no longer current or otherwise is no longer needed. If the instance ofRememberObserver
following the single reference recommendation above is tracking an external resource bothonForgotten
andonAbandoned
each indicate that the resource is no longer needed. If the object is tracking work started or resources allocated inonRemembered
,onAbandoned
can be ignored as it will not be called ifonRemembered
is called. ( I02c36 )Do not mark
collectAsState()
functions as inline ( Ia73e4 )
Исправления ошибок
- WithConstraints was reworked as BoxWithConstraints and moved to foundation.layout. ( I9420b , b/173387208 )
- Leverage TestCoroutineDispatcher in testing ( I532b6 )
Version 1.0.0-alpha10
13 января 2021 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha10
is released. Version 1.0.0-alpha10 contains these commits.
Breaking Change
Restructuring of the internal compiler API allows batching changes to the nodes generated as a result of composition into the "apply changes" phase of composition, after all
@Composable
functions have completed.This is a behavioral breaking change that might affect application code as nodes are no longer available from internal and experimental APIs until after changes have been applied. This can usually be worked around by surrounding code with such dependencies in a
SideEffect
composable to defer execution of the code until after the nodes have been created and initialized. ( I018da )
Изменения API
- Added a way to track if the recomposer has applied changes. ( I1b3e2 )
Expand [Abstract]ComposeView APIs to allow recycling Compose-based views, disposing their composition to recreate again later. Add APIs for installing and discovering window-scoped Recomposers and CompositionReferences for creating child compositions.
Add ViewCompositionStrategy for configuring the composition disposal strategy of [Abstract]ComposeViews; default behavior is dispose on window detach. ( I860ab )
Исправления ошибок
- Recomposer now exposes a Flow of its current state, allowing monitoring its activity and the activity of associated effects. ( Ifb2b9 )
- The native keyEvent can now be accessed through keyEvent.nativeKeyEvent ( I87c57 , b/173086397 )
Version 1.0.0-alpha09
16 декабря 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha09
is released. Version 1.0.0-alpha09 contains these commits.
Изменения API
Removed SlotTable, SlotReader and SlotWriter from the public API. These were marked as InternalComposeAPI previously. Now they are internal to the compose module.
CompositionData and CompositionGroup were added as a replacement for the ui-tooling API to use to extract composition information. These are public but are not intended for use outside the ui-tooling API as they provide the raw information the ui-tooling API interprets ( I31a9c )
The Applier class is no longer considered an ( Id85b0 )
The
Applier
interface has changed to simplify building trees bottom-up instead of top-down.The
insert()
method has been renamed toinsertTopDown()
.A new method,
insertBottomUp()
, was added.An applier either inserts nodes into the tree it is editing using
insertTopDown()
orinsertBottomUp()
depending on which performs better.Some trees, such as
LayoutNode
andView
, are much more efficient to build bottom-up than top-down. Prior to this change, a stack of inserts was required to implement bottom-up which needed to be copied to every applier which needed bottom-up construction for performance. With this change anApplier
overridesinsertBottomUp()
to build a tree bottom-up andinsertTopDown()
to build the tree top-down. ( Icbdc2 )Compose supports property getters that can make composable invocations. Support for this is not going away, but the syntax for declaring a property getter as being @Composable is changing.
The now-deprecated syntax for doing this was by annotating the property itself:
@Composable val someProperty: Int get() = ...
The now-correct syntax for doing this is by annotating the getter of the property:
val someProperty: Int @Composable get() = ...
Both syntaxes will work for some time, but the former deprecated syntax will eventually become a compile error. ( Id9197 )
Исправления ошибок
- AndroidOwner made internal ( Ibcad0 , b/170296980 )
- subcomposeInto(LayoutNode) was made internal ( Id724a )
Version 1.0.0-alpha08
2 декабря 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha08
is released. Version 1.0.0-alpha08 contains these commits.
Изменения API
- Added lint check for composable lambda parameter naming and position, to check for consistency with Compose guidelines. Also migrated some APIs using
children
as the name for their trailing lambda tocontent
, according to the lint check and guidance. ( Iec48e ) - Recomposer no longer accepts an EmbeddingContext; required scheduling dependencies are obtained from the effectCoroutineContext. FrameManager is deprecated; platform integrations should initialize their own global snapshot handling. ( I02369 )
- RestorableStateHolder.withRestorableState function was renamed to RestorableStateProvider ( I66640 )
Исправления ошибок
- Deprecated Ambients named with
Ambient
as their suffix, and replaced them with new properties prefixed with Ambient, following other Ambients and Compose API guidelines. ( I33440 ) - Remove old ui-test module and its stubs ( I3a7cb )
Version 1.0.0-alpha07
November 11, 2020
androidx.compose.runtime:runtime-*:1.0.0-alpha07
is released. Version 1.0.0-alpha07 contains these commits.
Новые функции
Изменения API
- The
@UnionType
annotation has been deprecated ( I57cde ) - provideDefault was added as an alternative to provide for providing ambients, and it can be used to specify ambient values that will only be set when there is no ambient value already provided. ( Id6635 , b/171024925 )
- LaunchedTask was renamed to LaunchedEffect for consistency with the SideEffect and DisposableEffect APIs. LaunchedEffect with no subject params is not permitted in order to encourage best practices. ( Ifd3d4 )
- Applier now has onBeginChanges/onEndChanges callbacks that are invoked when a Composer begins/is finished applying changes to the tree. These may be used for batching resource management if needed. ( Icf476 )
- Recomposer now requires a CoroutineContext at construction ( Ic4610 )
- Changes to the internal SlotTable implementation which should not affect the public API. ( If9828 )
- Deprecated rxjava2 adapters which does not take the initial value were removed ( Idb72f )
Исправления ошибок
- foundation.Text has been deprecated and replaced with material.Text. For a basic, unopinionated text API that does not consume values from a theme, see androidx.compose.foundation.BasicText. ( If64cb )
- BaseTextField has been deprecated. Use BasicTextField instead. ( I896eb )
- Several layout related symbols were moved from androidx.compose.ui to androidx.compose.layout.ui. ( I0fa98 , b/170475424 )
External Contribution
- Added
runtime-rxjava3
module for compose. Similar toruntime-rxjava2
( I02cbf )
Version 1.0.0-alpha06
28 октября 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha06
is released. Version 1.0.0-alpha06 contains these commits.
Изменения API
- Recomposer is now a CompositionReference and a valid composition parent. Explicit Recomposer is now required in fewer places. ( I4036f )
- Added DisposableEffect counterpart API to SideEffect, filling the role of onCommit-with-params but with a required onDispose.
- Added rememberUpdatedState API to publish data from recomposition to ongoing or long-lived processes such as DisposableEffects or LaunchedTasks.
- ( Id50b9 )
- MutableVector now implements RandomAccess ( I85d73 , b/170461551 )
- Added SideEffect composable for applying side effects of composition to objects managed by the composition. SideEffect is intended to replace the onCommit composable. ( Ia77c2 )
- New experimental api RestorableStateHolder. It allows to save the state defined with [savedInstanceState] and [rememberSavedInstanceState] for the subtree before disposing it to make it possible to compose it back next time with the restored state. ( I66884 , b/166586419 )
Исправления ошибок
- Enable transitions in ComposeTestRule; remove option to enable the blinking cursor from ComposeTestRule. ( If0de3 )
Версия 1.0.0-альфа05
14 октября 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha05
is released. Version 1.0.0-alpha05 contains these commits.
Изменения API
- Experimental Modifier.pointerInput suspending input modifier ( Ia77d2 )
- The scrolling performance of LazyColumn/Row is improved by doing less work in subcomposition on every scroll. The new hasInvalidations() method was added for Composition class. hasPendingChanges() method from Recomposer was renamed to hasInvalidations() ( Ib2f32 , b/168293643 , b/167972292 , b/165028371 )
- Add produceState API for launching coroutines from composition that update a single
State<T>
value over time ( Id4a57 ) - launchInComposition renamed to LaunchedTask to match Compose API guidelines ( I99a8e )
- The order of place() calls in custom Layouts now defines the drawing order for the children ( Ibc9f6 )
Версия 1.0.0-альфа04
1 октября 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha04
is released. Version 1.0.0-alpha04 contains these commits.
Изменения API
- Added OwnerScope to allow collection of layout and drawing observation scopes once they are no longer valid. ( Ic4cf8 )
- Added derivedStateOf API to create State objects based on a calculation which may read (and derive from) other State objects ( If758b )
- Added TestOnly API for SnapshotStateObserver ( I6e2a9 )
Исправления ошибок
- foundation.Box was deprecated. Please use foundation.layout.Box instead. ( Ie5950 , b/167680279 )
Версия 1.0.0-альфа03
16 сентября 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha03
is released. Version 1.0.0-alpha03 contains these commits.
Изменения API
-
CompositionCoroutineScope
no longer implementsMonotonicFrameClock
. Callers ofwithFrameNanos
should import the top-level function explicitly. ( Icb642 , b/166778123 )
Исправления ошибок
- Global testing functions such as
onNode
orwaitForIdle
are now deprecated, please migrate to their new counterparts that are defined on ComposeTestRule ( I7f45a ) -
launchInComposition
no longer launches coroutines undispatched ( Ief6af , b/166486000 )
Версия 1.0.0-альфа02
2 сентября 2020 г.
androidx.compose.runtime:runtime-*:1.0.0-alpha02
is released. Version 1.0.0-alpha02 contains these commits.
Изменения API
- Add
snapshotFlow
andwithMutableSnapshot
APIs for consuming and producing Snapshot data changes. ( I3e722 ) The calling convention for composable functions has changed. This is a binary breaking change. All libraries must be recompiled to work with this version of the compose compiler plugin.
This change does not create a source level breaking change as the only APIs that have changed are compiler APIs that have an explicit opt in. ( I7afd2 , b/158123185 )
Removed scheduling methods from EmbeddingContext ( I7b9be )
onPreCommit is deprecated; onCommit now has onPreCommit's behavior.
onCommit and onActive now run in the same choreographer frame that the composition changes committed in rather than at the beginning of the next choreographer frame. ( I70403 )
Версия 1.0.0-альфа01
August 26, 2020
androidx.compose.runtime:runtime-*:1.0.0-alpha01
is released. Version 1.0.0-alpha01 contains these commits.
Version 0.1.0-dev
Version 0.1.0-dev17
19 августа 2020 г.
androidx.compose.runtime:runtime-*:0.1.0-dev17
is released. Version 0.1.0-dev17 contains these commits.
Изменения API
- Custom emits can now declare that one or more of its setters can be skipped and recomposed independently of the emit. ( Ibbd13 )
Removed deprecated FrameManager calls.
Internal compose APIs have been changed to reduce the amount of overhead to track state objects such as
mutableStateof()
( I80ba6 )The
state { ... }
composable is now deprecated in favor of explicit calls toremember { mutableStateOf(...) }
for clarity. This reduces the overall API surface and number of concepts for state management, and matches theby mutableStateOf()
pattern for class property delegation. ( Ia5727 )Flow.collectAsState now determines the default dispatcher from the composition itself rather than defaulting to Dispatchers.Main. ( I9c1d9 )
Crash when something which saves the state was used inside the for loop is fixed. Now having the same key in savedInstanceState() is allowed, api of UiSavedStateRegistry is now adjusted to this new requirement ( I4ab76 , b/160042650 , b/156853976 , b/159026663 , b/154920561 )
Исправления ошибок
-
emitView
was deprecated. UseAndroidView
instead if possible for emitting Views inside Compose. Note that composing Views and ViewGroups directly will not be supported in the future unless these are leaves in the composition tree, case when this can be achieved using AndroidView. ( I29b1e , b/163871221 )
Version 0.1.0-dev16
5 августа 2020 г.
androidx.compose.runtime:runtime-*:0.1.0-dev16
is released. Version 0.1.0-dev16 contains these commits.
Изменения API
The default mutation policy of
mutableStateOf()
,ambientOf()
andsavedInstanceStateOf()
has changed to bestructuralEqualityPolicy()
instead ofreferentialEqualityPolicy()
.The default for deciding if a new value assigned to a
mutableStateOf()
instance is considered a change now defaults to using==
instead of using===
.See https://kotlinlang.org/docs/reference/equality.html
ambientOf()
andsavedInstanceStateOf()
usemutableStateOf()
in their implementations so they were changed to be consistent withmutableStateOf()
.Using structural equality more closely matches developer expectations.
Например,
val state = mutableStateOf(1f)
с последующим,
state.value = 1f
will no longer be consider a change to
state
and uses ofstate
during composition will no longer need to be recomposed.This is a breaking change but, in most cases (such when using classes that do not override
equals()
), this will not have a noticeable effect on an application.Classes that do override
equals()
, such asdata
classes, might see a performance degradation as theirequals()
methods are now, by default, called when assigned to amutableStateOf()
.The previous behavior can be restored by adding the policy parameter
policy = referentialEqualityPolicy()
to calls tomutableStateOf()
,ambientOf()
andsavedInstanceStateOf()
. ( Ic21a7 )Row
andColumn
are now inline function significantly reducing the overhead of using them. ( I75c10 )
Исправления ошибок
- setViewContent was deprecated. setContent should be used instead. ( I7e497 , b/160335130 )
Added MonotonicFrameAnimationClock that enables you to use a MonotonicFrameClock as an AnimationClockObservable to bridge the gap between the new coroutines based clocks and APIs that still use the old callback based clocks.
The MonotonicFrameClock equivalent of ManualAnimationClock is now ManualFrameClock. ( I111c7 , b/161247083 )
Modifier.stateDraggable was completely reworked and renamed to Modifier.swipeable. A new SwipeableState class was introduced, and DrawerState and BottomDrawerState were refactored to inherit from it. [Modal/Bottom]DrawerLayout no longer take an onStateChange parameter. ( I72332 , b/148023068 )
Modifier.plus has been deprecated, use Modifier.then instead. 'Then' has a stronger signal of ordering, while also prohibits to type
Modifier.padding().background() + anotherModifier
, which breaks the chain and harder to read ( Iedd58 , b/161529964 )SubcomposeLayout is added. It is a low level primitive which allows to compose the children during the measuring if we want to use some values available only later during the measure for the subtree composition. For example WithConstraints is not implemented using SubcomposeLayout. ( I25cc8 )
Material FilledTextField was renamed to TextField and foundational TextField was renamed to BaseTextField to make simplest desired API easy to discover and use ( Ia6242 , b/155482676 )
Modifier.drawBackground has been renamed to Modifier.background ( I13677 )
Version 0.1.0-dev15
22 июля 2020 г.
androidx.compose.runtime:runtime-*:0.1.0-dev15
is released. Version 0.1.0-dev15 contains these commits.
Dependencies Update
- To use the
0.1.0-dev15
version of Compose, you will need to update your dependencies according to the new code snippets shown above in Declaring dependencies .
Изменения API
@Model
annotation is now deprecated. Use state and mutableStateOf as alternatives. This deprecation decision was reached after much careful discussion.Оправдание
Rationale includes but is not limited to:
- Reduces API surface area and concepts we need to teach
- More closely aligns with other comparable toolkits (Swift UI, React, Flutter)
- Reversible decision. We can always bring
@Model
back later. - Removes corner-case usage and difficult to answer questions about configuring
@Model
as things we need to handle -
@Model
data classes, equals, hashcode, etc. - How do I have some properties “observed” and others not?
- How do I specify structural vs. referential equality to be used in observation?
- Reduces “magic” in the system. Would reduce the likelihood of someone assuming system was smarter than it is (ie, it knowing how to diff a list)
- Makes the granularity of observation more intuitive.
- Improves refactorability from variable -> property on class
- Potentially opens up possibilities to do hand-crafted State-specific optimizations
- More closely aligns with the rest of the ecosystem and reduces ambiguity towards immutable or us “embracing mutable state”
Заметки о миграции
Almost all existing usages of
@Model
are fairly trivially transformed in one of two ways. The example below has a@Model
class with two properties just for the sake of example, and has it being used in a composable.@Model class Position( var x: Int, var y: Int ) @Composable fun Example() { var p = remember { Position(0, 0) } PositionChanger( position=p, onXChange={ p.x = it } onYChange={ p.y = it } ) }
Alternative 1: Use
State<OriginalClass>
and create copies.This approach is made easier with Kotlin's data classes. Essentially, make all previously
var
properties intoval
properties of a data class, and then usestate
instead ofremember
, and assign the state value to cloned copies of the original using the data classcopy(...)
convenience method.It's important to note that this approach only works when the only mutations to that class were done in the same scope that the
State
instance is created. If the class is internally mutating itself outside of the scope of usage, and you are relying on the observation of that, then the next approach is the one you will want to use.data class Position( val x: Int, val y: Int ) @Composable fun Example() { var p by state { Position(0, 0) } PositionChanger( position=p, onXChange={ p = p.copy(x=it) } onYChange={ p = p.copy(y=it) } ) }
Alternative 2: Use mutableStateOf and property delegates
This approach is made easier with Kotlin's property delegates and the
mutableStateOf
API which allows you to create MutableState instances outside of composition. Essentially, replace allvar
properties of the original class withvar
properties withmutableStateOf
as their property delegate. This has the advantage that the usage of the class will not change at all, only the internal implementation of it. The behavior is not completely identical to the original example though, as each property is now observed/subscribed to individually, so the recompositions you see after this refactor could be more narrow (a good thing).class Position(x: Int, y: Int) { var x by mutableStateOf(x) var y by mutableStateOf(y) } // source of Example is identical to original @Composable fun Example() { var p = remember { Position(0, 0) } PositionChanger( position=p, onXChange={ p.x = it } onYChange={ p.y = it } ) }
( I409e8 , b/152050010 , b/146362815 , b/146342522 , b/143413369 , b/135715219 , b/143263925 , b/139653744 )
Changes the code generation strategy of Compose's compiler. Prior to the change, the compose compiler would transform calls to composable functions. With this change, we now transform the body of a composable function and leave the callsite unaltered (mostly).
This means that most of the logic communicating with the compose runtime happens at the start of the function body, instead of at the callsite.
This should be a source-compatible change for all usage of compose. Most users of compose should not have to update any code as a result of this change.
In order to support this work, the JVM signature of all composable functions has changed. A Composable function accepting a single parameter is transformed into a function accepting 3 parameters, the additional parameters are the Composer, a 'key' integer. a bitmask integer used to propagate metadata through calls.
Compose now also transforms default arguments to a composable function. It does this without introducing an additional synthetic default overload of the function itself, so this change will result in fewer functions being defined.
Known intentional behavioral changes resulting from this:
- Some calls will skip where they wouldn't have previously
- Composable expressions in default argument expressions are now correctly subscribed to and handled
This work included some optimizations: 1. The result of comparisons of parameters are propagated through the call graph to other composable functions. This will result in fewer comparisons at runtime, reduces the slot table size, as well as more skipping of composable functions that were previously not skipped 2. Paremeters which are determined to be “static” at compile time are no longer compared or stored in the runtime. This reduces the number of comparisons and reduces slot table size. 3. Control flow structure of the body of functions is used to minimize the number of groups that are generated. This reduces slot table size and results in less work for the runtime 4. Unused dispatch and receiver parameters to functions are not included in determining skippability of the function if they are not used inside of the body of the function.
Most breaking changes were for APIs that the compiler targets directly, and typical use of compose will not be affected: 1. Composer::startExpr was removed 2. Composer::endExpr was removed 3. Composer::call was deprecated 4. The non-varargs overloads of
key
have been removed. Use thevararg
version going forward. 5. The Pivotal annotation was deprecated. Usekey
as a replacement. 6. ScopeUpdateScope::updateScope was changed to expect a Function3 instead of Function1 7. restartableFunction and restartableFunctionN were updated to include additional compile time parameters ( I60756 , b/143464846 )Added sortWith and removeRange to MutableVector ( Icccf7 )
Added default method implementations for CompositionLifecycleObserver ( I24289 )
Applier now requires a clear() method for disposing compositions ( Ibe697 )
Added asMutableList() to MutableVector to allow it to be passed to public API without having to copy the entire list. ( I298df )
Added rememberCoroutineScope() to obtain a managed CoroutineScope in composition for launching jobs in response to events. ( I0e264 )
MutableVector is a new collection that does not implement any of the standard Collection interface. This collection offers speed above other requirements and is intended to only be used in internal implementations. ( I8ebd6 )
Temporarily removed
StableMutableList
andStableMutableMap
to avoid an issue in the version of Kotlin compose requires. These interfaces will be reintroduced once compose is updated to a version of Kotlin that doesn't have the issue.SnapshotStateList
andSnapshotStateMap
are now public but they will be deprecated onceStableMutableList
andStableMutableMap
are restored. ( Ia7769 )add top-level withFrameNanos function for animation timing ( Ie34c5 )
@Untracked annotation has been deprecated. Replace with @ComposableContract(tracked=false) ( Id211e )
RestartableFunction and associated APIs have been renamed to ComposableLambda, etc. These APIs were targeted only by the compiler so this should not affect source level compatibility normally. The rename was done primarily to communicate what this class is better when it shows up in stack traces ( I7eb25 )
@Composable annotation is no longer valid on classes ( Ia5f02 )
Ambient<T>
is now @Stable instead of @Immutable ( I0b4bb )Prior to this change, the compose compiler plugin would non-trivially intercept calls to constructors inside of a @Composable function if there was an ( I5205a , b/158123804 )
The Recompose composable is no longer a useful abstraction. Most recomposition should happen as a result of MutableState assignments. For anything beyond that, it is recommended that you use the
invalidate
function to trigger a recomposition of the current scope. ( Ifc992 )Observe is no longer a useful abstraction. If you need to replicate it, its implementation can be replicated by just creating a composable function which executes a composable lambda parameter. For example,
@Composable fun Observe(body: @Composable () -> Unit) = body()
( I40d37 )@Direct was deprecated in favor of @ComposableContract(restartable=false) ( If4708 )
Added an adapter for the recently introduced StateFlow which allows as to pre-populate the initial value so the returned State is non-nullable ( I61dd8 , b/156233789 )
Added an adapter for Flow. Example of the usage: val value by flow.collectAsState() ( If2198 , b/153375923 )
[Mutable]State property delegate operators moved to extensions to support Kotlin 1.4 property delegate optimizations. Callers must add imports to continue using
by state { ... }
orby mutableStateOf(...)
. ( I5312c )androidx.compose.ViewComposer has been moved to androidx.ui.node.UiComposer androidx.compose.Emittable has been removed. It was redundant with ComponentNode. androidx.compose.ViewAdapters has been removed. They are no longer a supported use case. Compose.composeInto has been deprecated. Use
setContent
orsetViewContent
instead. Compose.disposeComposition has been deprecated. Use thedispose
method on theComposition
returned bysetContent
instead. androidx.compose.Compose.subcomposeInto has moved to androidx.ui.core.subcomposeInto ComponentNode#emitInsertAt has been renamed to ComponentNode#insertAt ComponentNode#emitRemoveAt has been renamed to ComponentNode#removeAt ComponentNode#emitMode has been renamed to ComponentNode#move ( Idef00 )Updated the
ComposeFlags.COMPOSER_PARAM
flag to betrue
, which will change the code generation strategy for the compose plugin. At a high level, this causes @Composable functions to be generated with an additional synthetic parameter, which is passed through to subsequent @Composable calls in order for the runtime to properly manage execution. This is a significant binary breaking change, however, should preserve source-level compatibility in all sanctioned usage of compose. ( I7971c )Breaking changes to the ambients API. See log and
Ambient<T>
documentation for details ( I4c7ee , b/143769776 )Added ui-livedata - new artifact with an adapter for LiveData. Example of the usage: val value by liveData.observeAsState() ( Ie9e8c , b/150465596 )
Rx adapters without explicit initial value are deprecated. Using null is not always the best default, for example when you have a List it is better to start with emptyList() or any other reasonable default ( I00025 , b/161348384 )
Added ui-rxjava2 - new artifact with adapters for RxJava2. Example of the usage: val value by observable.subscribeAsState() ( Ifab4b , b/153369097 )
savedInstanceState()
can now be used with nullable types ( I6847f , b/153532190 )New listSaver() and mapSaver() to make it easier to write custom Saver objects ( I8cf68 , b/152331508 )
New functions: savedInstanceState() and rememberSavedInstanceState(). They are similar to state() and remember() but have a saved instance state support build in ( If1987 , b/152025209 )
Исправления ошибок
-
runOnIdleCompose
renamed torunOnIdle
( I83607 ) - Made LayoutNode experimental API ( I4f2e9 )
- androidx.ui.foundation.TextFieldValue and androidx.ui.input.EditorValue is deprecated. TextField, FilledTextField and CoreTextField composables that uses that type is also deprecated. Please use androidx.ui.input.TextFieldValue instead ( I4066d , b/155211005 )
- Removed deprecated DrawBackground API in favor of drawBackground extension APIs on Modifier. Refactored color, brush and paint drawBackground implementations to reduce code paths as well as remove requirement for Modifier to be created as part of composition. ( I0343a )
- Updated higher level compose APIs that expose a Canvas to expose CanvasScope instead. This removes the need for consumers to maintain their own Paint objects. For consumers that still require access to a Canvas they can use the drawCanvas extension method which provides a callback to issue drawing commands with the underlying Canvas. ( I80afd )
- WithConstraints trailing lambda API has been changed. Now instead of two params it has a receiver scope which in addition to constraints and layoutDirection provides minWidth, maxWidth, minHeight and maxHeight properties in Dp ( I91b9a , b/149979702 )
- Added symmetric padding modifier. ( I39840 )
- Updated wrapContentWidth and wrapContentHeight to expect vertical or horizontal Alignment rather than any Alignment. The gravity modifier was updated to accept vertical or horizontal Alignment. Row, Column and Stack were updated to support custom continuous Alignments. ( Ib0728 )
- ui-text module is renamed as ui-text-core ( I57dec )
- Improve DrawModifier API:
- Made the receiver scope for draw() ContentDrawScope
- Removed all parameters on draw()
- DrawScope has same interface as former CanvasScope
- ContentDrawScope has drawContent() method ( Ibaced , b/152919067 )
- ColoredRect has been deprecated. Use
Box(Modifier.preferredSize(width, height).drawBackground(color))
instead. ( I499fa , b/152753731 ) - Replaced Modifier plus operator with factory extension functions ( I225e4 )
- RowScope and ColumnScope members are now accessible outside Row and Column. ( I3a641 )
- Renamed LayoutFlexible to LayoutWeight. Renamed tight parameter to fill. ( If4738 )
- WithConstraints got LayoutDirection parameter ( I6d6f7 )
- Renamed background to DrawBackground and make it to be memorized by default ( Ia0bd3 )
- Replaced ButtonStyle with distinct functions and removed text (string) overload. See updated samples for usage information. ( If63ab , b/146478620 , b/146482131 )
-
runOnIdleCompose
andrunOnUiThread
are now global functions instead of methods on ComposeTestRule. ( Icbe8f )
External Contribution
- Remove unneeded API such as Looper and Handler from Compose Runtime porting layer ( I6847d )
- Deprecate
Flow<T>.collectAsState()
with no initial value. UseStateFlow<T>
or pass an explicit initial value instead. ( I63f98 , b/157674865 )