Clear routes when media router manager has no callback
This CL clears routes when the last callback of MediaRouter2Manager
is unregistered. By doing this, we can ensure
MediaRouter2Manager#getAvailableRoutes() returns correct routes
during at least a single callback is registered.
A test for the behavior is added as well.
This CL also fixed a bug that unregistering a callback from MediaRouter2
disconnects it when multiple callback is used.
Bug: 153515567
Test: atest mediaroutertest & cts test & manually
using MediaRouter2Demo and Sample OutputSwitcher to see
if forgotten BT device is correctly removed.
(w/o this CL forgotten BT device remains)
Change-Id: I31a5001115f1f163c8971bbd906516551b860252
4 files changed