Status Update
Comments
al...@google.com <al...@google.com>
al...@google.com <al...@google.com>
al...@google.com <al...@google.com> #2
Never got around to posting the stacktraces + repro, sorry!
Simple repro:
@Composable
fun NoAssociatedStateIssueRepro() {
val state = rememberModalBottomSheetState(ModalBottomSheetValue.HalfExpanded)
ModalBottomSheetLayout(
sheetState = state,
sheetContent = { Box(Modifier.height(56.dp) }
) {
}
}
The same crash can be provoked by having an empty sheet content:
@Composable
fun EmptySheetContentIssueRepro() {
val state = rememberModalBottomSheetState(ModalBottomSheetValue.HalfExpanded)
ModalBottomSheetLayout(
sheetState = state,
sheetContent = { }
) {
}
}
This will crash with
java.lang.IllegalArgumentException: The initial value must have an associated anchor.
at androidx.compose.material.SwipeableState.ensureInit$material_debug(Swipeable.kt:139)
at androidx.compose.material.SwipeableKt$swipeable$3.invoke(Swipeable.kt:579)
at androidx.compose.material.SwipeableKt$swipeable$3.invoke(Swipeable.kt:571)
at androidx.compose.ui.ComposedModifierKt$materialize$result$1.invoke(ComposedModifier.kt:75)
at androidx.compose.ui.ComposedModifierKt$materialize$result$1.invoke(ComposedModifier.kt:70)
at androidx.compose.ui.Modifier$Element$DefaultImpls.foldIn(Modifier.kt:107)
at androidx.compose.ui.ComposedModifier.foldIn(ComposedModifier.kt:47)
at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:149)
at androidx.compose.ui.ComposedModifierKt.materialize(ComposedModifier.kt:70)
at androidx.compose.ui.layout.LayoutKt$materializerOf$1.invoke-Deg8D_g(Layout.kt:174)
at androidx.compose.ui.layout.LayoutKt$materializerOf$1.invoke(Layout.kt:173)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:130)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:46)
at androidx.compose.material.ModalBottomSheetKt$ModalBottomSheetLayout$2.invoke-jYbf7pk(ModalBottomSheet.kt:399)
at androidx.compose.material.ModalBottomSheetKt$ModalBottomSheetLayout$2.invoke(ModalBottomSheet.kt:269)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:149)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:46)
at androidx.compose.material.ModalBottomSheetKt$BottomSheetStack$1$1$placeable$1.invoke(ModalBottomSheet.kt:344)
at androidx.compose.material.ModalBottomSheetKt$BottomSheetStack$1$1$placeable$1.invoke(ModalBottomSheet.kt:344)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:46)
at androidx.compose.ui.layout.SubcomposeLayoutState$subcompose$2$1.invoke(SubcomposeLayout.kt:167)
at androidx.compose.ui.layout.SubcomposeLayoutState$subcompose$2$1.invoke(SubcomposeLayout.kt:167)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:46)
at androidx.compose.runtime.ComposerKt.invokeComposable(Composer.kt:3422)
at androidx.compose.runtime.ComposerImpl.composeContent$runtime_debug(Composer.kt:2604)
at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:348)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_debug(Recomposer.kt:697)
at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_debug(Composer.kt:3028)
at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_debug(Composer.kt:3028)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:304)
at androidx.compose.ui.layout.SubcomposeLayoutState.subcomposeInto(SubcomposeLayout.kt:184)
at androidx.compose.ui.layout.SubcomposeLayoutState.access$subcomposeInto(SubcomposeLayout.kt:100)
at androidx.compose.ui.layout.SubcomposeLayoutState$subcompose$2.invoke(SubcomposeLayout.kt:160)
at androidx.compose.ui.layout.SubcomposeLayoutState$subcompose$2.invoke(SubcomposeLayout.kt:158)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.withNoObservations(SnapshotStateObserver.kt:137)
at androidx.compose.ui.node.OwnerSnapshotObserver.withNoSnapshotReadObservation$ui_debug(OwnerSnapshotObserver.kt:49)
at androidx.compose.ui.node.LayoutNode.withNoSnapshotReadObservation$ui_debug(LayoutNode.kt:1086)
at androidx.compose.ui.layout.SubcomposeLayoutState.subcompose(SubcomposeLayout.kt:158)
at androidx.compose.ui.layout.SubcomposeLayoutState.subcompose(SubcomposeLayout.kt:152)
al...@google.com <al...@google.com>
ap...@google.com <ap...@google.com> #3
Thanks Jossi, we'll take a look into it :)
al...@google.com <al...@google.com> #4
al...@google.com <al...@google.com> #5
Any updates on this? It still crashes in 1.2.0-beta02
as...@google.com <as...@google.com> #7
It's still a problem in 1.2.1...
al...@google.com <al...@google.com>
bu...@google.com <bu...@google.com> #8
There are no updates to share on this yet. We'll update when we have news :)
bu...@google.com <bu...@google.com>
al...@google.com <al...@google.com> #9
Any update on this issue
Fatal Exception: java.lang.IllegalArgumentException: The initial value must have an associated anchor. at androidx.compose.material.SwipeableState.ensureInit$material_release(Swipeable.kt:138) at androidx.compose.material.SwipeableKt$swipeable$3.invoke(Swipeable.kt:594) at androidx.compose.material.SwipeableKt$swipeable$3.invoke(Swipeable.kt:573) at androidx.compose.ui.ComposedModifierKt$materialize$result$1.invoke(ComposedModifier.kt:278) at androidx.compose.ui.ComposedModifierKt$materialize$result$1.invoke(ComposedModifier.kt:273) at androidx.compose.ui.Modifier$Element.foldIn(Modifier.java:110) at androidx.compose.ui.ComposedModifier.foldIn(ComposedModifier.kt) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.ComposedModifierKt.materialize(ComposedModifier.kt:273) at androidx.compose.ui.layout.LayoutKt$materializerOf$1.invoke-Deg8D_g(Layout.kt:226) at androidx.compose.ui.layout.LayoutKt$materializerOf$1.invoke(Layout.kt:225) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.animation.AnimatedContentKt$$InternalSyntheticOutline$53$ecb30c9002b8026b405a53f2ba709cfaa8a2c7e1404b01422d70647ebaa2f34c$1.m(AnimatedContentKt.java:2) at androidx.compose.material.SurfaceKt$Surface$1.invoke(Surface.kt:38) at androidx.compose.material.SurfaceKt$Surface$1.invoke(Surface.kt:117) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228) at androidx.compose.material.SurfaceKt.Surface-F-jzlyU(Surface.kt:114) at androidx.compose.material.ModalBottomSheetKt$ModalBottomSheetLayout$1.invoke(ModalBottomSheet.kt:341) at androidx.compose.material.ModalBottomSheetKt$ModalBottomSheetLayout$1.invoke(ModalBottomSheet.kt:326) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116) at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$1.invoke(ComposableLambda.jvm.kt:127) at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$1.invoke(ComposableLambda.jvm.kt:127) at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:145) at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2351) at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2618) at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3205) at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3183) at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:252) at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(SnapshotStateKt.java:1) at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3183) at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3148) at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:746) at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:876) at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:107) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:485) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:454) at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34) at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109) at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41) at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1106) at android.view.Choreographer.doCallbacks(Choreographer.java:866) at android.view.Choreographer.doFrame(Choreographer.java:792) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8669) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
bu...@google.com <bu...@google.com> #10
bu...@google.com <bu...@google.com>
al...@google.com <al...@google.com> #11
No updates to share yet. We're working on the underlying APIs at the moment to address this properly.
bu...@google.com <bu...@google.com> #12
Branch: androidx-main
commit 3f94eba802caebc95f8f9055ffb572f6ee72ca2e
Author: Levi Albuquerque <levima@google.com>
Date: Thu Mar 16 15:15:20 2023
Migrating BottomDrawer to use SwipeableV2
Move BottomDrawer to use the new SwipeableV2 APIS.
Relnote: Update BottomDrawer internals to use the new SwipeableV2 APIs. Because of this BottomDrawerState will now only have APIS defined at the class level, it won't inherit methods/properties from SwipeableState. We're using composition with an internal SwipeableV2State. Offset is now a nullable floating point property, the current value and a swipe target value can still be accessed through currentValue and targetValue properties. The previous class level methods such as open/expand/close and properties such as isOpen/isClosed continue to be supported.
Test: Updated tests and added new ones.
Fixes: 178529942
Fixes: 220676296
Change-Id: Iad40c08ca8f48afbc451191c788e80584e874b98
M compose/material/material/api/public_plus_experimental_current.txt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
bu...@google.com <bu...@google.com>
al...@google.com <al...@google.com>
ap...@google.com <ap...@google.com> #13
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material:material:1.5.0-alpha03
al...@google.com <al...@google.com> #14
ap...@google.com <ap...@google.com> #15
Branch: androidx-main
commit 6604eaf83fbfe432168c242c69fb4d709c8a1283
Author: Alan Viverette <alanv@google.com>
Date: Tue Mar 26 16:11:11 2024
Apply auto-fixes from ObsoleteCompatMethod in androidx.core:core
Bumps annotation dependency to latest for @ReplaceWith.
Relnote: Deprecated obsolete compat methods
Bug: 313834577
Test: ./gradlew :core:core:checkApi
Change-Id: I01d9076d4ef7b12614b233f8b0b3e147e97b8221
M activity/integration-tests/testapp/build.gradle
M appcompat/integration-tests/receive-content-testapp/build.gradle
M core/core/api/current.txt
M core/core/api/restricted_current.txt
M core/core/build.gradle
M core/core/src/main/java/androidx/core/accessibilityservice/AccessibilityServiceInfoCompat.java
M core/core/src/main/java/androidx/core/app/ActivityManagerCompat.java
M core/core/src/main/java/androidx/core/app/AlarmManagerCompat.java
M core/core/src/main/java/androidx/core/app/BundleCompat.java
M core/core/src/main/java/androidx/core/app/NavUtils.java
M core/core/src/main/java/androidx/core/app/NotificationCompat.java
M core/core/src/main/java/androidx/core/content/ContextCompat.java
M core/core/src/main/java/androidx/core/graphics/BitmapCompat.java
M core/core/src/main/java/androidx/core/graphics/drawable/DrawableCompat.java
M core/core/src/main/java/androidx/core/location/LocationCompat.java
M core/core/src/main/java/androidx/core/net/ConnectivityManagerCompat.java
M core/core/src/main/java/androidx/core/os/BundleCompat.java
M core/core/src/main/java/androidx/core/os/ParcelCompat.java
M core/core/src/main/java/androidx/core/view/MarginLayoutParamsCompat.java
M core/core/src/main/java/androidx/core/view/MenuCompat.java
M core/core/src/main/java/androidx/core/view/MotionEventCompat.java
M core/core/src/main/java/androidx/core/view/ScaleGestureDetectorCompat.java
M core/core/src/main/java/androidx/core/view/VelocityTrackerCompat.java
M core/core/src/main/java/androidx/core/view/ViewCompat.java
M core/core/src/main/java/androidx/core/view/ViewConfigurationCompat.java
M core/core/src/main/java/androidx/core/view/ViewGroupCompat.java
M core/core/src/main/java/androidx/core/view/ViewParentCompat.java
M core/core/src/main/java/androidx/core/view/accessibility/AccessibilityEventCompat.java
M core/core/src/main/java/androidx/core/view/accessibility/AccessibilityRecordCompat.java
M core/core/src/main/java/androidx/core/widget/CheckedTextViewCompat.java
M core/core/src/main/java/androidx/core/widget/ListPopupWindowCompat.java
M core/core/src/main/java/androidx/core/widget/ListViewCompat.java
M core/core/src/main/java/androidx/core/widget/PopupWindowCompat.java
ap...@google.com <ap...@google.com> #16
Branch: androidx-main
commit ee226e3f129903a29954c39dd49e49ae1f42e320
Author: Alan Viverette <alanv@google.com>
Date: Tue Mar 26 16:30:49 2024
Apply auto-fix for problematic instances of ObsoleteCompatMethod
These didn't apply cleanly and needed some manual work.
Relnote: Deprecate additional obsolete compat methods
Bug: 313834577
Test: ./gradlew :core:core:checkApi :media:media:checkApi
Change-Id: Ie44708f1423037d74b64aadb7418182a6a1dc089
M core/core/api/current.txt
M core/core/api/restricted_current.txt
M core/core/src/main/java/androidx/core/view/MenuItemCompat.java
M core/core/src/main/java/androidx/core/view/accessibility/AccessibilityManagerCompat.java
M core/core/src/main/java/androidx/core/widget/TextViewCompat.java
ap...@google.com <ap...@google.com> #17
Branch: androidx-main
commit 90f97d778b1f3f5e3b0664e0e5df1786f0373c3c
Author: Alan Viverette <alanv@google.com>
Date: Tue Mar 26 16:23:11 2024
Fix ObsoleteCompatDetector auto-fix to remove line breaks
Bug: 313834577
Test: ObsoleteCompatDetectorTest
Change-Id: I1530004a57c019682da7a38a54cadb225753c5fb
A lint-checks/integration-tests/src/main/java/androidx/ObsoleteCompatMethodMissingMultiLineReplaceWith.java
M lint-checks/src/main/java/androidx/build/lint/ObsoleteCompatDetector.kt
M lint-checks/src/test/java/androidx/build/lint/ObsoleteCompatDetectorTest.kt
al...@google.com <al...@google.com> #18
We still have some constants that warrant deprecation and a handful of methods outside of core
, but I think this is sufficient for now.
ub...@gmail.com <ub...@gmail.com> #19
I see that LocationCompat.isMock
was deprecated as part of this effort. This looks like a mistake: Location.isMockProvider
was added in API 18, but deprecated in API 31, at which point Location.isMock
was added. So there remains a need for this compatibility method.
I hope you can revert this one as part of this issue without requiring a separate issue for every single thing that may have gone wrong.
au...@google.com <au...@google.com>
al...@google.com <al...@google.com> #20
LocationCompat.isMock()
calls directly through to the deprecated Location.isFromMockProvider()
regardless of SDK level, which was a bad implementation to begin with.
al...@google.com <al...@google.com>
ap...@google.com <ap...@google.com> #21
Branch: androidx-main
commit 3b9df12d74b961741050fe589aae8003532ec248
Author: Alan Viverette <alanv@google.com>
Date: Wed Jun 12 17:01:10 2024
Undeprecate LocationCompat.isMock, fix delegation on API 31+
Relnote: """Reverts deprecation of LocationCompat.isMock and delegates
to the platform API on API level 31 and above."""
Fixes: 313834577
Test: LocationCompatTest
Change-Id: I559407ae8f2cce149cd2802322485f1b80cb85c9
M core/core/api/current.txt
M core/core/api/restricted_current.txt
M core/core/src/main/java/androidx/core/location/LocationCompat.java
ub...@gmail.com <ub...@gmail.com> #22
Thanks for the fix! I just noticed another one:
ParcelCompat.writeBoolean was deprecated with instructions to use Parcel.writeInt directly with a value of 0 or 1. This does not make sense. The point of ParcelCompat.writeBoolean was to complement Parcel.writeBoolean, which was introduced in API 29. Doesn't make sense to take it away now.
al...@google.com <al...@google.com>
ub...@gmail.com <ub...@gmail.com> #23
Just a general thought: it might make sense to review these deprecations systematically. I'm guessing there are quite a few more problems lurking, as I only use a small slice of the affected APIs.
al...@google.com <al...@google.com> #24
Likely, but I don't think we would have caught either of these during manual review. They were technically correct since the implementations were single-line and inlineable, so applying the replacement would still have the same runtime behavior (and bytecode if running an optimizer).
We'd need to go back through and audit methods that were originally written without a proper SDK_INT
check.
ap...@google.com <ap...@google.com> #25
Branch: androidx-main
commit 2d316160b6048996e91929c28ec33d91603900bb
Author: Alan Viverette <alanv@google.com>
Date: Thu Jun 13 14:10:24 2024
Undeprecate ParcelCompat.writeBoolean, fix delegation on API 29+
Relnote: """Reverts deprecation of ParcelCompat.writeBoolean and delegates
to the platform API on API level 29 and above."""
Bug: 313834577
Test: ParcelCompatTest
Change-Id: I9d2436d90f3cbe3bf22e2a3c97171f39b53cf040
M core/core/api/current.txt
M core/core/api/restricted_current.txt
M core/core/src/main/java/androidx/core/os/ParcelCompat.java
al...@google.com <al...@google.com> #26
Closing this out. There may still be one-offs, but let's use new bug reports for those.
Description
```
public static int getWindowSystemUiVisibility(@NonNull View view) {
return view.getWindowSystemUiVisibility();
}
```
These methods should be deprecated.