Fix MediaRouter bugs
Fix a bug where a newly added group had no supported types at the time
of callback dispatch, meaning that no registered callbacks would be
invoked.
Fix a bug where subscribed type flags were not updated properly when
re-adding a callback for new types.
Change-Id: I7d9f11b363ebdca692786cec1d432600946e5721
diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java
index 8a9a764..357bf4e 100644
--- a/media/java/android/media/MediaRouter.java
+++ b/media/java/android/media/MediaRouter.java
@@ -240,7 +240,7 @@
for (int i = 0; i < count; i++) {
final CallbackInfo info = sStatic.mCallbacks.get(i);
if (info.cb == cb) {
- info.type &= types;
+ info.type |= types;
return;
}
}
@@ -342,6 +342,7 @@
if (cat.isGroupable() && !(info instanceof RouteGroup)) {
// Enforce that any added route in a groupable category must be in a group.
final RouteGroup group = new RouteGroup(info.getCategory());
+ group.mSupportedTypes = info.mSupportedTypes;
sStatic.mRoutes.add(group);
dispatchRouteAdded(group);
group.addRoute(info);