Loading media/java/android/media/MediaRoute2Info.java +20 −6 Original line number Diff line number Diff line Loading @@ -249,22 +249,36 @@ public final class MediaRoute2Info implements Parcelable { return mExtras; } /** * Returns if the route supports the specified control category * * @param controlCategory control category to consider * @return true if the route supports at the category */ public boolean supportsControlCategory(@NonNull String controlCategory) { Objects.requireNonNull(controlCategory, "control category must not be null"); for (String supportedCategory : getSupportedCategories()) { if (TextUtils.equals(controlCategory, supportedCategory)) { return true; } } return false; } //TODO: Move this if we re-define control category / selector things. /** * Returns true if the route supports at least one of the specified control categories * Returns if the route supports at least one of the specified control categories * * @param controlCategories the list of control categories to consider * @return true if the route supports at least one category */ public boolean supportsControlCategory(@NonNull Collection<String> controlCategories) { public boolean supportsControlCategories(@NonNull Collection<String> controlCategories) { Objects.requireNonNull(controlCategories, "control categories must not be null"); for (String controlCategory : controlCategories) { for (String supportedCategory : getSupportedCategories()) { if (TextUtils.equals(controlCategory, supportedCategory)) { if (supportsControlCategory(controlCategory)) { return true; } } } return false; } Loading media/java/android/media/MediaRouter2.java +6 −6 Original line number Diff line number Diff line Loading @@ -271,7 +271,7 @@ public class MediaRouter2 { List<MediaRoute2Info> filteredRoutes = new ArrayList<>(); for (MediaRoute2Info route : mRoutes.values()) { if (route.supportsControlCategory(mControlCategories)) { if (route.supportsControlCategories(mControlCategories)) { filteredRoutes.add(route); } } Loading Loading @@ -399,8 +399,8 @@ public class MediaRouter2 { mControlCategories = newControlCategories; for (MediaRoute2Info route : mRoutes.values()) { boolean preSupported = route.supportsControlCategory(prevControlCategories); boolean postSupported = route.supportsControlCategory(newControlCategories); boolean preSupported = route.supportsControlCategories(prevControlCategories); boolean postSupported = route.supportsControlCategories(newControlCategories); if (preSupported == postSupported) { continue; } Loading Loading @@ -430,7 +430,7 @@ public class MediaRouter2 { synchronized (sLock) { for (MediaRoute2Info route : routes) { mRoutes.put(route.getUniqueId(), route); if (route.supportsControlCategory(mControlCategories)) { if (route.supportsControlCategories(mControlCategories)) { addedRoutes.add(route); } } Loading @@ -446,7 +446,7 @@ public class MediaRouter2 { synchronized (sLock) { for (MediaRoute2Info route : routes) { mRoutes.remove(route.getUniqueId()); if (route.supportsControlCategory(mControlCategories)) { if (route.supportsControlCategories(mControlCategories)) { removedRoutes.add(route); } } Loading @@ -462,7 +462,7 @@ public class MediaRouter2 { synchronized (sLock) { for (MediaRoute2Info route : routes) { mRoutes.put(route.getUniqueId(), route); if (route.supportsControlCategory(mControlCategories)) { if (route.supportsControlCategories(mControlCategories)) { changedRoutes.add(route); } } Loading media/java/android/media/MediaRouter2Manager.java +1 −1 Original line number Diff line number Diff line Loading @@ -163,7 +163,7 @@ public class MediaRouter2Manager { List<MediaRoute2Info> routes = new ArrayList<>(); synchronized (mRoutesLock) { for (MediaRoute2Info route : mRoutes.values()) { if (route.supportsControlCategory(controlCategories)) { if (route.supportsControlCategories(controlCategories)) { routes.add(route); } } Loading Loading
media/java/android/media/MediaRoute2Info.java +20 −6 Original line number Diff line number Diff line Loading @@ -249,22 +249,36 @@ public final class MediaRoute2Info implements Parcelable { return mExtras; } /** * Returns if the route supports the specified control category * * @param controlCategory control category to consider * @return true if the route supports at the category */ public boolean supportsControlCategory(@NonNull String controlCategory) { Objects.requireNonNull(controlCategory, "control category must not be null"); for (String supportedCategory : getSupportedCategories()) { if (TextUtils.equals(controlCategory, supportedCategory)) { return true; } } return false; } //TODO: Move this if we re-define control category / selector things. /** * Returns true if the route supports at least one of the specified control categories * Returns if the route supports at least one of the specified control categories * * @param controlCategories the list of control categories to consider * @return true if the route supports at least one category */ public boolean supportsControlCategory(@NonNull Collection<String> controlCategories) { public boolean supportsControlCategories(@NonNull Collection<String> controlCategories) { Objects.requireNonNull(controlCategories, "control categories must not be null"); for (String controlCategory : controlCategories) { for (String supportedCategory : getSupportedCategories()) { if (TextUtils.equals(controlCategory, supportedCategory)) { if (supportsControlCategory(controlCategory)) { return true; } } } return false; } Loading
media/java/android/media/MediaRouter2.java +6 −6 Original line number Diff line number Diff line Loading @@ -271,7 +271,7 @@ public class MediaRouter2 { List<MediaRoute2Info> filteredRoutes = new ArrayList<>(); for (MediaRoute2Info route : mRoutes.values()) { if (route.supportsControlCategory(mControlCategories)) { if (route.supportsControlCategories(mControlCategories)) { filteredRoutes.add(route); } } Loading Loading @@ -399,8 +399,8 @@ public class MediaRouter2 { mControlCategories = newControlCategories; for (MediaRoute2Info route : mRoutes.values()) { boolean preSupported = route.supportsControlCategory(prevControlCategories); boolean postSupported = route.supportsControlCategory(newControlCategories); boolean preSupported = route.supportsControlCategories(prevControlCategories); boolean postSupported = route.supportsControlCategories(newControlCategories); if (preSupported == postSupported) { continue; } Loading Loading @@ -430,7 +430,7 @@ public class MediaRouter2 { synchronized (sLock) { for (MediaRoute2Info route : routes) { mRoutes.put(route.getUniqueId(), route); if (route.supportsControlCategory(mControlCategories)) { if (route.supportsControlCategories(mControlCategories)) { addedRoutes.add(route); } } Loading @@ -446,7 +446,7 @@ public class MediaRouter2 { synchronized (sLock) { for (MediaRoute2Info route : routes) { mRoutes.remove(route.getUniqueId()); if (route.supportsControlCategory(mControlCategories)) { if (route.supportsControlCategories(mControlCategories)) { removedRoutes.add(route); } } Loading @@ -462,7 +462,7 @@ public class MediaRouter2 { synchronized (sLock) { for (MediaRoute2Info route : routes) { mRoutes.put(route.getUniqueId(), route); if (route.supportsControlCategory(mControlCategories)) { if (route.supportsControlCategories(mControlCategories)) { changedRoutes.add(route); } } Loading
media/java/android/media/MediaRouter2Manager.java +1 −1 Original line number Diff line number Diff line Loading @@ -163,7 +163,7 @@ public class MediaRouter2Manager { List<MediaRoute2Info> routes = new ArrayList<>(); synchronized (mRoutesLock) { for (MediaRoute2Info route : mRoutes.values()) { if (route.supportsControlCategory(controlCategories)) { if (route.supportsControlCategories(controlCategories)) { routes.add(route); } } Loading