[Feature][T106][task-view-1120] support ng-ecall

    Only Configure: No
    Affected branch: unknown
    Affected module: log
    Is it affected on both ZXIC and MTK: only zxic
    Self-test: yes
    Doc Update: no

Change-Id: If3bead23730e67326cfeeaeb5030c1f1b2ff8561
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp
index c728665..28ed9b0 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp
@@ -226,7 +226,8 @@
        RIL_UNSOL_ECALL_ALACK_CLEARDOWN_RECEIVED == lynqIncomingEcallIndication ||
        RIL_UNSOL_ECALL_T5_TIMER_OUT  == lynqIncomingEcallIndication ||
        RIL_UNSOL_ECALL_T6_TIMER_OUT  == lynqIncomingEcallIndication ||
-       RIL_UNSOL_ECALL_T7_TIMER_OUT  == lynqIncomingEcallIndication)
+       RIL_UNSOL_ECALL_T7_TIMER_OUT  == lynqIncomingEcallIndication ||
+       RIL_UNSOL_ECALL_IMS_ACTIVE == lynqIncomingEcallIndication )
     {
         return 1;
     }
@@ -662,6 +663,7 @@
         break;
     }
     case RIL_UNSOL_ECALL_DISCONNECTED: // = 12
+    case RIL_UNSOL_ECALL_IMS_DISCONNECTED: // 14
     {
         start_ecll_timer(sAutoAnsTimer,autoAns_sig_value, AUTOANS_TIMEOUT);
         autoAnswerEcall(true);
@@ -714,7 +716,6 @@
         }
         break;
     }
-#if defined(TARGET_PLATFORM_MT2735)
     case RIL_UNSOL_ECALL_IMS_ACTIVE: // 13 ,
     {
         act_fecall_socid = soc_id;
@@ -725,6 +726,7 @@
         start_ecll_timer(sT2, sT2_sig_value,T2_TIMEOUT);
         break;
     }
+#if 0
     case RIL_UNSOL_ECALL_IMS_DISCONNECTED: // 14
     {
         fast_argc = 0;
@@ -734,11 +736,13 @@
         start_ecll_timer(sAutoAnsTimer_ims, autoAns_sig_value_ims, 12*AUTOANS_TIMEOUT);
         break;
     }
+#endif
     case RIL_UNSOL_ECALL_IMS_MSD_ACK: // 20
     {
         saveEcallRecord(p_cur->ind);
         break;
     }
+#if defined(TARGET_PLATFORM_MT2735)
     case RIL_UNSOL_ECALL_IMS_UPDATE_MSD: // 21,
     {
         RLOGD("update ims ecall msd_data: %s", msd_data==NULL ? "":msd_data);
@@ -756,16 +760,19 @@
         start_ecll_timer(sT5,sT5_sig_value, T5_TIMEOUT);
         break;
     }
+#endif
     case RIL_UNSOL_ECALL_IMS_MSD_NACK: // 23
     {
         saveEcallRecord(p_cur->ind);
         break;
     }
+#if defined(TARGET_PLATFORM_MT2735)
     case RIL_UNSOL_ECALL_IMS_SRVCC: // 24
     {
         start_ecll_timer(sT5,sT5_sig_value, T5_TIMEOUT);
         break;
     }
+#endif
     case RIL_UNSOL_ECALL_PSAP_CALLBACK_START: // 40
     {
         set_voice_audio_mode_to_value(AUDIO_MODE_CODEC,soc_id);
@@ -799,6 +806,7 @@
         }
         break;
     }
+#if defined(TARGET_PLATFORM_MT2735)
     case RIL_UNSOL_ECALL_PSAP_CALLBACK_IMS_UPDATE_MSD: // 41
     {
         // Similar to receive 13 + 21
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call_ecall.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call_ecall.cpp
index 83ddf64..f594388 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call_ecall.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call_ecall.cpp
@@ -603,6 +603,7 @@
                                         20241121 still regard T5 timeout as success by hq*/

        case LYNQ_ECALL_T6_TIMER_OUT:

        case LYNQ_ECALL_T7_TIMER_OUT:                          

+       case LYNQ_ECALL_IMS_ACTIVE:

            if(s_module_is_ecall_dial)

            {

                LYINFLOG("ecall is dialing, recv suc indication");

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c
index d7aa113..72ad97e 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c
@@ -1668,7 +1668,7 @@
 }

 

 /*add by hq at 2024/04/07 for ecall begin*/

-int convert_ecall_ind_to_mtk_ind(RIL_ECallIndication zxic_ind)	

+int convert_ecall_ind_to_mtk_ind(RIL_ECallIndication zxic_ind, int ecall_mode)	

 {

 	switch(zxic_ind) {

 	

@@ -1679,30 +1679,58 @@
 			return 10;//alerting

 			

 		case RIL_UNSOL_ECALL_EVENT_CONNECTED:

-		   return RIL_UNSOL_ECALL_ACTIVE;

-		   

+		{      

+		   if(ecall_mode==1)

+		   {

+		       return RIL_UNSOL_ECALL_IMS_ACTIVE;

+		   }

+		   else

+		   {

+		       return RIL_UNSOL_ECALL_ACTIVE;

+		   }

+		}   		   

 		case RIL_UNSOL_ECALL_EVENT_END_ABNORMAL:

    		   return RIL_UNSOL_ECALL_ABNORMAL_HANGUP;

-		   

-		case RIL_UNSOL_ECALL_EVENT_END_FROM_PASP:

-		   return RIL_UNSOL_ECALL_DISCONNECTED;

-		   

+		case RIL_UNSOL_ECALL_EVENT_END_FROM_PASP:			   

 		case RIL_UNSOL_ECALL_EVENT_END_FROM_USER:

-		   return RIL_UNSOL_ECALL_DISCONNECTED;

-		   

 		case RIL_UNSOL_ECALL_EVENT_PSAP_HANGUP_CALL:

-   		   return RIL_UNSOL_ECALL_DISCONNECTED;	

+		   if(ecall_mode==1)

+		   {

+		       return RIL_UNSOL_ECALL_IMS_DISCONNECTED;

+		   }

+		   else

+		   {

+		       return RIL_UNSOL_ECALL_DISCONNECTED;

+		   }

 		   

 		case RIL_UNSOL_ECALL_EVENT_MSD_START_SENDING:

-		   return RIL_UNSOL_ECALL_SENDING_MSD;

-		   

+		  if(ecall_mode!=1)

+		  {

+		       return RIL_UNSOL_ECALL_SENDING_MSD;

+		  }

+		  else

+		  {

+		       return RIL_UNSOL_ECALL_UNSPECIFIED;    

+		  }      

 		case RIL_UNSOL_ECALL_EVENT_ALACK_CLEARDOWN_RECEIVED:

-		   return RIL_UNSOL_ECALL_ALACK_CLEARDOWN_RECEIVED;

-

+		   if(ecall_mode==1)

+		   {

+		         return RIL_UNSOL_ECALL_IMS_MSD_ACK;

+		   }

+		   else

+		   {

+		      return RIL_UNSOL_ECALL_ALACK_CLEARDOWN_RECEIVED;

+		   }

 		case RIL_UNSOL_ECALL_EVENT_ALACK_POSITIVE_RECEIVED:

-		   return RIL_UNSOL_ECALL_ALACK_POSITIVE_RECEIVED;					

-		   

-		case RIL_ECALL_STATE_MSD_LLACK:

+		    if(ecall_mode==1)

+		    {

+		       return RIL_UNSOL_ECALL_IMS_MSD_ACK;

+		    }

+		    else

+		    {

+		       return RIL_UNSOL_ECALL_ALACK_POSITIVE_RECEIVED;	

+		    }

+		case RIL_UNSOL_ECALL_EVENT_LLACK_RECEIVED:

 		   return RIL_UNSOL_ECALL_LLACK_RECEIVED;

 		   

 		case RIL_UNSOL_ECALL_EVENT_MSDUPDATE_PSAP_REQURE:

@@ -1711,9 +1739,17 @@
 		case RIL_UNSOL_ECALL_EVENT_ECALLONLY_DEREGISTRATION:

 			return RIL_UNSOL_ECALL_ONLY_DEREGISTRATION;

 

-		case RIL_UNSOL_ECALL_EVENT_PSAP_CALLBACK_START:

+		case RIL_UNSOL_ECALL_EVENT_MSD_SEND_FAILURE:

+		    if(ecall_mode==1)

+		    {

+		       return RIL_UNSOL_ECALL_IMS_MSD_NACK;

+		    }

+		    else

+		    {

+		       return RIL_UNSOL_ECALL_UNSPECIFIED;    

+		    }      

+	    case RIL_UNSOL_ECALL_EVENT_PSAP_CALLBACK_START:

 			return RIL_UNSOL_ECALL_PSAP_CALLBACK_START;

-			

 		default:	

 			return RIL_UNSOL_ECALL_UNSPECIFIED;	

 	}

@@ -1775,7 +1811,7 @@
 	

 	ecall_state_indicate.call_id = id;

 	

-	RLOGD("handle_ecallstate call_id=%d, idr=%d, stat=%d, clear_down=%d, eCallMode=%d!\n", id, idr, stat, clear_down, eCallMode);

+	RLOGI("handle_ecallstate call_id=%d, idr=%d, stat=%d, clear_down=%d, eCallMode=%d!\n", id, idr, stat, clear_down, eCallMode);

 	

 	switch(stat) {

 		case RIL_ECALL_STATE_NONE: // None eCall in progress			

@@ -1783,57 +1819,57 @@
 			//do nothing			

 			return;

 		case RIL_ECALL_STATE_CONNECTING: // eCall start a request to connect to PSAP

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_CONNECTING);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_CONNECTING,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;

 		case RIL_ECALL_STATE_ALERTING:

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ALERTING);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ALERTING,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;

 		case RIL_ECALL_STATE_INCOMING: //ÔÝδʹÓÃ

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_INCOMING);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_INCOMING,eCallMode);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_CALL_CONNECTED:

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_CONNECTED);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_CONNECTED,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;

 		case RIL_ECALL_STATE_CALL_END_ABNORMAL:

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_ABNORMAL);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_ABNORMAL,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;

 		case RIL_ECALL_STATE_CALL_END_FROM_PSAP:

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_FROM_PASP);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_FROM_PASP,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;

 		case RIL_ECALL_STATE_END_FROM_USER:

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_FROM_USER);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_FROM_USER,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;			

 		case RIL_ECALL_STATE_PSAP_HUNGUP_CALL:

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_PSAP_HANGUP_CALL);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_PSAP_HANGUP_CALL,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;

 		case RIL_ECALL_STATE_REDIAL_END:			

 		case RIL_ECALL_STATE_DROP_AND_REDIAL_FAILED:			

 			//do nothing

 			return;

 		case RIL_ECALL_STATE_MSD_START_SENDING:

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_MSD_START_SENDING);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_MSD_START_SENDING,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;

 		case RIL_ECALL_STATE_SEND_SUCCESS:

 			if(1 == clear_down){

-				ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ALACK_CLEARDOWN_RECEIVED);/*modify by hq at 2024/04/07 for ecall*/

+				ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ALACK_CLEARDOWN_RECEIVED,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			} else if (0 == clear_down) {

-				ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ALACK_POSITIVE_RECEIVED);/*modify by hq at 2024/04/07 for ecall*/

+				ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ALACK_POSITIVE_RECEIVED,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			} else {

 				return;

 			}

 			

 			break;

 		case RIL_ECALL_STATE_SEND_FAILURE:

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_MSD_SEND_FAILURE);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_MSD_SEND_FAILURE,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;

 		case RIL_ECALL_STATE_CALL_END_T2_TIMER:

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_T2_TIMER);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_T2_TIMER,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;

 		case RIL_ECALL_STATE_MSD_LLACK:

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_LLACK_RECEIVED);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_LLACK_RECEIVED,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;

 		case RIL_ECALL_STATE_IVS_PSAP_SYN_LOCK:

-			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_PSAP_SYN_LOCK);/*modify by hq at 2024/04/07 for ecall*/

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_PSAP_SYN_LOCK,eCallMode);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 			break;

 		case RIL_ECALL_STATE_UNKNOWN:

 		default:	

@@ -1878,10 +1914,10 @@
 	}

 

 	if(1 == first_msd_req){

-		ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_PSAP_CALLBACK_START);/*modify by hq at 2024/04/07 for ecall*/

+		ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_PSAP_CALLBACK_START,0);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 	} 

 	else if (1 == data_type) {

-		ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_MSDUPDATE_PSAP_REQURE);/*modify by hq at 2024/04/07 for ecall*/

+		ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_MSDUPDATE_PSAP_REQURE,0);/*modify by hq at 2024/04/07 for ecall, modfify for ng-ecall at 2025/03/12*/

 	}

 	

 	ecall_state_indicate.call_id = s_ecallMsdData.call_id;

@@ -1899,7 +1935,7 @@
 	RIL_Ecall_Unsol_Indications ecall_state_indicate = {0};

 	/*modify by hq at 2024/04/07 for ecall end*/

 	ecall_state_indicate.call_id = s_ecallMsdData.call_id;

-	ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ECALLONLY_DEREGISTRATION);/*modify by hq at 2024/04/07 for ecall*/

+	ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ECALLONLY_DEREGISTRATION,0);/*modify by hq at 2024/04/07 for ecall*/

 	RLOGD("handle_t10dereg !\n");

 

 	RIL_onUnsolicitedResponse(RIL_UNSOL_ECALL_INDICATIONS /*RIL_UNSOL_ZXIC_ECALL_INDICATIONS*/, &ecall_state_indicate, sizeof(ecall_state_indicate));/*modify by hq at 2024/04/07 for ecall*/