Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91f0baa8 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

Utilities for managing event listeners from AudioService

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
parent 3ae8743e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment