Part 1/2: individual static helpers for managing listeners,
more to come to encompass all functionality inside
one class.
Implement utility classes for:
- storing information about a listener containing callback
and Executor to use (see ListenerInfo class)
- managing listeners in a list: remove / retrieve / check
presence of a listener in a given list (see
removeListener / getListenerInfo / hasListener methods)
- managing listeners in a list, while managing the
lifecycle of the list, and associated stub for receiving
events (for instance for AudioManager to receive events
from AudioService), including lazy initialization of
the listener list and stub to minimize memory usage
The utility class is used to refactor the management of
the following listeners:
Spatializer.OnSpatializerStateChangedListener
Spatializer.OnHeadTrackingModeChangedListener
AudioManager.OnModeChangedListener
AudioManager.OnCommunicationDeviceChangedListener
Bug: 206040617
Test: atest AudioModeListenerTest AudioCommunicationDeviceTest \
SpatializerTest
Change-Id: Ia37f1b19603282e0f14e6e5afc1226891e3c1d78