Allow for late audio module discovery in APM

Extract code that loads hardware modules and fills out
mAvailable{Input|Output}Devices into a reusable function.
It is used both during APM initialization and on
receiving a notification that a new HAL service has
been discovered.

Bug: 149854039
Test: atest audiopolicy_tests
Change-Id: Ifb7f0b61b06a0609802e63dccb26f3472328ef48
diff --git a/services/audiopolicy/AudioPolicyInterface.h b/services/audiopolicy/AudioPolicyInterface.h
index 4d53be4..8d0e5db 100644
--- a/services/audiopolicy/AudioPolicyInterface.h
+++ b/services/audiopolicy/AudioPolicyInterface.h
@@ -83,6 +83,10 @@
     // configuration functions
     //
 
+    // Informs APM that new HAL modules are available. This typically happens
+    // due to registration of an audio HAL service.
+    virtual void onNewAudioModulesAvailable() = 0;
+
     // indicate a change in device connection status
     virtual status_t setDeviceConnectionState(audio_devices_t device,
                                               audio_policy_dev_state_t state,