Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Predictive back breakage fix #42789

Merged
merged 6 commits into from
Jun 12, 2023

Conversation

justinmc
Copy link
Contributor

@justinmc justinmc commented Jun 12, 2023

This PR attempts to fix breakage(s) caused by #39208.

b/286627757

Main problem

There were breakages in Google's code where classes that implemented PlatformMessageHandler did not provide an implementation of setFrameworkHandlesBack.

... is not abstract and does not override abstract method setFrameworkHandlesBack(boolean) in PlatformMessageHandler

I've tried to fix this by adding a default empty implementation to PlatformMessageHandler. Is that ok to do there, even though other nearby methods don't have default implementations there?

Also, I noticed that I could probably do the same thing to avoid my empty implementation in FlutterFragment, so I added one to PlatformPluginDelegate as well. That did allow me to remove the implementation in FlutterFragment. Is that ok as well? Do I need to provide both empty implementations?

Other cleanup

I noticed that when I renamed frameworkHandlesBacks to frameworkHandlesBack, I forgot to rename some cases, which I've cleaned up here.

@justinmc justinmc requested a review from camsim99 June 12, 2023 20:58
@justinmc justinmc self-assigned this Jun 12, 2023
Copy link
Contributor

@camsim99 camsim99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach looks good to me given that setFrameworkHandlesBack is only relevant in particular places. Just left suggestions on expanding the documentation to make that fact clearer to the reader!

* <p>Relevant for registering and unregistering the app's OnBackInvokedCallback for the
* Predictive Back feature.
*/
default void setFrameworkHandlesBack(boolean frameworkHandlesBack) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this works as a good alternative to the empty implementation in FlutterFragment. Maybe the doc can expand on where this is currently relevant (FlutterActivity alone now I suppose)?

@@ -517,7 +517,7 @@ public interface PlatformMessageHandler {
void setSystemUiOverlayStyle(@NonNull SystemChromeStyle systemUiOverlayStyle);

/** The Flutter application would or would not like to handle navigation pop events itself. */
void setFrameworkHandlesBack(boolean frameworkHandlesBack);
default void setFrameworkHandlesBack(boolean frameworkHandlesBack) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me since it is only used in a particular place. I'd suggest expanding the doc to mention where exactly this is relevant currently (FlutterActivity), just so it's clear we don't expect it to work or be used elsewhere.

@justinmc justinmc merged commit 3b560aa into flutter:main Jun 12, 2023
@justinmc justinmc deleted the predictive-back-root-default branch June 12, 2023 23:19
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 13, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 13, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 13, 2023
…128754)

flutter/engine@f67ed35...d02b15e

2023-06-12 jonahwilliams@google.com [Impeller] Fix text jitter on Vulkan. (flutter/engine#42792)
2023-06-12 jmccandless@google.com Predictive back breakage fix (flutter/engine#42789)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants