mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Session tests: Log when no controllers are connected
While debugging various session tests failure I found that sometimes this list was empty (e.g. when a controller had failed to connect, or hadn't finished connecting yet) - resulting in these methods being silent no-ops. I think it's basically never expected for there to be no controllers connected when these methods are invoked, so this logs at ERROR level to give a clue of what happened when looking at the test logcat. PiperOrigin-RevId: 564750969
This commit is contained in:
parent
e2882c051b
commit
320a45f7d6
1 changed files with 10 additions and 0 deletions
|
|
@ -454,6 +454,11 @@ public class MediaSessionProviderService extends Service {
|
||||||
() -> {
|
() -> {
|
||||||
MediaSession session = sessionMap.get(sessionId);
|
MediaSession session = sessionMap.get(sessionId);
|
||||||
List<ControllerInfo> controllerInfos = MediaTestUtils.getTestControllerInfos(session);
|
List<ControllerInfo> controllerInfos = MediaTestUtils.getTestControllerInfos(session);
|
||||||
|
if (controllerInfos.isEmpty()) {
|
||||||
|
Log.e(
|
||||||
|
TAG,
|
||||||
|
"No connected controllers to receive custom command. sessionId=" + sessionId);
|
||||||
|
}
|
||||||
for (ControllerInfo info : controllerInfos) {
|
for (ControllerInfo info : controllerInfos) {
|
||||||
session.sendCustomCommand(info, SessionCommand.CREATOR.fromBundle(command), args);
|
session.sendCustomCommand(info, SessionCommand.CREATOR.fromBundle(command), args);
|
||||||
}
|
}
|
||||||
|
|
@ -476,6 +481,11 @@ public class MediaSessionProviderService extends Service {
|
||||||
() -> {
|
() -> {
|
||||||
MediaSession session = sessionMap.get(sessionId);
|
MediaSession session = sessionMap.get(sessionId);
|
||||||
List<ControllerInfo> controllerInfos = MediaTestUtils.getTestControllerInfos(session);
|
List<ControllerInfo> controllerInfos = MediaTestUtils.getTestControllerInfos(session);
|
||||||
|
if (controllerInfos.isEmpty()) {
|
||||||
|
Log.e(
|
||||||
|
TAG,
|
||||||
|
"No connected controllers to receive available commands. sessionId=" + sessionId);
|
||||||
|
}
|
||||||
for (ControllerInfo info : controllerInfos) {
|
for (ControllerInfo info : controllerInfos) {
|
||||||
session.setAvailableCommands(
|
session.setAvailableCommands(
|
||||||
info,
|
info,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue