-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
feat: Android Impeller support #1277
feat: Android Impeller support #1277
Conversation
@juliansteenbakker I will finish up the implementation and then look into getting someone from the Android team to perhaps peer review this change. This is mostly surface producer changes, by taking a look at the prior art from |
22a905b
to
38ade56
Compare
// See: https://developer.android.com/reference/androidx/camera/core/SurfaceRequest.Result | ||
|
||
// Always attempt a release. | ||
surface.release() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that adding this line fixes any occurrences of A resource failed to call close
that we sometimes get.
Previously, we never did anything with the result callback, thus also not releasing the surface.
|
||
// Preview | ||
val surfaceProvider = Preview.SurfaceProvider { request -> | ||
if (isStopped()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer have this check, I'm not sure if we should put it back or not.
sdk: ">=3.4.0 <4.0.0" | ||
flutter: ">=3.22.0" | ||
sdk: ">=3.6.0 <4.0.0" | ||
flutter: ">=3.27.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SurfaceProducer API has seen some changes over a long period of time, due to the lengthy release cadence of the framework itself.
The SurfaceProducer API was available, but non-functional in Flutter 3.22, with the migration doc for plugin authors listing Flutter 3.24 as the minimum required version for the migration. However, in Flutter 3.27 both Impeller on Android has been turned on by default, and there was a name change for one of the two callback in the SurfaceProducer usage. (onSurfaceCreated
-> onSurfaceAvailable
)
In Flutter 3.28 there will be another name change (onSurfaceDestroyed
-> onSurfaceCleanup
), but since the current stable is only version 3.27, I added a TODO for that change
TODO: test this change + add orientation correction if needed
This PR adds support for SurfaceProducer on Android, which enables support for Impeller on Android.
Fixes #867