Merge "Ignore transfer to an unknown route" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e3767bdaae
@@ -342,7 +342,14 @@ public final class MediaRouter2Manager {
|
||||
Objects.requireNonNull(sessionInfo, "sessionInfo must not be null");
|
||||
Objects.requireNonNull(route, "route must not be null");
|
||||
|
||||
//TODO(b/157875504): Ignore unknown route.
|
||||
synchronized (mRoutesLock) {
|
||||
if (!mRoutes.containsKey(route.getId())) {
|
||||
Log.w(TAG, "transfer: Ignoring an unknown route id=" + route.getId());
|
||||
notifyTransferFailed(sessionInfo, route);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (sessionInfo.getTransferableRoutes().contains(route.getId())) {
|
||||
transferToRoute(sessionInfo, route);
|
||||
} else {
|
||||
@@ -581,7 +588,7 @@ public final class MediaRouter2Manager {
|
||||
public List<MediaRoute2Info> getSelectedRoutes(@NonNull RoutingSessionInfo sessionInfo) {
|
||||
Objects.requireNonNull(sessionInfo, "sessionInfo must not be null");
|
||||
|
||||
synchronized (sLock) {
|
||||
synchronized (mRoutesLock) {
|
||||
return sessionInfo.getSelectedRoutes().stream().map(mRoutes::get)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
@@ -597,7 +604,7 @@ public final class MediaRouter2Manager {
|
||||
|
||||
List<String> selectedRouteIds = sessionInfo.getSelectedRoutes();
|
||||
|
||||
synchronized (sLock) {
|
||||
synchronized (mRoutesLock) {
|
||||
return sessionInfo.getSelectableRoutes().stream()
|
||||
.filter(routeId -> !selectedRouteIds.contains(routeId))
|
||||
.map(mRoutes::get)
|
||||
@@ -615,7 +622,7 @@ public final class MediaRouter2Manager {
|
||||
|
||||
List<String> selectedRouteIds = sessionInfo.getSelectedRoutes();
|
||||
|
||||
synchronized (sLock) {
|
||||
synchronized (mRoutesLock) {
|
||||
return sessionInfo.getDeselectableRoutes().stream()
|
||||
.filter(routeId -> selectedRouteIds.contains(routeId))
|
||||
.map(mRoutes::get)
|
||||
|
||||
Reference in New Issue
Block a user