sm7125-common: audio: match policy with stock

This reverts commit 9968055bb8.

Change-Id: Ieb31dd68364e6fee1167bfe777752c6b492e2a5e
urubino-microg
Simon1511 1 year ago committed by Ruchit
parent 677ca1c90a
commit cad99a7cfa
  1. 7
      audio/Android.bp
  2. 227
      audio/ParametersUtil.cpp
  3. 23
      audio/SamsungAudio/Android.bp
  4. 28
      audio/SamsungAudio/AndroidManifest.xml
  5. 34
      audio/SamsungAudio/src/android/hardware/media/BootCompletedReceiver.java
  6. 89
      audio/SamsungAudio/src/android/hardware/media/SamsungAudioService.java
  7. 40
      audio/SamsungAudio/src/android/hardware/media/Utils.java
  8. 3
      common.mk
  9. 118
      configs/audio/audio_policy_configuration.xml
  10. 3
      sepolicy/public/property.te
  11. 4
      sepolicy/vendor/hal_audio_default.te
  12. 1
      sepolicy/vendor/property_contexts
  13. 5
      sepolicy/vendor/system_app.te

@ -43,7 +43,6 @@ cc_defaults {
"libmemunreachable",
"libutils",
"android.hardware.audio.common-util",
"libtinyalsa",
],
header_libs: [
@ -70,7 +69,6 @@ cc_library_shared {
"android.hardware.audio.common@2.0",
"android.hardware.audio.common@2.0-util",
"libcutils",
"libtinyalsa",
],
cflags: [
"-DMAJOR_VERSION=2",
@ -89,7 +87,6 @@ cc_library_shared {
"android.hardware.audio.common@4.0",
"android.hardware.audio.common@4.0-util",
"libcutils",
"libtinyalsa",
],
cflags: [
"-DMAJOR_VERSION=4",
@ -107,7 +104,6 @@ cc_library_shared {
"android.hardware.audio.common@5.0",
"android.hardware.audio.common@5.0-util",
"libcutils",
"libtinyalsa",
],
cflags: [
"-DMAJOR_VERSION=5",
@ -125,7 +121,6 @@ cc_library_shared {
"android.hardware.audio.common@6.0",
"android.hardware.audio.common@6.0-util",
"libcutils",
"libtinyalsa",
],
cflags: [
"-DMAJOR_VERSION=6",
@ -145,7 +140,6 @@ cc_library_shared {
"android.hardware.audio.common@7.0-util",
"libbase",
"libcutils",
"libtinyalsa",
],
cflags: [
"-DMAJOR_VERSION=7",
@ -166,7 +160,6 @@ cc_library_shared {
"android.hardware.audio.common@7.1-util",
"libbase",
"libcutils",
"libtinyalsa",
],
cflags: [
"-DMAJOR_VERSION=7",

@ -21,9 +21,6 @@
#include <util/CoreUtils.h>
#include <tinyalsa/asoundlib.h>
#include <cutils/properties.h>
namespace android {
namespace hardware {
namespace audio {
@ -142,225 +139,6 @@ Result ParametersUtil::setParam(const char* name, float value) {
return setParams(param);
}
int getMixerValueByName(const char *name) {
const auto mixer = mixer_open(0);
const auto ctl = mixer_get_ctl_by_name(mixer, name);
int value = 0;
if (mixer == nullptr) {
ALOGE("Failed to find mixer ctl for %s", name);
return 0;
}
if (ctl == nullptr) {
ALOGE("Failed to find mixer ctl for %s", name);
return 0;
}
value = mixer_ctl_get_value(ctl, 0);
mixer_close(mixer);
return value;
}
const char *getMixerValueString(const char *name) {
const auto mixer = mixer_open(0);
const auto ctl = mixer_get_ctl_by_name(mixer, name);
int control_value = mixer_ctl_get_value(ctl, 0);
const char *value;
if (mixer == nullptr) {
ALOGE("Failed to find mixer ctl for %s", name);
return "-1";
}
if (ctl == nullptr) {
ALOGE("Failed to find mixer ctl for %s", name);
return "-1";
}
value = mixer_ctl_get_enum_string(ctl, control_value);
mixer_close(mixer);
return value;
}
void setMixerValueByName(mixer *mixer, const char *name, int value) {
const auto ctl = mixer_get_ctl_by_name(mixer, name);
if (ctl == nullptr) {
ALOGE("Failed to find mixer ctl for %s", name);
return;
}
if (mixer_ctl_set_value(ctl, 0, value) < 0) {
ALOGE("Failed to find mixer ctl for %s", name);
return;
}
}
void setMixerValueByNameString(mixer *mixer, const char *name, const char *value) {
const auto ctl = mixer_get_ctl_by_name(mixer, name);
if (ctl == nullptr) {
ALOGE("Failed to find mixer ctl for %s", name);
return;
}
if (mixer_ctl_set_enum_by_string(ctl, value)) {
ALOGE("Failed to find mixer ctl for %s", name);
return;
}
}
void setEarpieceVoipMixers(bool enabled) {
const auto mixer = mixer_open(0);
if (mixer == nullptr) {
ALOGE("Failed to open mixer");
return;
}
if (enabled) {
setMixerValueByNameString(mixer, "TX SMIC MUX0", "ADC0");
setMixerValueByNameString(mixer, "TX SMIC MUX1", "ADC2");
setMixerValueByName(mixer, "MultiMedia2 Mixer QUIN_MI2S_TX", 0);
setMixerValueByNameString(mixer, "TAS256X ASI1 SEL RIGHT", "I2C offset");
setMixerValueByName(mixer, "TAS256X ASI Right Switch", 0);
setMixerValueByNameString(mixer, "TAS256X ASI1 SEL LEFT", "LeftRightDiv2");
setMixerValueByName(mixer, "TAS256X RECEIVER ENABLE LEFT", 1);
setMixerValueByName(mixer, "TAS256X ASI Left Switch", 1);
setMixerValueByName(mixer, "TAS256X AMP OUTPUT LVL LEFT", 8);
setMixerValueByName(mixer, "TAS256X PLAYBACK VOLUME LEFT", 55);
setMixerValueByName(mixer, "TAS256X PLAYBACK VOLUME RIGHT", 55);
setMixerValueByName(mixer, "SmartPA Mute", 0);
setMixerValueByNameString(mixer, "EC Reference Channels", "One");
setMixerValueByNameString(mixer, "AUDIO_REF_EC_UL10 MUX", "QUIN_MI2S_RX");
setMixerValueByName(mixer, "Voip_Tx Mixer SLIM_7_TX_Voip", 0);
setMixerValueByName(mixer, "SLIM_7_RX_Voice Mixer Voip", 0);
setMixerValueByName(mixer, "QUIN_MI2S_RX_Voice Mixer Voip", 1);
setMixerValueByName(mixer, "Voip_Tx Mixer TX_CDC_DMA_TX_3_Voip", 1);
setMixerValueByName(mixer, "QUIN_MI2S_RX_Voice Mixer Voip", 0);
setMixerValueByName(mixer, "Voip_Tx Mixer TX_CDC_DMA_TX_3_Voip", 0);
}
mixer_close(mixer);
}
void setSpeakerVoipMixers(bool enabled) {
const auto mixer = mixer_open(0);
if (mixer == nullptr) {
ALOGE("Failed to open mixer");
return;
}
if (enabled) {
setMixerValueByNameString(mixer, "TX SMIC MUX0", "ADC2");
setMixerValueByNameString(mixer, "TX SMIC MUX1", "ADC0");
setMixerValueByName(mixer, "MultiMedia2 Mixer QUIN_MI2S_TX", 1);
setMixerValueByNameString(mixer, "TAS256X ASI1 SEL RIGHT", "Right");
setMixerValueByName(mixer, "TAS256X ASI Right Switch", 1);
setMixerValueByNameString(mixer, "TAS256X ASI1 SEL LEFT", "Left");
setMixerValueByName(mixer, "TAS256X RECEIVER ENABLE LEFT", 0);
setMixerValueByName(mixer, "TAS256X ASI Left Switch", 1);
setMixerValueByName(mixer, "TAS256X AMP OUTPUT LVL LEFT", 20);
setMixerValueByName(mixer, "TAS256X PLAYBACK VOLUME LEFT", 55);
setMixerValueByName(mixer, "TAS256X PLAYBACK VOLUME RIGHT", 55);
setMixerValueByName(mixer, "SmartPA Mute", 0);
setMixerValueByNameString(mixer, "EC Reference Channels", "Two");
setMixerValueByNameString(mixer, "AUDIO_REF_EC_UL10 MUX", "QUIN_MI2S_RX");
setMixerValueByName(mixer, "Voip_Tx Mixer SLIM_7_TX_Voip", 0);
setMixerValueByName(mixer, "SLIM_7_RX_Voice Mixer Voip", 0);
setMixerValueByName(mixer, "QUIN_MI2S_RX_Voice Mixer Voip", 1);
setMixerValueByName(mixer, "Voip_Tx Mixer TX_CDC_DMA_TX_3_Voip", 1);
setMixerValueByName(mixer, "QUIN_MI2S_RX_Voice Mixer Voip", 0);
setMixerValueByName(mixer, "Voip_Tx Mixer TX_CDC_DMA_TX_3_Voip", 0);
}
mixer_close(mixer);
}
void setBTVoipMixers(bool enabled) {
const auto mixer = mixer_open(0);
if (mixer == nullptr) {
ALOGE("Failed to open mixer");
return;
}
if (enabled) {
setMixerValueByName(mixer, "TX_AIF1_CAP Mixer DEC0", 0);
setMixerValueByName(mixer, "TX_AIF1_CAP Mixer DEC1", 0);
setMixerValueByNameString(mixer, "TX SMIC MUX0", "ZERO");
setMixerValueByNameString(mixer, "TX SMIC MUX1", "ZERO");
setMixerValueByNameString(mixer, "TX DEC0 MUX", "MSM_DMIC");
setMixerValueByNameString(mixer, "TX DEC1 MUX", "MSM_DMIC");
setMixerValueByName(mixer, "TX_DEC0 Volume", 102);
setMixerValueByName(mixer, "TX_DEC1 Volume", 102);
setMixerValueByName(mixer, "Voip_Tx Mixer SLIM_7_TX_Voip", 1);
setMixerValueByName(mixer, "Voip_Tx Mixer TX_CDC_DMA_TX_3_Voip", 0);
setMixerValueByName(mixer, "SLIM_7_RX_Voice Mixer Voip", 1);
setMixerValueByName(mixer, "QUIN_MI2S_RX_Voice Mixer Voip", 0);
setMixerValueByName(mixer, "TAS256X IVSENSE ENABLE", 0);
setMixerValueByName(mixer, "TAS256X PLAYBACK VOLUME LEFT", 55);
setMixerValueByName(mixer, "TAS256X RECEIVER ENABLE LEFT", 0);
setMixerValueByName(mixer, "TAS256X AMP OUTPUT LVL LEFT", 20);
setMixerValueByName(mixer, "SmartPA Mute", 1);
setMixerValueByName(mixer, "ADC1 Volume", 12);
setMixerValueByName(mixer, "ADC3 Volume", 12);
setMixerValueByNameString(mixer, "TX_CDC_DMA_TX_3 Channels", "One");
setMixerValueByName(mixer, "TAS256X ASI Left Switch", 0);
setMixerValueByNameString(mixer, "TAS256X ASI1 SEL LEFT", "I2C Offset");
setMixerValueByName(mixer, "ADC3_MIXER Switch", 0);
}
mixer_close(mixer);
}
void fixupMixers() {
char simslot[92];
char voipdevice[92];
const char *ampstatus;
int voipstatus, btvoipstatus;
property_get("vendor.calls.slotid", simslot, "-1");
property_get("vendor.audio.voip.device", voipdevice, "none");
voipstatus = getMixerValueByName("QUIN_MI2S_RX_Voice Mixer Voip");
ampstatus = getMixerValueString("TAS256X RECEIVER ENABLE LEFT");
btvoipstatus = getMixerValueByName("SLIM_7_RX_Voice Mixer Voip");
ALOGD("ampstatus is %s", ampstatus);
ALOGD("voipstatus is %d", voipstatus);
ALOGD("bluetooth VoIP status is %d", btvoipstatus);
// VoIP call
if (voipstatus == 1 || btvoipstatus == 1) {
ALOGD("In VoIP call");
if (strcmp(voipdevice, "bluetooth") == 0 && btvoipstatus == 0) {
ALOGD("Setting bluetooth mixers");
setBTVoipMixers(true);
}
if (strcmp(voipdevice, "earpiece") == 0) {
if (btvoipstatus == 1 || strcmp(ampstatus, "DISABLE") == 0) {
ALOGD("Setting earpiece mixers");
setEarpieceVoipMixers(true);
}
}
if (strcmp(voipdevice, "speaker") == 0) {
if (btvoipstatus == 1 || strcmp(ampstatus, "ENABLE") == 0) {
ALOGD("Setting speaker mixers");
setSpeakerVoipMixers(true);
}
}
}
}
Result ParametersUtil::setParametersImpl(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) {
AudioParameter params;
@ -372,11 +150,6 @@ Result ParametersUtil::setParametersImpl(const hidl_vec<ParameterValue>& context
params.add(String8("g_sco_samplerate"),
String8(parameters[i].value == AudioParameter::valueOn ? "16000" : "8000"));
}
if (parameters[i].key == "voip_call") {
if (parameters[i].value == "1") {
fixupMixers();
}
}
params.add(String8(parameters[i].key.c_str()), String8(parameters[i].value.c_str()));
}
return setParams(params);

@ -1,23 +0,0 @@
//
// Copyright (C) 2023 The LineageOS Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
android_app {
name: "SamsungAudio",
srcs: ["src/**/*.java"],
certificate: "platform",
platform_apis: true,
system_ext_specific: true,
}

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.hardware.media"
android:versionCode="1"
android:versionName="1.0"
android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-sdk
android:targetSdkVersion="30"/>
<application
android:label="SamsungAudio"
android:persistent="true">
<receiver android:name=".BootCompletedReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<service android:name=".SamsungAudioService"
android:permission="SamsungAudioService">
</service>
</application>
</manifest>

@ -1,34 +0,0 @@
/*
* Copyright (c) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.media;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class BootCompletedReceiver extends BroadcastReceiver {
private static final boolean DEBUG = false;
private static final String TAG = "SamsungAudio";
@Override
public void onReceive(final Context context, Intent intent) {
if (DEBUG) Log.d(TAG, "Received boot completed intent");
Utils.startService(context);
}
}

@ -1,89 +0,0 @@
/*
* Copyright (c) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.media;
import android.app.Service;
import android.content.Intent;
import android.content.Context;
import android.os.SystemProperties;
import android.os.IBinder;
import android.util.Log;
import android.os.Handler;
import android.media.AudioManager;
import android.media.AudioDeviceInfo;
import android.media.AudioSystem;
public class SamsungAudioService extends Service {
private static final String TAG = "SamsungAudioService";
private static final boolean DEBUG = false;
private Handler mHandler;
private static Runnable mRunnable;
private AudioManager mAudioManager;
@Override
public void onCreate() {
if (DEBUG) Log.d(TAG, "SamsungAudioService Started");
mAudioManager = getSystemService(AudioManager.class);
mHandler = new Handler();
mRunnable = new Runnable() {
public void run() {
if (DEBUG) Log.d(TAG, "onCreate: " + TAG + " is running");
if (mAudioManager.getMode() == AudioManager.MODE_IN_COMMUNICATION) {
if (mAudioManager.getCommunicationDevice().getType() == AudioDeviceInfo.TYPE_BLUETOOTH_SCO
|| mAudioManager.getCommunicationDevice().getType() == AudioDeviceInfo.TYPE_BLUETOOTH_A2DP
|| mAudioManager.getCommunicationDevice().getType() == AudioDeviceInfo.TYPE_BLE_SPEAKER
|| mAudioManager.getCommunicationDevice().getType() == AudioDeviceInfo.TYPE_BLE_HEADSET) {
if (DEBUG) Log.d(TAG, "Setting VoIP parameter for bluetooth");
SystemProperties.set("vendor.audio.voip.device", "bluetooth");
AudioSystem.setParameters("voip_call=1");
}
if (mAudioManager.getCommunicationDevice().getType() == AudioDeviceInfo.TYPE_BUILTIN_EARPIECE) {
if (DEBUG) Log.d(TAG, "Setting VoIP parameter for earpiece");
SystemProperties.set("vendor.audio.voip.device", "earpiece");
AudioSystem.setParameters("voip_call=1");
}
if (mAudioManager.getCommunicationDevice().getType() == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER) {
if (DEBUG) Log.d(TAG, "Setting VoIP parameter for speaker");
SystemProperties.set("vendor.audio.voip.device", "speaker");
AudioSystem.setParameters("voip_call=1");
}
}
mHandler.postDelayed(mRunnable, 1000);
}
};
mHandler.postDelayed(mRunnable, 0);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (DEBUG) Log.d(TAG, "Starting service");
return START_STICKY;
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}

@ -1,40 +0,0 @@
/*
* Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.media;
import android.content.Context;
import android.content.Intent;
import android.os.UserHandle;
import android.util.Log;
public final class Utils {
private static final String TAG = "SamsungAudioUtils";
private static final boolean DEBUG = false;
protected static void startService(Context context) {
if (DEBUG) Log.d(TAG, "Starting service");
context.startServiceAsUser(new Intent(context, SamsungAudioService.class),
UserHandle.CURRENT);
}
protected static void stopService(Context context) {
if (DEBUG) Log.d(TAG, "Stopping service");
context.stopServiceAsUser(new Intent(context, SamsungAudioService.class),
UserHandle.CURRENT);
}
}

@ -79,8 +79,7 @@ PRODUCT_PACKAGES += \
libqcomvisualizer \
libqcomvoiceprocessing \
libqcompostprocbundle \
libvolumelistener \
SamsungAudio
libvolumelistener
TARGET_EXCLUDES_AUDIOFX := true

@ -2,14 +2,14 @@
<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
<globalConfiguration speaker_drc_enabled="false"/>
<globalConfiguration speaker_drc_enabled="false" call_screen_mode_supported="true"/>
<modules>
<module name="primary" halVersion="3.0">
<module name="primary" halVersion="2.0">
<attachedDevices>
<item>Earpiece</item>
<item>Telephony Tx</item>
<item>Speaker</item>
<item>Telephony Tx</item>
<item>Built-In Mic</item>
<item>Built-In Back Mic</item>
<item>Telephony Rx</item>
@ -18,7 +18,7 @@
<defaultOutputDevice>Speaker</defaultOutputDevice>
<mixPorts>
<mixPort name="primary-out" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_DEEP_BUFFER">
<mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
@ -26,7 +26,49 @@
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="primary-in" role="sink">
<mixPort name="deep_buffer" role="source"
flags="AUDIO_OUTPUT_FLAG_DEEP_BUFFER">
<profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="mmap_no_irq_out" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_MMAP_NOIRQ">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="direct_pcm" role="source"
flags="AUDIO_OUTPUT_FLAG_DIRECT">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,176400,192000,352800,384000"
channelMasks="AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,176400,192000,352800,384000"
channelMasks="AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,176400,192000,352800,384000"
channelMasks="AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,176400,192000,352800,384000"
channelMasks="AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
</mixPort>
<mixPort name="compressed_offload" role="source"
flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING">
<profile name="" format="AUDIO_FORMAT_MP3"
samplingRates="11025,16000,22050,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_AAC_LC"
samplingRates="11025,16000,22050,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_AAC_HE_V1"
samplingRates="11025,16000,22050,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_AAC_HE_V2"
samplingRates="11025,16000,22050,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_FLAC"
samplingRates="11025,16000,22050,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
</mixPort>
<mixPort name="primary input" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
@ -46,6 +88,16 @@
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="incall_music_uplink" role="source" flags="AUDIO_OUTPUT_FLAG_INCALL_MUSIC">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,48000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="mmap_no_irq_in" role="sink" flags="AUDIO_INPUT_FLAG_MMAP_NOIRQ">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3"/>
</mixPort>
<mixPort name="voip_rx" role="source"
flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_VOIP_RX">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
@ -60,7 +112,6 @@
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="hifi_playback" role="source" />
<mixPort name="hifi_input" role="sink" />
</mixPorts>
@ -78,21 +129,21 @@
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="Wired Headphone" role="sink" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE">
<devicePort tagName="Wired Headphones" role="sink" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="BT SCO Car Kit" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
@ -115,36 +166,37 @@
<devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK"/>
</devicePort>
<devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK"/>
</devicePort>
<devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK"/>
</devicePort>
<devicePort tagName="Bt Sco Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK"/>
</devicePort>
<devicePort tagName="Aux Device In" type="AUDIO_DEVICE_IN_AUX_DIGITAL" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK"/>
</devicePort>
<devicePort tagName="Telephony Rx" type="AUDIO_DEVICE_IN_TELEPHONY_RX" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK"/>
</devicePort>
<devicePort tagName="FM Mic" type="AUDIO_DEVICE_IN_FM_TUNER" role="source">
<devicePort tagName="FM Tuner" type="AUDIO_DEVICE_IN_FM_TUNER" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK"/>
</devicePort>
<devicePort tagName="USB Device In" type="AUDIO_DEVICE_IN_USB_DEVICE" role="source">
</devicePort>
@ -154,35 +206,37 @@
<!-- route declaration, i.e. list all available sources for a given sink -->
<routes>
<route type="mix" sink="Earpiece"
sources="primary-out,fast"/>
sources="primary output,deep_buffer,fast,compressed_offload"/>
<route type="mix" sink="Speaker"
sources="primary-out,fast"/>
sources="primary output,deep_buffer,fast,compressed_offload,mmap_no_irq_out"/>
<route type="mix" sink="Wired Headset"
sources="primary-out,fast"/>
<route type="mix" sink="Wired Headphone"
sources="primary-out,fast"/>
sources="primary output,deep_buffer,fast,compressed_offload,mmap_no_irq_out"/>
<route type="mix" sink="Wired Headphones"
sources="primary output,deep_buffer,fast,compressed_offload,mmap_no_irq_out"/>
<route type="mix" sink="USB Device Out"
sources="primary-out,fast,hifi_playback"/>
sources="primary output,deep_buffer,fast,direct_pcm,compressed_offload,mmap_no_irq_out,hifi_playback"/>
<route type="mix" sink="USB Headset Out"
sources="primary-out,fast,hifi_playback"/>
sources="primary output,deep_buffer,fast,direct_pcm,compressed_offload,mmap_no_irq_out,hifi_playback"/>
<route type="mix" sink="usb_surround_sound"
sources="USB Device In,USB Headset In"/>
<route type="mix" sink="hifi_input"
sources="USB Device In,USB Headset In"/>
<route type="mix" sink="BT SCO"
sources="primary-out,fast,voip_rx"/>
sources="primary output,deep_buffer,fast,voip_rx"/>
<route type="mix" sink="BT SCO Headset"
sources="primary-out,fast,voip_rx"/>
sources="primary output,deep_buffer,fast,voip_rx"/>
<route type="mix" sink="BT SCO Car Kit"
sources="primary-out,fast,voip_rx"/>
sources="primary output,deep_buffer,fast,voip_rx"/>
<route type="mix" sink="Telephony Tx"
sources="voice_tx"/>
sources="voice_tx,incall_music_uplink"/>
<route type="mix" sink="voice_rx"
sources="Telephony Rx"/>
<route type="mix" sink="voip_tx"
sources="Built-In Mic,Built-In Back Mic,Bt Sco Headset Mic,USB Device In,USB Headset In,Wired Headset Mic"/>
<route type="mix" sink="primary-in"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,Bt Sco Headset Mic,Aux Device In,FM Mic,USB Device In,USB Headset In"/>
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,Bt Sco Headset Mic,Aux Device In,FM Tuner,USB Device In,USB Headset In"/>
<route type="mix" sink="primary input"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,Bt Sco Headset Mic,Aux Device In,FM Tuner,USB Device In,USB Headset In,Telephony Rx"/>
<route type="mix" sink="mmap_no_irq_in"
sources="Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In"/>
</routes>
</module>

@ -1,5 +1,2 @@
# Audio
system_public_prop(vendor_samsung_audio_prop)
# Fingerprint
system_public_prop(vendor_fingerprint_prop)

@ -6,6 +6,4 @@ allow hal_audio_default imei_efs_file:file { read open getattr };
allow hal_audio_default efs_file:dir search;
get_prop(hal_audio_default, vendor_radio_prop)
get_prop(hal_audio_default, vendor_samsung_audio_prop)
set_prop(hal_audio_default, vendor_samsung_audio_prop)
get_prop(hal_audio_default, vendor_radio_prop)

@ -1,6 +1,5 @@
# audio
vendor.audio_hal. u:object_r:vendor_audio_prop:s0
vendor.audio.voip.device u:object_r:vendor_samsung_audio_prop:s0
# Bluetooth
vendor.bluetooth_fw_ver u:object_r:vendor_bluetooth_prop:s0

@ -13,7 +13,4 @@ allow system_app sysfs_mdnie_writable:file { open write getattr };
# UDFPS
set_prop(system_app, vendor_fingerprint_prop)
get_prop(system_app, vendor_fingerprint_prop)
set_prop(system_app, vendor_samsung_audio_prop)
get_prop(system_app, vendor_samsung_audio_prop)
get_prop(system_app, vendor_fingerprint_prop)
Loading…
Cancel
Save