Bug Fixes
OnBackPressedDispatcherandNavigationEventDispatcherare now both initialized lazily inComponentActivity. I710e6Fixed issues with
OnBackPressedDistpatcherthat caused the following:- Only the latest dispatcher an
OnBackPressedCallbackwas added to being notified of its enabled state b/418715930 OnBackPressedDispatcherremoves the wrong callback when using theaddCallbackfunction that takes a lifecycle. b/422714753OnBackPressedDispatcher.remove()does not remove all instances of a registeredOnBackPressedCallback. b/423024414
- Only the latest dispatcher an
Bug Fixes
- Added workaround for runtime images causing
CompilationMode.None()to not measure worst case performance after first iteration. Unfortunately this workaround requires a delay of 5 seconds to intentionally corrupt the runtime image at the beginning of each macrobenchmark suite I4a4f1.
API Changes
- Remove experimental annotation from ephemeral browsing API If8b1b
New Features
- Added support for
Action.MEDIA_PLAYBACKwhich displays an indicator based on media playback state. - Added support for controlling a user’s scroll position upon refresh of the
SectionedItemTemplate.
API Changes
- Add support for saving a user's scroll position within the
SectionedItemTemplatebetween refreshes. Ia4c51 - Updated
MEDIA_PLAYBACKaction to enable it for row end action I05cc4 - Add a new action type I6cc5a
- Add
CarAppExtender#addAction(Action)so that any type of action can be added to theCarAppExtender. Idc4d7 - Made
SectionedItemTemplateaccessible for API 8 and above. I9a079
Breaking Changes
- The
backgroundandbordermodifier nodes now implementSemanticsModifierNode. This can result in newSemanticsNodesadded to the semantics tree and, therefore, lead to test failures in tests that make assumptions about the semantics tree structure. For example, tests that useonChild,onParent,onSibling, and other similar methods to make assertions can fail if a new node is added between the current and target nodes. The preferred way to fix these failures is to add atestTagto the target node directly. Another approach is to use a looser matcher, such asonNode(hasAnyAncestor(hasText("ancestor")) and hasText("target")). I638b5
API Changes
- Rename
Modifier.addTextContextMenuComponentstoappendTextContextMenuComponents. I4c43f - Removed
AnnotatedOutputTransformationand carriedaddStylefunctions toTextFieldBuffer.addStylecan still only be called fromOutputTransformation. I9930a b/417991824 - Clickable is rewritten to not use suspend pointer input as an optimization. This feature is enabled by a flag - you can disable if you encounter a bug in the new implementation -
ComposeFoundationFlags.isNonSuspendingPointerInputInClickableEnabled. I85b65 - Introduced
isFlingCancellationWithNestedScrollFixEnabledto fix an issue with fling propagation in nested scrolling. In this CL we are restoring the fling continuation behavior removed in aosp/3260391. We will still cancel the fling animation in case the child is removed from composition. I467f4 b/405910180 b/419049142 b/416784125 WindowInsetsRulers: changedrulersIgnoringVisibilityto maximum. ChangedgetDisplayCutoutBounds()to be an extension function ofPlacementScope.WindowInsetsAnimationPropertieshas been changed toWindowInsetsAnimationand thegetAnimationProperties()has been changed togetAnimation(). I3816f- Changed
InsetsRulersto be in common code with the nameWindowInsetsRulers. Simplified the API so all insets areWindowInsetsRulers. Extracted non-rulers animation properties to anAnimationPropertiesclass.WindowInsetsRulers.innermostOf()can be used to merge multipleWindowInsetsRulers. I2f0c6 b/415012444
Bug Fixes
- Re-add usage of
scrollAnimationSpecinContentInViewNode. The behavior was removed during thescrollAnimationSpecdeprecation which caused use cases to be broken. I1436a b/403301605
Bug Fixes
- Hyperlinks in
Text(AnnotatedString)now have Material styling by default. I0e8ed b/339843816
New Features
- Added a center aligned hero carousel component I6f6d3
API Changes
- Implement XR overrides vertical toolbar Ia1604
- Added programmatic scroll functions to
CarouselStateI12f8e - Add
ComponentOverrideforModalWideNavigationRailI4f440 - Add
ComponentOverrideforWideNavigationRailI6354f - Create
ComponentOverrideforHorizontalFloatingToolbarI51116 - Create
ComponentOverrideforShortNavigationBarI30e24 SwipeToDismissBoxStatereferences toconfirmValueChangehave been marked deprecated. Users should instead leverageSwipeToDismissBoxAPIonDismissedcallback. Iee780- Added userScrollEnabled parameter to Carousel composables. I1d4d2
- Carousel's
currentItemcan now be observed fromCarouselState. Ie87e9
Bug Fixes
- Fix an issue where an arbitrary shape on a FAB that is passed to a
FloatingToolbarthat was not applying its shadow correctly. Icdcc9 b/423336922 - All Carousels now use the Carousel semantic role by default. I7af12
- Fixed incorrect thumb movement when the slider state was updated via
LaunchedEffectId9f31 b/302774166
API Changes
- Make
currentWindowAdaptiveInfo()function support large and extra-large window width size classes and promotecalculatePosture()andcurrentWindowDpSize()functions to stable. I92e97
API Changes
- Added a tooling API for parsing source information added by Compose compiler. Iceaf9 b/408492167
SnapshotStateSetnow implementsParcelableon Android, it is now supported to be used as partrememberSaveable { ... }. I755dd b/378623803SnapshotStateListnow implementsParcelableon Android, it is now supported to be used as partrememberSaveable { ... }. Id18be b/378623803movableContentOf()is now marked with@RememberInCompositionannotation, which allows lint to catch incorrect usages I2738d- Updated experimental composition observers API to allow for more comprehensive observation of recomposition causes I32b6a
- Change
setDiagnosticStackTraceEnabledto experimental to account for future development of this feature. I11db3 currentCompositeKeyHashis now deprecated. UsecurrentCompositeKeyHashCodeinstead. 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@StableMarkerhave 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
rememberSaveableoverload that accepts aKSerializertorememberSerializable. This change clarifies its intended use withkotlinx.serialization. Supporting generalkotlinx.Serializableclasses directly inrememberSaveablewould require areifiedtype parameter, which would break source compatibility by requiring all call sites to provide reified type information at compile time. Idb875 I38627 b/376028110
Bug Fixes
- 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
onForgottento remember observers when the pausable composition is disposed of.RememberObserversin 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 bySnapshotStateListafter callingprevious()could removed the wrong element from the list and didn't match what theArrayListdoes for the same sequence of calls. I05ab7 b/417493222 - Fixed an ordering issue with the dispatching of
onForgottonthat could, for example, cause theonDisposeof 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
OffsetAppliernow 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.withFrameNanosis 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
onReuseandonDeactivatecould 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
LifecycleRegistryto unsafe mode in Compose Multiplatform to disableMainThreadchecks and fix threading issues. See CMP-8227 for details. Icee87
External Contribution
- Fixed a bug affecting Molecule users where using
RecompositionMode.Immediatecould cause missed recompositions. I9f3a9 b/419527812 - Exposed
PausableCompositionisAppliedandisCancelledgetters which allow for checking the state of thePausableComposition. I994aa - Added
AnnotationTarget.FUNCTIONto theFunctionKeyMetaannotation. I08021
Bug Fixes
- Flag for
isGetFocusedRectReturnEmptyEnabledhas been removed now that the feature has been fully verified. Ife722 - Flag
ComposeUiFlags.isGetFocusedRectReturnEmptyEnabledmakes it so that when nothing is focusable in aComposeView, it sets the rect to an Empty value. This prevents a focus search from choosing the View to focus on. This is especially important for when an IME has a NEXT option where it might try to focus on theComposeViewandrequestFocus()fails. Ibd0e2 b/369256395
Breaking Changes
- The
graphicsLayermodifier nodes now implementsSemanticsModifierNode. This can result in newSemanticsNodesadded to the semantics tree and, therefore, lead to test failures in tests that make assumptions about the semantics tree structure. For example, tests that useonChild,onParent,onSibling, and other similar methods to make assertions can fail if a new node is added between the current and target nodes. The preferred way to fix these failures is to add atestTagto the target node directly. Another approach is to use a looser matcher, such asonNode(hasAnyAncestor(hasText("ancestor")) and hasText("target")). I638b5
API Changes
- Changed
ShadowContextto be a sealed interface I3ce40 - Adds a cross module way to create an Indirect Touch Event (for testing) I22e4c
- Makes
IndirectTouchEvent.nativeEventexperimental. I6fda5 - Revises API surface based on API council feedback. Ibf378
- Remove
FrameRateCategory.NoPreferenceconstant. RenameModifier.requestedFrameRatetoModifier.preferredFrameRate. I2f976 WindowInsetsRulers: changedrulersIgnoringVisibilityto maximum. ChangedgetDisplayCutoutBounds()to be an extension function ofPlacementScope.WindowInsetsAnimationPropertieshas been changed toWindowInsetsAnimationand thegetAnimationProperties()has been changed togetAnimation(). I3816f- Changed class
ShadowParamstoShadowI11cca - Change the package for frame rate API from
androidx.compose.ui.uitoandroidx.compose.uiI8994e - Changed
InsetsRulersto be in common code with the nameWindowInsetsRulers. Simplified the API so all insets areWindowInsetsRulers. Extracted non-rulers animation properties to anAnimationPropertiesclass.WindowInsetsRulers.innermostOf()can be used to merge multipleWindowInsetsRulers. I2f0c6 b/415012444 - Added a tooling API for parsing source information added by Compose compiler. Iceaf9 b/408492167
Bug Fixes
- Flag for
isGetFocusedRectReturnEmptyEnabledhas been removed now that the feature has been fully verified. Ife722 - Fixes a bug in
performScrollToNode, which in some cases was not reaching the target node. With this fix, it should always reach the target node in those cases. A side effect of this change is that the exact scroll position at the end of the action may now be different, which affects screenshot tests and tests that make assumptions about the exact scroll position. I2c8a1
New Features
- Core library has been updated to target Kotlin 2.0 language level and requires use of Kotlin Gradle Plugin 2.0.0 or newer. Idb6b5
API Changes
Added
NotificationCompat.ProgressStyleandNotificationCompat.Builder.setRequestPromotedOngoing(). See Progress centric notifications and Live Updates for details.Added
Parcel.useextension function for safe handling ofParcelresources. I436da
New Features
- Pre Android 14, update the Credential Manager dialogs to be more consistent with Android 14+.
API Changes
- Update
CreateDigitalCredentialRequestconstructor API I6f6da
New Features
- Compose interoperability modules for authoring, brush, and geometry modules
API Changes
- New Compose interoperability modules and APIs, API cleanup I0e464
InProgressStroke.enqueueInputs/updateShapemethods which returnedkotlin.Resultare removed, clients should use e.g.enqueueInputsOrThroworenqueueInputsOrIgnoreinstead.InProgressStroke.getNeedsUpdateis renamed toisUpdateNeeded.InProgressStroke.populateOutlinePositionnow returns its output parameter to allow call chaining, consistent with other methods in Ink. TheTextureBitmapStoreinterface is moved from the rendering module to the brush module.BoxAccumulator.populateFromis made to take a nullable immutable Box instead of a mutableBoxAccumulator, to make it clearer what is mutated, callers should changeboxAccumulator.add(other)toboxAccumulator.add(other.box).BrushUtil.toBuilderWithAndroidColor/createBuilderWithAndroidColorare removed, use thesetAndroidColorofBrush.Builderafter constructing instead. Ia7155- Previously experimental property
InProgressStrokesView.textureBitmapStoreis now private. There are still public accessors for this property. I1d706
Bug Fixes
- Improved performance for custom brushes containing many particles.
API Changes
NavEntry.contentis now private. To invokeNavEntrycontent, call the newNavEntry.Content()api which no longer requires akeyparameter to invoke. Icd0fd b/420991203NavEntry.keyis now a private field. TheNavEntryand its relevant states should be identified by the newcontentKeyfield which is generated from the newcontentKeyFactorylambda and defaults to a saveable hash generated fromNavEntry.key(I81a6c, b/422001357, b/420991203 I2d7d4, b/420991203, b/422841812)
Dependency Changes
- Navigation3 now depends on the new
androidx.navigationevent.composeartifact.
New Features
- Introduced a new
navigationevent-composemodule to support Jetpack Compose features in thenavigationeventlibrary. 980d78 NavigationEventCompose has added a newLocalNavigationEventDispatcherOwnerlocal composition. It returns a nullable value to better determine whether it is available in the current composition.NavigationEventHandlerwill now throw an error if the underlying owner is not found. 62ffdaNavigationEventCompose has added a newNavigationEventHandlerComposable to handle (predictive back gesture) events. It provides aFlowofNavigationEventobjects that must be collected in the suspending lambda you provide c42ba6 :
NavigationEventHandler { progress: Flow<NavigationEvent> ->
// This block is executed when the back gesture begins.
try {
progress.collect { backEvent ->
// Handle gesture progress updates here.
}
// This block is executed if the gesture completes successfully.
} catch (e: CancellationException) {
// This block is executed if the gesture is cancelled
throw e
} finally {
// This block is executed either the gesture is completed or cancelled
}
}
API Changes
- Each
NavigationEventCallbackcan now be registered with only oneNavigationEventDispatcherat a time; adding it to multiple dispatchers throws anIllegalStateException. Note that this behavior differs fromOnBackPressedDispatcher, which allows multiple dispatchers. e82c19 - Made
isPassThroughavalto prevent mutation during navigation, which could breakNavigationEvent's dispatching. I0b287
Bug Fixes
- Fix an issue where annotation values would be incorrectly read when processing native sources with KSP, sometimes missing schema exports. b/416549580
- Fix a bug where leading comments in a SQL would cause statements to be executed as if they were non-read queries. b/413061402
- Fix an issue with Room’s Gradle Plugin failing to configure due to the schema directory being empty. b/417823384
- No longer throw a
SQLiteExceptionwhen obtaining a connection takes too long, instead a log message will be sent by the library. Logging instead of throwing works around iOS suspending loopers causing Room to misinterpret the timeout that occurs in the Kotlin Coroutine acquiring the connection and thus preventing the exception from being thrown when an iOS app is backgrounded and later resumed in the middle of a database operation. b/422448815
Bug Fixes
- Add missing R8 / Proguard rules to keep JNI / external functions from being obfuscated. b/421626199
- Fix a bug where leading comments in a SQL would cause statements to be executed as if they were non-read queries. b/413061402
API Changes
- Added
UiObject2#waitForStableas a shortcut forUiObject2#accessibilityNodeInfo#waitForStable()
Bug Fixes
- Fix layout bug in
TransformingLazyColumn, where content that fits within the screen is now aligned correctly from the top of the screen I80115 - Fixed an issue with
TransformingLazyColumnwhere the bottom item was incorrectly scaled when scrolling to the very bottom of a list with anEdgeButton. The scroll progress now follows a gradient descent when restoring the layout. Iea375 TransformingLazyColumnnow reads the item height inside the background painter, which allows customTransformationSpecsto implement morphing. I022f0SwipeToRevealnow vertically centers the revealed actions correctly. I4419b- Fixed a bug in
SwipeToRevealthat prevented it working correctly with swipe-to-dismiss if both views and compose were in use on the screen. I5dc0e - Fixed a bug where
SwipeToRevealactions were drawn with a vertical offset when scrolling. I29444 AlertDialog,ConfirmationDialog,OpenOnPhoneDialogandSwipeToRevealnow round up paddings and sizes that are calculated as a percentage of the screen size. I76367ButtonDefaults.outlinedButtonBordernow updates following enabled/disabled state changes sizeIf2ddd- Fixed a bug in
EdgeButtonheight that occurred on complex screens with Pager andScreenScaffold. I946e3 - Fixed a race condition that could cause Placeholder animations to stop. I53530
- Improved
HorizontalPageIndicatorandVerticalPageIndicatorperformance by drawing to Canvas. Ifae1e - Refined the shape of EdgeButton to smooth the transitions between the ellipsis and circles that make up the outline. I7721e
- Fixed a bug in
LevelIndicatorthat caused animations to stop, due to unnecessary recompositions. I45d08
Bug Fixes
- Fix layout bug in
TransformingLazyColumn, where content that fits within the screen is now aligned correctly from the top of the screen I80115 - Fixed an issue with
TransformingLazyColumnwhere the bottom item was incorrectly scaled when scrolling to the very bottom of a list with anEdgeButton. The scroll progress now follows a gradient descent when restoring the layout. Iea375 TransformingLazyColumnnow reads the item height inside the background painter, which allows customTransformationSpecsto implement morphing. I022f0SwipeToRevealnow vertically centers the revealed actions correctly. I4419b- Fixed a bug in
SwipeToRevealthat prevented it working correctly with swipe-to-dismiss if both views and compose were in use on the screen. I5dc0e - Fixed a bug where
SwipeToRevealactions were drawn with a vertical offset when scrolling. I29444 AlertDialog,ConfirmationDialog,OpenOnPhoneDialogandSwipeToRevealnow round up paddings and sizes that are calculated as a percentage of the screen size. I76367ButtonDefaults.outlinedButtonBordernow updates following enabled/disabled state changes sizeIf2ddd- Fixed a bug in
EdgeButtonheight that occurred on complex screens with Pager andScreenScaffold. I946e3 - Fixed a race condition that could cause Placeholder animations to stop. I53530
- Improved
HorizontalPageIndicatorandVerticalPageIndicatorperformance by drawing to Canvas. Ifae1e - Refined the shape of EdgeButton to smooth the transitions between the ellipsis and circles that make up the outline. I7721e
- Fixed a bug in
LevelIndicatorthat caused animations to stop, due to unnecessary recompositions. I45d08
API Changes
- Added the Watch Face Push API which allows a Wear OS app to install a watch face on a watch programmatically.
- The API was previously published as
:wear:watchface:watchface-push
Bug Fixes
- Fix an issue when persisting workers with network requests and default capabilities that would lead to removed capabilities being re-added causing workers with network constraints to misbehave. b/409716532
- Fix a bug that would cause workers with network constraints to not execute promptly due to constraints not met even though the network and capabilities were available. b/423403088