engine
engine copied to clipboard
Platform channel for predictive back in route transitions on android
This pull request introduces platform channel support for predictive back route transitions on Android, as part of the ongoing efforts in flutter/flutter#131961.
- For Android SDK 33: Utilizes
OnBackInvokedCallbackto handle back navigation events (#39208). - For Android SDK 34 and above: Employs
OnBackAnimationCallback, taking advantage of the enhanced back navigation capabilities introduced in this version.
In both scenarios, the callbacks are appropriately forwarded to the Flutter framework. This PR focuses on the engine part, setting the stage for integrating these enhancements into the broader Flutter ecosystem.
References
Part of flutter/flutter#131961 Framework PR: flutter/flutter#141373 Fixes https://github.com/flutter/flutter/issues/111295
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [x] I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
- [x] I listed at least one issue that this PR fixes in the description above.
- [x] I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with
///). - [x] I signed the CLA.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
Thanks, @justinmc. I've just created the PR for the framework part flutter/flutter#141373
What is the status of this PR, is it waiting on review comments or framework changes? Friendly ping @justinmc / @maRci002
In my opinion, this PR is ready for further review. However, I've encountered some issues with testing, particularly related to the @Config annotation. I'm currently awaiting some inputs from @camsim99 to resolve these concerns. Once these are addressed, I believe the PR will be in good shape for final review.
I owe a major review on this, sorry for the delay. I've been struggling to get my engine development set up on a new machine...
@maRci002 Looks like tests are passing! Is this ready for re-review?
@maRci002 Looks like tests are passing! Is this ready for re-review?
@camsim99, thanks, but the API might change over time. I will definitely let you know when it's ready for review from an Android perspective.
@maRci002 Can you fix the build conflict? I think it's just that PR https://github.com/flutter/engine/pull/51171 requires the use of API_LEVELS.API_33 instead of 33 etc. now.
I think once you've fixed the merge conflict we should move forward with merging this PR, and then focus on getting the framework PR merged.
Framework and Engine should be merged together; otherwise, on Android 14, the back button will break down since the commitBackGesture event will be sent instead of popRoute.
@camsim99, thank you for waiting. The PR is ready for review from an Android perspective. However, please do not apply autosubmit label if possible until the framework is finished. I will let you know when it's ready :)
Ah good catch. Sounds good.
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).
If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.
Changes reported for pull request #49093 at sha 7bcd50fd284b58b47fcc842f20a085ed1c77f002
Thanks for the quick turnaround on that!
Any idea how these changes can somehow causeOnBackInvokedCallback to be invoked on a different platformview, causing an exception on Android < 13?
https://github.com/flutter/flutter/issues/151733
Apologies if this is unwanted here. I simply traced my exception back to this change and I'm seriously out of my depth here.