mirror of
https://github.com/samsonjs/media.git
synced 2026-03-31 10:25:48 +00:00
Call future listener on the same handler that created the controller
The direct executor is not the proper way to determine on what thread to run the
`Future.Listener` and the `MediaControllerCreationListener` because the listener
may call the controller passed as argument which must happen on the same thread
that built the controller. This change makes sure this is the case.
PiperOrigin-RevId: 490478587
(cherry picked from commit 68908be18d)
This commit is contained in:
parent
a98efd8b97
commit
0ba58cc634
1 changed files with 1 additions and 2 deletions
|
|
@ -29,7 +29,6 @@ import androidx.media3.common.util.Log;
|
|||
import androidx.media3.test.session.common.HandlerThreadTestRule;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import org.junit.rules.ExternalResource;
|
||||
|
|
@ -206,7 +205,7 @@ public final class MediaControllerTestRule extends ExternalResource {
|
|||
controllerCreationListener.onCreated(mediaController);
|
||||
}
|
||||
},
|
||||
MoreExecutors.directExecutor());
|
||||
handlerThreadTestRule.getHandler()::post);
|
||||
}
|
||||
return future.get(timeoutMs, MILLISECONDS);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue