Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/camera/camera_android_camerax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.6.11

* Replaces deprecated Android embedder APIs (`onSurfaceCreated` -> `onSurfaceAvailable`).
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
Copy link
Contributor

Choose a reason for hiding this comment

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

The versions in the changelog entry should have been 3.27/3.6, right?


## 0.6.10+3

* Bumps com.google.guava:guava from 33.3.1-android to 33.4.0-android.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ public void onSurfaceRequested(@NonNull SurfaceRequest request) {
surfaceProducer.setCallback(
new TextureRegistry.SurfaceProducer.Callback() {
@Override
// TODO(matanlurey): Replace with onSurfaceAvailable once available on stable;
// https://github.com/flutter/flutter/issues/155131.
@SuppressWarnings({"deprecation", "removal"})
public void onSurfaceCreated() {
public void onSurfaceAvailable() {
// Do nothing. The Preview.SurfaceProvider will handle this whenever a new
// Surface is needed.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ public void createSurfaceProducer_setsExpectedSurfaceProducerCallback() {

reset(mockSurfaceRequest);

// Verify callback's onSurfaceCreated does not interact with the SurfaceRequest.
simulateSurfaceCreation(callback);
// Verify callback's onSurfaceAvailable does not interact with the SurfaceRequest.
callback.onSurfaceAvailable();
verifyNoMoreInteractions(mockSurfaceRequest);
}

Expand Down Expand Up @@ -262,12 +262,4 @@ public void setTargetRotation_makesCallToSetTargetRotation() {

verify(mockPreview).setTargetRotation(targetRotation);
}

// TODO(matanlurey): Replace with inline calls to onSurfaceAvailable once
// available on stable; see https://github.com/flutter/flutter/issues/155131.
// This seperate method only exists to scope the suppression.
@SuppressWarnings({"deprecation", "removal"})
void simulateSurfaceCreation(TextureRegistry.SurfaceProducer.Callback producerLifecycle) {
producerLifecycle.onSurfaceCreated();
}
}
6 changes: 3 additions & 3 deletions packages/camera/camera_android_camerax/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: camera_android_camerax
description: Android implementation of the camera plugin using the CameraX library.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.6.10+3
version: 0.6.11

environment:
sdk: ^3.5.0
flutter: ">=3.24.0"
sdk: ^3.6.0
flutter: ">=3.27.0"

flutter:
plugin:
Expand Down
5 changes: 5 additions & 0 deletions packages/video_player/video_player_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.7.17

* Replaces deprecated Android embedder APIs (`onSurfaceCreated` -> `onSurfaceAvailable`).
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.

## 2.7.16

* Updates internal Pigeon API to use newer features.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ interface ExoPlayerProvider {
}

@RestrictTo(RestrictTo.Scope.LIBRARY)
// TODO(matanlurey): https://github.com/flutter/flutter/issues/155131.
@SuppressWarnings({"deprecation", "removal"})
public void onSurfaceCreated() {
public void onSurfaceAvailable() {
if (savedStateDuring != null) {
exoPlayer = createVideoPlayer();
savedStateDuring.restore(exoPlayer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void seekAndGetPosition() {
}

@Test
public void onSurfaceProducerDestroyedAndRecreatedReleasesAndThenRecreatesAndResumesPlayer() {
public void onSurfaceProducerDestroyedAndAvailableReleasesAndThenRecreatesAndResumesPlayer() {
VideoPlayer videoPlayer = createVideoPlayer();

verify(mockProducer).setCallback(callbackCaptor.capture());
Expand All @@ -190,7 +190,7 @@ public void onSurfaceProducerDestroyedAndRecreatedReleasesAndThenRecreatesAndRes

// Create a new mock exo player so that we get a new instance.
mockExoPlayer = mock(ExoPlayer.class);
simulateSurfaceCreation(producerLifecycle);
producerLifecycle.onSurfaceAvailable();

verify(mockExoPlayer).seekTo(10L);
verify(mockExoPlayer).setRepeatMode(Player.REPEAT_MODE_ALL);
Expand Down Expand Up @@ -226,7 +226,7 @@ public void onDisposeSurfaceProducerCallbackIsDisconnected() {
}

@Test
public void onInitializedCalledWhenVideoPlayerInitiallyCreated() {
public void onInitializedCalledWhenVideoPlayerInitiallyAvailable() {
VideoPlayer videoPlayer = createVideoPlayer();

// Pretend we have a video, and capture the registered event listener.
Expand All @@ -242,7 +242,7 @@ public void onInitializedCalledWhenVideoPlayerInitiallyCreated() {
}

@Test
public void onSurfaceCreatedDoesNotSendInitializeEventAgain() {
public void onSurfaceAvailableDoesNotSendInitializeEventAgain() {
// The VideoPlayer contract assumes that the event "initialized" is sent exactly once
// (duplicate events cause an error to be thrown at the shared Dart layer). This test verifies
// that the onInitialized event is sent exactly once per player.
Expand All @@ -251,13 +251,13 @@ public void onSurfaceCreatedDoesNotSendInitializeEventAgain() {
VideoPlayer videoPlayer = createVideoPlayer();
when(mockExoPlayer.getVideoSize()).thenReturn(new VideoSize(300, 200));

// Capture the lifecycle events so we can simulate onSurfaceCreated/Destroyed.
// Capture the lifecycle events so we can simulate onSurfaceAvailableDestroyed.
verify(mockProducer).setCallback(callbackCaptor.capture());
TextureRegistry.SurfaceProducer.Callback producerLifecycle = callbackCaptor.getValue();

// Trigger destroyed/created.
// Trigger destroyed/available.
producerLifecycle.onSurfaceDestroyed();
simulateSurfaceCreation(producerLifecycle);
producerLifecycle.onSurfaceAvailable();

// Initial listener, and the new one from the resume.
verify(mockExoPlayer, times(2)).addListener(listenerCaptor.capture());
Expand All @@ -273,17 +273,17 @@ public void onSurfaceCreatedDoesNotSendInitializeEventAgain() {
}

@Test
public void onSurfaceCreatedWithoutDestroyDoesNotRecreate() {
public void onSurfaceAvailableWithoutDestroyDoesNotRecreate() {
// Initially create the video player, which creates the initial surface.
VideoPlayer videoPlayer = createVideoPlayer();
verify(mockProducer).getSurface();

// Capture the lifecycle events so we can simulate onSurfaceCreated/Destroyed.
// Capture the lifecycle events so we can simulate onSurfaceAvailable/Destroyed.
verify(mockProducer).setCallback(callbackCaptor.capture());
TextureRegistry.SurfaceProducer.Callback producerLifecycle = callbackCaptor.getValue();

// Calling onSurfaceCreated does not do anything, since the surface was never destroyed.
simulateSurfaceCreation(producerLifecycle);
// Calling onSurfaceAvailable does not do anything, since the surface was never destroyed.
producerLifecycle.onSurfaceAvailable();
verifyNoMoreInteractions(mockProducer);

videoPlayer.dispose();
Expand All @@ -301,12 +301,4 @@ public void disposeReleasesExoPlayerBeforeTexture() {
inOrder.verify(mockExoPlayer).release();
inOrder.verify(mockProducer).release();
}

// TODO(matanlurey): Replace with inline calls to onSurfaceAvailable once
// available on stable; see https://github.com/flutter/flutter/issues/155131.
// This separate method only exists to scope the suppression.
@SuppressWarnings({"deprecation", "removal"})
void simulateSurfaceCreation(TextureRegistry.SurfaceProducer.Callback producerLifecycle) {
producerLifecycle.onSurfaceCreated();
}
}
6 changes: 3 additions & 3 deletions packages/video_player/video_player_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: video_player_android
description: Android implementation of the video_player plugin.
repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
version: 2.7.16
version: 2.7.17

environment:
sdk: ^3.5.0
flutter: ">=3.24.0"
sdk: ^3.6.0
flutter: ">=3.27.0"

flutter:
plugin:
Expand Down
Loading