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

Conversation

@mklim
Copy link
Contributor

@mklim mklim commented Oct 9, 2019

Fixes a bug where PlatformViewController was not being notified of FlutterView attachment changes.

Related to flutter/flutter#41851.

@mklim
Copy link
Contributor Author

mklim commented Oct 9, 2019

@amirh this still needs a test before it can land but if you want to review the basic approach in the meantime feel free.

@mklim
Copy link
Contributor Author

mklim commented Oct 9, 2019

This is ready for review. The unit test I added is not good, it's just an interaction test. To really test the behavior I would have need to have significantly refactored the PlatformViewsController class and then changed FlutterEngine to use constructor injection. That may be worth it, but I wasn't sure whether it was good to make this PR any riskier.

// TODO(mattcarroll): add javadocs
@UiThread
public static native boolean nativeGetIsSoftwareRenderingEnabled();
public native boolean nativeGetIsSoftwareRenderingEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this meant to be part of this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see now.

This seems to indicate that most of these methods shouldn't be static then, right?

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

This LGTM, but would defer to @amirh

I suspect that many of the methods on FlutterJNI should be made instance methods similar to this one, except for ones that we know will always be global (like the observatory uri).

@mklim
Copy link
Contributor Author

mklim commented Oct 9, 2019

I suspect that many of the methods on FlutterJNI should be made instance methods similar to this one, except for ones that we know will always be global (like the observatory uri).

I agree. I conservatively just instanced the one thing I needed to for this test case but I think it would make sense to move all of them. These are really depending on some mutable state (the native library being loaded) so I don't think they're really immutable/"static" to begin with.

Michael Klimushyn added 2 commits October 11, 2019 17:12
Fixes a bug where `PlatformViewController` was not being notified of
`FlutterView` attachment changes.

Unfortunately the test here is just an interaction test. I refactored
some of the underlying code so that FlutterEngine could be initialized
without through missing native library errors, but even with that
variance there isn't any obvious way to test the real behavior here. I'd
need to significantly refactor FlutterEngine and PlatformViewsController
to write a more effective test here.
Copy link
Contributor

@amirh amirh left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants