Status Update
Comments
jb...@google.com <jb...@google.com>
cl...@google.com <cl...@google.com> #2
Branch: androidx-main
commit f796782ea16c76f151e7d7635945f2f27c1190a0
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Mon Mar 22 01:26:40 2021
[GH] [FragmentStrictMode] Detect calls to Fragment#setTargetFragment
## Proposed Changes
- Detect calls to `Fragment#setTargetFragment`
## Testing
Test: See `FragmentStrictModeTest#detectSetTargetFragment`
## Issues Fixed
Fixes: 153737745
This is an imported pull request from
Resolves #139
Github-Pr-Head-Sha: 89c830c8fe9c487e0dd14087dc99a720496d5c0f
GitOrigin-RevId: e73f51cf62e973d664cdfd8193b830e24e007a7c
Change-Id: I3066e87ed7cfa2bda19089979c722f1efe4103cf
M fragment/fragment/api/public_plus_experimental_current.txt
M fragment/fragment/api/restricted_current.txt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentStrictMode.java
A fragment/fragment/src/main/java/androidx/fragment/app/strictmode/TargetFragmentUsageViolation.java
mi...@gmail.com <mi...@gmail.com> #3
I'll attach the project folder as a zip file.
One other thing I've noticed is that if I start the code with "Debug 'app'", the first time It does not crash, but it is reset to the default startDestination.
To highlight this I've added an extra screen, so now to reproduce the bug you would first need to navigate to screen "B".
I've tested with "Pixel 8 API 33" emulator
do...@noteing.com <do...@noteing.com> #4
sa...@gmail.com <sa...@gmail.com> #5
I've tested the app's behaviour using typed navigation. I've also discovered that it crashes after the death process when reopening the app. I tested this on API 33 and API 30 emulators.
You can find the source code at the following URL:
To replicate the issue:
- Clone the repository
- Run the app
- It will display a screen with 3 EditText fields; enter random values in each field
- Simulate a system crash
- Open the app, and it will crash with the following stack trace.
I've also created an issue with a video attached -
Stacktrace
--------- beginning of crash
2024-06-03 22:36:13.896 16299-16299 AndroidRuntime dev.sagar.playinfo E FATAL EXCEPTION: main (Ask Gemini)
Process: dev.sagar.playinfo, PID: 16299
java.lang.IllegalStateException: Restoring the Navigation back stack failed: destination 2475885 cannot be found from the current destination ComposeNavGraph(0x0) startDestination={Destination(0xe274fa2) route=dev.sagar.playinfo.navigation.Screen.SignUp}
at androidx.navigation.NavController.onGraphCreated(NavController.kt:1365)
at androidx.navigation.NavController.setGraph(NavController.kt:1310)
at androidx.navigation.NavController.setGraph(NavController.kt:105)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:448)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:317)
at dev.sagar.playinfo.navigation.NavGraphKt.SetupNavGraph(NavGraph.kt:20)
at dev.sagar.playinfo.ComposableSingletons$MainActivityKt$lambda-1$1$1.invoke(MainActivity.kt:31)
at dev.sagar.playinfo.ComposableSingletons$MainActivityKt$lambda-1$1$1.invoke(MainActivity.kt:30)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.material3.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1$bodyContentPlaceables$1.invoke(Scaffold.kt:303)
at androidx.compose.material3.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1$bodyContentPlaceables$1.invoke(Scaffold.kt:285)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:1017)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:493)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:97)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3593)
at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3520)
at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:743)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:1114)
at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3874)
at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:649)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:635)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcomposeInto(SubcomposeLayout.kt:516)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:488)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:479)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:463)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$Scope.subcompose(SubcomposeLayout.kt:895)
at androidx.compose.material3.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1.invoke-0kLqBqw(Scaffold.kt:285)
at androidx.compose.material3.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1.invoke(Scaffold.kt:179)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:725)
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:135)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:316)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:315)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:503)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:502)
2024-06-03 22:36:13.899 16299-16299 AndroidRuntime dev.sagar.playinfo E at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:258) (Ask Gemini)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1771)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:40)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:692)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:668)
at androidx.compose.foundation.layout.BoxMeasurePolicy.measure-3p2s80s(Box.kt:151)
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:135)
at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:646)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:188)
at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:646)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:188)
at androidx.compose.foundation.layout.FillNode.measure-3p2s80s(Size.kt:699)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:188)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:316)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:315)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:503)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:502)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:258)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1771)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:40)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:692)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:668)
at androidx.compose.ui.layout.RootMeasurePolicy.measure-3p2s80s(RootMeasurePolicy.kt:38)
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:135)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:316)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:315)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2441)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:502)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:258)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1771)
2024-06-03 22:36:13.901 16299-16299 AndroidRuntime dev.sagar.playinfo E at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:40) (Ask Gemini)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:692)
at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui_release(LayoutNode.kt:1221)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(MeasureAndLayoutDelegate.kt:367)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureOnly(MeasureAndLayoutDelegate.kt:622)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureOnly(MeasureAndLayoutDelegate.kt:420)
at androidx.compose.ui.platform.AndroidComposeView.onMeasure(AndroidComposeView.android.kt:1345)
at android.view.View.measure(View.java:26357)
at androidx.compose.ui.platform.AbstractComposeView.internalOnMeasure$ui_release(ComposeView.android.kt:309)
at androidx.compose.ui.platform.AbstractComposeView.onMeasure(ComposeView.android.kt:296)
at android.view.View.measure(View.java:26357)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:26357)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:26357)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:760)
at android.view.View.measure(View.java:26357)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3926)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2612)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2884)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2328)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9087)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1231)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239)
at android.view.Choreographer.doCallbacks(Choreographer.java:899)
at android.view.Choreographer.doFrame(Choreographer.java:832)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
be...@gmail.com <be...@gmail.com> #6
Lib version: 2.8.0-beta02
Os version: all
Language: all
Please fix it quickly as typed navigation is really something needed. Thanks guys you rock <3
be...@gmail.com <be...@gmail.com> #7
cl...@google.com <cl...@google.com>
ap...@google.com <ap...@google.com> #8
Branch: androidx-main
commit 194e1790e466b8ac2bd8a87e9745e53d1503e1f5
Author: Clara Fok <clarafok@google.com>
Date: Thu Jun 13 16:13:42 2024
Fix crash when resume after process death
RestoreState crashes when resuming after process death because the destination ID which is based on serializer hashcode() is different after process death.
Update the hash algorithm that safe args
Test: manual test by killing process in emulator
Test: ./gradlew navigation:navigation-common:cC
Test: ./graldew navigation:navigation-runtime:cC
Bug: 341801005
Relnote: "Fixed crash from restore state when resuming the app after process death."
Change-Id: Ia8f38fc59b8e4dac1910c5a593e1ec0585e59456
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavGraphTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavOptionsBuilderTest.kt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/RouteFilledTest.kt
A navigation/navigation-common/src/androidTest/java/androidx/navigation/serialization/TestUtil.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptions.kt
M navigation/navigation-common/src/main/java/androidx/navigation/serialization/RouteSerializer.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
cl...@google.com <cl...@google.com> #9
Fixed internally and will be available in navigation-2.8.0-rc01
jo...@hella.info <jo...@hella.info> #10
```
val entry by navController.currentBackStackEntryAsState()
when (entry?.destination?.id) {
ScreenA.serializer().hashCode() -> R.string.example
...
}
```
Just to describe the current screen in a top bar. I used to do this with the `route` instead of the `id, and i have searched for quite a while for an alternative with type safe navigation and found this possibility.
I think this commit will break my code, right? And if so, what would be the correct way to determine the current type safe navigation route i am on?
cl...@google.com <cl...@google.com> #11
pr...@google.com <pr...@google.com> #12
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-common:2.8.0-beta04
androidx.navigation:navigation-runtime:2.8.0-beta04
ni...@gmail.com <ni...@gmail.com> #13
jb...@google.com <jb...@google.com> #14
Please file a separate bug with a minimal sample project that reproduces your issue.
Description
Component used: Navigation
Version used: 2.8.0-beta01
Devices/Android versions reproduced on: 24-33
Tested on emulators with android 24 and 33, and on a real device with android 24
To trigger system initiated process death, I set the background processes limit to 0
The following exception is thrown upon reopening the application:
java.lang.IllegalStateException: Restoring the Navigation back stack failed: destination 161177858 cannot be found from the current destination ComposeNavGraph(0x0) startDestination={Destination(0x8431a13) route=com.myk00l.test.B}