Merge "BluetoothAudio 2.1 Hash"
diff --git a/bluetooth_audio/2.1/Android.bp b/bluetooth_audio/2.1/Android.bp
new file mode 100644
index 0000000..c421ce2
--- /dev/null
+++ b/bluetooth_audio/2.1/Android.bp
@@ -0,0 +1,18 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+    name: "vendor.qti.hardware.bluetooth_audio@2.1",
+    root: "vendor.qti.hardware.bluetooth_audio",
+    system_ext_specific: true,
+    srcs: [
+        "types.hal",
+        "IBluetoothAudioPort.hal",
+        "IBluetoothAudioProvider.hal",
+        "IBluetoothAudioProvidersFactory.hal",
+    ],
+    interfaces: [
+        "android.hidl.base@1.0",
+        "vendor.qti.hardware.bluetooth_audio@2.0",
+    ],
+    gen_java: false,
+}
diff --git a/bluetooth_audio/2.1/IBluetoothAudioPort.hal b/bluetooth_audio/2.1/IBluetoothAudioPort.hal
new file mode 100644
index 0000000..896c8b6
--- /dev/null
+++ b/bluetooth_audio/2.1/IBluetoothAudioPort.hal
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Not a contribution.
+ */
+
+/*
+ * Copyright 2018 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.
+ */
+
+package vendor.qti.hardware.bluetooth_audio@2.1;
+
+import @2.0::IBluetoothAudioPort;
+/**
+ * HAL interface from the Audio HAL to the Bluetooth stack
+ *
+ * The Audio HAL calls methods in this interface to start, suspend, and stop
+ * an audio stream. These calls return immediately and the results, if any,
+ * are sent over the IBluetoothAudioProvider interface.
+ *
+ * Moreover, the Audio HAL can also get the presentation position of the stream
+ * and provide stream metadata.
+ *
+ * Note: For HIDL APIs with a "generates" statement, the callback parameter used
+ * for return value must be invoked synchronously before the API call returns.
+ */
+interface IBluetoothAudioPort extends @2.0::IBluetoothAudioPort {
+};
diff --git a/bluetooth_audio/2.1/IBluetoothAudioProvider.hal b/bluetooth_audio/2.1/IBluetoothAudioProvider.hal
new file mode 100644
index 0000000..ec174df
--- /dev/null
+++ b/bluetooth_audio/2.1/IBluetoothAudioProvider.hal
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Not a contribution.
+ */
+
+/*
+ * Copyright 2018 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.
+ */
+
+package vendor.qti.hardware.bluetooth_audio@2.1;
+
+import @2.0::IBluetoothAudioProvider;
+import @2.1::IBluetoothAudioPort;
+import @2.1::AudioConfiguration;
+import @2.0::Status;
+import @2.0::SessionParams;
+/**
+ * HAL interface from the Bluetooth stack to the Audio HAL
+ *
+ * The Bluetooth stack calls methods in this interface to start and end audio
+ * sessions and sends callback events to the Audio HAL.
+ *
+ * Note: For HIDL APIs with a "generates" statement, the callback parameter used
+ * for return value must be invoked synchronously before the API call returns.
+ */
+interface IBluetoothAudioProvider extends @2.0::IBluetoothAudioProvider {
+
+    /**
+     * This method indicates that the Bluetooth stack is ready to stream audio.
+     * It registers an instance of IBluetoothAudioPort with and provides the
+     * current negotiated codec to the Audio HAL. After this method is called,
+     * the Audio HAL can invoke IBluetoothAudioPort.startStream().
+     *
+     * Note: endSession() must be called to unregister this IBluetoothAudioPort
+     *
+     * @param hostIf An instance of IBluetoothAudioPort for stream control
+     * @param audioConfig The audio configuration negotiated with the remote
+     *    device. The PCM parameters are set if software based encoding,
+     *    otherwise the correct codec configuration is used for hardware
+     *    encoding.
+     *
+     * @return status One of the following
+     *    SUCCESS if this IBluetoothAudioPort was successfully registered with
+     *        the Audio HAL
+     *    UNSUPPORTED_CODEC_CONFIGURATION if the Audio HAL cannot register this
+     *        IBluetoothAudioPort with the given codec configuration
+     *    FAILURE if the Audio HAL cannot register this IBluetoothAudioPort for
+     *        any other reason
+     * @return dataMQ The fast message queue for audio data from this provider.
+     *    Audio data will be in PCM format as specified by the
+     *    audioConfig.pcmConfig parameter.
+     *    Invalid if streaming is offloaded to hardware or on failure.
+     */
+    startSession_2_1(IBluetoothAudioPort hostIf, AudioConfiguration audioConfig)
+                generates (Status status, fmq_sync<uint8_t> dataMQ);
+};
diff --git a/bluetooth_audio/2.1/IBluetoothAudioProvidersFactory.hal b/bluetooth_audio/2.1/IBluetoothAudioProvidersFactory.hal
new file mode 100644
index 0000000..4573d38
--- /dev/null
+++ b/bluetooth_audio/2.1/IBluetoothAudioProvidersFactory.hal
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Not a contribution.
+ */
+
+/*
+ * Copyright 2018 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.
+ */
+
+package vendor.qti.hardware.bluetooth_audio@2.1;
+
+import @2.0::IBluetoothAudioProvidersFactory;
+import @2.1::IBluetoothAudioProvider;
+import @2.1::AudioCapabilities;
+import @2.0::SessionType;
+import @2.0::Status;
+/**
+ * This factory allows a HAL implementation to be split into multiple
+ * independent providers.
+ *
+ * When the Bluetooth stack is ready to create an audio session, it must first
+ * obtain the IBluetoothAudioProvider for that session type by calling
+ * openProvider().
+ *
+ * Note: For HIDL APIs with a "generates" statement, the callback parameter used
+ * for return value must be invoked synchronously before the API call returns.
+ */
+interface IBluetoothAudioProvidersFactory extends @2.0::IBluetoothAudioProvidersFactory {
+
+    /**
+     * Opens an audio provider for a session type. To close the provider, it is
+     * necessary to release references to the returned provider object.
+     *
+     * @param sessionType The session type (e.g.
+     *    A2DP_SOFTWARE_ENCODING_DATAPATH).
+     *
+     * @return status One of the following
+     *    SUCCESS if the Audio HAL successfully opens the provider with the
+     *        given session type
+     *    FAILURE if the Audio HAL cannot open the provider
+     * @return provider The provider of the specified session type
+     */
+    openProvider_2_1(SessionType sessionType)
+        generates (Status status, IBluetoothAudioProvider provider);
+
+    /**
+     * Gets a list of audio capabilities for a session type.
+     *
+     * For software encoding, the PCM capabilities are returned.
+     * For hardware encoding, the supported codecs and their capabilities are
+     * returned.
+     *
+     * @param sessionType The session type (e.g.
+     *    A2DP_SOFTWARE_ENCODING_DATAPATH).
+     * @return audioCapabilities A list containing all the capabilities
+     *    supported by the sesson type. The capabilities is a list of
+     *    available options when configuring the codec for the session.
+     *    For software encoding it is the PCM data rate.
+     *    For hardware encoding it is the list of supported codecs and their
+     *    capabilities.
+     *    If a provider isn't supported, an empty list should be returned.
+     *    Note: Only one entry should exist per codec when using hardware
+     *    encoding.
+     */
+     getProviderCapabilities_2_1(SessionType sessionType)
+         generates (vec<AudioCapabilities> audioCapabilities);
+};
diff --git a/bluetooth_audio/2.1/types.hal b/bluetooth_audio/2.1/types.hal
new file mode 100644
index 0000000..3bf47e5
--- /dev/null
+++ b/bluetooth_audio/2.1/types.hal
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Not a contribution.
+ */
+
+/*
+ * Copyright 2018 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.
+ */
+
+package vendor.qti.hardware.bluetooth_audio@2.1;
+
+import @2.0::CodecType;
+import @2.0::SampleRate;
+import @2.0::ChannelMode;
+import @2.0::SbcParameters;
+import @2.0::AacParameters;
+import @2.0::LdacParameters;
+import @2.0::AptxParameters;
+import @2.0::AptxAdaptiveParameters;
+import @2.0::AptxTwsParameters;
+import @2.0::BaCeltParameters;
+import @2.0::PcmParameters;
+import @2.0::BitsPerSample;
+
+
+enum CodecType : @2.0::CodecType {
+    LC3 = 0x18,
+};
+
+enum ExtSampleRate : @2.0::SampleRate {
+    RATE_24000_2 = 0x100,
+    RATE_8000 = 0x200,
+};
+
+enum LC3ChannelMode : uint8_t {
+    UNKNOWN = 0x00,
+    STEREO = 0x01,
+    JOINT_STEREO = 0x02,
+    DUAL = 0x04,
+    MONO = 0x08,
+    CH_5_1 = 0x10,
+};
+/** Used for Hardware Encoding LC3 codec parameters */
+struct lc3CodecConfig {
+    ExtSampleRate sampleRate;
+    LC3ChannelMode channelMode;
+    uint16_t octetsPerFrame; //Octets Per Codec Frame
+    uint16_t frameDuration; //7.5msec, 10msec
+    uint32_t bitrate;
+    BitsPerSample bitsPerSample;
+    uint8_t numBlocks;
+};
+
+/** Used for Hardware Encoding LC3 codec parameters */
+struct LC3Parameters {
+    lc3CodecConfig txConfig;
+    lc3CodecConfig rxConfig;
+    uint8_t rxConfigSet; //this shall be set if fromAirConfig Config is present
+    uint16_t rxLatency;
+    uint8_t decoderOuputChannels;
+    uint8_t mode; //0x01-Connected, 0x02-Broadcast, 0x03-Simulcast
+    uint8_t[16] codecSpecific;
+    uint8_t defaultQlevel;
+    uint8_t NumStreamIDGroup;
+    uint32_t[48] streamMap;//upto 16 stream id support
+};
+
+/**
+ * Used to specify the capabilities of the codecs supported by Hardware Encoding.
+ * AptX and AptX-HD both use the AptxParameters field.
+ */
+struct CodecCapabilities {
+    CodecType codecType;
+
+    union Capabilities {
+      SbcParameters sbcCapabilities;
+      AacParameters aacCapabilities;
+      LdacParameters ldacCapabilities;
+      AptxParameters aptxCapabilities;
+      AptxAdaptiveParameters aptxAdaptiveCapabilities;
+      AptxTwsParameters aptxTwsCapabilities;
+      BaCeltParameters baCeltCapabilities;
+      LC3Parameters lc3Capabilities;
+    } capabilities;
+};
+
+
+/** Used to specify the capabilities of the different session types. */
+union AudioCapabilities {
+    PcmParameters pcmCapabilities;
+    CodecCapabilities codecCapabilities;
+};
+
+/**
+ * Used to configure a Hardware Encoding session.
+ * AptX and AptX-HD both use the AptxParameters field.
+ */
+struct CodecConfiguration {
+    CodecType codecType;
+    /**
+     * The encoded audio bitrate in bits / second.
+     * 0x00000000 - The audio bitrate is not specified / unused
+     * 0x00000001 - 0x00FFFFFF - Encoded audio bitrate in bits/second
+     * 0x01000000 - 0xFFFFFFFF - Reserved
+     *
+     * The HAL needs to support all legal bitrates for the selected codec.
+     */
+    uint32_t encodedAudioBitrate;
+    /** Peer MTU (in octets) */
+    uint16_t peerMtu;
+    /** Content protection by SCMS-T */
+    bool isScmstEnabled;
+    /** Scrambling Requirement */
+    bool isScramblingEnabled;
+    union CodecSpecific {
+        SbcParameters sbcConfig;
+        AacParameters aacConfig;
+        LdacParameters ldacConfig;
+        AptxParameters aptxConfig;
+        AptxAdaptiveParameters aptxAdaptiveConfig;
+        AptxTwsParameters aptxTwsConfig;
+        BaCeltParameters baCeltConfig;
+        LC3Parameters lc3Config;
+    } config;
+};
+
+/** Used to configure either a Hardware or Software Encoding session based on session type */
+union AudioConfiguration {
+    PcmParameters pcmConfig;
+    CodecConfiguration codecConfig;
+};
diff --git a/display/current.txt b/display/current.txt
index d7e5a02..fef0227 100644
--- a/display/current.txt
+++ b/display/current.txt
@@ -71,3 +71,4 @@
 f724000c84dd66ffaea8b3edc610f13381a62513854e35d89b3f4a4daad620d0 vendor.qti.hardware.display.composer@3.0::IQtiComposerClient
 c85fce19541fb31c8ce4927166a4b50da1e5d50a98594bcaae2f8b2eec12fb7d vendor.qti.hardware.display.allocator@4.0::IQtiAllocator
 f49205d41f011a96c6d238ea69f7b6c9d159809f4ecabef04ca4ccdb195d57b5 vendor.qti.hardware.display.mapper@4.0::IQtiMapper
+9f484e68c3e4faef0a0f601ff7074d0431499cfaceba43b42fbc35c8264fbddf vendor.qti.hardware.display.mapperextensions@1.2::IQtiMapperExtensions
diff --git a/display/mapperextensions/1.2/Android.bp b/display/mapperextensions/1.2/Android.bp
new file mode 100644
index 0000000..778ee1a
--- /dev/null
+++ b/display/mapperextensions/1.2/Android.bp
@@ -0,0 +1,17 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+    name: "vendor.qti.hardware.display.mapperextensions@1.2",
+    owner: "qti",
+    root: "vendor.qti.hardware.display",
+    system_ext_specific: true,
+    srcs: [
+        "IQtiMapperExtensions.hal",
+    ],
+    interfaces: [
+        "android.hidl.base@1.0",
+        "vendor.qti.hardware.display.mapperextensions@1.0",
+        "vendor.qti.hardware.display.mapperextensions@1.1",
+    ],
+    gen_java: false,
+}
diff --git a/display/mapperextensions/1.2/IQtiMapperExtensions.hal b/display/mapperextensions/1.2/IQtiMapperExtensions.hal
new file mode 100644
index 0000000..2e34cf4
--- /dev/null
+++ b/display/mapperextensions/1.2/IQtiMapperExtensions.hal
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials provided
+ *      with the distribution.
+ *    * Neither the name of The Linux Foundation. nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package vendor.qti.hardware.display.mapperextensions@1.2;
+
+import @1.1::IQtiMapperExtensions;
+import @1.0::Error;
+
+interface IQtiMapperExtensions extends @1.1::IQtiMapperExtensions {
+
+    /*
+     * Copy graphics metadata.
+     * Set dst buffer to src buffer.
+     */
+    @callflow(next="*")
+    copyMetaData(pointer src, pointer dst) generates (Error error);
+
+    /*
+     * Copy graphics metadata from src buffer.
+     * Set virtual address to src buffer.
+     */
+    @callflow(next="*")
+    setMetadataBlob(vec<uint8_t> src, pointer dst) generates (Error error);
+
+    /*
+     * Get graphics metadata blob from src buffer.
+     */
+    @callflow(next="*")
+    getMetadataBlob(pointer src) generates (Error error, vec<uint8_t> data);
+};
\ No newline at end of file