Status Update
Comments
ys...@google.com <ys...@google.com> #2
Screen Record of the Issue
Please capture screen record or video of the issue using following steps:
adb shell screenrecord /sdcard/video.mp4
Subsequently use following command to pull the recorded file:
adb pull /sdcard/video.mp4
Attach the file to this issue.
Steps to capture bugreport:
===========================
Android Wear devices connected to Android devices
On you Android phone, following the instructions in this doc, under the section ‘Instructions on your companion phone or tablets (Android)’
Launch the ‘Android Wear’ app on your phone or tablet. Tap on the three vertical ellipsis on the top right hand corner of the screen and click on “Report Wearable Bug” to capture a bug report from the watch
On the watch, you will observe a notification card with the text “Bug report #X is being generated”. It can take up to 20 minutes for the bug report to be generated and transferred to your phone.
Once the bug report is done, the notification card on the watch changes to “Bug report #X captured” and you will receive a notification on the phone that reads “Wearable bug report finished. Tap to send." Tap on this notification and email the bug report to a pre populated email address
Instructions on your companion phone or tablets (Android)
On your Android device, go to Settings > About phone or About tablet.
At the bottom of the screen, touch 'Build number' seven times in quick succession. You’ll see a message saying you’re now in developer mode.
Press Back to go back to the main Settings screen.
Touch Developer options.
At the top of the screen, make sure 'Developer options' is set to ON.
Check the box next to USB debugging.
Check the box next to Bug report shortcut.
Reproduce the issue or error message on your phone or tablet. It’s important that your device logs at least one occurrence of the problem.
Immediately after seeing the issue, press and hold the power button until the power menu appears.
Select Take bug report, then select Report in the dialog that follows.
After a significant delay -- up to two minutes -- your phone or tablet will vibrate and display a notification saying ‘Bug report captured’. Touch the notification to open Gmail with the report attached.
After replying to this message, you can disable developer mode and bug reports by going to Settings > Developer Options and sliding the top toggle to OFF.
Note: Please upload the bug report and screenshot to google drive and share the folder to android-bugreport@google.com, then share the link here.
ys...@google.com <ys...@google.com> #3
Please provide the requested information to proceed further. Unfortunately the issue will be closed within 7 days if there is no further update.
ys...@google.com <ys...@google.com> #4
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)
```