PatchPanel: Cleanup and refactoring

  * Unified software patch endpoints management code.

  * Noticed that Patch::clearConnections is only called before
    getting rid of Patch instance, so there is no need
    to explicitly clear references to endpoints' Track and Thread.

  * Fixed out-of-memory handling when creating tracks for
    a software patch.

  * Factored out finding HAL Device by module handle.

Test: verify transitions to/from BT while playing media and making calls
Change-Id: If6459c477054d6dff60dfa13f2d99ee2d6e887ad
6 files changed