Prevent ConcurrentModificationException

While dispatching a change to callbacks, if one of them removes itself
as part of the operation, it would cause a
ConcurrentModificationException (because it's in the same thread, so
it's re-entrant).

Prevent this by copying the list before dispatching.

Test: atest CastControllerImplTest
Fixes: 317700495
Flag: None

Change-Id: I8fed9957dd167437f3c3e9bde3ccbb48b0b4f6c3
21 files changed