Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back handling state is lost on activity recreation when using a cached engine #159158

Open
gmackall opened this issue Nov 19, 2024 · 0 comments · May be fixed by flutter/engine#56715
Open

Back handling state is lost on activity recreation when using a cached engine #159158

gmackall opened this issue Nov 19, 2024 · 0 comments · May be fixed by flutter/engine#56715
Assignees

Comments

@gmackall
Copy link
Member

gmackall commented Nov 19, 2024

Predictive back support was recently added, and included changes that maintain a state of whether the framework should handle back events or not
https://github.com/flutter/engine/blob/main/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java#L724
(and similar for FlutterFragment).

This state is lost when the activity (or activity hosting the fragment) is destroyed and recreated. This is fine when the engine is also destroyed, but if a cached engine is being used then the Flutter routes are not destroyed, so the two get out of sync.

We can fix this by overriding to save this state in onSaveInstanceState (conditionally), and then using the state when recreating the Activity/Fragment, though we will have to be careful to ensure the conditions match exactly when the engine is going to stay around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant