Skip to content

Commit f1a3da2

Browse files
authored
Remove additional (harmless but annoying) native stack traces. (#7837)
Closes flutter/flutter#156451.
1 parent 0a3d9fc commit f1a3da2

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

packages/video_player/video_player_android/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 2.7.12
2+
3+
* Fixes a [bug](https://github.com/flutter/flutter/issues/156451) where
4+
additional harmless but annoying warnings in the form of native stack traces
5+
would be printed when the app was backgrounded. There may be additional
6+
warnings that are not yet fixed, but this should address the
7+
most common case.
8+
19
## 2.7.11
210

311
* Fixes a [bug](https://github.com/flutter/flutter/issues/156158) where a

packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public void onSurfaceCreated() {
9797

9898
@RestrictTo(RestrictTo.Scope.LIBRARY)
9999
public void onSurfaceDestroyed() {
100-
exoPlayer.stop();
100+
// Intentionally do not call pause/stop here, because the surface has already been released
101+
// at this point (see https://github.com/flutter/flutter/issues/156451).
101102
savedStateDuring = ExoPlayerState.save(exoPlayer);
102103
exoPlayer.release();
103104
}

packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/VideoPlayerTest.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,21 @@ public void onSurfaceProducerDestroyedAndRecreatedReleasesAndThenRecreatesAndRes
200200
videoPlayer.dispose();
201201
}
202202

203+
@Test
204+
public void onSurfaceProducerDestroyedDoesNotStopOrPauseVideo() {
205+
VideoPlayer videoPlayer = createVideoPlayer();
206+
207+
verify(mockProducer).setCallback(callbackCaptor.capture());
208+
TextureRegistry.SurfaceProducer.Callback producerLifecycle = callbackCaptor.getValue();
209+
producerLifecycle.onSurfaceDestroyed();
210+
211+
verify(mockExoPlayer, never()).stop();
212+
verify(mockExoPlayer, never()).pause();
213+
verify(mockExoPlayer, never()).setPlayWhenReady(anyBoolean());
214+
215+
videoPlayer.dispose();
216+
}
217+
203218
@Test
204219
public void onDisposeSurfaceProducerCallbackIsDisconnected() {
205220
// Regression test for https://github.com/flutter/flutter/issues/156158.
@@ -289,7 +304,7 @@ public void disposeReleasesExoPlayerBeforeTexture() {
289304

290305
// TODO(matanlurey): Replace with inline calls to onSurfaceAvailable once
291306
// available on stable; see https://github.com/flutter/flutter/issues/155131.
292-
// This seperate method only exists to scope the suppression.
307+
// This separate method only exists to scope the suppression.
293308
@SuppressWarnings({"deprecation", "removal"})
294309
void simulateSurfaceCreation(TextureRegistry.SurfaceProducer.Callback producerLifecycle) {
295310
producerLifecycle.onSurfaceCreated();

packages/video_player/video_player_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: video_player_android
22
description: Android implementation of the video_player plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
5-
version: 2.7.11
5+
version: 2.7.12
66

77
environment:
88
sdk: ^3.5.0

0 commit comments

Comments
 (0)