Send features first and then routes when registering MR2Manager
When a new MediaRouter2Manager is registered, system service first sends the routes, and then sends the preferred features of all media apps. This order was not a problem for MediaRouter2Manager, but it is a problem when creating system MediaRouter2. Here's why: As a background, system MR2 is for one media app, while MR2Manager is for all media apps. MR2 creates MR2Manager internally to communicate with the system media router service, and it 'filters' the information that are useful for the target app. When system MR2 is created, the system service sends the routes and preferred features of all media apps to the internal MR2Manager. When the routes arrive, system MR2 checks whether the routes match the media app's features. If there is no matching routes, the onRoutesAdded() callback is not called. However, since the features come AFTER the routes, the feature is yet empty at the point when routes arrive. This makes the filtered routes also as empty, in turn the onRoutesAdded() callback is never called for the initial routes. Bug: 192454011 Test: atest com.android.mediaroutertest.MediaRouter2ManagerTest atest android.media.cts.SystemMediaRouter2Test Change-Id: I2f6101ff86ec6501e8364c75a41b58f2a04ee212
Loading
Please register or sign in to comment