Fix support for UNPROCESSED audio sources

Bug: 31217837
Bug: 27348456
Change-Id: I7ecce73b66de90fa2567fe399c770ba5b2715a36
(cherry picked from commit 6376cf27377268da45ef4c2e38e10fd881e64f8b)
diff --git a/audio_platform_info.xml b/audio_platform_info.xml
index 3e02839..c2ad270 100644
--- a/audio_platform_info.xml
+++ b/audio_platform_info.xml
@@ -7,6 +7,9 @@
         <device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS"    acdb_id="67"/>
         <device name="SND_DEVICE_IN_HEADSET_MIC_AEC"        acdb_id="47"/>
         <device name="SND_DEVICE_IN_VOICE_DMIC_TMUS"        acdb_id="89"/>
+        <device name="SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC" acdb_id="70"/>
+        <device name="SND_DEVICE_IN_UNPROCESSED_MIC"         acdb_id="68"/>
+        <device name="SND_DEVICE_IN_UNPROCESSED_STEREO_MIC" acdb_id="69"/>
     </acdb_ids>
 
     <pcm_ids>
diff --git a/audio_policy.conf b/audio_policy.conf
index 5c63ede..9fe0ed9 100644
--- a/audio_policy.conf
+++ b/audio_policy.conf
@@ -57,7 +57,7 @@
       primary {
         sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000
         channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO|AUDIO_CHANNEL_IN_FRONT_BACK
-        formats AUDIO_FORMAT_PCM_8_24_BIT
+        formats AUDIO_FORMAT_PCM_16_BIT
         devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_VOICE_CALL|AUDIO_DEVICE_IN_BACK_MIC
       }
       voice_rx {
diff --git a/mixer_paths.xml b/mixer_paths.xml
index 2bb94f8..a894337 100644
--- a/mixer_paths.xml
+++ b/mixer_paths.xml
@@ -938,9 +938,15 @@
 		<path name="handset-mic" />
 	</path>
 
-    <path name="unprocessed-mic">
-        <path name="unprocessed-handset-mic" />
-    </path>
+<path name="unprocessed-mic">
+    <path name="adc3" />
+    <ctl name="ADC1 Volume" value="0" />
+    <ctl name="ADC2 Volume" value="0" />
+    <ctl name="ADC3 Volume" value="3" />
+    <ctl name="ADC4 Volume" value="0" />
+    <ctl name="ADC5 Volume" value="0" />
+    <ctl name="ADC6 Volume" value="0" />
+</path>
 
 	<path name="camcorder-mic">
 		<path name="adc3" />
@@ -1079,4 +1085,13 @@
     <path name="voice-tx">
     </path>
 
+<path name="unprocessed-headset-mic">
+        <path name="headset-mic" />
+</path>
+
+<path name="unprocessed-stereo-mic">
+    <path name="speaker-dmic-endfire" />
+    <ctl name="ADC3 Volume" value="3" />
+    <ctl name="ADC4 Volume" value="3" />
+</path>
 </mixer>
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index 72f6530..69822af 100644
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -343,4 +343,7 @@
     <string-array name="config_cell_retries_per_error_code">
         <item>36,3</item> <!-- REGULAR_DEACTIVATION, 3 retries -->
     </string-array>
+
+    <!-- True if Unprocessed audio source supports the required frequency range and level -->
+    <bool name="config_supportAudioSourceUnprocessed">true</bool>
 </resources>