MediaRouter: make setControlCategories synchronous

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
5 files changed