diff --git a/.ci/flutter_master.version b/.ci/flutter_master.version index 594a2c4458a5..df575840c1e3 100644 --- a/.ci/flutter_master.version +++ b/.ci/flutter_master.version @@ -1 +1 @@ -fa402c8057a11481b834c478cb8374df9bbc0819 +ead6b0d17c893109b9424aaf116a74295472cc73 diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewHostApiImpl.java index 81d47936bcaf..e9b7b0d89ac6 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewHostApiImpl.java @@ -83,6 +83,9 @@ 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() { // Do nothing. The Preview.SurfaceProvider will handle this whenever a new // Surface is needed. diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/PreviewTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/PreviewTest.java index 0b475b7a1dc6..83ccb1edd9c5 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/PreviewTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/PreviewTest.java @@ -134,7 +134,7 @@ public void createSurfaceProducer_setsExpectedSurfaceProducerCallback() { reset(mockSurfaceRequest); // Verify callback's onSurfaceCreated does not interact with the SurfaceRequest. - callback.onSurfaceCreated(); + simulateSurfaceCreation(callback); verifyNoMoreInteractions(mockSurfaceRequest); } @@ -262,4 +262,12 @@ 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(); + } } diff --git a/packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/VideoPlayerTest.java b/packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/VideoPlayerTest.java index c968848cbbe3..b5dde43b9e0c 100644 --- a/packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/VideoPlayerTest.java +++ b/packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/VideoPlayerTest.java @@ -189,7 +189,7 @@ public void onSurfaceProducerDestroyedAndRecreatedReleasesAndThenRecreatesAndRes // Create a new mock exo player so that we get a new instance. mockExoPlayer = mock(ExoPlayer.class); - producerLifecycle.onSurfaceCreated(); + simulateSurfaceCreation(producerLifecycle); verify(mockExoPlayer).seekTo(10L); verify(mockExoPlayer).setRepeatMode(Player.REPEAT_MODE_ALL); @@ -231,7 +231,7 @@ public void onSurfaceCreatedDoesNotSendInitializeEventAgain() { // Trigger destroyed/created. producerLifecycle.onSurfaceDestroyed(); - producerLifecycle.onSurfaceCreated(); + simulateSurfaceCreation(producerLifecycle); // Initial listener, and the new one from the resume. verify(mockExoPlayer, times(2)).addListener(listenerCaptor.capture()); @@ -257,7 +257,7 @@ public void onSurfaceCreatedWithoutDestroyDoesNotRecreate() { TextureRegistry.SurfaceProducer.Callback producerLifecycle = callbackCaptor.getValue(); // Calling onSurfaceCreated does not do anything, since the surface was never destroyed. - producerLifecycle.onSurfaceCreated(); + simulateSurfaceCreation(producerLifecycle); verifyNoMoreInteractions(mockProducer); videoPlayer.dispose(); @@ -271,4 +271,12 @@ public void disposeReleasesTextureAndPlayer() { verify(mockProducer).release(); verify(mockExoPlayer).release(); } + + // 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(); + } }