File tree Expand file tree Collapse file tree 4 files changed +12
-5
lines changed
common/src/main/kotlin/com/tidal/sdk/player/common
main/kotlin/com/tidal/sdk/player/playbackengine
test/kotlin/com/tidal/sdk/player/playbackengine
src/androidTest/kotlin/com/tidal/sdk/player/playlog Expand file tree Collapse file tree 4 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1+ package com.tidal.sdk.player.common
2+
3+ class PlaybackEngineUsageAfterReleaseException :
4+ IllegalStateException (" Attempted to use a released PlaybackEngine" )
Original file line number Diff line number Diff line change 11package com.tidal.sdk.player.playbackengine
22
33import android.os.Handler
4+ import com.tidal.sdk.player.common.PlaybackEngineUsageAfterReleaseException
45import com.tidal.sdk.player.common.model.AudioQuality
56import com.tidal.sdk.player.common.model.LoudnessNormalizationMode
67import com.tidal.sdk.player.common.model.MediaProduct
@@ -78,8 +79,7 @@ internal class SingleHandlerPlaybackEngine(
7879
7980 private fun postOrThrow (runnable : Runnable ) {
8081 if (! handler.post(runnable)) {
81- val className = SingleHandlerPlaybackEngine ::class .simpleName
82- error(" Attempt to use a released instance of $className " )
82+ throw PlaybackEngineUsageAfterReleaseException ()
8383 }
8484 }
8585}
Original file line number Diff line number Diff line change @@ -473,6 +473,7 @@ internal class ExoPlayerPlaybackEngineTest {
473473
474474 playbackEngine.release()
475475
476+ verify(initialExtendedExoPlayer).currentPositionMs
476477 verify(initialExtendedExoPlayer).release()
477478 verifyNoMoreInteractions(initialExtendedExoPlayer, looper)
478479 }
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import com.tidal.sdk.common.TidalMessage
1818import com.tidal.sdk.eventproducer.EventSender
1919import com.tidal.sdk.eventproducer.model.ConsentCategory
2020import com.tidal.sdk.player.Player
21+ import com.tidal.sdk.player.common.PlaybackEngineUsageAfterReleaseException
2122import com.tidal.sdk.player.common.model.MediaProduct
2223import com.tidal.sdk.player.common.model.ProductType
2324import com.tidal.sdk.player.events.EventReporterModuleRoot
@@ -151,9 +152,10 @@ internal class SingleMediaProductPlayLogTest {
151152 player.release()
152153 job.join()
153154 }
154- } catch (alreadyReleasedException: IllegalStateException ) {
155- assertThat(alreadyReleasedException.message)
156- .isEqualTo(" Attempt to use a released instance of SingleHandlerPlaybackEngine" )
155+ } catch (throwable: Throwable ) {
156+ if (throwable !is PlaybackEngineUsageAfterReleaseException ) {
157+ throw throwable
158+ }
157159 }
158160 verify(eventSender, atMost(Int .MAX_VALUE ))
159161 .sendEvent(
You can’t perform that action at this time.
0 commit comments