Merge "[Feature][ZXW-127] Interface for adapting call volume settings"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-ril-service/lynq-ril-service.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-ril-service/lynq-ril-service.bb
index c05ec76..641ebb7 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-ril-service/lynq-ril-service.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-ril-service/lynq-ril-service.bb
@@ -3,7 +3,7 @@
 DESCRIPTION = "lynq ril service"
 LICENSE = "CLOSED"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
-DEPENDS += "${@bb.utils.contains('TARGET_PLATFORM', 'mt2735', 'audio-mixer-ctrl streamer1.0', '', d)} libapn libpal libvendor-ril libbinder glib-2.0 dbus liblynq-log liblynq-uci liblynq-shm"
+DEPENDS += "${@bb.utils.contains('TARGET_PLATFORM', 'mt2735', 'audio-mixer-ctrl streamer1.0', '', d)} libapn libpal libvendor-ril libbinder glib-2.0 dbus liblynq-log liblynq-uci liblynq-shm libmedia"
 #inherit workonsrc
 WORKONSRC = "${TOPDIR}/../src/lynq/framework/lynq-ril-service/src"
 FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/framework/:"
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/cc.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/cc.cpp
index d0f50c8..50e64ac 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/cc.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/cc.cpp
@@ -63,6 +63,14 @@
     #include "mixer_ctrl.h"
 }
 #endif //LYNQ_CC_SUPPORT
+
+#ifdef  MOBILETEK_TARGET_PLATFORM_T106
+
+extern "C" {
+        #include "sc_voice_api.h"
+}
+#endif
+
 #undef LOG_TAG
 #define LOG_TAG "LYNQ_RIL_CC"
 
@@ -97,6 +105,12 @@
 #define MIN_VOLUME (1)
 #endif
 
+#ifdef  MOBILETEK_TARGET_PLATFORM_T106
+#define MAX_VOLUME (5)
+#define MIN_VOLUME (0)
+#endif
+
+
 #ifdef TARGET_PLATFORM_MT2635
 #define MAX_VOLUME (17)
 #define MIN_VOLUME (-23)
@@ -255,8 +269,17 @@
 int mixer_set_volume(int value)
 {
     RLOGD("lynq this is function:%s,line%d",__FUNCTION__,__LINE__);
-    #if LYNQ_CC_SUPPORT
+
     int ret;
+#ifdef  MOBILETEK_TARGET_PLATFORM_T106
+    ret = sc_audio_set_rx_voice_vol(value);
+    if(ret != 0)
+    {
+        printf("set tx voice vol failed\n");
+        return -1;
+    }
+    RLOGD("Set speech volume success !!!");
+#else
     if (get_audio_path() == 0) {
         ret = set_mixer_ctrl_volume_value(g_mixer_name_volume, value);
     } else {
@@ -264,14 +287,28 @@
     }
     if (ret)
         RLOGE("set_mixer_ctrl_volume_value_int err: %d", ret);
+#endif
     return ret;
-    #endif //LYNQ_CC_SUPPORT
-    return 0;//LYNQ_CC_SUPPORT
+    
 }
 long int mixer_get_volume()
 {
     RLOGD("lynq this is function:%s,line%d",__FUNCTION__,__LINE__);
-    #if LYNQ_CC_SUPPORT
+    
+#ifdef  MOBILETEK_TARGET_PLATFORM_T106
+    int value = 0;
+    int ret = 0;
+    ret = sc_audio_get_rx_voice_vol(&value);
+    if(ret != 0)
+    {
+        printf("Get sc_audio_get_tx_voice_vol failed \n");
+        return -1;
+
+    }
+    RLOGD("Get speech volume success !!!");
+    return (long int)value;
+    
+#else
     long int vol_value;
     if (get_audio_path() == 0) {
         vol_value = get_mixer_ctrl_volume_value(g_mixer_name_volume);
@@ -280,8 +317,7 @@
     }
     RLOGD("The ctrl \"%s\" is set to %ld", g_mixer_name_volume, vol_value);
     return vol_value;
-    #endif //LYNQ_CC_SUPPORT
-    return 0;//LYNQ_CC_SUPPORT
+#endif
 }
 
 #if LYNQ_CC_SUPPORT
@@ -894,11 +930,37 @@
 int setSpeechVolume(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
 {
     RLOGD("lynq this is function:%s,line%d",__FUNCTION__,__LINE__);
-    #if LYNQ_CC_SUPPORT
     android::Parcel p;
     int setValue = 0;
     RLOGD("setSpeechVolume start!");
+    
+#ifdef  MOBILETEK_TARGET_PLATFORM_T106
+    if(argc < 2) 
+    {
+        android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_SET_SPEECH_VOLUME,0,2);
+        android::LYNQ_RIL_respSocket(p,pRI);
+        free(pRI);
+        RLOGW("Warning: no set volume value!");
+        return -1;
+    }
 
+    setValue = atoi(argv[1]);
+    RLOGD("set Speech Volume value is %d!",setValue);
+
+    if(setValue < MIN_VOLUME || setValue > MAX_VOLUME) 
+    {
+            RLOGW("Warning: set volume value is over-range!");
+            android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_SET_SPEECH_VOLUME,0,2);
+            android::LYNQ_RIL_respSocket(p,pRI);
+            free(pRI);
+            return -1;
+    }
+    mixer_set_volume(setValue);
+    android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_SET_SPEECH_VOLUME,0,0);
+    printf(">>>>set speech Volume<<<< success value is %d!\n",setValue);
+    android::LYNQ_RIL_respSocket(p,pRI);
+    printf("Set speechVolume done!!!\n");
+#else
     if(argc < 2) {
         android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_SET_SPEECH_VOLUME,0,2);
         android::LYNQ_RIL_respSocket_sp(p,pRI);
@@ -932,15 +994,15 @@
     printf(">>>>set speech Volume<<<< success value is %d!\n",setValue);
     /*Warren add for t800 ril service 2021/12/23 end*/
     android::LYNQ_RIL_respSocket_sp(p,pRI);
+#endif     
+
     free(pRI);
     return 0;
-    #endif //LYNQ_CC_SUPPORT
-    return 0;//LYNQ_CC_SUPPORT
 }
 int getSpeechVolume(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
 {
     RLOGD("lynq this is function:%s,line%d",__FUNCTION__,__LINE__);
-    #if LYNQ_CC_SUPPORT
+    
     android::Parcel p;
     printf("WARREN TEST001!!!\n");
     int volumn = mixer_get_volume();
@@ -955,15 +1017,19 @@
         android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_GET_SPEECH_VOLUME,0,0);
         /*Warren add for t800 ril service 2021/12/23 end*/
     }
-    printf("current Speech Volume is%d",volumn);
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+    p.writeInt32(1);
     p.writeInt32(volumn);
+ #else
+    p.writeInt32(volumn);
+ #endif 
     android::LYNQ_RIL_respSocket(p,(void *)pRI);
-    if(pRI) {
+    if(pRI) 
+    {
         free(pRI);
     }
+    
     return 0;
-    #endif //LYNQ_CC_SUPPORT
-    return 0;//LYNQ_CC_SUPPORT
 }
 int setDtmfVolume(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
 {
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/makefile b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/makefile
index 1ad54c8..746c615 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/makefile
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/makefile
@@ -12,10 +12,12 @@
 
 ifeq ($(strip $(TARGET_PLATFORM)), T106)
     LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106
+    LOCAL_CFLAGS += -DUSE_CAP_SUPPORT
 endif
 
 ifeq ($(strip $(MOBILETEK_FOTA_CFG)), PLATFORM)
     LOCAL_CFLAGS += -DMOBILETEK_FOTA_CFG
+
 endif
 
 ifeq ($(strip $(MOBILETEK_FOTA_CFG)), GSW)
@@ -141,6 +143,7 @@
     -lsqlite3 \
     -llynq-uci \
     -llynq-shm  \
+    -lmedia \
 
 ifeq ($(strip $(TARGET_PLATFORM)), mt2735)
 LOCAL_LIBS += -luciwrapper -luciwrapper -lgstbase-1.0 -llynq-protcl -llynq-thermal -llynq-systime  -lnandapi -ldtmf -lasound -lgstreamer-1.0 -lmtk_audio_mixer_ctrl -lpower
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
index 0dc22bc..b40f6c1 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
@@ -26,6 +26,11 @@
 #define CALL_ON  (1)

 #define USER_LOG_TAG "LYNQ_CALL"

 

+#ifdef MOBILETEK_TARGET_PLATFORM_T106

+#define MIN_VOLUME 0

+#define MAX_VOLUME 5

+#endif 

+

 using ::android::Parcel;

 

 /**

@@ -1359,12 +1364,24 @@
             return 0;

         }

     }

+    

+#ifdef MOBILETEK_TARGET_PLATFORM_T106

     else if (set==LYNQ_E_VOLUMN_SET_SPEECH)

     {

-        if(volume < 1 ||volume >7){

+        if(volume < MIN_VOLUME || volume > MAX_VOLUME)

+        {

             return 0;

         }

     }

+#else 

+    else if (set==LYNQ_E_VOLUMN_SET_SPEECH)

+        {

+            if(volume < 1 ||volume >7){

+                return 0;

+            }

+        }

+#endif

+

     return 1;

 }

 int lynq_set_DTMF_volume(const int volume)