AIDLize IAudioFlinger

This change removes all the manual parceling code used in the
IAudioFlinger interface. In order to reduce impact on existing client
and server code to a minimum, the IAudioFlinger interface is preserved
and a new translation layer between IAudioFlinger and its AIDL
counterpart, IAudioFlingerService, is introduced:
- AudioFlingerClientAdapter is for use on the client side. It wraps an
  IAudioFlingerService instance and presents an IAudioFlinger
  interface.
- AudioFlingerServerAdapter is for use on the server side. It wraps an
  IAudioFlinger instance and presents an IAudioFlingerService.

Argument conversion an error checking is performed rigorously in the
translation layer.

Test: Audio-related CTS tests from CtsMediaTestCases
Bug: 160253486
Change-Id: Ibe35317e449b0faa3ef5336bb30f669106978a31
diff --git a/include/media/MicrophoneInfo.h b/include/media/MicrophoneInfo.h
index e89401a..a5045b9 100644
--- a/include/media/MicrophoneInfo.h
+++ b/include/media/MicrophoneInfo.h
@@ -208,6 +208,21 @@
     int32_t mDirectionality;
 };
 
+// Conversion routines, according to AidlConversion.h conventions.
+inline ConversionResult<MicrophoneInfo>
+aidl2legacy_MicrophoneInfo(const media::MicrophoneInfoData& aidl) {
+    MicrophoneInfo legacy;
+    RETURN_IF_ERROR(legacy.readFromParcelable(aidl));
+    return legacy;
+}
+
+inline ConversionResult<media::MicrophoneInfoData>
+legacy2aidl_MicrophoneInfo(const MicrophoneInfo& legacy) {
+    media::MicrophoneInfoData aidl;
+    RETURN_IF_ERROR(legacy.writeToParcelable(&aidl));
+    return aidl;
+}
+
 } // namespace media
 } // namespace android