Commit 174d9948 by tonihei Committed by Andrew Lewis

Remove opt-out for suppressing wrong thread usage error.

Enforcing the correct thread usage has been enabled since 2.13.0.
Opting-out of this enforement is dangerous as it can hide very hard
to debug bugs.

PiperOrigin-RevId: 424815808
parent 1402bd6f
...@@ -148,6 +148,8 @@ ...@@ -148,6 +148,8 @@
`MediaItem.LiveConfiguration.Builder#setTargetOffsetMs` to override the `MediaItem.LiveConfiguration.Builder#setTargetOffsetMs` to override the
manifest, or `DashMediaSource#setFallbackTargetLiveOffsetMs` to provide manifest, or `DashMediaSource#setFallbackTargetLiveOffsetMs` to provide
a fallback value. a fallback value.
* Remove `(Simple)ExoPlayer.setThrowsWhenUsingWrongThread`. Opting out of
the thread enforcement is no longer possible.
### 2.16.1 (2021-11-18) ### 2.16.1 (2021-11-18)
......
...@@ -119,11 +119,7 @@ which the player must be accessed can be queried using ...@@ -119,11 +119,7 @@ which the player must be accessed can be queried using
If you see `IllegalStateException` being thrown with the message "Player is If you see `IllegalStateException` being thrown with the message "Player is
accessed on the wrong thread", then some code in your app is accessing an accessed on the wrong thread", then some code in your app is accessing an
`ExoPlayer` instance on the wrong thread (the exception's stack trace shows you `ExoPlayer` instance on the wrong thread (the exception's stack trace shows you
where). You can temporarily opt out from these exceptions being thrown by where).
calling `ExoPlayer.setThrowsWhenUsingWrongThread(false)`, in which case the
issue will be logged as a warning instead. Using this opt out is not safe and
may result in unexpected or obscure errors. It will be removed in ExoPlayer
2.16.
{:.info} {:.info}
For more information about ExoPlayer's threading model, see the For more information about ExoPlayer's threading model, see the
......
...@@ -1457,19 +1457,6 @@ public interface ExoPlayer extends Player { ...@@ -1457,19 +1457,6 @@ public interface ExoPlayer extends Player {
void setPriorityTaskManager(@Nullable PriorityTaskManager priorityTaskManager); void setPriorityTaskManager(@Nullable PriorityTaskManager priorityTaskManager);
/** /**
* Sets whether the player should throw an {@link IllegalStateException} when methods are called
* from a thread other than the one associated with {@link #getApplicationLooper()}.
*
* <p>The default is {@code true} and this method will be removed in the future.
*
* @param throwsWhenUsingWrongThread Whether to throw when methods are called from a wrong thread.
* @deprecated Disabling the enforcement can result in hard-to-detect bugs. Do not use this method
* except to ease the transition while wrong thread access problems are fixed.
*/
@Deprecated
void setThrowsWhenUsingWrongThread(boolean throwsWhenUsingWrongThread);
/**
* Sets whether audio offload scheduling is enabled. If enabled, ExoPlayer's main loop will run as * Sets whether audio offload scheduling is enabled. If enabled, ExoPlayer's main loop will run as
* rarely as possible when playing an audio stream using audio offload. * rarely as possible when playing an audio stream using audio offload.
* *
......
...@@ -1541,9 +1541,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -1541,9 +1541,7 @@ public class SimpleExoPlayer extends BasePlayer
streamVolumeManager.setMuted(muted); streamVolumeManager.setMuted(muted);
} }
@Deprecated /* package */ void setThrowsWhenUsingWrongThread(boolean throwsWhenUsingWrongThread) {
@Override
public void setThrowsWhenUsingWrongThread(boolean throwsWhenUsingWrongThread) {
this.throwsWhenUsingWrongThread = throwsWhenUsingWrongThread; this.throwsWhenUsingWrongThread = throwsWhenUsingWrongThread;
} }
......
...@@ -357,12 +357,6 @@ public class StubExoPlayer extends StubPlayer implements ExoPlayer { ...@@ -357,12 +357,6 @@ public class StubExoPlayer extends StubPlayer implements ExoPlayer {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Deprecated
@Override
public void setThrowsWhenUsingWrongThread(boolean throwsWhenUsingWrongThread) {
throw new UnsupportedOperationException();
}
@Override @Override
public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled) { public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment