service: Refactor IPC and singletons

This CL makes the following major refactors to the system service code:

  1. A new global Daemon object is introduced, which manages the main event
  loop and all other subsystems of the Bluetooth daemon. This object is the only
  singleton class and initializes and owns everything else.

  2. Everything that was a singleton and/or was initialized directly in main.cpp
  is now a) no longer a singleton; b) now initialized and owned by the global
  Daemon instance.

  3. All of the Chromecast specific IPC code has been moved into the ipc/
  subdirectory. This directory is meant for everything that is IPC related,
  paving the way for enabling multiple IPC systems (domain-socket based, Binder
  based, etc) simultaneously in the future. Main changes to the Chromecast IPC
  code are:

      a. All files and classes have been renamed to reflect the
      UNIX-domain-socket-specific nature of the IPC mechanism.

      b. The code no longer hogs up the main thread while listening for
      connections. All of this logic has been moved to a dedicated thread with
      its own MessageLoopForIO, so that it can use the built-in mechanisms for
      polling on client sockets in the future.

Bug: 22532180
Change-Id: I42db06dba6cff3bc8f8101a1ea2b6787a69409fd
17 files changed