Merge "hal: add apptype as a part of event_value"
diff --git a/configs/atoll/atoll.mk b/configs/atoll/atoll.mk
index 65d42cc..5acb773 100644
--- a/configs/atoll/atoll.mk
+++ b/configs/atoll/atoll.mk
@@ -169,6 +169,8 @@
     vendor/qcom/opensource/audio-hal/primary-hal/configs/atoll/mixer_paths_wcd9375.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_wcd9375.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/atoll/mixer_paths_qrd.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_qrd.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/atoll/mixer_paths_wcd9375qrd.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_wcd9375qrd.xml \
+    frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml \
+    frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml
 
 #XML Audio configuration files
 ifneq ($(TARGET_USES_AOSP_FOR_AUDIO), true)
diff --git a/configs/atoll/audio_policy_configuration.xml b/configs/atoll/audio_policy_configuration.xml
index e96660a..a6d7eef 100644
--- a/configs/atoll/audio_policy_configuration.xml
+++ b/configs/atoll/audio_policy_configuration.xml
@@ -266,17 +266,20 @@
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
                 <devicePort tagName="BT A2DP Out" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP" role="sink"
-                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC">
+                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TW
+SP">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
                 <devicePort tagName="BT A2DP Headphones" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES" role="sink"
-                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC">
+                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TW
+SP">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
                 <devicePort tagName="BT A2DP Speaker" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER" role="sink"
-                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC">
+                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TW
+SP">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
diff --git a/configs/kona/kona.mk b/configs/kona/kona.mk
index a8991fc..33a678f 100644
--- a/configs/kona/kona.mk
+++ b/configs/kona/kona.mk
@@ -187,7 +187,8 @@
     vendor/qcom/opensource/audio-hal/primary-hal/configs/kona/audio_configs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_configs.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/kona/audio_configs_stock.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_configs_stock.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/kona/audio_tuning_mixer.txt:$(TARGET_COPY_OUT_VENDOR)/etc/audio_tuning_mixer.txt \
-    frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml
+    frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml \
+    frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml
 
 #XML Audio configuration files
 ifneq ($(TARGET_USES_AOSP_FOR_AUDIO), true)
@@ -300,7 +301,7 @@
 
 #enable pbe effects
 PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.safx.pbe.enabled=true
+vendor.audio.safx.pbe.enabled=false
 
 #parser input buffer size(256kb) in byte stream mode
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -400,7 +401,6 @@
 vendor.audio.feature.a2dp_offload.enable=true \
 vendor.audio.feature.afe_proxy.enable=true \
 vendor.audio.feature.anc_headset.enable=true \
-vendor.audio.feature.audio_sphere.enable=true \
 vendor.audio.feature.battery_listener.enable=true \
 vendor.audio.feature.compr_cap.enable=false \
 vendor.audio.feature.compress_in.enable=true \
diff --git a/configs/lito/audio_effects.xml b/configs/lito/audio_effects.xml
index b6e318e..add0925 100644
--- a/configs/lito/audio_effects.xml
+++ b/configs/lito/audio_effects.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--- Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.            -->
+<!--- Copyright (c) 2018-2019, 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    -->
@@ -30,9 +30,6 @@
     <libraries>
         <library name="bundle" path="libbundlewrapper.so"/>
         <library name="reverb" path="libreverbwrapper.so"/>
-        <library name="qcbassboost" path="libqcbassboost.so"/>
-        <library name="qcvirt" path="libqcvirt.so"/>
-        <library name="qcreverb" path="libqcreverb.so"/>
         <library name="visualizer_sw" path="libvisualizer.so"/>
         <library name="visualizer_hw" path="libqcomvisualizer.so"/>
         <library name="downmix" path="libdownmix.so"/>
@@ -47,11 +44,11 @@
     </libraries>
     <effects>
         <effectProxy name="bassboost" library="proxy" uuid="14804144-a5ee-4d24-aa88-0002a5d5c51b">
-            <libsw library="qcbassboost" uuid="23aca180-44bd-11e2-bcfd-0800200c9a66"/>
+            <libsw library="bundle" uuid="8631f300-72e2-11df-b57e-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="2c4a8c24-1581-487f-94f6-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="virtualizer" library="proxy" uuid="d3467faa-acc7-4d34-acaf-0002a5d5c51b">
-            <libsw library="qcvirt" uuid="e6c98a16-22a3-11e2-b87b-f23c91aec05e"/>
+            <libsw library="bundle" uuid="1d4033c0-8557-11df-9f2d-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="509a4498-561a-4bea-b3b1-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="equalizer" library="proxy" uuid="c8e70ecd-48ca-456e-8a4f-0002a5d5c51b">
@@ -60,19 +57,19 @@
         </effectProxy>
         <effect name="volume" library="bundle" uuid="119341a0-8469-11df-81f9-0002a5d5c51b"/>
         <effectProxy name="reverb_env_aux" library="proxy" uuid="48404ac9-d202-4ccc-bf84-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="a8c1e5f3-293d-43cd-95ec-d5e26c02e217"/>
+            <libsw library="reverb" uuid="4a387fc0-8ab3-11df-8bad-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="79a18026-18fd-4185-8233-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="reverb_env_ins" library="proxy" uuid="b707403a-a1c1-4291-9573-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="791fff8b-8129-4655-83a4-59bc61034c3a"/>
+            <libsw library="reverb" uuid="c7a511a0-a3bb-11df-860e-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="eb64ea04-973b-43d2-8f5e-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="reverb_pre_aux" library="proxy" uuid="1b78f587-6d1c-422e-8b84-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="53ef1db5-c0c0-445b-b060-e34d20ebb70a"/>
+            <libsw library="reverb" uuid="f29a1400-a3bb-11df-8ddc-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="6987be09-b142-4b41-9056-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="reverb_pre_ins" library="proxy" uuid="f3e178d2-ebcb-408e-8357-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="b08a0e38-22a5-11e2-b87b-f23c91aec05e"/>
+            <libsw library="reverb" uuid="172cdf00-a3bc-11df-a72f-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="aa2bebf6-47cf-4613-9bca-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="visualizer" library="proxy" uuid="1d0a1a53-7d5d-48f2-8e71-27fbd10d842c">
diff --git a/configs/lito/audio_policy_configuration.xml b/configs/lito/audio_policy_configuration.xml
index e8990fb..a33356b 100644
--- a/configs/lito/audio_policy_configuration.xml
+++ b/configs/lito/audio_policy_configuration.xml
@@ -263,17 +263,20 @@
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
                 <devicePort tagName="BT A2DP Out" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP" role="sink"
-                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE">
+                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TW
+SP">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
                 <devicePort tagName="BT A2DP Headphones" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES" role="sink"
-                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE">
+                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TW
+SP">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
                 <devicePort tagName="BT A2DP Speaker" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER" role="sink"
-                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE">
+                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TW
+SP">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
diff --git a/configs/lito/lito.mk b/configs/lito/lito.mk
index 56fd30f..00876db 100644
--- a/configs/lito/lito.mk
+++ b/configs/lito/lito.mk
@@ -179,7 +179,8 @@
     vendor/qcom/opensource/audio-hal/primary-hal/configs/lito/mixer_paths_qrd.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_qrd.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/lito/audio_configs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_configs.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/lito/audio_configs_stock.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_configs_stock.xml \
-    frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml
+    frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml \
+    frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml
 
 #XML Audio configuration files
 ifneq ($(TARGET_USES_AOSP_FOR_AUDIO), true)
@@ -284,7 +285,7 @@
 
 #enable pbe effects
 PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.safx.pbe.enabled=true
+vendor.audio.safx.pbe.enabled=false
 
 #parser input buffer size(256kb) in byte stream mode
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -384,7 +385,6 @@
 vendor.audio.feature.a2dp_offload.enable=true \
 vendor.audio.feature.afe_proxy.enable=true \
 vendor.audio.feature.anc_headset.enable=true \
-vendor.audio.feature.audio_sphere.enable=true \
 vendor.audio.feature.battery_listener.enable=true \
 vendor.audio.feature.compr_cap.enable=false \
 vendor.audio.feature.compress_in.enable=true \
diff --git a/configs/lito/mixer_paths_qrd.xml b/configs/lito/mixer_paths_qrd.xml
index 0d8585b..b246c5a 100644
--- a/configs/lito/mixer_paths_qrd.xml
+++ b/configs/lito/mixer_paths_qrd.xml
@@ -2284,7 +2284,7 @@
     </path>
 
     <path name="speaker-protected">
-        <ctl name="WSA_AIF_VI Mixer WSA_SPKR_VI_1" value="1" />
+        <ctl name="WSA_AIF_VI Mixer WSA_SPKR_VI_2" value="1" />
         <ctl name="WSA_CDC_DMA_0 TX Format" value="PACKED_16B" />
         <path name="speaker" />
         <ctl name="VI_FEED_TX Channels" value="One" />
@@ -2292,7 +2292,7 @@
     </path>
 
     <path name="voice-speaker-protected">
-        <ctl name="WSA_AIF_VI Mixer WSA_SPKR_VI_1" value="1" />
+        <ctl name="WSA_AIF_VI Mixer WSA_SPKR_VI_2" value="1" />
         <ctl name="WSA_CDC_DMA_0 TX Format" value="PACKED_16B" />
         <path name="speaker-mono" />
         <ctl name="VI_FEED_TX Channels" value="One" />
diff --git a/configs/msm8937/msm8937.mk b/configs/msm8937/msm8937.mk
index 72fa6f3..a41740f 100644
--- a/configs/msm8937/msm8937.mk
+++ b/configs/msm8937/msm8937.mk
@@ -199,10 +199,6 @@
 vendor.audio.use.sw.alac.decoder=true\
 vendor.audio.use.sw.ape.decoder=true
 
-#property for AudioSphere Post processing
-PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.pp.asphere.enabled=false
-
 #Audio voice concurrency related flags
 PRODUCT_PROPERTY_OVERRIDES += \
 vendor.voice.playback.conc.disabled=true\
@@ -245,7 +241,6 @@
 vendor.audio.feature.a2dp_offload.enable=false \
 vendor.audio.feature.afe_proxy.enable=true \
 vendor.audio.feature.anc_headset.enable=true \
-vendor.audio.feature.audio_sphere.enable=true \
 vendor.audio.feature.battery_listener.enable=false \
 vendor.audio.feature.compr_cap.enable=false \
 vendor.audio.feature.compress_in.enable=false \
diff --git a/configs/msm8953/msm8953.mk b/configs/msm8953/msm8953.mk
index 25d42cf..0b0e6be 100644
--- a/configs/msm8953/msm8953.mk
+++ b/configs/msm8953/msm8953.mk
@@ -212,10 +212,6 @@
 vendor.audio.use.sw.alac.decoder=true\
 vendor.audio.use.sw.ape.decoder=true
 
-#property for AudioSphere Post processing
-PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.pp.asphere.enabled=false
-
 #Audio voice concurrency related flags
 PRODUCT_PROPERTY_OVERRIDES += \
 vendor.voice.playback.conc.disabled=true\
diff --git a/configs/msm8998/msm8998.mk b/configs/msm8998/msm8998.mk
index bee32c8..6b77f69 100644
--- a/configs/msm8998/msm8998.mk
+++ b/configs/msm8998/msm8998.mk
@@ -191,7 +191,7 @@
 
 #enable pbe effects
 PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.safx.pbe.enabled=true
+vendor.audio.safx.pbe.enabled=false
 
 #parser input buffer size(256kb) in byte stream mode
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -255,7 +255,6 @@
 vendor.audio.feature.a2dp_offload.enable=true \
 vendor.audio.feature.afe_proxy.enable=true \
 vendor.audio.feature.anc_headset.enable=true \
-vendor.audio.feature.audio_sphere.enable=true \
 vendor.audio.feature.battery_listener.enable=false \
 vendor.audio.feature.compr_cap.enable=false \
 vendor.audio.feature.compress_in.enable=false \
diff --git a/configs/msmnile/msmnile.mk b/configs/msmnile/msmnile.mk
index ae79cd6..3315b11 100644
--- a/configs/msmnile/msmnile.mk
+++ b/configs/msmnile/msmnile.mk
@@ -176,7 +176,8 @@
     vendor/qcom/opensource/audio-hal/primary-hal/configs/msmnile/sound_trigger_mixer_paths.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/msmnile/audio_configs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_configs.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/msmnile/audio_configs_stock.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_configs_stock.xml \
-    frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml
+    frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml \
+    frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml
 
 #XML Audio configuration files
 ifneq ($(TARGET_USES_AOSP_FOR_AUDIO), true)
@@ -280,7 +281,7 @@
 
 #enable pbe effects
 PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.safx.pbe.enabled=true
+vendor.audio.safx.pbe.enabled=false
 
 #parser input buffer size(256kb) in byte stream mode
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -379,7 +380,6 @@
 vendor.audio.feature.a2dp_offload.enable=true \
 vendor.audio.feature.afe_proxy.enable=false \
 vendor.audio.feature.anc_headset.enable=false \
-vendor.audio.feature.audio_sphere.enable=false \
 vendor.audio.feature.battery_listener.enable=false \
 vendor.audio.feature.compr_cap.enable=false \
 vendor.audio.feature.compress_in.enable=false \
@@ -424,7 +424,6 @@
 vendor.audio.feature.a2dp_offload.enable=true \
 vendor.audio.feature.afe_proxy.enable=true \
 vendor.audio.feature.anc_headset.enable=true \
-vendor.audio.feature.audio_sphere.enable=true \
 vendor.audio.feature.battery_listener.enable=true \
 vendor.audio.feature.compr_cap.enable=false \
 vendor.audio.feature.compress_in.enable=true \
diff --git a/configs/msmsteppe/audio_effects.xml b/configs/msmsteppe/audio_effects.xml
index 7c0cd22..add0925 100644
--- a/configs/msmsteppe/audio_effects.xml
+++ b/configs/msmsteppe/audio_effects.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--- Copyright (c) 2018, The Linux Foundation. All rights reserved.            -->
+<!--- Copyright (c) 2018-2019, 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    -->
@@ -30,9 +30,6 @@
     <libraries>
         <library name="bundle" path="libbundlewrapper.so"/>
         <library name="reverb" path="libreverbwrapper.so"/>
-        <library name="qcbassboost" path="libqcbassboost.so"/>
-        <library name="qcvirt" path="libqcvirt.so"/>
-        <library name="qcreverb" path="libqcreverb.so"/>
         <library name="visualizer_sw" path="libvisualizer.so"/>
         <library name="visualizer_hw" path="libqcomvisualizer.so"/>
         <library name="downmix" path="libdownmix.so"/>
@@ -47,11 +44,11 @@
     </libraries>
     <effects>
         <effectProxy name="bassboost" library="proxy" uuid="14804144-a5ee-4d24-aa88-0002a5d5c51b">
-            <libsw library="qcbassboost" uuid="23aca180-44bd-11e2-bcfd-0800200c9a66"/>
+            <libsw library="bundle" uuid="8631f300-72e2-11df-b57e-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="2c4a8c24-1581-487f-94f6-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="virtualizer" library="proxy" uuid="d3467faa-acc7-4d34-acaf-0002a5d5c51b">
-            <libsw library="qcvirt" uuid="e6c98a16-22a3-11e2-b87b-f23c91aec05e"/>
+            <libsw library="bundle" uuid="1d4033c0-8557-11df-9f2d-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="509a4498-561a-4bea-b3b1-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="equalizer" library="proxy" uuid="c8e70ecd-48ca-456e-8a4f-0002a5d5c51b">
@@ -60,19 +57,19 @@
         </effectProxy>
         <effect name="volume" library="bundle" uuid="119341a0-8469-11df-81f9-0002a5d5c51b"/>
         <effectProxy name="reverb_env_aux" library="proxy" uuid="48404ac9-d202-4ccc-bf84-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="a8c1e5f3-293d-43cd-95ec-d5e26c02e217"/>
+            <libsw library="reverb" uuid="4a387fc0-8ab3-11df-8bad-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="79a18026-18fd-4185-8233-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="reverb_env_ins" library="proxy" uuid="b707403a-a1c1-4291-9573-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="791fff8b-8129-4655-83a4-59bc61034c3a"/>
+            <libsw library="reverb" uuid="c7a511a0-a3bb-11df-860e-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="eb64ea04-973b-43d2-8f5e-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="reverb_pre_aux" library="proxy" uuid="1b78f587-6d1c-422e-8b84-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="53ef1db5-c0c0-445b-b060-e34d20ebb70a"/>
+            <libsw library="reverb" uuid="f29a1400-a3bb-11df-8ddc-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="6987be09-b142-4b41-9056-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="reverb_pre_ins" library="proxy" uuid="f3e178d2-ebcb-408e-8357-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="b08a0e38-22a5-11e2-b87b-f23c91aec05e"/>
+            <libsw library="reverb" uuid="172cdf00-a3bc-11df-a72f-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="aa2bebf6-47cf-4613-9bca-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="visualizer" library="proxy" uuid="1d0a1a53-7d5d-48f2-8e71-27fbd10d842c">
diff --git a/configs/msmsteppe/mixer_paths_qrd.xml b/configs/msmsteppe/mixer_paths_qrd.xml
index db33f96..5665322 100644
--- a/configs/msmsteppe/mixer_paths_qrd.xml
+++ b/configs/msmsteppe/mixer_paths_qrd.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!-- Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.    -->
+<!-- Copyright (c) 2015-2019, 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 -->
@@ -2196,7 +2196,15 @@
     </path>
 
     <path name="voice-headphones">
-        <path name="headphones" />
+        <ctl name="RX_MACRO RX0 MUX" value="AIF1_PB" />
+        <ctl name="RX_MACRO RX1 MUX" value="AIF1_PB" />
+        <ctl name="RX_CDC_DMA_RX_0 Channels" value="Two" />
+        <ctl name="RX INT0_1 MIX1 INP0" value="RX0" />
+        <ctl name="RX INT1_1 MIX1 INP0" value="RX1" />
+        <ctl name="RX INT0 DEM MUX" value="CLSH_DSM_OUT" />
+        <ctl name="RX INT1 DEM MUX" value="CLSH_DSM_OUT" />
+        <ctl name="HPHL_RDAC Switch" value="1" />
+        <ctl name="HPHR_RDAC Switch" value="1" />
     </path>
 
     <path name="voice-line">
diff --git a/configs/msmsteppe/msmsteppe.mk b/configs/msmsteppe/msmsteppe.mk
index 528bd7c..ec546ac 100644
--- a/configs/msmsteppe/msmsteppe.mk
+++ b/configs/msmsteppe/msmsteppe.mk
@@ -176,6 +176,8 @@
     vendor/qcom/opensource/audio-hal/primary-hal/configs/msmsteppe/mixer_paths_qrd.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_qrd.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/msmsteppe/mixer_paths_wcd9375qrd.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_wcd9375qrd.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/msmsteppe/mixer_paths_tavil.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_tavil.xml \
+    frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml \
+    frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml
 
 #XML Audio configuration files
 ifneq ($(TARGET_USES_AOSP_FOR_AUDIO), true)
@@ -287,7 +289,7 @@
 
 #enable pbe effects
 PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.safx.pbe.enabled=true
+vendor.audio.safx.pbe.enabled=false
 
 #parser input buffer size(256kb) in byte stream mode
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -360,7 +362,6 @@
 vendor.audio.feature.a2dp_offload.enable=true \
 vendor.audio.feature.afe_proxy.enable=true \
 vendor.audio.feature.anc_headset.enable=true \
-vendor.audio.feature.audio_sphere.enable=true \
 vendor.audio.feature.battery_listener.enable=false \
 vendor.audio.feature.compr_cap.enable=false \
 vendor.audio.feature.compress_in.enable=false \
diff --git a/configs/msmsteppe/sound_trigger_mixer_paths.xml b/configs/msmsteppe/sound_trigger_mixer_paths.xml
index a489e7f..90de0d3 100644
--- a/configs/msmsteppe/sound_trigger_mixer_paths.xml
+++ b/configs/msmsteppe/sound_trigger_mixer_paths.xml
@@ -206,11 +206,11 @@
         <ctl name="TX_DEC3 Volume" value="102" />
         <ctl name="TX DMIC MUX0" value="DMIC2" />
         <ctl name="TX_AIF1_CAP Mixer DEC1" value="1" />
-        <ctl name="TX DMIC MUX1" value="DMIC1" />
+        <ctl name="TX DMIC MUX1" value="DMIC0" />
         <ctl name="TX_AIF1_CAP Mixer DEC2" value="1" />
         <ctl name="TX DMIC MUX2" value="DMIC3" />
         <ctl name="TX_AIF1_CAP Mixer DEC3" value="1" />
-        <ctl name="TX DMIC MUX3" value="DMIC0" />
+        <ctl name="TX DMIC MUX3" value="DMIC1" />
     </path>
 
     <path name="echo-reference">
diff --git a/configs/msmsteppe/sound_trigger_mixer_paths_wcd9340.xml b/configs/msmsteppe/sound_trigger_mixer_paths_wcd9340.xml
index 55dd42f..f74c4fe 100644
--- a/configs/msmsteppe/sound_trigger_mixer_paths_wcd9340.xml
+++ b/configs/msmsteppe/sound_trigger_mixer_paths_wcd9340.xml
@@ -199,7 +199,7 @@
         <ctl name= "DMIC MUX0" value="DMIC2" />
         <ctl name= "DEC0 Volume" value="84" />
         <ctl name= "ADC MUX1" value="DMIC" />
-        <ctl name= "DMIC MUX1" value="DMIC0" />
+        <ctl name= "DMIC MUX1" value="DMIC5" />
         <ctl name= "DEC1 Volume" value="84" />
         <ctl name= "WDMA3 PORT0 MUX" value="DEC0" />
         <ctl name= "WDMA3 PORT1 MUX" value="DEC1" />
@@ -217,7 +217,7 @@
         <ctl name= "DMIC MUX1" value="DMIC0" />
         <ctl name= "DEC1 Volume" value="84" />
         <ctl name= "ADC MUX2" value="DMIC" />
-        <ctl name= "DMIC MUX2" value="DMIC1" />
+        <ctl name= "DMIC MUX2" value="DMIC5" />
         <ctl name= "DEC2 Volume" value="84" />
         <ctl name= "WDMA3 PORT0 MUX" value="DEC0" />
         <ctl name= "WDMA3 PORT1 MUX" value="DEC1" />
@@ -237,10 +237,10 @@
         <ctl name= "DMIC MUX1" value="DMIC0" />
         <ctl name= "DEC1 Volume" value="84" />
         <ctl name= "ADC MUX2" value="DMIC" />
-        <ctl name= "DMIC MUX2" value="DMIC1" />
+        <ctl name= "DMIC MUX2" value="DMIC5" />
         <ctl name= "DEC2 Volume" value="84" />
         <ctl name= "ADC MUX3" value="DMIC" />
-        <ctl name= "DMIC MUX3" value="DMIC3" />
+        <ctl name= "DMIC MUX3" value="DMIC1" />
         <ctl name= "DEC3 Volume" value="84" />
         <ctl name= "WDMA3 PORT0 MUX" value="DEC0" />
         <ctl name= "WDMA3 PORT1 MUX" value="DEC1" />
@@ -298,7 +298,7 @@
         <ctl name="AIF1_CAP Mixer SLIM TX8" value="1" />
         <ctl name="CDC_IF TX7 MUX" value="DEC7" />
         <ctl name="ADC MUX7" value="DMIC" />
-        <ctl name="DMIC MUX7" value="DMIC1" />
+        <ctl name="DMIC MUX7" value="DMIC2" />
         <ctl name="CDC_IF TX8 MUX" value="DEC8" />
         <ctl name="ADC MUX8" value="DMIC" />
         <ctl name="DMIC MUX8" value="DMIC5" />
@@ -312,13 +312,13 @@
         <ctl name="SLIM_0_TX Channels" value="Three" />
         <ctl name="CDC_IF TX5 MUX" value="DEC5" />
         <ctl name="ADC MUX5" value="DMIC" />
-        <ctl name="DMIC MUX5" value="DMIC1" />
+        <ctl name="DMIC MUX5" value="DMIC2" />
         <ctl name="CDC_IF TX6 MUX" value="DEC6" />
         <ctl name="ADC MUX6" value="DMIC" />
-        <ctl name="DMIC MUX6" value="DMIC5" />
+        <ctl name="DMIC MUX6" value="DMIC0" />
         <ctl name="CDC_IF TX7 MUX" value="DEC7" />
         <ctl name="ADC MUX7" value="DMIC" />
-        <ctl name="DMIC MUX7" value="DMIC2" />
+        <ctl name="DMIC MUX7" value="DMIC5" />
     </path>
 
     <path name="listen-ape-handset-qmic">
@@ -329,16 +329,16 @@
         <ctl name="SLIM_0_TX Channels" value="Four" />
         <ctl name="CDC_IF TX5 MUX" value="DEC5" />
         <ctl name="ADC MUX5" value="DMIC" />
-        <ctl name="DMIC MUX5" value="DMIC1" />
+        <ctl name="DMIC MUX5" value="DMIC2" />
         <ctl name="CDC_IF TX6 MUX" value="DEC6" />
         <ctl name="ADC MUX6" value="DMIC" />
-        <ctl name="DMIC MUX6" value="DMIC5" />
+        <ctl name="DMIC MUX6" value="DMIC0" />
         <ctl name="CDC_IF TX7 MUX" value="DEC7" />
         <ctl name="ADC MUX7" value="DMIC" />
-        <ctl name="DMIC MUX7" value="DMIC2" />
+        <ctl name="DMIC MUX7" value="DMIC5" />
         <ctl name="CDC_IF TX8 MUX" value="DEC8" />
         <ctl name="ADC MUX8" value="DMIC" />
-        <ctl name="DMIC MUX8" value="DMIC0" />
+        <ctl name="DMIC MUX8" value="DMIC1" />
     </path>
 
     <path name="echo-reference">
diff --git a/configs/msmsteppe/sound_trigger_platform_info.xml b/configs/msmsteppe/sound_trigger_platform_info.xml
index 413f4c6..a85a180 100644
--- a/configs/msmsteppe/sound_trigger_platform_info.xml
+++ b/configs/msmsteppe/sound_trigger_platform_info.xml
@@ -54,6 +54,8 @@
 
     </common_config>
     <acdb_ids>
+        <!--For internal codec please enable below device-->
+        <!--param DEVICE_HANDSET_MIC_APE="130" /-->
         <param DEVICE_HANDSET_MIC_APE="100" />
         <param DEVICE_HANDSET_MIC_CPE="128" />
         <param DEVICE_HANDSET_MIC_ECPP_CPE="128" />
@@ -127,6 +129,28 @@
             <param read_rsp_ids="0x00020013, 0x3, 0x00020016" />
             <param custom_config_ids="0x00012C0D, 0x3, 0x00012C20" />
         </gcs_usecase>
+        <gcs_usecase>
+            <param uid="0x7" />
+            <param acdb_devices="DEVICE_HANDSET_DMIC_CPE" />
+            <param load_sound_model_ids="0x00012C0D, 0x7, 0x00012C14" />
+            <param confidence_levels_ids="0x00012C0D, 0x7, 0x00012C28" />
+            <param detection_event_ids="0x00012C0D, 0x7, 0x00012B05" />
+            <param read_cmd_ids="0x00020013, 0x7, 0x00020015" />
+            <param read_rsp_ids="0x00020013, 0x7, 0x00020016" />
+            <param custom_config_ids="0x00012C0D, 0x7, 0x00012C20" />
+            <param det_event_type_ids="0x00012C0D, 0x7, 0x00012C2A" />
+        </gcs_usecase>
+        <gcs_usecase>
+            <param uid="0x8" />
+            <param acdb_devices="DEVICE_HANDSET_DMIC_CPE" />
+            <param load_sound_model_ids="0x00012C0D, 0x8, 0x00012C14" />
+            <param confidence_levels_ids="0x00012C0D, 0x8, 0x00012C28" />
+            <param detection_event_ids="0x00012C0D, 0x8, 0x00012B05" />
+            <param read_cmd_ids="0x00020013, 0x8, 0x00020015" />
+            <param read_rsp_ids="0x00020013, 0x8, 0x00020016" />
+            <param custom_config_ids="0x00012C0D, 0x8, 0x00012C20" />
+            <param det_event_type_ids="0x00012C0D, 0x8, 0x00012C2A" />
+        </gcs_usecase>
         <!-- Module and param ids with which the algorithm is integrated
             in non-graphite firmware (note these must come after gcs params)
             Extends flexibility to have different ids based on execution type.
diff --git a/configs/qssi/qssi.mk b/configs/qssi/qssi.mk
index 39569fb..653c177 100644
--- a/configs/qssi/qssi.mk
+++ b/configs/qssi/qssi.mk
@@ -106,6 +106,10 @@
 PRODUCT_PRODUCT_PROPERTIES += \
 audio.sys.noisy.broadcast.delay=600
 
+#offload minimum duration set to 30sec
+PRODUCT_PRODUCT_PROPERTIES += \
+audio.offload.min.duration.secs=30
+
 #offload pausetime out duration to 3 secs to inline with other outputs
 PRODUCT_PRODUCT_PROPERTIES += \
 audio.sys.offload.pstimeout.secs=3
diff --git a/configs/sdm660/sdm660.mk b/configs/sdm660/sdm660.mk
index 84f0f1e..5695851 100644
--- a/configs/sdm660/sdm660.mk
+++ b/configs/sdm660/sdm660.mk
@@ -202,7 +202,7 @@
 
 #enable pbe effects
 PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.safx.pbe.enabled=true
+vendor.audio.safx.pbe.enabled=false
 
 #parser input buffer size(256kb) in byte stream mode
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -266,7 +266,6 @@
 vendor.audio.feature.a2dp_offload.enable=true \
 vendor.audio.feature.afe_proxy.enable=true \
 vendor.audio.feature.anc_headset.enable=true \
-vendor.audio.feature.audio_sphere.enable=true \
 vendor.audio.feature.battery_listener.enable=false \
 vendor.audio.feature.compr_cap.enable=false \
 vendor.audio.feature.compress_in.enable=false \
diff --git a/configs/sdm710/sdm710.mk b/configs/sdm710/sdm710.mk
index 177562a..fb01728 100644
--- a/configs/sdm710/sdm710.mk
+++ b/configs/sdm710/sdm710.mk
@@ -296,7 +296,7 @@
 
 #enable pbe effects
 PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.safx.pbe.enabled=true
+vendor.audio.safx.pbe.enabled=false
 
 #parser input buffer size(256kb) in byte stream mode
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -365,7 +365,6 @@
 vendor.audio.feature.a2dp_offload.enable=true \
 vendor.audio.feature.afe_proxy.enable=true \
 vendor.audio.feature.anc_headset.enable=true \
-vendor.audio.feature.audio_sphere.enable=true \
 vendor.audio.feature.battery_listener.enable=false \
 vendor.audio.feature.compr_cap.enable=false \
 vendor.audio.feature.compress_in.enable=false \
diff --git a/configs/sdm845/sdm845.mk b/configs/sdm845/sdm845.mk
index 80ff74b..c3c3578 100644
--- a/configs/sdm845/sdm845.mk
+++ b/configs/sdm845/sdm845.mk
@@ -233,7 +233,7 @@
 
 #enable pbe effects
 PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.safx.pbe.enabled=true
+vendor.audio.safx.pbe.enabled=false
 
 #parser input buffer size(256kb) in byte stream mode
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -314,7 +314,6 @@
 vendor.audio.feature.a2dp_offload.enable=true \
 vendor.audio.feature.afe_proxy.enable=true \
 vendor.audio.feature.anc_headset.enable=true \
-vendor.audio.feature.audio_sphere.enable=true \
 vendor.audio.feature.battery_listener.enable=false \
 vendor.audio.feature.compr_cap.enable=false \
 vendor.audio.feature.compress_in.enable=false \
diff --git a/configs/trinket/audio_effects.xml b/configs/trinket/audio_effects.xml
index a1cc069..add0925 100644
--- a/configs/trinket/audio_effects.xml
+++ b/configs/trinket/audio_effects.xml
@@ -30,9 +30,6 @@
     <libraries>
         <library name="bundle" path="libbundlewrapper.so"/>
         <library name="reverb" path="libreverbwrapper.so"/>
-        <library name="qcbassboost" path="libqcbassboost.so"/>
-        <library name="qcvirt" path="libqcvirt.so"/>
-        <library name="qcreverb" path="libqcreverb.so"/>
         <library name="visualizer_sw" path="libvisualizer.so"/>
         <library name="visualizer_hw" path="libqcomvisualizer.so"/>
         <library name="downmix" path="libdownmix.so"/>
@@ -47,11 +44,11 @@
     </libraries>
     <effects>
         <effectProxy name="bassboost" library="proxy" uuid="14804144-a5ee-4d24-aa88-0002a5d5c51b">
-            <libsw library="qcbassboost" uuid="23aca180-44bd-11e2-bcfd-0800200c9a66"/>
+            <libsw library="bundle" uuid="8631f300-72e2-11df-b57e-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="2c4a8c24-1581-487f-94f6-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="virtualizer" library="proxy" uuid="d3467faa-acc7-4d34-acaf-0002a5d5c51b">
-            <libsw library="qcvirt" uuid="e6c98a16-22a3-11e2-b87b-f23c91aec05e"/>
+            <libsw library="bundle" uuid="1d4033c0-8557-11df-9f2d-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="509a4498-561a-4bea-b3b1-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="equalizer" library="proxy" uuid="c8e70ecd-48ca-456e-8a4f-0002a5d5c51b">
@@ -60,19 +57,19 @@
         </effectProxy>
         <effect name="volume" library="bundle" uuid="119341a0-8469-11df-81f9-0002a5d5c51b"/>
         <effectProxy name="reverb_env_aux" library="proxy" uuid="48404ac9-d202-4ccc-bf84-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="a8c1e5f3-293d-43cd-95ec-d5e26c02e217"/>
+            <libsw library="reverb" uuid="4a387fc0-8ab3-11df-8bad-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="79a18026-18fd-4185-8233-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="reverb_env_ins" library="proxy" uuid="b707403a-a1c1-4291-9573-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="791fff8b-8129-4655-83a4-59bc61034c3a"/>
+            <libsw library="reverb" uuid="c7a511a0-a3bb-11df-860e-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="eb64ea04-973b-43d2-8f5e-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="reverb_pre_aux" library="proxy" uuid="1b78f587-6d1c-422e-8b84-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="53ef1db5-c0c0-445b-b060-e34d20ebb70a"/>
+            <libsw library="reverb" uuid="f29a1400-a3bb-11df-8ddc-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="6987be09-b142-4b41-9056-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="reverb_pre_ins" library="proxy" uuid="f3e178d2-ebcb-408e-8357-0002a5d5c51b">
-            <libsw library="qcreverb" uuid="b08a0e38-22a5-11e2-b87b-f23c91aec05e"/>
+            <libsw library="reverb" uuid="172cdf00-a3bc-11df-a72f-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="aa2bebf6-47cf-4613-9bca-0002a5d5c51b"/>
         </effectProxy>
         <effectProxy name="visualizer" library="proxy" uuid="1d0a1a53-7d5d-48f2-8e71-27fbd10d842c">
diff --git a/configs/trinket/audio_policy_configuration.xml b/configs/trinket/audio_policy_configuration.xml
index 5d74497..8015afa 100644
--- a/configs/trinket/audio_policy_configuration.xml
+++ b/configs/trinket/audio_policy_configuration.xml
@@ -263,17 +263,20 @@
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
                 <devicePort tagName="BT A2DP Out" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP" role="sink"
-                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC">
+                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TW
+SP">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
                 <devicePort tagName="BT A2DP Headphones" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES" role="sink"
-                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC">
+                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TW
+SP">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
                 <devicePort tagName="BT A2DP Speaker" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER" role="sink"
-                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC">
+                            encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TW
+SP">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </devicePort>
diff --git a/configs/trinket/trinket.mk b/configs/trinket/trinket.mk
index e5f2f56..5176889 100644
--- a/configs/trinket/trinket.mk
+++ b/configs/trinket/trinket.mk
@@ -92,6 +92,8 @@
     vendor/qcom/opensource/audio-hal/primary-hal/configs/trinket/mixer_paths_tavil.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_tavil.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/trinket/mixer_paths_tasha.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_tasha.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/trinket/mixer_paths_tashalite.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_tashalite.xml \
+    frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml \
+    frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml
 
 #XML Audio configuration files
 ifneq ($(TARGET_USES_AOSP_FOR_AUDIO), true)
@@ -185,7 +187,7 @@
 
 #enable pbe effects
 PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.safx.pbe.enabled=true
+vendor.audio.safx.pbe.enabled=false
 
 #parser input buffer size(256kb) in byte stream mode
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -242,7 +244,6 @@
 vendor.audio.feature.a2dp_offload.enable=true \
 vendor.audio.feature.afe_proxy.enable=true \
 vendor.audio.feature.anc_headset.enable=true \
-vendor.audio.feature.audio_sphere.enable=true \
 vendor.audio.feature.battery_listener.enable=false \
 vendor.audio.feature.compr_cap.enable=false \
 vendor.audio.feature.compress_in.enable=false \
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index a2a52a8..f9f33d1 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -98,12 +98,13 @@
 bool cin_attached_usecase(audio_usecase_t uc_id);
 bool cin_format_supported(audio_format_t format);
 size_t cin_get_buffer_size(struct stream_in *in);
-int cin_start_input_stream(struct stream_in *in);
+int cin_open_input_stream(struct stream_in *in);
 void cin_stop_input_stream(struct stream_in *in);
 void cin_close_input_stream(struct stream_in *in);
+void cin_free_input_stream_resources(struct stream_in *in);
 int cin_read(struct stream_in *in, void *buffer,
                         size_t bytes, size_t *bytes_read);
-int cin_configure_input_stream(struct stream_in *in);
+int cin_configure_input_stream(struct stream_in *in, struct audio_config *in_config);
 
 void audio_extn_set_snd_card_split(const char* in_snd_card_name)
 {
@@ -5063,9 +5064,9 @@
 {
     return (audio_extn_compress_in_enabled? cin_get_buffer_size(in): 0);
 }
-int audio_extn_cin_start_input_stream(struct stream_in *in)
+int audio_extn_cin_open_input_stream(struct stream_in *in)
 {
-    return (audio_extn_compress_in_enabled? cin_start_input_stream(in): -1);
+    return (audio_extn_compress_in_enabled? cin_open_input_stream(in): -1);
 }
 void audio_extn_cin_stop_input_stream(struct stream_in *in)
 {
@@ -5075,15 +5076,19 @@
 {
     (audio_extn_compress_in_enabled? cin_close_input_stream(in): NULL);
 }
+void audio_extn_cin_free_input_stream_resources(struct stream_in *in)
+{
+    return (audio_extn_compress_in_enabled? cin_free_input_stream_resources(in): NULL);
+}
 int audio_extn_cin_read(struct stream_in *in, void *buffer,
                         size_t bytes, size_t *bytes_read)
 {
     return (audio_extn_compress_in_enabled?
                             cin_read(in, buffer, bytes, bytes_read): -1);
 }
-int audio_extn_cin_configure_input_stream(struct stream_in *in)
+int audio_extn_cin_configure_input_stream(struct stream_in *in, struct audio_config *in_config)
 {
-    return (audio_extn_compress_in_enabled? cin_configure_input_stream(in): -1);
+    return (audio_extn_compress_in_enabled? cin_configure_input_stream(in, in_config): -1);
 }
 // END: COMPRESS_IN ====================================================
 
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index d2b8309..18bfc2a 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -216,6 +216,9 @@
 
 //END: EXTN_QDSP_PLUGIN      ===========================================
 
+#define MIN_OFFLOAD_BUFFER_DURATION_MS 5 /* 5ms */
+#define MAX_OFFLOAD_BUFFER_DURATION_MS (100 * 1000) /* 100s */
+
 void audio_extn_set_parameters(struct audio_device *adev,
                                struct str_parms *parms);
 
@@ -1067,12 +1070,13 @@
 bool audio_extn_cin_attached_usecase(audio_usecase_t uc_id);
 bool audio_extn_cin_format_supported(audio_format_t format);
 size_t audio_extn_cin_get_buffer_size(struct stream_in *in);
-int audio_extn_cin_start_input_stream(struct stream_in *in);
+int audio_extn_cin_open_input_stream(struct stream_in *in);
 void audio_extn_cin_stop_input_stream(struct stream_in *in);
 void audio_extn_cin_close_input_stream(struct stream_in *in);
+void audio_extn_cin_free_input_stream_resources(struct stream_in *in);
 int audio_extn_cin_read(struct stream_in *in, void *buffer,
                         size_t bytes, size_t *bytes_read);
-int audio_extn_cin_configure_input_stream(struct stream_in *in);
+int audio_extn_cin_configure_input_stream(struct stream_in *in, struct audio_config *in_config);
 // END: COMPRESS_INPUT_ENABLED ===============================
 
 //START: SOURCE_TRACKING_FEATURE ==============================================
@@ -1147,6 +1151,8 @@
             uint64_t *frames, struct timespec *timestamp, int32_t clock_id);
 int audio_extn_utils_pcm_get_dsp_presentation_pos(struct stream_out *out,
             uint64_t *frames, struct timespec *timestamp, int32_t clock_id);
+size_t audio_extn_utils_get_input_buffer_size(uint32_t, audio_format_t, int, int64_t, bool);
+int audio_extn_utils_get_perf_mode_flag(void);
 #ifdef AUDIO_HW_LOOPBACK_ENABLED
 /* API to create audio patch */
 int audio_extn_hw_loopback_create_audio_patch(struct audio_hw_device *dev,
diff --git a/hal/audio_extn/auto_hal.c b/hal/audio_extn/auto_hal.c
index f008a47..ad5e331 100644
--- a/hal/audio_extn/auto_hal.c
+++ b/hal/audio_extn/auto_hal.c
@@ -445,7 +445,7 @@
  */
 #define MIN_VOLUME_VALUE_MB -6000
 #define MAX_VOLUME_VALUE_MB 600
-
+#define STEP_VALUE_MB 100
 int audio_extn_auto_hal_set_audio_port_config(struct audio_hw_device *dev,
                         const struct audio_port_config *config)
 {
@@ -498,7 +498,10 @@
                     /* millibel = 1/100 dB = 1/1000 bel
                      * q13 = (10^(mdb/100/20))*(2^13)
                      */
-                    volume = powf(10.0, ((float)config->gain.values[0] / 2000));
+                    if(config->gain.values[0] <= (MIN_VOLUME_VALUE_MB + STEP_VALUE_MB))
+                        volume = 0.0 ;
+                    else
+                        volume = powf(10.0, ((float)config->gain.values[0] / 2000));
                     ALOGV("%s: set volume to stream: %p", __func__,
                         &out_ctxt->output->stream);
                     /* set gain if output stream is active */
diff --git a/hal/audio_extn/compress_in.c b/hal/audio_extn/compress_in.c
index 6cf6b81..6b525b0 100644
--- a/hal/audio_extn/compress_in.c
+++ b/hal/audio_extn/compress_in.c
@@ -100,7 +100,7 @@
  * only after validating that input against cin_attached_usecase
  * except below calls
  * 1. cin_applicable_stream(in)
- * 2. cin_configure_input_stream(in)
+ * 2. cin_configure_input_stream(in, in_config)
  */
 
 bool cin_attached_usecase(audio_usecase_t uc_id)
@@ -179,7 +179,7 @@
     return sz;
 }
 
-int cin_start_input_stream(struct stream_in *in)
+int cin_open_input_stream(struct stream_in *in)
 {
     int ret = -EINVAL;
     struct audio_device *adev = in->dev;
@@ -208,12 +208,23 @@
 
     ALOGV("%s: in %p, cin_data %p", __func__, in, cin_data);
     if (cin_data->compr) {
+        compress_stop(cin_data->compr);
+    }
+}
+
+
+void cin_close_input_stream(struct stream_in *in)
+{
+    cin_private_data_t *cin_data = (cin_private_data_t *) in->cin_extn;
+
+    ALOGV("%s: in %p, cin_data %p", __func__, in, cin_data);
+    if (cin_data->compr) {
         compress_close(cin_data->compr);
         cin_data->compr = NULL;
     }
 }
 
-void cin_close_input_stream(struct stream_in *in)
+void cin_free_input_stream_resources(struct stream_in *in)
 {
     cin_private_data_t *cin_data = (cin_private_data_t *) in->cin_extn;
 
@@ -265,9 +276,8 @@
     return ret;
 }
 
-int cin_configure_input_stream(struct stream_in *in)
+int cin_configure_input_stream(struct stream_in *in, struct audio_config *in_config)
 {
-    struct audio_device *adev = in->dev;
     struct audio_config config = {.format = 0};
     int ret = 0, buffer_size = 0, meta_size = sizeof(struct snd_codec_metadata);
     cin_private_data_t *cin_data = NULL;
@@ -304,7 +314,8 @@
     config.channel_mask = in->channel_mask;
     config.format = in->format;
     in->config.channels = audio_channel_count_from_in_mask(in->channel_mask);
-    buffer_size = adev->device.get_input_buffer_size(&adev->device, &config);
+    buffer_size = audio_extn_utils_get_input_buffer_size(config.sample_rate, config.format,
+                    in->config.channels, in_config->offload_info.duration_us / 1000, false);
 
     cin_data->compr_config.fragment_size = buffer_size;
     cin_data->compr_config.codec->id = get_snd_codec_id(in->format);
@@ -321,6 +332,11 @@
     else
         cin_data->compr_config.codec->compr_passthr = PASSTHROUGH_GEN;
 
+    if (in->flags & AUDIO_INPUT_FLAG_FAST) {
+        ALOGD("%s: Setting latency mode to true", __func__);
+        cin_data->compr_config.codec->flags |= audio_extn_utils_get_perf_mode_flag();
+    }
+
     if ((in->flags & AUDIO_INPUT_FLAG_TIMESTAMP) ||
         (in->flags & AUDIO_INPUT_FLAG_PASSTHROUGH)) {
         compress_config_set_timstamp_flag(&cin_data->compr_config);
@@ -332,6 +348,6 @@
     return ret;
 
 err_config:
-    cin_close_input_stream(in);
+    cin_free_input_stream_resources(in);
     return ret;
 }
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index d66b368..30bc10d 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -37,6 +37,7 @@
 #include "platform.h"
 #include "platform_api.h"
 #include "audio_extn.h"
+#include "voice_extn.h"
 #include "voice.h"
 #include <sound/compress_params.h>
 #include <sound/compress_offload.h>
@@ -1249,6 +1250,88 @@
     return rc;
 }
 
+static int audio_extn_utils_check_input_parameters(uint32_t sample_rate,
+                                  audio_format_t format,
+                                  int channel_count)
+{
+    int ret = 0;
+
+    if (((format != AUDIO_FORMAT_PCM_16_BIT) && (format != AUDIO_FORMAT_PCM_8_24_BIT) &&
+        (format != AUDIO_FORMAT_PCM_24_BIT_PACKED) && (format != AUDIO_FORMAT_PCM_32_BIT) &&
+        (format != AUDIO_FORMAT_PCM_FLOAT)) &&
+        !voice_extn_compress_voip_is_format_supported(format) &&
+        !audio_extn_compr_cap_format_supported(format) &&
+        !audio_extn_cin_format_supported(format))
+            ret = -EINVAL;
+
+    switch (channel_count) {
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+    case 6:
+    case 8:
+        break;
+    default:
+        ret = -EINVAL;
+    }
+
+    switch (sample_rate) {
+    case 8000:
+    case 11025:
+    case 12000:
+    case 16000:
+    case 22050:
+    case 24000:
+    case 32000:
+    case 44100:
+    case 48000:
+    case 88200:
+    case 96000:
+    case 176400:
+    case 192000:
+        break;
+    default:
+        ret = -EINVAL;
+    }
+
+    return ret;
+}
+
+static inline uint32_t audio_extn_utils_nearest_multiple(uint32_t num, uint32_t multiplier)
+{
+    uint32_t remainder = 0;
+
+    if (!multiplier)
+        return num;
+
+    remainder = num % multiplier;
+    if (remainder)
+        num += (multiplier - remainder);
+
+    return num;
+}
+
+static inline uint32_t audio_extn_utils_lcm(uint32_t num1, uint32_t num2)
+{
+    uint32_t high = num1, low = num2, temp = 0;
+
+    if (!num1 || !num2)
+        return 0;
+
+    if (num1 < num2) {
+         high = num2;
+         low = num1;
+    }
+
+    while (low != 0) {
+        temp = low;
+        low = high % low;
+        high = temp;
+    }
+    return (num1 * num2)/high;
+}
+
 int audio_extn_utils_send_app_type_cfg(struct audio_device *adev,
                                        struct audio_usecase *usecase)
 {
@@ -1442,11 +1525,15 @@
 
 uint32_t get_alsa_fragment_size(uint32_t bytes_per_sample,
                                   uint32_t sample_rate,
-                                  uint32_t noOfChannels)
+                                  uint32_t noOfChannels,
+                                  int64_t duration_ms)
 {
     uint32_t fragment_size = 0;
     uint32_t pcm_offload_time = PCM_OFFLOAD_BUFFER_DURATION;
 
+    if (duration_ms >= MIN_OFFLOAD_BUFFER_DURATION_MS && duration_ms <= MAX_OFFLOAD_BUFFER_DURATION_MS)
+        pcm_offload_time = duration_ms;
+
     fragment_size = (pcm_offload_time
                      * sample_rate
                      * bytes_per_sample
@@ -1481,7 +1568,8 @@
     out->compr_config.fragment_size =
              get_alsa_fragment_size(hal_op_bytes_per_sample,
                                       out->sample_rate,
-                                      popcount(out->channel_mask));
+                                      popcount(out->channel_mask),
+                                      out->info.duration_us / 1000);
 
     if ((src_format != dst_format) &&
          hal_op_bytes_per_sample != hal_ip_bytes_per_sample) {
@@ -2860,3 +2948,51 @@
 
     return is_running_with_enhanced_fwk;
 }
+
+int audio_extn_utils_get_perf_mode_flag(void)
+{
+#ifdef COMPRESSED_PERF_MODE_FLAG
+    return COMPRESSED_PERF_MODE_FLAG;
+#else
+    return 0;
+#endif
+}
+
+size_t audio_extn_utils_get_input_buffer_size(uint32_t sample_rate,
+                                            audio_format_t format,
+                                            int channel_count,
+                                            int64_t duration_ms,
+                                            bool is_low_latency)
+{
+    size_t size = 0;
+    size_t capture_duration = AUDIO_CAPTURE_PERIOD_DURATION_MSEC;
+    uint32_t bytes_per_period_sample = 0;
+
+
+    if (audio_extn_utils_check_input_parameters(sample_rate, format, channel_count) != 0)
+        return 0;
+
+    if (duration_ms >= MIN_OFFLOAD_BUFFER_DURATION_MS && duration_ms <= MAX_OFFLOAD_BUFFER_DURATION_MS)
+        capture_duration = duration_ms;
+
+    size = (sample_rate * capture_duration) / 1000;
+    if (is_low_latency)
+        size = LOW_LATENCY_CAPTURE_PERIOD_SIZE;
+
+
+    bytes_per_period_sample = audio_bytes_per_sample(format) * channel_count;
+    size *= bytes_per_period_sample;
+
+    /* make sure the size is multiple of 32 bytes and additionally multiple of
+     * the frame_size (required for 24bit samples and non-power-of-2 channel counts)
+     * At 48 kHz mono 16-bit PCM:
+     *  5.000 ms = 240 frames = 15*16*1*2 = 480, a whole multiple of 32 (15)
+     *  3.333 ms = 160 frames = 10*16*1*2 = 320, a whole multiple of 32 (10)
+     *
+     *  The loop reaches result within 32 iterations, as initial size is
+     *  already a multiple of frame_size
+     */
+    size = audio_extn_utils_nearest_multiple(size, audio_extn_utils_lcm(32, bytes_per_period_sample));
+
+    return size;
+}
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 5baa9ad..7d8103b 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2912,8 +2912,10 @@
     if (audio_extn_ext_hw_plugin_usecase_start(adev->ext_hw_plugin, uc_info))
         ALOGE("%s: failed to start ext hw plugin", __func__);
 
+    android_atomic_acquire_cas(true, false, &(in->capture_stopped));
+
     if (audio_extn_cin_attached_usecase(in->usecase)) {
-       ret = audio_extn_cin_start_input_stream(in);
+       ret = audio_extn_cin_open_input_stream(in);
        if (ret)
            goto error_open;
        else
@@ -6231,7 +6233,7 @@
             in->capture_started = false;
         } else {
             if (audio_extn_cin_attached_usecase(in->usecase))
-                audio_extn_cin_stop_input_stream(in);
+                audio_extn_cin_close_input_stream(in);
         }
 
         if (in->pcm) {
@@ -6535,6 +6537,13 @@
         in->standby = 0;
     }
 
+    /* Avoid read if capture_stopped is set */
+    if (android_atomic_acquire_load(&(in->capture_stopped)) > 0) {
+        ALOGD("%s: force stopped catpure session, ignoring read request", __func__);
+        ret = -EINVAL;
+        goto exit;
+    }
+
     // what's the duration requested by the client?
     long ns = 0;
 
@@ -7383,6 +7392,11 @@
             ALOGV("non-offload DIRECT_usecase ... usecase selected %d ", out->usecase);
         }
 
+        if (out->flags & AUDIO_OUTPUT_FLAG_FAST) {
+            ALOGD("%s: Setting latency mode to true", __func__);
+            out->compr_config.codec->flags |= audio_extn_utils_get_perf_mode_flag();
+        }
+
         if (out->usecase == USECASE_INVALID) {
             if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL &&
                     config->format == 0 && config->sample_rate == 0 &&
@@ -7466,6 +7480,10 @@
 
             out->compr_config.fragments = DIRECT_PCM_NUM_FRAGMENTS;
 
+            if ((config->offload_info.duration_us >= MIN_OFFLOAD_BUFFER_DURATION_MS * 1000) &&
+                   (config->offload_info.duration_us <= MAX_OFFLOAD_BUFFER_DURATION_MS * 1000))
+                out->info.duration_us = (int64_t)config->offload_info.duration_us;
+
             /* Check if alsa session is configured with the same format as HAL input format,
              * if not then derive correct fragment size needed to accomodate the
              * conversion of HAL input format to alsa format.
@@ -8214,13 +8232,17 @@
             if (usecase->stream.out && (usecase->type == PCM_PLAYBACK) &&
                 (usecase->devices & AUDIO_DEVICE_OUT_ALL_A2DP)){
                 ALOGD("reconfigure a2dp... forcing device switch");
-
                 pthread_mutex_unlock(&adev->lock);
                 lock_output_stream(usecase->stream.out);
                 pthread_mutex_lock(&adev->lock);
                 audio_extn_a2dp_set_handoff_mode(true);
+                ALOGD("Switching to speaker and muting the stream before select_devices");
+                check_a2dp_restore_l(adev, usecase->stream.out, false);
                 //force device switch to re configure encoder
                 select_devices(adev, usecase->id);
+                ALOGD("Unmuting the stream after select_devices");
+                usecase->stream.out->a2dp_compress_mute = false;
+                out_set_compr_volume(&usecase->stream.out->stream, usecase->stream.out->volume_l, usecase->stream.out->volume_r);
                 audio_extn_a2dp_set_handoff_mode(false);
                 pthread_mutex_unlock(&usecase->stream.out->lock);
                 break;
@@ -8728,6 +8750,8 @@
     }
 
     if (config->sample_rate == LOW_LATENCY_CAPTURE_SAMPLE_RATE &&
+            (flags & AUDIO_INPUT_FLAG_TIMESTAMP) == 0 &&
+            (flags & AUDIO_INPUT_FLAG_COMPRESS) == 0 &&
             (flags & AUDIO_INPUT_FLAG_FAST) != 0) {
         is_low_latency = true;
 #if LOW_LATENCY_CAPTURE_USE_CASE
@@ -8848,7 +8872,7 @@
                    (in->dev->mode != AUDIO_MODE_IN_COMMUNICATION)) {
             audio_extn_compr_cap_init(in);
         } else if (audio_extn_cin_applicable_stream(in)) {
-            ret = audio_extn_cin_configure_input_stream(in);
+            ret = audio_extn_cin_configure_input_stream(in, config);
             if (ret)
                 goto err_open;
         } else {
@@ -8899,7 +8923,7 @@
                     ALOGV("%s: overriding usecase with USECASE_AUDIO_RECORD_COMPRESS2 and appending compress flag", __func__);
                     if (audio_extn_cin_applicable_stream(in)) {
                         in->sample_rate = config->sample_rate;
-                        ret = audio_extn_cin_configure_input_stream(in);
+                        ret = audio_extn_cin_configure_input_stream(in, config);
                         if (ret)
                             goto err_open;
                     }
@@ -9026,7 +9050,7 @@
         audio_extn_compr_cap_deinit();
 
     if (audio_extn_cin_attached_usecase(in->usecase))
-        audio_extn_cin_close_input_stream(in);
+        audio_extn_cin_free_input_stream_resources(in);
 
     if (in->is_st_session) {
         ALOGV("%s: sound trigger pcm stop lab", __func__);
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index d84a8f7..4810896 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -473,6 +473,8 @@
     float zoom;
     audio_microphone_direction_t direction;
 
+    volatile int32_t capture_stopped;
+
     /* Array of supported channel mask configurations. +1 so that the last entry is always 0 */
     audio_channel_mask_t supported_channel_masks[MAX_SUPPORTED_CHANNEL_MASKS + 1];
     audio_format_t supported_formats[MAX_SUPPORTED_FORMATS + 1];
diff --git a/hal/audio_hw_extn_api.c b/hal/audio_hw_extn_api.c
index af73375..22c8685 100644
--- a/hal/audio_hw_extn_api.c
+++ b/hal/audio_hw_extn_api.c
@@ -34,6 +34,7 @@
 #include <inttypes.h>
 #include <errno.h>
 #include <log/log.h>
+#include <cutils/atomic.h>
 
 #include <hardware/audio.h>
 #include "sound/compress_params.h"
@@ -190,6 +191,31 @@
     return ret;
 }
 
+int qahwi_in_stop(struct audio_stream_in* stream) {
+    struct stream_in *in = (struct stream_in *)stream;
+    struct audio_device *adev = in->dev;
+
+    ALOGD("%s processing, in %p", __func__, in);
+
+    pthread_mutex_lock(&adev->lock);
+
+    if (!in->standby) {
+        if (in->pcm != NULL ) {
+            pcm_stop(in->pcm);
+        } else if (audio_extn_cin_attached_usecase(in->usecase)) {
+            audio_extn_cin_stop_input_stream(in);
+        }
+
+        /* Set the atomic variable when the session is stopped */
+        if (android_atomic_acquire_cas(false, true, &(in->capture_stopped)) == 0)
+            ALOGI("%s: capture_stopped bit set", __func__);
+    }
+
+    pthread_mutex_unlock(&adev->lock);
+
+    return 0;
+}
+
 ssize_t qahwi_in_read_v2(struct audio_stream_in *stream, void* buffer,
                           size_t bytes, uint64_t *timestamp)
 {
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index e6989f6..8b9b53d 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -4206,7 +4206,7 @@
         * enforced audible (e.g. Camera shutter sound).
         */
         if ((mode == AUDIO_MODE_IN_CALL) ||
-            voice_is_in_call(adev) ||
+            voice_check_voicecall_usecases_active(adev) ||
             voice_extn_compress_voip_is_active(adev))
                 is_active_voice_call = true;
 
@@ -4289,7 +4289,7 @@
     }
 
     if ((mode == AUDIO_MODE_IN_CALL) ||
-        voice_is_in_call(adev) ||
+        voice_check_voicecall_usecases_active(adev) ||
         voice_extn_compress_voip_is_active(adev)) {
         if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
             devices & AUDIO_DEVICE_OUT_WIRED_HEADSET ||
@@ -4665,8 +4665,10 @@
     ALOGV("%s: enter: out_device(%#x) in_device(%#x) channel_count (%d) channel_mask (0x%x)",
           __func__, out_device, in_device, channel_count, channel_mask);
     if (my_data->external_mic) {
-        if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || voice_is_in_call(adev) ||
-            voice_extn_compress_voip_is_active(adev) || audio_extn_hfp_is_active(adev))) {
+        if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) ||
+            voice_check_voicecall_usecases_active(adev) ||
+            voice_extn_compress_voip_is_active(adev) ||
+            audio_extn_hfp_is_active(adev))) {
             if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
                out_device & AUDIO_DEVICE_OUT_EARPIECE ||
                out_device & AUDIO_DEVICE_OUT_SPEAKER )
@@ -4680,8 +4682,10 @@
     if (snd_device != AUDIO_DEVICE_NONE)
         goto exit;
 
-    if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || voice_is_in_call(adev) ||
-        voice_extn_compress_voip_is_active(adev) || audio_extn_hfp_is_active(adev))) {
+    if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) ||
+        voice_check_voicecall_usecases_active(adev) ||
+        voice_extn_compress_voip_is_active(adev) ||
+        audio_extn_hfp_is_active(adev))) {
         if ((adev->voice.tty_mode != TTY_MODE_OFF) &&
             !voice_extn_compress_voip_is_active(adev)) {
             if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 676a30d..1b14d63 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -4814,6 +4814,9 @@
                 else if (strncmp(backend_tag_table[snd_device], "headphones",
                             sizeof("headphones")) == 0)
                         port = HEADPHONE_BACKEND;
+                else if (strncmp(backend_tag_table[snd_device], "headset",
+                            sizeof("headset")) == 0)
+                        port = HEADPHONE_BACKEND;
                 else if (strcmp(backend_tag_table[snd_device], "hdmi") == 0)
                         port = HDMI_RX_BACKEND;
                 else if (strcmp(backend_tag_table[snd_device], "display-port") == 0)
@@ -5591,7 +5594,7 @@
         * enforced audible (e.g. Camera shutter sound).
         */
         if ((mode == AUDIO_MODE_IN_CALL) ||
-            voice_is_in_call(adev) ||
+            voice_check_voicecall_usecases_active(adev) ||
             voice_extn_compress_voip_is_active(adev))
                 is_active_voice_call = true;
 
@@ -5715,7 +5718,7 @@
     }
 
     if ((mode == AUDIO_MODE_IN_CALL) ||
-        voice_is_in_call(adev) ||
+        voice_check_voicecall_usecases_active(adev) ||
         voice_extn_compress_voip_is_active(adev) ||
         adev->enable_voicerx ||
         audio_extn_hfp_is_active(adev)) {
@@ -6212,8 +6215,10 @@
     ALOGV("%s: enter: out_device(%#x) in_device(%#x) channel_count (%d) channel_mask (0x%x)",
           __func__, out_device, in_device, channel_count, channel_mask);
     if (my_data->external_mic) {
-        if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || voice_is_in_call(adev) ||
-            voice_extn_compress_voip_is_active(adev) || audio_extn_hfp_is_active(adev))) {
+        if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) ||
+            voice_check_voicecall_usecases_active(adev) ||
+            voice_extn_compress_voip_is_active(adev) ||
+            audio_extn_hfp_is_active(adev))) {
             if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
                out_device & AUDIO_DEVICE_OUT_EARPIECE ||
                out_device & AUDIO_DEVICE_OUT_SPEAKER )
@@ -6227,8 +6232,10 @@
     if (snd_device != AUDIO_DEVICE_NONE)
         goto exit;
 
-    if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) || voice_is_in_call(adev) ||
-        voice_extn_compress_voip_is_active(adev) || audio_extn_hfp_is_active(adev))) {
+    if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) ||
+        voice_check_voicecall_usecases_active(adev) ||
+        voice_extn_compress_voip_is_active(adev) ||
+        audio_extn_hfp_is_active(adev))) {
         if ((adev->voice.tty_mode != TTY_MODE_OFF) &&
             !voice_extn_compress_voip_is_active(adev)) {
             if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
@@ -7953,6 +7960,9 @@
 {
     char value[PROPERTY_VALUE_MAX] = {0};
     uint32_t fragment_size = COMPRESS_OFFLOAD_FRAGMENT_SIZE;
+    uint32_t new_fragment_size = 0;
+    int32_t duration_ms = 0;
+    int channel_count = 0;
     if((property_get("vendor.audio.offload.buffer.size.kb", value, "")) &&
             atoi(value)) {
         fragment_size =  atoi(value) * 1024;
@@ -7966,6 +7976,17 @@
         fragment_size = info->offload_buffer_size;
     }
 
+    /* Use client specified buffer size if mentioned */
+    if ((info != NULL) && (info->duration_us > 0)) {
+        duration_ms = info->duration_us / 1000;
+        channel_count = audio_channel_count_from_in_mask(info->channel_mask);
+
+        new_fragment_size = (duration_ms * info->sample_rate * channel_count * audio_bytes_per_sample(info->format)) / 1000;
+        ALOGI("%s:: Overwriting offload buffer size with client requested size old:%d new:%d", __func__, fragment_size, new_fragment_size);
+
+        fragment_size = new_fragment_size;
+    }
+
     if (info != NULL) {
         if (info->is_streaming && info->has_video) {
             fragment_size = COMPRESS_OFFLOAD_FRAGMENT_SIZE_FOR_AV_STREAMING;
diff --git a/hal/voice.c b/hal/voice.c
index 729ab27..006dd08 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -377,6 +377,22 @@
     return session_id;
 }
 
+bool voice_check_voicecall_usecases_active(struct audio_device *adev)
+{
+    struct listnode *node;
+    struct audio_usecase *usecase = NULL;
+
+    list_for_each(node, &adev->usecase_list) {
+        usecase = node_to_item(node, struct audio_usecase, list);
+        if (usecase->type == VOICE_CALL) {
+            ALOGV("%s: voice usecase:%s is active", __func__,
+                   use_case_table[usecase->id]);
+            return true;
+        }
+    }
+    return false;
+}
+
 int voice_check_and_set_incall_rec_usecase(struct audio_device *adev,
                                            struct stream_in *in)
 {
diff --git a/hal/voice.h b/hal/voice.h
index 9612edd..188345d 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -101,4 +101,5 @@
 bool voice_is_call_state_active(struct audio_device *adev);
 void voice_set_device_mute_flag (struct audio_device *adev, bool state);
 snd_device_t voice_get_incall_rec_backend_device(struct stream_in *in);
+bool voice_check_voicecall_usecases_active(struct audio_device *adev);
 #endif //VOICE_H
diff --git a/post_proc/Android.mk b/post_proc/Android.mk
index 6b1afd3..fb42514 100644
--- a/post_proc/Android.mk
+++ b/post_proc/Android.mk
@@ -30,8 +30,7 @@
         virtualizer.c \
         reverb.c \
         effect_api.c \
-        effect_util.c \
-        asphere.c
+        effect_util.c
 
 # HW_ACCELERATED has been disabled by default since msm8996. File doesn't
 # compile cleanly on tip so don't want to include it, but keeping this
diff --git a/post_proc/Makefile.am b/post_proc/Makefile.am
index bd29473..8bd41ae 100644
--- a/post_proc/Makefile.am
+++ b/post_proc/Makefile.am
@@ -19,10 +19,6 @@
 c_sources += hw_accelerator.c
 endif
 
-if AUDIOSPHERE
-c_sources += asphere.c
-endif
-
 library_include_HEADERS = $(h_sources)
 library_includedir = $(includedir)
 
diff --git a/post_proc/asphere.c b/post_proc/asphere.c
deleted file mode 100644
index efe07c6..0000000
--- a/post_proc/asphere.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/* Copyright (c) 2015, 2017, 2019 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.
- *
- */
-#define LOG_TAG "audio_pp_asphere"
-/*#define LOG_NDEBUG 0*/
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <sys/stat.h>
-#include <log/log.h>
-#include <cutils/list.h>
-#include <cutils/str_parms.h>
-#include <cutils/properties.h>
-#include <hardware/audio_effect.h>
-#include <pthread.h>
-#include "bundle.h"
-#include "equalizer.h"
-#include "bass_boost.h"
-#include "virtualizer.h"
-#include "reverb.h"
-#include "asphere.h"
-
-#define ASPHERE_MIXER_NAME  "MSM ASphere Set Param"
-
-#define AUDIO_PARAMETER_KEY_ASPHERE_STATUS  "asphere_status"
-#define AUDIO_PARAMETER_KEY_ASPHERE_ENABLE   "asphere_enable"
-#define AUDIO_PARAMETER_KEY_ASPHERE_STRENGTH "asphere_strength"
-
-#define AUDIO_ASPHERE_EVENT_NODE "/data/misc/audio_pp/event_node"
-
-enum {
-    ASPHERE_ACTIVE = 0,
-    ASPHERE_SUSPENDED,
-    ASPHERE_ERROR
-};
-
-#ifdef AUDIO_FEATURE_ENABLED_GCOV
-extern void  __gcov_flush();
-static void enable_gcov()
-{
-    __gcov_flush();
-}
-#else
-static void enable_gcov()
-{
-}
-#endif
-
-struct asphere_module {
-    bool enabled;
-    int status;
-    int strength;
-    pthread_mutex_t lock;
-    int init_status;
-};
-
-static struct asphere_module asphere;
-pthread_once_t asphere_once = PTHREAD_ONCE_INIT;
-
-static int asphere_create_app_notification_node(void)
-{
-    int fd;
-    if ((fd = open(AUDIO_ASPHERE_EVENT_NODE, O_CREAT|O_TRUNC|O_WRONLY,
-                            S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) {
-        ALOGE("creating notification node failed %d", errno);
-        return -EINVAL;
-    }
-    chmod(AUDIO_ASPHERE_EVENT_NODE, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH);
-    close(fd);
-    ALOGD("%s: successfully created notification node %s",
-                               __func__, AUDIO_ASPHERE_EVENT_NODE);
-    return 0;
-}
-
-static int asphere_notify_app(void)
-{
-    int fd;
-    if ((fd = open(AUDIO_ASPHERE_EVENT_NODE, O_TRUNC|O_WRONLY)) < 0) {
-        ALOGE("opening notification node failed %d", errno);
-        return -EINVAL;
-    }
-    close(fd);
-    ALOGD("%s: successfully opened notification node", __func__);
-    return 0;
-}
-
-static int asphere_get_values_from_mixer(void)
-{
-    int ret = 0;
-    long val[2] = {-1, -1};
-    struct mixer_ctl *ctl = NULL;
-    struct mixer *mixer = mixer_open(MIXER_CARD);
-    if (mixer)
-        ctl = mixer_get_ctl_by_name(mixer, ASPHERE_MIXER_NAME);
-    if (!ctl) {
-        ALOGE("%s: could not get ctl for mixer cmd - %s",
-              __func__, ASPHERE_MIXER_NAME);
-        return -EINVAL;
-    }
-    ret = mixer_ctl_get_array(ctl, val, sizeof(val)/sizeof(val[0]));
-    if (!ret) {
-        asphere.enabled = (val[0] == 0) ? false : true;
-        asphere.strength = val[1];
-    }
-    ALOGD("%s: returned %d, enabled:%ld, strength:%ld",
-          __func__, ret, val[0], val[1]);
-
-    return ret;
-}
-
-static int asphere_set_values_to_mixer(void)
-{
-    int ret = 0;
-    long val[2] = {-1, -1};
-    struct mixer_ctl *ctl = NULL;
-    struct mixer *mixer = mixer_open(MIXER_CARD);
-    if (mixer)
-        ctl = mixer_get_ctl_by_name(mixer, ASPHERE_MIXER_NAME);
-    if (!ctl) {
-        ALOGE("%s: could not get ctl for mixer cmd - %s",
-              __func__, ASPHERE_MIXER_NAME);
-        return -EINVAL;
-    }
-    val[0] = ((asphere.status == ASPHERE_ACTIVE) && asphere.enabled) ? 1 : 0;
-    val[1] = asphere.strength;
-
-    ret = mixer_ctl_set_array(ctl, val, sizeof(val)/sizeof(val[0]));
-    ALOGD("%s: returned %d, enabled:%ld, strength:%ld",
-          __func__, ret, val[0], val[1]);
-
-    return ret;
-}
-
-static void asphere_init_once() {
-    ALOGD("%s", __func__);
-    pthread_mutex_init(&asphere.lock, NULL);
-
-    if (property_get_bool("vendor.audio.feature.audio_sphere.enable", false)) {
-        asphere.init_status = 1;
-        asphere_get_values_from_mixer();
-        asphere_create_app_notification_node();
-        return;
-    } else {
-        ALOGW("%s: asphere feature not enabled", __func__);
-    }
-
-    asphere.init_status = 0;
-}
-
-static int asphere_init() {
-    pthread_once(&asphere_once, asphere_init_once);
-    enable_gcov();
-    return asphere.init_status;
-}
-
-static bool asphere_parms_allowed(struct str_parms *parms)
-{
-    if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_ASPHERE_ENABLE))
-        return true;
-    if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_ASPHERE_STRENGTH))
-        return true;
-    if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_ASPHERE_STATUS))
-        return true;
-
-    return false;
-}
-
-void asphere_set_parameters(struct str_parms *parms)
-{
-    int ret = 0;
-    bool enable = false;
-    int strength = -1;
-    char value[32] = {0};
-    bool set_enable = false, set_strength = false;
-
-    if (!asphere_parms_allowed(parms)) {
-        return;
-    }
-
-    if (asphere_init() != 1) {
-        ALOGW("%s: init check failed!!!", __func__);
-        return;
-    }
-
-    ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_ASPHERE_ENABLE,
-                                                  value, sizeof(value));
-    if (ret > 0) {
-        enable = (atoi(value) == 1) ? true : false;
-        set_enable = true;
-    }
-
-    ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_ASPHERE_STRENGTH,
-                                                   value, sizeof(value));
-    if (ret > 0) {
-        strength = atoi(value);
-        if (strength >= 0 && strength <= 1000)
-            set_strength = true;
-    }
-
-    if (set_enable || set_strength) {
-        pthread_mutex_lock(&asphere.lock);
-        asphere.enabled = set_enable ? enable : asphere.enabled;
-        asphere.strength = set_strength ? strength : asphere.strength;
-        ret = asphere_set_values_to_mixer();
-        pthread_mutex_unlock(&asphere.lock);
-        ALOGV("%s: exit ret %d", __func__, ret);
-    }
-}
-
-void asphere_get_parameters(struct str_parms *query,
-                                      struct str_parms *reply)
-{
-    char value[32] = {0};
-    int ret;
-
-    if (asphere_init() != 1) {
-        ALOGW("%s: init check failed!!!", __func__);
-        return;
-    }
-
-    ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_ASPHERE_STATUS,
-                                                 value, sizeof(value));
-    if (ret >= 0) {
-        str_parms_add_int(reply, AUDIO_PARAMETER_KEY_ASPHERE_STATUS,
-                                                     asphere.status);
-    }
-
-    ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_ASPHERE_ENABLE,
-                                                 value, sizeof(value));
-    if (ret >= 0) {
-        str_parms_add_int(reply, AUDIO_PARAMETER_KEY_ASPHERE_ENABLE,
-                                              asphere.enabled ? 1 : 0);
-    }
-
-    ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_ASPHERE_STRENGTH,
-                                                  value, sizeof(value));
-    if (ret >= 0) {
-        str_parms_add_int(reply, AUDIO_PARAMETER_KEY_ASPHERE_STRENGTH,
-                                                     asphere.strength);
-    }
-}
-
-static bool effect_needs_asphere_concurrency_handling(effect_context_t *context)
-{
-    if (memcmp(&context->desc->type,
-                &equalizer_descriptor.type, sizeof(effect_uuid_t)) == 0 ||
-        memcmp(&context->desc->type,
-                &bassboost_descriptor.type, sizeof(effect_uuid_t)) == 0 ||
-        memcmp(&context->desc->type,
-                &virtualizer_descriptor.type, sizeof(effect_uuid_t)) == 0 ||
-        memcmp(&context->desc->type,
-                &ins_preset_reverb_descriptor.type, sizeof(effect_uuid_t)) == 0 ||
-        memcmp(&context->desc->type,
-                &ins_env_reverb_descriptor.type, sizeof(effect_uuid_t)) == 0)
-        return true;
-
-    return false;
-}
-
-void handle_asphere_on_effect_enabled(bool enable,
-                                      effect_context_t *context,
-                                      struct listnode *created_effects)
-{
-    struct listnode *node;
-
-    ALOGV("%s: effect %0x", __func__, context->desc->type.timeLow);
-    if (asphere_init() != 1) {
-        ALOGW("%s: init check failed!!!", __func__);
-        return;
-    }
-
-    if (!effect_needs_asphere_concurrency_handling(context)) {
-        ALOGV("%s: effect %0x, do not need concurrency handling",
-                                 __func__, context->desc->type.timeLow);
-        return;
-    }
-
-    list_for_each(node, created_effects) {
-        effect_context_t *fx_ctxt = node_to_item(node,
-                                                 effect_context_t,
-                                                 effects_list_node);
-        if (fx_ctxt != NULL &&
-            effect_needs_asphere_concurrency_handling(fx_ctxt) == true &&
-            fx_ctxt != context && effect_is_active(fx_ctxt) == true) {
-            ALOGV("%s: found another effect %0x, skip processing %0x", __func__,
-                      fx_ctxt->desc->type.timeLow, context->desc->type.timeLow);
-            return;
-        }
-    }
-    pthread_mutex_lock(&asphere.lock);
-    asphere.status = enable ? ASPHERE_SUSPENDED : ASPHERE_ACTIVE;
-    asphere_set_values_to_mixer();
-    asphere_notify_app();
-    pthread_mutex_unlock(&asphere.lock);
-}
diff --git a/post_proc/asphere.h b/post_proc/asphere.h
deleted file mode 100644
index 3babd1d..0000000
--- a/post_proc/asphere.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (c) 2015, 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.
- *
- */
-
-#ifndef OFFLOAD_ASPHERE_H_
-#define OFFLOAD_ASPHERE_H_
-
-#include <cutils/str_parms.h>
-#include <cutils/list.h>
-#include "bundle.h"
-
-void asphere_get_parameters(struct str_parms *query,
-                            struct str_parms *reply);
-void asphere_set_parameters(struct str_parms *reply);
-void handle_asphere_on_effect_enabled(bool enable,
-                                      effect_context_t *context,
-                                      struct listnode *created_effects);
-
-#endif /* OFFLOAD_ASPHERE_H_ */
diff --git a/post_proc/bundle.c b/post_proc/bundle.c
index 1e6b91d..0dbf27b 100644
--- a/post_proc/bundle.c
+++ b/post_proc/bundle.c
@@ -40,6 +40,7 @@
 
 #include <stdlib.h>
 #include <cutils/list.h>
+#include <cutils/str_parms.h>
 #include <log/log.h>
 #include <system/thread_defs.h>
 #include <tinyalsa/asoundlib.h>
@@ -53,7 +54,6 @@
 #include "bass_boost.h"
 #include "virtualizer.h"
 #include "reverb.h"
-#include "asphere.h"
 
 #ifdef DTS_EAGLE
 #include "effect_util.h"
@@ -455,20 +455,16 @@
 
 /*
  * Effect Bundle Set and get param operations.
- * currently only handles audio sphere scenario,
- * but the interface itself can be utilized for any effect.
  */
 __attribute__ ((visibility ("default")))
-void offload_effects_bundle_get_parameters(struct str_parms *query,
-                                           struct str_parms *reply)
+void offload_effects_bundle_get_parameters(struct str_parms *query __unused,
+                                           struct str_parms *reply __unused)
 {
-    asphere_get_parameters(query, reply);
 }
 
 __attribute__ ((visibility ("default")))
-void offload_effects_bundle_set_parameters(struct str_parms *parms)
+void offload_effects_bundle_set_parameters(struct str_parms *parms __unused)
 {
-    asphere_set_parameters(parms);
 }
 
 /*
@@ -826,7 +822,6 @@
             status = -ENOSYS;
             goto exit;
         }
-        handle_asphere_on_effect_enabled(true, context, &created_effects_list);
         context->state = EFFECT_STATE_ACTIVE;
         if (context->ops.enable)
             context->ops.enable(context);
@@ -841,7 +836,6 @@
             status = -ENOSYS;
             goto exit;
         }
-        handle_asphere_on_effect_enabled(false, context, &created_effects_list);
         context->state = EFFECT_STATE_INITIALIZED;
         if (context->ops.disable)
             context->ops.disable(context);
diff --git a/qahw/inc/qahw.h b/qahw/inc/qahw.h
index dd5b403..5020c8f 100644
--- a/qahw/inc/qahw.h
+++ b/qahw/inc/qahw.h
@@ -358,6 +358,10 @@
 ssize_t qahw_in_read_l(qahw_stream_handle_t *in_handle,
                      qahw_in_buffer_t *in_buf);
 /*
+ * Stop input stream. Returns zero on success.
+ */
+int qahw_in_stop_l(qahw_stream_handle_t *in_handle);
+/*
  * Return the amount of input frames lost in the audio driver since the
  * last call of this function.
  * Audio driver is expected to reset the value to 0 and restart counting
diff --git a/qahw/src/qahw.c b/qahw/src/qahw.c
index 3390c26..545152c 100644
--- a/qahw/src/qahw.c
+++ b/qahw/src/qahw.c
@@ -61,6 +61,8 @@
 typedef uint64_t (*qahwi_in_read_v2_t)(audio_stream_in_t *in, void* buffer,
                                        size_t bytes, int64_t *timestamp);
 
+typedef int (*qahwi_in_stop_t)(audio_stream_in_t *in);
+
 typedef int (*qahwi_out_set_param_data_t)(struct audio_stream_out *out,
                                       qahw_param_id param_id,
                                       qahw_param_payload *payload);
@@ -109,6 +111,7 @@
     struct listnode list;
     pthread_mutex_t lock;
     qahwi_in_read_v2_t qahwi_in_read_v2;
+    qahwi_in_stop_t qahwi_in_stop;
 } qahw_stream_in_t;
 
 typedef enum {
@@ -1035,6 +1038,31 @@
 }
 
 /*
+ * Stop input stream. Returns zero on success.
+ */
+int qahw_in_stop_l(qahw_stream_handle_t *in_handle)
+{
+    int rc = -EINVAL;
+    qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+    audio_stream_in_t *in = NULL;
+
+    if (!is_valid_qahw_stream_l((void *)qahw_stream_in, STREAM_DIR_IN)) {
+        ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+        goto exit;
+    }
+    ALOGD("%s", __func__);
+
+    in = qahw_stream_in->stream;
+
+    if (qahw_stream_in->qahwi_in_stop)
+        rc = qahw_stream_in->qahwi_in_stop(in);
+    ALOGD("%s: exit", __func__);
+
+exit:
+    return rc;
+}
+
+/*
  * Return the amount of input frames lost in the audio driver since the
  * last call of this function.
  * Audio driver is expected to reset the value to 0 and restart counting
@@ -1718,6 +1746,7 @@
     qahw_module_t *qahw_module_temp = NULL;
     audio_hw_device_t *audio_device = NULL;
     qahw_stream_in_t *qahw_stream_in = NULL;
+    const char *error;
 
     pthread_mutex_lock(&qahw_module_init_lock);
     qahw_module_temp = get_qahw_module_by_ptr_l(qahw_module);
@@ -1747,6 +1776,7 @@
     if (rc) {
         ALOGE("%s::open input stream failed %d",__func__, rc);
         free(qahw_stream_in);
+        goto exit;
     } else {
         qahw_stream_in->module = hw_module;
         *in_handle = (void *)qahw_stream_in;
@@ -1757,7 +1787,6 @@
     /* dlsym qahwi_in_read_v2 if timestamp flag is used */
     if (!rc && ((flags & QAHW_INPUT_FLAG_TIMESTAMP) ||
                 (flags & QAHW_INPUT_FLAG_PASSTHROUGH))) {
-        const char *error;
 
         /* clear any existing errors */
         dlerror();
@@ -1769,7 +1798,16 @@
         }
     }
 
-exit:
+    /* clear any existing errors */
+    dlerror();
+    qahw_stream_in->qahwi_in_stop = (qahwi_in_stop_t)
+        dlsym(qahw_module->module->dso, "qahwi_in_stop");
+    if ((error = dlerror()) != NULL) {
+        ALOGI("%s: dlsym error %s for qahwi_in_stop", __func__, error);
+        qahw_stream_in->qahwi_in_stop = NULL;
+    }
+
+ exit:
     pthread_mutex_unlock(&qahw_module->lock);
     return rc;
 }
diff --git a/qahw_api/inc/qahw_api.h b/qahw_api/inc/qahw_api.h
index 823c6bb..b37757d 100644
--- a/qahw_api/inc/qahw_api.h
+++ b/qahw_api/inc/qahw_api.h
@@ -354,6 +354,10 @@
 ssize_t qahw_in_read(qahw_stream_handle_t *in_handle,
                      qahw_in_buffer_t *in_buf);
 /*
+ * Stop input stream. Returns zero on success.
+ */
+int qahw_in_stop(qahw_stream_handle_t *in_handle);
+/*
  * Return the amount of input frames lost in the audio driver since the
  * last call of this function.
  * Audio driver is expected to reset the value to 0 and restart counting
diff --git a/qahw_api/src/qahw_api.cpp b/qahw_api/src/qahw_api.cpp
index f1c75f4..0810ede 100644
--- a/qahw_api/src/qahw_api.cpp
+++ b/qahw_api/src/qahw_api.cpp
@@ -678,6 +678,22 @@
     }
 }
 
+int qahw_in_stop(qahw_stream_handle_t *in_handle)
+{
+    if (g_binder_enabled) {
+        if (!g_qas_died) {
+            sp<Iqti_audio_server> qas = get_qti_audio_server();
+            if (qas_status(qas) == -1)
+                return -ENODEV;
+            return qas->qahw_in_stop(in_handle);
+        } else {
+            return -ENODEV;
+        }
+    } else {
+        return qahw_in_stop_l(in_handle);
+    }
+}
+
 uint32_t qahw_in_get_input_frames_lost(qahw_stream_handle_t *in_handle)
 {
     ALOGV("%d:%s",__LINE__, __func__);
@@ -1544,6 +1560,11 @@
     return qahw_in_read_l(in_handle, in_buf);
 }
 
+int qahw_in_stop(qahw_stream_handle_t *in_handle)
+{
+    return qahw_in_stop_l(in_handle);
+}
+
 uint32_t qahw_in_get_input_frames_lost(qahw_stream_handle_t *in_handle)
 {
     ALOGV("%d:%s",__LINE__, __func__);