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

Add SurfaceProducer.Callback lifecycle hooks #53280

Merged
merged 14 commits into from
Jun 24, 2024

Conversation

matanlurey
Copy link
Contributor

@matanlurey matanlurey commented Jun 7, 2024

Work towards flutter/flutter#148417.

@matanlurey matanlurey requested review from johnmccutchan and gmackall and removed request for jonahwilliams June 12, 2024 21:18
@@ -63,3 +63,7 @@ android {
}
}

dependencies {
implementation 'androidx.lifecycle:lifecycle-process:2.2.0'
Copy link
Member

Choose a reason for hiding this comment

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

This shouldn't be necessary - do the new classes not resolve in android studio for you without it?

If they don't resolve without, I may need to revert #50840, I think something about that PR may have messed up how we resolve the android_embedding_dependencies jars

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You know, I'm not sure. I think this was auto-added by IntelliJ. Let me try removing and resyncing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It appears to work fine w/o, removing.

matanlurey added a commit that referenced this pull request Jun 13, 2024
…ndererTest` (#53361)

In #53280, I'm adding
lifecycle-aware methods to `SurfaceProducer`.

That means, in order to test that it WAI, we'll need to be running in a
simulated activity, and be able to switch scenario states (i.e. to
`RESUMED`). This was mentioned as well in
flutter/flutter#133151 as being something we
want to do.

This PR adds a `FlutterEngineRule`, which allows the creation of a
"real" `FlutterEngine` and an `Intent` that can power
`AndroidScenarioRule<FlutterActivity>`. I felt bad doing all of this
work for a single `@Test`, so I also refactored the rest of the file and
cleaned things up a bit.

That said, I'm happy to revert or make changes if we liked how things
were setup before.
@matanlurey matanlurey force-pushed the surface-producer-lifecycle-148417 branch from 4865484 to c8b4446 Compare June 13, 2024 23:55
@matanlurey matanlurey marked this pull request as ready for review June 13, 2024 23:55
@matanlurey matanlurey changed the title Add a SurfaceProducer.setOnSurfaceRecreatedCallback lifecycle hook Add SurfaceProducer.Callback lifecycle hooks Jun 13, 2024
void setCallback(Callback callback);

/** Callback invoked by {@link #setCallback(Callback)}. */
interface Callback {
Copy link
Contributor

Choose a reason for hiding this comment

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

naming nit: Callbacks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@matanlurey matanlurey merged commit be7db94 into flutter:main Jun 24, 2024
30 checks passed
@matanlurey matanlurey deleted the surface-producer-lifecycle-148417 branch June 24, 2024 15:07
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 24, 2024
jason-simmons added a commit to jason-simmons/flutter that referenced this pull request Jun 24, 2024
Includes updates to Gradle lockfiles required by flutter/engine#53280
jason-simmons added a commit to jason-simmons/flutter that referenced this pull request Jun 24, 2024
Includes updates to Gradle lockfiles required by flutter/engine#53280
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 24, 2024
Includes updates to Gradle lockfiles required by flutter/engine#53280
sigurdm pushed a commit to sigurdm/flutter that referenced this pull request Jun 26, 2024
Includes updates to Gradle lockfiles required by flutter/engine#53280
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants