From 4de4f857391b0328da93443940e5b353e07cdaa5 Mon Sep 17 00:00:00 2001 From: krocard Date: Thu, 1 Jul 2021 12:48:43 +0100 Subject: [PATCH] Document threading guarantee of Player.addListener These guarantees were documented for `EventListener` and hold as well for Listener but were not documented. PiperOrigin-RevId: 382498188 --- .../java/com/google/android/exoplayer2/Player.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/Player.java b/library/common/src/main/java/com/google/android/exoplayer2/Player.java index 4731e71972..c1c123b075 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/Player.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/Player.java @@ -1262,9 +1262,11 @@ public interface Player { Looper getApplicationLooper(); /** - * Registers a listener to receive events from the player. The listener's methods will be called - * on the thread that was used to construct the player. However, if the thread used to construct - * the player does not have a {@link Looper}, then the listener will be called on the main thread. + * Registers a listener to receive events from the player. + * + *

The listener's methods will be called on the thread that was used to construct the player. + * However, if the thread used to construct the player does not have a {@link Looper}, then the + * listener will be called on the main thread. * * @param listener The listener to register. * @deprecated Use {@link #addListener(Listener)} and {@link #removeListener(Listener)} instead. @@ -1275,6 +1277,10 @@ public interface Player { /** * Registers a listener to receive all events from the player. * + *

The listener's methods will be called on the thread that was used to construct the player. + * However, if the thread used to construct the player does not have a {@link Looper}, then the + * listener will be called on the main thread. + * * @param listener The listener to register. */ void addListener(Listener listener);