Status Update
Comments
ys...@google.com <ys...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
Author: Louis Pullen-Freilich <
Link:
Adds OverscrollEffect#withoutDrawing and OverscrollEffect#withoutEventHandling
Expand for full commit details
Adds OverscrollEffect#withoutDrawing and OverscrollEffect#withoutEventHandling
These APIs allow overscroll to have events dispatched to it by one component, and rendered in a separate component.
Fixes: b/266550551
Fixes: b/204650733
Fixes: b/255554340
Fixes: b/229537244
Test: OverscrollTest
Relnote: "Adds OverscrollEffect#withoutDrawing and OverscrollEffect#withoutEventHandling APIs - these APIs create a wrapped instance of the provided overscroll effect that doesn't draw / handle events respectively, which allows for rendering overscroll in a separate component from the component that is dispatching events. For example, disabling drawing the overscroll inside a lazy list, and then drawing the overscroll separately on top / elsewhere."
Change-Id: Idbb3d91546b49c1987a041f959bce4b2b09a9f61
Files:
- M
compose/foundation/foundation/api/current.txt
- M
compose/foundation/foundation/api/restricted_current.txt
- M
compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/OverscrollDemo.kt
- M
compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/OverscrollSample.kt
- M
compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/OverscrollTest.kt
- M
compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Overscroll.kt
Hash: f64e25b7a473c757d080521e7dd97b3f6670f60d
Date: Fri Nov 01 18:43:56 2024
ys...@google.com <ys...@google.com> #3
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.8.0-alpha06
androidx.compose.foundation:foundation-android:1.8.0-alpha06
androidx.compose.foundation:foundation-jvmstubs:1.8.0-alpha06
androidx.compose.foundation:foundation-linuxx64stubs:1.8.0-alpha06
ys...@google.com <ys...@google.com> #4
Also seems to only happen on deeplinks from complications, so maybe there is a race condition that doesn't happen for normal launches?
st...@google.com <st...@google.com> #5
Hardik - please take a look to see if you can reproduce this reliably.
ys...@google.com <ys...@google.com> #6
Possibly lower priority. I think I've fixed by avoiding navigating shortly after startup. Instead I found a way to use TaskStackBuilder instead of intent extras.
So I think this code inside my activity setContent
was triggering it.
LaunchedEffect(Unit) {
navigateFromTileLaunch()
}
calling this
fun navigateFromTileLaunch() {
val tileButton = intent.getAndRemoveKey("tile")
if (tileButton == "session") {
val conference = intent.getAndRemoveKey("conference")
val sessionId = intent.getAndRemoveKey("session")
if (conference != null && sessionId != null) {
navController.navigate(
SessionDetailsDestination.createNavigationRoute(
SessionDetailsKey(conference, sessionId)
)
)
}
} else if (tileButton == "login") {
navController.navigate(SignInDestination.route)
} else if (tileButton == "conferences") {
navController.navigate(ConferencesDestination.route)
}
}
ha...@google.com <ha...@google.com>
ys...@google.com <ys...@google.com> #7
I'm still getting this with deeplinks from Complications. appIntent works, but sessionIntent crashes about 50% of the time.
private fun sessionIntent(conference: String, sessionDetails: SessionDetails): PendingIntent? {
val sessionDetailIntent = Intent(
Intent.ACTION_VIEW,
"confetti://confetti/session/${conference}/${sessionDetails.id}".toUri()
)
return getActivity(
this,
0,
sessionDetailIntent,
FLAG_IMMUTABLE or FLAG_UPDATE_CURRENT
)
}
private fun appIntent(): PendingIntent? {
val appIntent = Intent(
this,
MainActivity::class.java
)
return getActivity(
this,
0,
appIntent,
FLAG_IMMUTABLE or FLAG_UPDATE_CURRENT
)
}
st...@google.com <st...@google.com> #8
See also
ys...@google.com <ys...@google.com> #9
The current code has that deeplink disabled because it crashes.
Effective repro steps
Full Steps:
- install app on Mobile, select a conference, bookmark some sessions
- Install app on Wear, login, confirm bookmarks are synced automatically.
- Add a complication (if you undo my edit) then it should show the session details in the complication.
Short Steps.
- Change the
https://github.com/joreilly/Confetti/blob/main/wearApp/src/main/java/dev/johnoreilly/confetti/wear/complication/NextSessionComplicationService.kt to use a deeplink for the result returned in all cases (remove the if conditions) - Add a complication
If you want I can make a test PR tomorrow
ha...@google.com <ha...@google.com> #11
Thanks Yuri, Able to reproduce the issue for this application. Looking into the root cause now.
ha...@google.com <ha...@google.com> #12
The issue seems to be occuring while using deep links for navigation. The navigation graph doesn't seem to be built completely hence throwing this issue.
Though the issue is not occuring 100% of the times, pasting easier steps to reproduce this issue in androidx:
Code:
@Composable
fun Demo()
{
val navController = rememberSwipeDismissableNavController()
SwipeDismissableNavHost(navController = navController, startDestination = "hello"){
composable(route = "hello"){
Test()
}
composable(route = "hello2", deepLinks = listOf(
navDeepLink {uriPattern = "hk1://hk1"}
)){
Test2()
}
}
}
@Composable
fun Test2(){
Column(modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally) {
Text("Hello Test 2")
}
}
@Composable
fun Test(){
Column(modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally) {
Text("Hello world")
}
}
Add the following intent filter to AndroidManifest:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="hk1"
android:scheme="hk1" />
</intent-filter>
Next steps:
- Investigate on initialization flow of navigation graph.
- Link Intent deep link handling with navigation flow.
ha...@google.com <ha...@google.com> #13
Created internal tracking bug:
ha...@google.com <ha...@google.com> #14
The root cause of this issue is inconsistent backstack state when handling the pending intent.
The activity was being called twice once with backstack size 0 and next time with the expected size.
We need to add the following flags FLAG_ACTIVITY_NEW_TASK, FLAG_ACTIVITY_CLEAR_TASK
to the session intent to ensure a consistent activity back stack.
See related bug:
@yschimke Can you please confirm if this works for you?
ys...@google.com <ys...@google.com> #15
So far, working perfectly.
ha...@google.com <ha...@google.com>
ys...@google.com <ys...@google.com> #16
I'd suggest fixing this anyway, does it fail like this on mobile? Or just silently ignore the empty stack?
The launch may not be getting the desired result, but it shouldn't cause the app to crash like this.
ys...@google.com <ys...@google.com> #18
Can we reopen then?
ha...@google.com <ha...@google.com>
st...@google.com <st...@google.com> #19
The reason for throwing the exception in the past was that the backstack could be empty due to using the wrong function to build the navigation graph - so there was a specific request to throw an error explaining why nothing was displayed on the screen.
This is something that the developer needs to address, so I think better to throw an error that describes the problem (the backstack is empty, which should not happen) and add more background in the comments as per
ys...@google.com <ys...@google.com> #20
It may not be optimal, but it's the default and not an error on mobile.
I don't think anything means this only applies to launching your own app, but I could be missing something. It seems like a DOS if I can launch an intent with deeplinks and nuke my competitors apps. To we have other examples of where you can cause crashes like this?
st...@google.com <st...@google.com> #21
Thanks for the extra insight Yuri - I agree that this can be seen as a vulnerability, so let's remove the exception and log a message instead, then continue (which will in some cases leave a blank screen, but the log message and extra comments in the source code should help developers in that case).
ha...@google.com <ha...@google.com>
ha...@google.com <ha...@google.com> #22
ap...@google.com <ap...@google.com> #23
Branch: androidx-main
commit 6d370cb96df84e695e3aa88db7cf4ad35a494bf4
Author: hardik <hardikkwl@google.com>
Date: Thu May 04 17:23:30 2023
Log warning inplace of throwing exception for empty backstack in SwipeDismissableNavHost
Relnote: SwipeDismissableNavHost now logs a warning with potential causes of empty backstack. This is done to prevent unexpected crashes caused because of IllegalArgumentException which was thrown when the backstack was empty.
Bug: 277700155
Test: Tested manually by triggering deep link intents
Change-Id: I04a812325b4a8b5d59d4ce1ba2f770ee75b0ba71
M wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHost.kt
ju...@google.com <ju...@google.com> #24
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.wear.compose:compose-navigation:1.2.0-beta01
Description
Version used: 1.2.0-alpha07
Devices/Android versions reproduced on: Pixel Watch
Not 100% reproducible, and I haven't nailed down exactly what is going on. Feel free to close, but raising here as we saw it once previously in compose-wear slack.
Happens with
```
Fatal Exception: java.lang.IllegalArgumentException: The WearNavigator backstack is empty, there is no navigation destination to display.
at androidx.wear.compose.navigation.SwipeDismissableNavHostKt.SwipeDismissableNavHost(SwipeDismissableNavHost.kt:562)
at androidx.wear.compose.navigation.SwipeDismissableNavHostKt.SwipeDismissableNavHost(SwipeDismissableNavHost.kt:154)
at com.google.android.horologist.compose.navscaffold.WearNavScaffoldKt$WearNavScaffold$4.invoke(WearNavScaffold.kt:210)
at com.google.android.horologist.compose.navscaffold.WearNavScaffoldKt$WearNavScaffold$4.invoke(WearNavScaffold.kt:8)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:49)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:8)
at androidx.wear.compose.material.ScaffoldKt.Scaffold(Scaffold.kt:381)
at com.google.android.horologist.compose.navscaffold.WearNavScaffoldKt.WearNavScaffold(WearNavScaffold.kt:245)
at dev.johnoreilly.confetti.wear.ui.ConfettiAppKt$ConfettiApp$1.invoke(ConfettiApp.kt:57)
at dev.johnoreilly.confetti.wear.ui.ConfettiAppKt$ConfettiApp$1.invoke(ConfettiApp.kt:8)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:49)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:8)
at dev.johnoreilly.confetti.wear.ui.ThemeKt$ConfettiTheme$2.invoke(Theme.kt:43)
at dev.johnoreilly.confetti.wear.ui.ThemeKt$ConfettiTheme$2.invoke(Theme.kt:8)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:49)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:8)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:40)
at androidx.wear.compose.material.TextKt.ProvideTextStyle(Text.kt:104)
at androidx.wear.compose.material.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:45)
at androidx.wear.compose.material.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:8)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:49)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:8)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:40)
at androidx.wear.compose.material.MaterialThemeKt.MaterialTheme(MaterialTheme.kt:424)
at dev.johnoreilly.confetti.wear.ui.ThemeKt.ConfettiTheme(Theme.kt:112)
at dev.johnoreilly.confetti.wear.ui.ThemeKt.ConfettiTheme(Theme.kt:173)
at dev.johnoreilly.confetti.wear.ui.ConfettiAppKt.ConfettiApp(ConfettiApp.kt:130)
at dev.johnoreilly.confetti.wear.MainActivity$onCreate$1$1.invoke(MainActivity.java:45)
at dev.johnoreilly.confetti.wear.MainActivity$onCreate$1$1.invoke(MainActivity.java:8)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:49)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:8)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:40)
at dev.johnoreilly.confetti.wear.MainActivity$onCreate$1.invoke(MainActivity.java:106)
at dev.johnoreilly.confetti.wear.MainActivity$onCreate$1.invoke(MainActivity.java:8)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:49)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:8)
at androidx.compose.ui.platform.ComposeView.Content(ComposeView.java:35)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(AbstractComposeView.java:35)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(AbstractComposeView.java:8)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:49)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:8)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:40)
at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:347)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals_android.kt:45)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals_android.kt:8)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:49)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:8)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:40)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals_android.kt:302)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(WrappedComposition.java:41)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(WrappedComposition.java:8)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:49)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:8)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:40)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(WrappedComposition.java:155)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(WrappedComposition.java:8)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:49)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:8)
at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm_jvm.kt:22)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(ComposerImpl.java:19)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(ComposerImpl.java)
at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(SnapshotStateKt__DerivedState.kt:45)
at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(SnapshotState.kt)
at androidx.compose.runtime.ComposerImpl.doCompose(ComposerImpl.java:138)
at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(ComposerImpl.java:18)
at androidx.compose.runtime.CompositionImpl.composeContent(CompositionImpl.java:17)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.java:34)
at androidx.compose.runtime.CompositionImpl.setContent(CompositionImpl.java:15)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(WrappedComposition.java:82)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(WrappedComposition.java:2)
at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.java:11)
at androidx.compose.ui.platform.WrappedComposition.setContent(WrappedComposition.java:12)
at androidx.compose.ui.platform.WrappedComposition.onStateChanged(WrappedComposition.java:28)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:24)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:105)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(WrappedComposition.java:43)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(WrappedComposition.java:2)
at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.java:115)
at android.view.View.dispatchAttachedToWindow(View.java:20516)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3493)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3500)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3500)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3500)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2462)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1997)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8250)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:731)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7660)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
```