Audio HAL: fixes for issues discovered after client conversion

Several issues addressed:

  -- added IDevice.supportsAudioPatches to query whether
     create/removeAudioPatch is actually supported by HAL;

  -- IStreamOutCallback proxy needs to be owned by IStreamOut
     implementation. In order for the client to reset the reference,
     added method IStreamOut.clearCallback;

  -- IDevice.open{Input|Output}Stream need to return a "suggested" audio
     config from HAL;

  -- code for converting between system/audio.h and HIDL
     data structures has been moved to
     android.hardware.audio.common@2.0-util library for reuse;

  -- added a workaround for the issue with QC effects HAL trying to write
     into the input parameters buffer, which is r/o by Binder design.

Bug: 30222631
Change-Id: I64af24d79c12d6ac3b0f87d085a821913e29237b
Test: tried using with WIP HIDL client on N5X
diff --git a/audio/2.0/default/StreamOut.h b/audio/2.0/default/StreamOut.h
index ca33b2d..b76214a 100644
--- a/audio/2.0/default/StreamOut.h
+++ b/audio/2.0/default/StreamOut.h
@@ -83,6 +83,7 @@
     Return<void> getRenderPosition(getRenderPosition_cb _hidl_cb)  override;
     Return<void> getNextWriteTimestamp(getNextWriteTimestamp_cb _hidl_cb)  override;
     Return<Result> setCallback(const sp<IStreamOutCallback>& callback)  override;
+    Return<Result> clearCallback()  override;
     Return<void> supportsPauseAndResume(supportsPauseAndResume_cb _hidl_cb)  override;
     Return<Result> pause()  override;
     Return<Result> resume()  override;
@@ -95,9 +96,7 @@
     audio_hw_device_t *mDevice;
     audio_stream_out_t *mStream;
     sp<Stream> mStreamCommon;
-    // Do not store sp<> to avoid creating a reference loop if the entity that holds
-    // onto the output stream owns or implements the callback.
-    wp<IStreamOutCallback> mCallback;
+    sp<IStreamOutCallback> mCallback;
 
     virtual ~StreamOut();