Add audio.common types AIDL definition

This is a subset of the types defined in
hardware/interfaces/audio/common/2.0/types.hal.
Specifically, the subset that sound trigger depends on.
These files were auto-generated using the hidl2aidl tool, and
later manually edited to workaround some missing features in
the conversion tool or AIDL (mostly around enum support).

Change-Id: I1c0ffe8a2ebaf09eb4516beaaf4b6fc80985bfc9
Bug: 142070343
diff --git a/media/Android.bp b/media/Android.bp
index 1912930..b77c701 100644
--- a/media/Android.bp
+++ b/media/Android.bp
@@ -109,3 +109,27 @@
     srcs: [":framework-media-annotation-srcs"],
     installable: false,
 }
+
+aidl_interface {
+    name: "audio_common-aidl",
+    local_include_dir: "java",
+    srcs: [
+        "java/android/media/audio/common/AudioChannelMask.aidl",
+        "java/android/media/audio/common/AudioConfig.aidl",
+        "java/android/media/audio/common/AudioFormat.aidl",
+        "java/android/media/audio/common/AudioOffloadInfo.aidl",
+        "java/android/media/audio/common/AudioStreamType.aidl",
+        "java/android/media/audio/common/AudioUsage.aidl",
+    ],
+    backend:
+    {
+        cpp: {
+            enabled: true,
+        },
+        java: {
+            // Already generated as part of the entire media java library.
+            enabled: false,
+        },
+    },
+}
+
diff --git a/media/java/android/media/audio/common/AudioChannelMask.aidl b/media/java/android/media/audio/common/AudioChannelMask.aidl
new file mode 100644
index 0000000..b9b08e6
--- /dev/null
+++ b/media/java/android/media/audio/common/AudioChannelMask.aidl
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ // This file has been semi-automatically generated using hidl2aidl from its counterpart in
+ // hardware/interfaces/audio/common/5.0/types.hal
+
+package android.media.audio.common;
+
+/**
+ * A channel mask per se only defines the presence or absence of a channel, not
+ * the order.
+ *
+ * The channel order convention is that channels are interleaved in order from
+ * least significant channel mask bit to most significant channel mask bit,
+ * with unused bits skipped. For example for stereo, LEFT would be first,
+ * followed by RIGHT.
+ * Any exceptions to this convention are noted at the appropriate API.
+ *
+ * AudioChannelMask is an opaque type and its internal layout should not be
+ * assumed as it may change in the future.  Instead, always use functions
+ * to examine it.
+ *
+ * These are the current representations:
+ *
+ *   REPRESENTATION_POSITION
+ *     is a channel mask representation for position assignment.  Each low-order
+ *     bit corresponds to the spatial position of a transducer (output), or
+ *     interpretation of channel (input).  The user of a channel mask needs to
+ *     know the context of whether it is for output or input.  The constants
+ *     OUT_* or IN_* apply to the bits portion.  It is not permitted for no bits
+ *     to be set.
+ *
+ *   REPRESENTATION_INDEX
+ *     is a channel mask representation for index assignment.  Each low-order
+ *     bit corresponds to a selected channel.  There is no platform
+ *     interpretation of the various bits.  There is no concept of output or
+ *     input.  It is not permitted for no bits to be set.
+ *
+ * All other representations are reserved for future use.
+ *
+ * Warning: current representation distinguishes between input and output, but
+ * this will not the be case in future revisions of the platform. Wherever there
+ * is an ambiguity between input and output that is currently resolved by
+ * checking the channel mask, the implementer should look for ways to fix it
+ * with additional information outside of the mask.
+ *
+ * {@hide}
+ */
+@Backing(type="int")
+enum AudioChannelMask {
+    /**
+     * must be 0 for compatibility
+     */
+    REPRESENTATION_POSITION = 0,
+    /**
+     * 1 is reserved for future use
+     */
+    REPRESENTATION_INDEX = 2,
+    /**
+     * 3 is reserved for future use
+     *
+     *
+     * These can be a complete value of AudioChannelMask
+     */
+    NONE = 0x0,
+    INVALID = 0xC0000000,
+    /**
+     * These can be the bits portion of an AudioChannelMask
+     * with representation REPRESENTATION_POSITION.
+     *
+     *
+     * output channels
+     */
+    OUT_FRONT_LEFT = 0x1,
+    OUT_FRONT_RIGHT = 0x2,
+    OUT_FRONT_CENTER = 0x4,
+    OUT_LOW_FREQUENCY = 0x8,
+    OUT_BACK_LEFT = 0x10,
+    OUT_BACK_RIGHT = 0x20,
+    OUT_FRONT_LEFT_OF_CENTER = 0x40,
+    OUT_FRONT_RIGHT_OF_CENTER = 0x80,
+    OUT_BACK_CENTER = 0x100,
+    OUT_SIDE_LEFT = 0x200,
+    OUT_SIDE_RIGHT = 0x400,
+    OUT_TOP_CENTER = 0x800,
+    OUT_TOP_FRONT_LEFT = 0x1000,
+    OUT_TOP_FRONT_CENTER = 0x2000,
+    OUT_TOP_FRONT_RIGHT = 0x4000,
+    OUT_TOP_BACK_LEFT = 0x8000,
+    OUT_TOP_BACK_CENTER = 0x10000,
+    OUT_TOP_BACK_RIGHT = 0x20000,
+    OUT_TOP_SIDE_LEFT = 0x40000,
+    OUT_TOP_SIDE_RIGHT = 0x80000,
+    /**
+     * Haptic channel characteristics are specific to a device and
+     * only used to play device specific resources (eg: ringtones).
+     * The HAL can freely map A and B to haptic controllers, the
+     * framework shall not interpret those values and forward them
+     * from the device audio assets.
+     */
+    OUT_HAPTIC_A = 0x20000000,
+    OUT_HAPTIC_B = 0x10000000,
+// TODO(ytai): Aliases not currently supported in AIDL - can inline the values.
+//    OUT_MONO = OUT_FRONT_LEFT,
+//    OUT_STEREO = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT),
+//    OUT_2POINT1 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_LOW_FREQUENCY),
+//    OUT_2POINT0POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT),
+//    OUT_2POINT1POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY),
+//    OUT_3POINT0POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT),
+//    OUT_3POINT1POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY),
+//    OUT_QUAD = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_BACK_LEFT | OUT_BACK_RIGHT),
+//    OUT_QUAD_BACK = OUT_QUAD,
+//    /**
+//     * like OUT_QUAD_BACK with *_SIDE_* instead of *_BACK_*
+//     */
+//    OUT_QUAD_SIDE = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT),
+//    OUT_SURROUND = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_BACK_CENTER),
+//    OUT_PENTA = (OUT_QUAD | OUT_FRONT_CENTER),
+//    OUT_5POINT1 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT),
+//    OUT_5POINT1_BACK = OUT_5POINT1,
+//    /**
+//     * like OUT_5POINT1_BACK with *_SIDE_* instead of *_BACK_*
+//     */
+//    OUT_5POINT1_SIDE = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_SIDE_LEFT | OUT_SIDE_RIGHT),
+//    OUT_5POINT1POINT2 = (OUT_5POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT),
+//    OUT_5POINT1POINT4 = (OUT_5POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT),
+//    OUT_6POINT1 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_BACK_CENTER),
+//    /**
+//     * matches the correct AudioFormat.CHANNEL_OUT_7POINT1_SURROUND
+//     */
+//    OUT_7POINT1 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT),
+//    OUT_7POINT1POINT2 = (OUT_7POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT),
+//    OUT_7POINT1POINT4 = (OUT_7POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT),
+//    OUT_MONO_HAPTIC_A = (OUT_FRONT_LEFT | OUT_HAPTIC_A),
+//    OUT_STEREO_HAPTIC_A = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_HAPTIC_A),
+//    OUT_HAPTIC_AB = (OUT_HAPTIC_A | OUT_HAPTIC_B),
+//    OUT_MONO_HAPTIC_AB = (OUT_FRONT_LEFT | OUT_HAPTIC_A | OUT_HAPTIC_B),
+//    OUT_STEREO_HAPTIC_AB = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_HAPTIC_A | OUT_HAPTIC_B),
+    /**
+     * These are bits only, not complete values
+     *
+     *
+     * input channels
+     */
+    IN_LEFT = 0x4,
+    IN_RIGHT = 0x8,
+    IN_FRONT = 0x10,
+    IN_BACK = 0x20,
+    IN_LEFT_PROCESSED = 0x40,
+    IN_RIGHT_PROCESSED = 0x80,
+    IN_FRONT_PROCESSED = 0x100,
+    IN_BACK_PROCESSED = 0x200,
+    IN_PRESSURE = 0x400,
+    IN_X_AXIS = 0x800,
+    IN_Y_AXIS = 0x1000,
+    IN_Z_AXIS = 0x2000,
+    IN_BACK_LEFT = 0x10000,
+    IN_BACK_RIGHT = 0x20000,
+    IN_CENTER = 0x40000,
+    IN_LOW_FREQUENCY = 0x100000,
+    IN_TOP_LEFT = 0x200000,
+    IN_TOP_RIGHT = 0x400000,
+    IN_VOICE_UPLINK = 0x4000,
+    IN_VOICE_DNLINK = 0x8000,
+// TODO(ytai): Aliases not currently supported in AIDL - can inline the values.
+//    IN_MONO = IN_FRONT,
+//    IN_STEREO = (IN_LEFT | IN_RIGHT),
+//    IN_FRONT_BACK = (IN_FRONT | IN_BACK),
+//    IN_6 = (IN_LEFT | IN_RIGHT | IN_FRONT | IN_BACK | IN_LEFT_PROCESSED | IN_RIGHT_PROCESSED),
+//    IN_2POINT0POINT2 = (IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT),
+//    IN_2POINT1POINT2 = (IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY),
+//    IN_3POINT0POINT2 = (IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT),
+//    IN_3POINT1POINT2 = (IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY),
+//    IN_5POINT1 = (IN_LEFT | IN_CENTER | IN_RIGHT | IN_BACK_LEFT | IN_BACK_RIGHT | IN_LOW_FREQUENCY),
+//    IN_VOICE_UPLINK_MONO = (IN_VOICE_UPLINK | IN_MONO),
+//    IN_VOICE_DNLINK_MONO = (IN_VOICE_DNLINK | IN_MONO),
+//    IN_VOICE_CALL_MONO = (IN_VOICE_UPLINK_MONO | IN_VOICE_DNLINK_MONO),
+//    COUNT_MAX = 30,
+//    INDEX_HDR = REPRESENTATION_INDEX << COUNT_MAX,
+//    INDEX_MASK_1 = INDEX_HDR | ((1 << 1) - 1),
+//    INDEX_MASK_2 = INDEX_HDR | ((1 << 2) - 1),
+//    INDEX_MASK_3 = INDEX_HDR | ((1 << 3) - 1),
+//    INDEX_MASK_4 = INDEX_HDR | ((1 << 4) - 1),
+//    INDEX_MASK_5 = INDEX_HDR | ((1 << 5) - 1),
+//    INDEX_MASK_6 = INDEX_HDR | ((1 << 6) - 1),
+//    INDEX_MASK_7 = INDEX_HDR | ((1 << 7) - 1),
+//    INDEX_MASK_8 = INDEX_HDR | ((1 << 8) - 1),
+//    INDEX_MASK_9 = INDEX_HDR | ((1 << 9) - 1),
+//    INDEX_MASK_10 = INDEX_HDR | ((1 << 10) - 1),
+//    INDEX_MASK_11 = INDEX_HDR | ((1 << 11) - 1),
+//    INDEX_MASK_12 = INDEX_HDR | ((1 << 12) - 1),
+//    INDEX_MASK_13 = INDEX_HDR | ((1 << 13) - 1),
+//    INDEX_MASK_14 = INDEX_HDR | ((1 << 14) - 1),
+//    INDEX_MASK_15 = INDEX_HDR | ((1 << 15) - 1),
+//    INDEX_MASK_16 = INDEX_HDR | ((1 << 16) - 1),
+//    INDEX_MASK_17 = INDEX_HDR | ((1 << 17) - 1),
+//    INDEX_MASK_18 = INDEX_HDR | ((1 << 18) - 1),
+//    INDEX_MASK_19 = INDEX_HDR | ((1 << 19) - 1),
+//    INDEX_MASK_20 = INDEX_HDR | ((1 << 20) - 1),
+//    INDEX_MASK_21 = INDEX_HDR | ((1 << 21) - 1),
+//    INDEX_MASK_22 = INDEX_HDR | ((1 << 22) - 1),
+//    INDEX_MASK_23 = INDEX_HDR | ((1 << 23) - 1),
+//    INDEX_MASK_24 = INDEX_HDR | ((1 << 24) - 1),
+}
diff --git a/media/java/android/media/audio/common/AudioConfig.aidl b/media/java/android/media/audio/common/AudioConfig.aidl
new file mode 100644
index 0000000..50dd796
--- /dev/null
+++ b/media/java/android/media/audio/common/AudioConfig.aidl
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ // This file has been semi-automatically generated using hidl2aidl from its counterpart in
+ // hardware/interfaces/audio/common/5.0/types.hal
+
+package android.media.audio.common;
+
+import android.media.audio.common.AudioFormat;
+import android.media.audio.common.AudioOffloadInfo;
+
+/**
+ * Commonly used audio stream configuration parameters.
+ *
+ * {@hide}
+ */
+parcelable AudioConfig {
+    int sampleRateHz;
+    int channelMask;
+    AudioFormat format;
+    AudioOffloadInfo offloadInfo;
+    long frameCount;
+}
diff --git a/media/java/android/media/audio/common/AudioFormat.aidl b/media/java/android/media/audio/common/AudioFormat.aidl
new file mode 100644
index 0000000..aadc8e2
--- /dev/null
+++ b/media/java/android/media/audio/common/AudioFormat.aidl
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ // This file has been semi-automatically generated using hidl2aidl from its counterpart in
+ // hardware/interfaces/audio/common/5.0/types.hal
+
+package android.media.audio.common;
+
+/**
+ * Audio format  is a 32-bit word that consists of:
+ *   main format field (upper 8 bits)
+ *   sub format field (lower 24 bits).
+ *
+ * The main format indicates the main codec type. The sub format field indicates
+ * options and parameters for each format. The sub format is mainly used for
+ * record to indicate for instance the requested bitrate or profile.  It can
+ * also be used for certain formats to give informations not present in the
+ * encoded audio stream (e.g. octet alignement for AMR).
+ *
+ * {@hide}
+ */
+@Backing(type="int")
+enum AudioFormat {
+   INVALID = 0xFFFFFFFF,
+   DEFAULT = 0,
+   PCM = 0x00000000,
+   MP3 = 0x01000000,
+   AMR_NB = 0x02000000,
+   AMR_WB = 0x03000000,
+   AAC = 0x04000000,
+   /**
+    * Deprecated, Use AAC_HE_V1
+    */
+   HE_AAC_V1 = 0x05000000,
+   /**
+    * Deprecated, Use AAC_HE_V2
+    */
+   HE_AAC_V2 = 0x06000000,
+   VORBIS = 0x07000000,
+   OPUS = 0x08000000,
+   AC3 = 0x09000000,
+   E_AC3 = 0x0A000000,
+   DTS = 0x0B000000,
+   DTS_HD = 0x0C000000,
+   /**
+    * IEC61937 is encoded audio wrapped in 16-bit PCM.
+    */
+   IEC61937 = 0x0D000000,
+   DOLBY_TRUEHD = 0x0E000000,
+   EVRC = 0x10000000,
+   EVRCB = 0x11000000,
+   EVRCWB = 0x12000000,
+   EVRCNW = 0x13000000,
+   AAC_ADIF = 0x14000000,
+   WMA = 0x15000000,
+   WMA_PRO = 0x16000000,
+   AMR_WB_PLUS = 0x17000000,
+   MP2 = 0x18000000,
+   QCELP = 0x19000000,
+   DSD = 0x1A000000,
+   FLAC = 0x1B000000,
+   ALAC = 0x1C000000,
+   APE = 0x1D000000,
+   AAC_ADTS = 0x1E000000,
+   SBC = 0x1F000000,
+   APTX = 0x20000000,
+   APTX_HD = 0x21000000,
+   AC4 = 0x22000000,
+   LDAC = 0x23000000,
+   /**
+    * Dolby Metadata-enhanced Audio Transmission
+    */
+   MAT = 0x24000000,
+   AAC_LATM = 0x25000000,
+   CELT = 0x26000000,
+   APTX_ADAPTIVE = 0x27000000,
+   LHDC = 0x28000000,
+   LHDC_LL = 0x29000000,
+   APTX_TWSP = 0x2A000000,
+   /**
+    * Deprecated
+    */
+   MAIN_MASK = 0xFF000000,
+   SUB_MASK = 0x00FFFFFF,
+   /**
+    * Subformats
+    */
+   PCM_SUB_16_BIT = 0x1,
+   PCM_SUB_8_BIT = 0x2,
+   PCM_SUB_32_BIT = 0x3,
+   PCM_SUB_8_24_BIT = 0x4,
+   PCM_SUB_FLOAT = 0x5,
+   PCM_SUB_24_BIT_PACKED = 0x6,
+   MP3_SUB_NONE = 0x0,
+   AMR_SUB_NONE = 0x0,
+   AAC_SUB_MAIN = 0x1,
+   AAC_SUB_LC = 0x2,
+   AAC_SUB_SSR = 0x4,
+   AAC_SUB_LTP = 0x8,
+   AAC_SUB_HE_V1 = 0x10,
+   AAC_SUB_SCALABLE = 0x20,
+   AAC_SUB_ERLC = 0x40,
+   AAC_SUB_LD = 0x80,
+   AAC_SUB_HE_V2 = 0x100,
+   AAC_SUB_ELD = 0x200,
+   AAC_SUB_XHE = 0x300,
+   VORBIS_SUB_NONE = 0x0,
+   E_AC3_SUB_JOC = 0x1,
+   MAT_SUB_1_0 = 0x1,
+   MAT_SUB_2_0 = 0x2,
+   MAT_SUB_2_1 = 0x3,
+// TODO(ytai): Aliases not currently supported in AIDL - can inline the values.
+//   /**
+//    * Aliases
+//    *
+//    *
+//    * note != AudioFormat.ENCODING_PCM_16BIT
+//    */
+//   PCM_16_BIT = (PCM | PCM_SUB_16_BIT),
+//   /**
+//    * note != AudioFormat.ENCODING_PCM_8BIT
+//    */
+//   PCM_8_BIT = (PCM | PCM_SUB_8_BIT),
+//   PCM_32_BIT = (PCM | PCM_SUB_32_BIT),
+//   PCM_8_24_BIT = (PCM | PCM_SUB_8_24_BIT),
+//   PCM_FLOAT = (PCM | PCM_SUB_FLOAT),
+//   PCM_24_BIT_PACKED = (PCM | PCM_SUB_24_BIT_PACKED),
+//   AAC_MAIN = (AAC | AAC_SUB_MAIN),
+//   AAC_LC = (AAC | AAC_SUB_LC),
+//   AAC_SSR = (AAC | AAC_SUB_SSR),
+//   AAC_LTP = (AAC | AAC_SUB_LTP),
+//   AAC_HE_V1 = (AAC | AAC_SUB_HE_V1),
+//   AAC_SCALABLE = (AAC | AAC_SUB_SCALABLE),
+//   AAC_ERLC = (AAC | AAC_SUB_ERLC),
+//   AAC_LD = (AAC | AAC_SUB_LD),
+//   AAC_HE_V2 = (AAC | AAC_SUB_HE_V2),
+//   AAC_ELD = (AAC | AAC_SUB_ELD),
+//   AAC_XHE = (AAC | AAC_SUB_XHE),
+//   AAC_ADTS_MAIN = (AAC_ADTS | AAC_SUB_MAIN),
+//   AAC_ADTS_LC = (AAC_ADTS | AAC_SUB_LC),
+//   AAC_ADTS_SSR = (AAC_ADTS | AAC_SUB_SSR),
+//   AAC_ADTS_LTP = (AAC_ADTS | AAC_SUB_LTP),
+//   AAC_ADTS_HE_V1 = (AAC_ADTS | AAC_SUB_HE_V1),
+//   AAC_ADTS_SCALABLE = (AAC_ADTS | AAC_SUB_SCALABLE),
+//   AAC_ADTS_ERLC = (AAC_ADTS | AAC_SUB_ERLC),
+//   AAC_ADTS_LD = (AAC_ADTS | AAC_SUB_LD),
+//   AAC_ADTS_HE_V2 = (AAC_ADTS | AAC_SUB_HE_V2),
+//   AAC_ADTS_ELD = (AAC_ADTS | AAC_SUB_ELD),
+//   AAC_ADTS_XHE = (AAC_ADTS | AAC_SUB_XHE),
+//   E_AC3_JOC = (E_AC3 | E_AC3_SUB_JOC),
+//   MAT_1_0 = (MAT | MAT_SUB_1_0),
+//   MAT_2_0 = (MAT | MAT_SUB_2_0),
+//   MAT_2_1 = (MAT | MAT_SUB_2_1),
+//   AAC_LATM_LC = (AAC_LATM | AAC_SUB_LC),
+//   AAC_LATM_HE_V1 = (AAC_LATM | AAC_SUB_HE_V1),
+//   AAC_LATM_HE_V2 = (AAC_LATM | AAC_SUB_HE_V2),
+}
diff --git a/media/java/android/media/audio/common/AudioOffloadInfo.aidl b/media/java/android/media/audio/common/AudioOffloadInfo.aidl
new file mode 100644
index 0000000..ec10d71
--- /dev/null
+++ b/media/java/android/media/audio/common/AudioOffloadInfo.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ // This file has been semi-automatically generated using hidl2aidl from its counterpart in
+ // hardware/interfaces/audio/common/5.0/types.hal
+
+package android.media.audio.common;
+
+import android.media.audio.common.AudioFormat;
+import android.media.audio.common.AudioStreamType;
+import android.media.audio.common.AudioUsage;
+
+/**
+ * Additional information about the stream passed to hardware decoders.
+ *
+ * {@hide}
+ */
+parcelable AudioOffloadInfo {
+    int sampleRateHz;
+    int channelMask;
+    AudioFormat format;
+    AudioStreamType streamType;
+    int bitRatePerSecond;
+    long durationMicroseconds;
+    boolean hasVideo;
+    boolean isStreaming;
+    int bitWidth;
+    int bufferSize;
+    AudioUsage usage;
+}
+
diff --git a/media/java/android/media/audio/common/AudioStreamType.aidl b/media/java/android/media/audio/common/AudioStreamType.aidl
new file mode 100644
index 0000000..c545667
--- /dev/null
+++ b/media/java/android/media/audio/common/AudioStreamType.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ // This file has been semi-automatically generated using hidl2aidl from its counterpart in
+ // hardware/interfaces/audio/common/5.0/types.hal
+
+package android.media.audio.common;
+
+/**
+ *  Audio streams
+ *
+ * Audio stream type describing the intended use case of a stream.
+ *
+ * {@hide}
+ */
+@Backing(type="int")
+enum AudioStreamType {
+    DEFAULT = -1,
+    MIN = 0,
+    VOICE_CALL = 0,
+    SYSTEM = 1,
+    RING = 2,
+    MUSIC = 3,
+    ALARM = 4,
+    NOTIFICATION = 5,
+    BLUETOOTH_SCO = 6,
+    ENFORCED_AUDIBLE = 7,
+    DTMF = 8,
+    TTS = 9,
+    ACCESSIBILITY = 10,
+}
diff --git a/media/java/android/media/audio/common/AudioUsage.aidl b/media/java/android/media/audio/common/AudioUsage.aidl
new file mode 100644
index 0000000..ef34816
--- /dev/null
+++ b/media/java/android/media/audio/common/AudioUsage.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ // This file has been semi-automatically generated using hidl2aidl from its counterpart in
+ // hardware/interfaces/audio/common/5.0/types.hal
+
+package android.media.audio.common;
+
+/**
+ * {@hide}
+ */
+@Backing(type="int")
+enum AudioUsage {
+    UNKNOWN = 0,
+    MEDIA = 1,
+    VOICE_COMMUNICATION = 2,
+    VOICE_COMMUNICATION_SIGNALLING = 3,
+    ALARM = 4,
+    NOTIFICATION = 5,
+    NOTIFICATION_TELEPHONY_RINGTONE = 6,
+    ASSISTANCE_ACCESSIBILITY = 11,
+    ASSISTANCE_NAVIGATION_GUIDANCE = 12,
+    ASSISTANCE_SONIFICATION = 13,
+    GAME = 14,
+    VIRTUAL_SOURCE = 15,
+    ASSISTANT = 16,
+}