audiopolicy: Add more tests, fix issues found

Added tests that ensure correct initialization of APM.

Fixed issues:

  -- UB in VolumeCurvesForStream::volIndexToDb due to not
     checking that the pointer is non-null;

  -- AudioInputDescriptor::open and SwAudioOutputDescriptor::open
     were not checking that the returned IO handle is valid,
     this was causing an infinite loop in
     AudioPolicyManager::selectOutputForMusicEffects, added an
     assertion.

  -- Memory leak of VolumeCurves collection in APM.

Test: audiopolicy_tests
Change-Id: Ia4ecca1dd03b74d7f93720f042da05d5a0c74a6b
diff --git a/services/audiopolicy/tests/AudioPolicyTestClient.h b/services/audiopolicy/tests/AudioPolicyTestClient.h
index c4da98a..7e0450d 100644
--- a/services/audiopolicy/tests/AudioPolicyTestClient.h
+++ b/services/audiopolicy/tests/AudioPolicyTestClient.h
@@ -22,7 +22,7 @@
 class AudioPolicyTestClient : public AudioPolicyClientInterface
 {
 public:
-    virtual ~AudioPolicyTestClient() {}
+    virtual ~AudioPolicyTestClient() = default;
 
     // AudioPolicyClientInterface Implementation
     audio_module_handle_t loadHwModule(const char* /*name*/) override { return 0; }