sm8550-common: audio-impl: Pass call state to audio hal and patch RIL
* Fixes 2nd sim audio when in call. Co-authored-by: Simon1511 <me@simon1511.de> Change-Id: I25ced80d833a36ac1141d5894aed99a0931d3946
This commit is contained in:
@@ -68,6 +68,7 @@ cc_library_shared {
|
||||
"android.hardware.audio@2.0-util",
|
||||
"android.hardware.audio.common@2.0",
|
||||
"android.hardware.audio.common@2.0-util",
|
||||
"libcutils",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=2",
|
||||
@@ -85,6 +86,7 @@ cc_library_shared {
|
||||
"android.hardware.audio@4.0-util",
|
||||
"android.hardware.audio.common@4.0",
|
||||
"android.hardware.audio.common@4.0-util",
|
||||
"libcutils",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=4",
|
||||
@@ -101,6 +103,7 @@ cc_library_shared {
|
||||
"android.hardware.audio@5.0-util",
|
||||
"android.hardware.audio.common@5.0",
|
||||
"android.hardware.audio.common@5.0-util",
|
||||
"libcutils",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=5",
|
||||
@@ -117,6 +120,7 @@ cc_library_shared {
|
||||
"android.hardware.audio@6.0-util",
|
||||
"android.hardware.audio.common@6.0",
|
||||
"android.hardware.audio.common@6.0-util",
|
||||
"libcutils",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=6",
|
||||
@@ -135,6 +139,7 @@ cc_library_shared {
|
||||
"android.hardware.audio.common@7.0-enums",
|
||||
"android.hardware.audio.common@7.0-util",
|
||||
"libbase",
|
||||
"libcutils",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=7",
|
||||
|
@@ -19,6 +19,9 @@
|
||||
#include "core/default/PrimaryDevice.h"
|
||||
#include "core/default/Util.h"
|
||||
|
||||
#include <cutils/properties.h>
|
||||
#include <string.h>
|
||||
|
||||
#if MAJOR_VERSION >= 4
|
||||
#include <cmath>
|
||||
#endif
|
||||
@@ -208,6 +211,35 @@ Return<Result> PrimaryDevice::setVoiceVolume(float volume) {
|
||||
}
|
||||
|
||||
Return<Result> PrimaryDevice::setMode(AudioMode mode) {
|
||||
/* On stock ROM Samsung sets the g_call_state and g_call_sim_slot audio parameters
|
||||
* in the framework, breaking it on AOSP ROMs. For the audio params call_state and
|
||||
* g_call_state 2 corresponds to CALL_ACTIVE and 1 to CALL_INACTIVE respectively.
|
||||
* For the g_call_sim_slot parameter 0x01 describes SIM1 and 0x02 SIM2.
|
||||
*/
|
||||
|
||||
char simSlot1[92], simSlot2[92];
|
||||
|
||||
// These props return either 0 (not calling),
|
||||
// or 1 (SIM is calling)
|
||||
property_get("vendor.calls.slot_id0", simSlot1, "");
|
||||
property_get("vendor.calls.slot_id1", simSlot2, "");
|
||||
|
||||
// Wait until one sim slot reports a call
|
||||
if (mode == AudioMode::IN_CALL) {
|
||||
while (strcmp(simSlot1, "0") == 0 && strcmp(simSlot2, "0") == 0) {
|
||||
property_get("vendor.calls.slot_id0", simSlot1, "");
|
||||
property_get("vendor.calls.slot_id1", simSlot2, "");
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(simSlot1, "1") == 0) {
|
||||
// SIM1
|
||||
mDevice->halSetParameters("g_call_sim_slot=0x01");
|
||||
} else if (strcmp(simSlot2, "1") == 0) {
|
||||
// SIM2
|
||||
mDevice->halSetParameters("g_call_sim_slot=0x02");
|
||||
}
|
||||
|
||||
// INVALID, CURRENT, CNT, MAX are reserved for internal use.
|
||||
// TODO: remove the values from the HIDL interface
|
||||
switch (mode) {
|
||||
|
@@ -173,6 +173,8 @@ struct Device : public IDevice, public ParametersUtil {
|
||||
|
||||
uint32_t version() const { return mDevice->common.version; }
|
||||
|
||||
int halSetParameters(const char* keysAndValues) override;
|
||||
|
||||
private:
|
||||
bool mIsClosed;
|
||||
audio_hw_device_t* mDevice;
|
||||
@@ -191,7 +193,6 @@ struct Device : public IDevice, public ParametersUtil {
|
||||
|
||||
// Methods from ParametersUtil.
|
||||
char* halGetParameters(const char* keys) override;
|
||||
int halSetParameters(const char* keysAndValues) override;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
Reference in New Issue
Block a user