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@2.0-util",
|
||||||
"android.hardware.audio.common@2.0",
|
"android.hardware.audio.common@2.0",
|
||||||
"android.hardware.audio.common@2.0-util",
|
"android.hardware.audio.common@2.0-util",
|
||||||
|
"libcutils",
|
||||||
],
|
],
|
||||||
cflags: [
|
cflags: [
|
||||||
"-DMAJOR_VERSION=2",
|
"-DMAJOR_VERSION=2",
|
||||||
@@ -85,6 +86,7 @@ cc_library_shared {
|
|||||||
"android.hardware.audio@4.0-util",
|
"android.hardware.audio@4.0-util",
|
||||||
"android.hardware.audio.common@4.0",
|
"android.hardware.audio.common@4.0",
|
||||||
"android.hardware.audio.common@4.0-util",
|
"android.hardware.audio.common@4.0-util",
|
||||||
|
"libcutils",
|
||||||
],
|
],
|
||||||
cflags: [
|
cflags: [
|
||||||
"-DMAJOR_VERSION=4",
|
"-DMAJOR_VERSION=4",
|
||||||
@@ -101,6 +103,7 @@ cc_library_shared {
|
|||||||
"android.hardware.audio@5.0-util",
|
"android.hardware.audio@5.0-util",
|
||||||
"android.hardware.audio.common@5.0",
|
"android.hardware.audio.common@5.0",
|
||||||
"android.hardware.audio.common@5.0-util",
|
"android.hardware.audio.common@5.0-util",
|
||||||
|
"libcutils",
|
||||||
],
|
],
|
||||||
cflags: [
|
cflags: [
|
||||||
"-DMAJOR_VERSION=5",
|
"-DMAJOR_VERSION=5",
|
||||||
@@ -117,6 +120,7 @@ cc_library_shared {
|
|||||||
"android.hardware.audio@6.0-util",
|
"android.hardware.audio@6.0-util",
|
||||||
"android.hardware.audio.common@6.0",
|
"android.hardware.audio.common@6.0",
|
||||||
"android.hardware.audio.common@6.0-util",
|
"android.hardware.audio.common@6.0-util",
|
||||||
|
"libcutils",
|
||||||
],
|
],
|
||||||
cflags: [
|
cflags: [
|
||||||
"-DMAJOR_VERSION=6",
|
"-DMAJOR_VERSION=6",
|
||||||
@@ -135,6 +139,7 @@ cc_library_shared {
|
|||||||
"android.hardware.audio.common@7.0-enums",
|
"android.hardware.audio.common@7.0-enums",
|
||||||
"android.hardware.audio.common@7.0-util",
|
"android.hardware.audio.common@7.0-util",
|
||||||
"libbase",
|
"libbase",
|
||||||
|
"libcutils",
|
||||||
],
|
],
|
||||||
cflags: [
|
cflags: [
|
||||||
"-DMAJOR_VERSION=7",
|
"-DMAJOR_VERSION=7",
|
||||||
|
@@ -19,6 +19,9 @@
|
|||||||
#include "core/default/PrimaryDevice.h"
|
#include "core/default/PrimaryDevice.h"
|
||||||
#include "core/default/Util.h"
|
#include "core/default/Util.h"
|
||||||
|
|
||||||
|
#include <cutils/properties.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#if MAJOR_VERSION >= 4
|
#if MAJOR_VERSION >= 4
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#endif
|
#endif
|
||||||
@@ -208,6 +211,35 @@ Return<Result> PrimaryDevice::setVoiceVolume(float volume) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Return<Result> PrimaryDevice::setMode(AudioMode mode) {
|
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.
|
// INVALID, CURRENT, CNT, MAX are reserved for internal use.
|
||||||
// TODO: remove the values from the HIDL interface
|
// TODO: remove the values from the HIDL interface
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
@@ -173,6 +173,8 @@ struct Device : public IDevice, public ParametersUtil {
|
|||||||
|
|
||||||
uint32_t version() const { return mDevice->common.version; }
|
uint32_t version() const { return mDevice->common.version; }
|
||||||
|
|
||||||
|
int halSetParameters(const char* keysAndValues) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mIsClosed;
|
bool mIsClosed;
|
||||||
audio_hw_device_t* mDevice;
|
audio_hw_device_t* mDevice;
|
||||||
@@ -191,7 +193,6 @@ struct Device : public IDevice, public ParametersUtil {
|
|||||||
|
|
||||||
// Methods from ParametersUtil.
|
// Methods from ParametersUtil.
|
||||||
char* halGetParameters(const char* keys) override;
|
char* halGetParameters(const char* keys) override;
|
||||||
int halSetParameters(const char* keysAndValues) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace implementation
|
} // namespace implementation
|
||||||
|
@@ -70,6 +70,7 @@ function blob_fixup() {
|
|||||||
vendor/lib64/libsec-ril.so)
|
vendor/lib64/libsec-ril.so)
|
||||||
xxd -p -c0 "${2}" | sed "s/600e40f9e10315aa820c8052e30314aa/600e40f9e10315aa820c8052030080d2/g" | xxd -r -p > "${2}".patched
|
xxd -p -c0 "${2}" | sed "s/600e40f9e10315aa820c8052e30314aa/600e40f9e10315aa820c8052030080d2/g" | xxd -r -p > "${2}".patched
|
||||||
mv "${2}".patched "${2}"
|
mv "${2}".patched "${2}"
|
||||||
|
sed -i 's/ril.dds.call.ongoing/vendor.calls.slot_id/g' "${2}"
|
||||||
;;
|
;;
|
||||||
vendor/etc/vintf/manifest/sec_c2_manifest_default0_1_0.xml)
|
vendor/etc/vintf/manifest/sec_c2_manifest_default0_1_0.xml)
|
||||||
sed -i 's/default0/software/g' "${2}"
|
sed -i 's/default0/software/g' "${2}"
|
||||||
|
Reference in New Issue
Block a user