nowinandroid
nowinandroid copied to clipboard
[Bug]: Screen is not retained after process death
Is there an existing issue for this?
- [X] I have searched the existing issues
Is there a StackOverflow question about this issue?
- [X] I have searched StackOverflow
What happened?
Steps to reproduce:
- Open the app
- Go to Interests -> Accessibility(just an example)
- Put the app in the background
- Trigger a process death
- Reopen the app
Result: The For You screen is opened, instead of the last opened screen(Interests -> Accessibility)
Tested on Samsung S20, demoDebug build.
Relevant logcat output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Seems that this is not a bug, rather a normal behaviour of the app.
Saved instance state bundles persist through both configuration changes and process death, use saved instance state to store a minimal amount of data necessary, such as an ID, to re-create the data necessary to restore the UI back to its previous state should the other persistence mechanisms fail. Most apps should implement this to handle system-initiated process death.
https://developer.android.com/topic/libraries/architecture/saving-states#onsaveinstancestate
I can't reproduce this with the latest main code. Please re-open if you can still reproduce.
@alexvanyo
open the app
scroll the list
switch to other app
exec adb shell am kill com.google.samples.apps.nowinandroid to simulate the system-initiated process death
come back to this app
the scroll position of list is lost
Interesting, only the scroll position of for you tab is not saved, the scroll position of other lists is stored normally. I think this is a bug.