The main objective of this CL is to enable selecting BT device.
For that it updates MRM and SystemMediaRoute2Provider such that
- MRM.getRoutingControllers() returns a list including the system session
- SystemMediaRoute2Provider marks routes as "transferable"
- SystemMediaRoute2Provider sets provider id correctly
- SystemMediaRoute2Provider handles transferToRoute()
Bug: 147979868
Bug: 147122575
Test: atest mediaroutertest
&& manually selecting phone / bt devices from output switcher
Change-Id: I2e2032fd6677f79b9f864c313c40846daa87f113
This CL introduces RoutingController into MediaRouter2Manager
to enable it to control remote routing sessions.
Tests are also revised according to MRM changes.
Bug: 147787194
Test: atest mediaroutertest
Change-Id: Id4ab61fcb690fccac42df049e1fb74d89bcf3d6a
This CL renames following classes:
- RouteSessionInfo to RoutingSessionInfo
- RouteSessionController to RoutingController
Bug: 147527788
Test: atest mediaroutertest
Change-Id: I6d6c997d9119b668bd8879f2f5a8ca266ddbeccc
This CL covers APIs for discovering routes published by
MediaRoute2ProviderService.
Bug: 147402721
Test: atest mediaroutertest
Change-Id: I978a6489ae1bcfcd6bb427d4a939c49ff3420e2d
Providers are notified of change of discovery request
to respond properly.
Whenever a media app registers a callback it should provide
discovery request which includes route types and a way to scan.
MediaRouter combines all discovery request into a single request
and sends it to the media router service, which combines requests
from all clients and notifies provider of the combined request.
This CL also changes control category as route type.
Bug: 139033746
Test: atest mediaroutertest
Change-Id: I5ca37683ae0761ff587c1c920e32fd6d768a2cd3
This CL makes MediaRoute2Info#getId() return a unique ID when it is
called for routes which were get via MediaRouter2 / MediaRouter2Manager.
Acordingly, this CL removes MediaRoute2Info#getUniqueId().
Bug: 147338138
Test: atest mediaroutertest
Change-Id: Id2960c45e9cabde7bc5b57554608aebe03fcbe04
Each MediaRoute2Provider instance saves session infos
published by MediaRoute2ProviderService.
For that, MediaRouter2ProviderService notifies provider info and session
infos simultaneously and to minimize the number of binder calls,
schedulePublishState is added into MediaRoute2ProviderService.
The saved sessions can be obtained by calling MRM.getActiveSessions().
Test: atest mediaroutertest
&& manually call MRM.getActiveSessions()
Change-Id: I6938105f8d154ad9542f7e7c6210a451ee4ae90d
A unique request id can be used to identify each request
and the client of the request.
Test: atest mediaroutertest
Change-Id: I3234eaf0c4d398a47d412bc13ce711165d87e2db
This CL adds session-related apis into MediaRouteProvider
so MediaRouterService can call them.
This CL also removes methods related to "route selection".
Test: atest mediaroutertest
Change-Id: I68c2cde91d305315e95e5d9ab1d6d23459c28c9d
This method will list up routes that are actively used
by some applications.
Once dynamic grouping is implemented, it will return
sessions instead of routes.
Bug: 146604082
Test: atest mediaroutertest
Change-Id: Ic013d3c2ded47b7ebca0b4cf99d2a7ea75045dc1
MR2.getRoutes() right after MR2.setControlCategories() will return
routes filtered with new control categories.
In order to call backs properly, mHandledControlCategories is added,
which is changed only in handler.
getRoutes() is also changed such that routes are evaluated lazily
to avoid unnecessary evaluation.
CallbackRecords are implemented in a way that doesn't acquire explicit
lock.
Callbacks are modified so that newly register callbacks no longer
get notified existing routes.
Also, fixed test according to changes of MR2 and MRM.
Bug: 145488462
Test: atest mediaroutertest (5 times)
Change-Id: I9ba3d74bcf423d801249420d947f41eccb37d67a
This CL updates callbacks for MediaRouter2Manager such that
onRoutesAdded, onRoutesRemoved are added and onRoutesChanged is changed.
onControlCategories also is added to know when getAvailableRoutes() can
be called.
It also updated tests for that and add some helper methods to test
easily.
Test: atest mediaroutertest
Change-Id: I122ce8f8472e01284f13b8aec79e3b8e97fc712b
This CL revised callbacks for MediaRouter2 so that it gives
a list instead of a single route.
This will effectively reduce the number of invokings.
This CL also fixes binder call between media router service and media
router such that media router service notifies only changes of routes
instead of all provider information.
Following CLs will update manager callbacks as well.
Test: atest mediaroutertest
Change-Id: Ibbc23aa5f12f5450d44c81756e3fcefe3e0d7f4b
Add requestSetVolume and requestUpdateVolume into
MediaRouter2 and MediaRouter2Manager to enable users to control volume
of routes.
This CL also includes test cleanup for readability.
Bug: 142298160
Test: atest mediaroutertest
Change-Id: Iebb396c921517ec1a7677f90baa119ab647b5689
As with this CL, media apps can get the list of available routes using
MediaRouter2.getRoutes() or MediaRouter2.Callback.onRouteListChanged().
For that MediaRouterService notifies MediaRouter2 of providerinfos.
This CL also clarifies provider info notification logic.
1) When a new client or a new manager is registered, it will be
notified.
2) When a provider info is updated, it will be notified.
onRouteListChanged will be called for a newly registerd callback.
Fixed a bug that MediaRoute2ProviderProxy didn't report state update
when the provider is disonnected.
Test: atest mediaroutertest
Change-Id: I50f5c3cabce80e7fb0a1b5596883c35911d6f122
Now it uses mLock to synchronize mCallbackRecords, mControlCategories,
and mClient instead of enforcing main thread.
Also, check concurrency of MediaRouter2 and MediaRouter2Manager.
This CL also removes control category parameter from addCallback(registerCallback)
not to permit two callbacks in an application to have different control categories.
Function names are changed from add/remove callbacks to register/unregister callbacks
to follow the API guideline.
Test: atest mediaroutertest
Change-Id: I40f2bc45f7d108416182b68b4ae23127f8bb2eb4
This CL adds capability to media route 2 info, which can be used
to get available routes for each app, which set control categories.
The test for control category is changed to test getAvailableRoutes().
Test: atest mediaroutertest
Change-Id: If93d64f02b4868b5e04b737431291b18a52177de
Seamless transfer for a single provider case and two providers case
should be dealt with in different ways.
For a single provider case, the provider can handle transfer and returns
the result of transfer.
For multiple providers case, the media app handles the transfer.
This CL covers seamless transfer within a single provider.
If a user requests semless transfer in System UI, MR2Manager.selectRoute
should be called and this request is sent to MediaRoute2ProviderService
that can handle seamless transfer internally.
The new test, testSingleProviderSelect() in MediaRouterManagerTest tests the path for
seamless transfer and ensure transfer request is handled by a provider.
From this CL, we use packagename instead of uid to select app for seamless transfer.
This is required to handle unlaunched apps that don't have uid.
It would prevent to use media router 2 in a multi-user case, that will
be supported by another CL.
I also added onUnselectRoute in MediaRoute2ProviderService, which is
essential to notify a provider that a media app stopped casting.
Bug: 136775407
Test: atest mediaroutertest
Change-Id: Ie3d0e988a72eedea6036f465454e661c424a0495
With this, MediaRouter2Manager.Callback.onRouteSelected will be called properly.
This CL also adds provider id to MediaRoute2Info to distinguish routes
with the same id from different providers.
Test: atest mediaroutertest
Change-Id: If353a4decad489576a39b1a93c7d99c7fe238abe
Instead of extending MediaRouter, this CL introduce MediaRouter2 class.
This will prevent regression from chaing MediaRouter and we can easily
modify and test `new' features.
For MediaRouter2, IMediaRouter2Client is also added to differentiate the
previous router and the new one in MediaRouterService.
This CL also contains MediaRouter2.sendControlRequest which can be used
to manipulate media routes.
(It is temporarily being used to test MediaRouter2Manager callbacks.)
Bug: 132138073
Test: atest mediaroutertest (w/ mediarouteprovider installed)
Change-Id: I895fe456e38d437cec8e3ca9501cd7f105c5f4d6
Make onRouteAdded/Changed/Removed available in
MediaRouter2Manager.Callback
Currently onRouteAdded is only included in the test.
(onRouteRemoved is not called properly due to not handling removed
providers correctly).
Bug: 130875543
Test: atest mediaroutertest w/ mediarouteprovider installed
Change-Id: Idd1fdaeb9fcf1c4b8c2b7798c3ed62eeb044d2cb
With this CL, MediaRoute2ProviderService can update its provider info
and publish its routes.
MediaRouter2Manager.Callback.onProviderUpdated(info) is alao added to
confirm whether correct provider info is sent.
Also, renamed the AIDLs such as
IMediaRouter2ManagerClient -> IMediaRouter2Manager
IMediaRoute2Callback -> IMediaRoute2ProviderClient
and changed on** to notify** in AIDLs.
Logics related to selecting/unselecting will be coverd by following CLs.
Test: atest mediaroutertest (after atest mediarouteprovider)
Change-Id: I5b119fbd0622a9422d3edf720b85e296ac4a5694
This CL is a draft for supporting seamless transfer
MediaRouterManager is added to notify providers seamless transfer request.
It also adds MediaRouter.setControlCategories() to let application notify
their control categories and filter out irrelevant routes.
Test: atest mediaroutertest after installing mediarouteprovider.apk
Change-Id: I7446855271d27ffaad2e82dda133bed80b9f9630