[Bugfix][T800][task-view-342] ecall t7 timeout, normal call event report
id is not correct
Only Configure: No
Affected branch: unknown
Affected module: ecall
Is it affected on both ZXIC and MTK: ZXIC only
Self-test: yes
Doc Update: no
Change-Id: I6fdab3d42ad74a440c62383adc7e6942f8cdc53c
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 3540ac0..d42142e 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
@@ -399,9 +399,10 @@
pthread_cond_signal(&call_state_change_cond);
pthread_mutex_unlock(&call_state_change_mutex);
}
-void send_call_state_change()
+void send_call_state_change(int callid)
{
LYINFLOG("send call state change");
+ s_CallId = callid;
pthread_mutex_lock(&s_call_state_change_mutex);
pthread_cond_signal(&s_call_state_change_cond);
pthread_mutex_unlock(&s_call_state_change_mutex);
@@ -431,16 +432,17 @@
#endif
pthread_mutex_lock(&s_notice_get_call_list_mutex);
pthread_cleanup_push(cleanup_call_list_mutex, NULL); // thread cleanup handler
+ int tmp_call_id;
while(s_call_list_loop)
{
update=0;
pthread_cond_wait(&s_notice_get_call_list_cond, &s_notice_get_call_list_mutex);
- LYDBGLOG("triggerGetCallList event!!!");
+ LYINFLOG("triggerGetCallList event %p!!!", pthread_self());
memset(call_list,0,sizeof(call_list));
ret = lynq_get_current_call_list(call_list);
if(ret != RESULT_OK)
{
- LYDBGLOG("get current call list failure!!!");
+ LYERRLOG("get current call list failure!!!");
continue;
}
LYINFLOG("++++++++++++++triggerGetCallList++++++++++++++");
@@ -470,12 +472,11 @@
if(call_end == 0)
{
LYINFLOG("MT/MO hungup,then clean call info local idx is %d id is %d",i, s_call_lists[i].call_id);
-
- s_CallId = s_call_lists[i].call_id;
-
//update_end_state(i);//lei modify for:update end state for this call
+ tmp_call_id = s_call_lists[i].call_id;
cleanCallList(i);
- send_call_state_change();//means mt/mo call is end
+ //Release the end handle
+ send_call_state_change(tmp_call_id);//means mt/mo call is end
//cleanCallList(i);
}
} //fix bug API-54
@@ -522,8 +523,7 @@
{
n = addAddr(call_list[i].addr,call_list[i].call_id);
updateCallList(&s_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);
- s_CallId = call_list[i].call_id;
- send_call_state_change();
+ send_call_state_change(call_list[i].call_id);
}
else if(s_call_lists[n].call_state == call_list[i].call_state)
{
@@ -535,7 +535,7 @@
**fix bug API-54
*/
LYINFLOG("resend incoming call signal");
- send_call_state_change();
+ send_call_state_change(call_list[i].call_id);
}
}
else
@@ -543,8 +543,7 @@
LYINFLOG("state changed from %d to %d",s_call_lists[n].call_state,call_list[i].call_state);
updateCallList(&s_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);//update mt call
- s_CallId = call_list[i].call_id;
- send_call_state_change();
+ send_call_state_change(call_list[i].call_id);
}
}
else
@@ -559,12 +558,11 @@
{
LYINFLOG("add a call id");
update=1;//for send sigal
- s_CallId = call_list[i].call_id;
}
LYINFLOG("local idx %d updated, original call id is %d origial addr is %s original state is %d",n,s_call_lists[n].call_id,s_call_lists[n].addr,s_call_lists[n].call_state);
updateCallList(&s_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);
call_end = 1;
- send_call_state_change();//means mo call is success
+ send_call_state_change(call_list[i].call_id);//means mo call is success
break;
}
}
@@ -612,10 +610,11 @@
void lynqNoticeGetModuleCallList()
{
+ LYINFLOG("RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED send start");
pthread_mutex_lock(&s_notice_get_call_list_mutex);
pthread_cond_signal(&s_notice_get_call_list_cond);
pthread_mutex_unlock(&s_notice_get_call_list_mutex);
-
+ LYINFLOG("RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED send end");
}
#if 0
@@ -767,6 +766,11 @@
}
int lynq_init_call(int utoken){
+
+ LYLOGSET(LOG_INFO);
+ LYLOGEINIT(USER_LOG_TAG);
+ LYERRLOG("%s start, parameter is %d", __func__,utoken);
+
if(g_module_init_flag != MODULE_CLOSED)
{
LYERRLOG("module state is %d",g_module_init_flag);
@@ -777,9 +781,7 @@
return LYNQ_E_PARAMETER_ANONALY;
}
g_module_init_flag = MODULE_SWITCHING;
-
- LYLOGSET(LOG_INFO);
- LYLOGEINIT(USER_LOG_TAG);
+
g_module_Global_uToken = utoken;
@@ -811,13 +813,14 @@
return LYNQ_E_INNER_ERROR;
}
-
-
g_module_init_flag = MODULE_RUNNING;
+
+ LYERRLOG("%s end suc", __func__);
return 0;
}
int lynq_deinit_call(void){
+ LYERRLOG("%s start", __func__);
if (g_module_init_flag != MODULE_RUNNING)
{
@@ -830,6 +833,8 @@
lynq_close_all_rc_socket_thread();
lynq_stop_call_list_loop();
g_module_init_flag = MODULE_CLOSED;
+
+ LYERRLOG("%s end suc", __func__);
return 0;
}
@@ -910,14 +915,17 @@
LYINFLOG("wait Call state Change");
int ret = 0;
int sec = 0;
- int usec = 0;
+ int ms = 0;
struct timeval now;
struct timespec timeout;
gettimeofday(&now,NULL);
sec = mtime/1000;
- usec = mtime%1000;
+ ms = mtime%1000;
timeout.tv_sec = now.tv_sec+sec;
- timeout.tv_nsec = now.tv_usec*1000+usec*1000000;
+ unsigned long long ns;
+ ns = now.tv_usec*1000ull + ms*1000000ull;
+ timeout.tv_sec += ns/1000000000;
+ timeout.tv_nsec = ns % 1000000000;
pthread_mutex_lock(&call_state_change_mutex);
ret = pthread_cond_timedwait(&call_state_change_cond,&call_state_change_mutex,&timeout);
pthread_mutex_unlock(&call_state_change_mutex);
@@ -976,7 +984,7 @@
s_module_isDial = 0;
LYERRLOG("lynq_call timeout:wait Call state fail!!! clear local idx %d",lynq_call_id);
cleanCallList(lynq_call_id);
- send_call_state_change();
+ send_call_state_change(lynq_call_id);
return LYNQ_E_TIME_OUT;
}
s_module_isDial = 0;
@@ -990,7 +998,7 @@
{
LYERRLOG("lynq_call dial addr %s fail, invalid id",addr);
cleanCallList(lynq_call_id);
- send_call_state_change();
+ send_call_state_change(lynq_call_id);
return LYNQ_E_INVALID_ID_ANONALY;
}
}
@@ -1031,21 +1039,17 @@
if(ret!=0)
{
return ret;
- }
+ }
delete p;
- int lynq_call_id=find_call_id_with_call_id(call_id);
+ int lynq_call_id=find_call_id_with_call_id(call_id);
if(lynq_call_id!=INVALID_ID)
{
+ //lei modify for API-857
cleanCallList(lynq_call_id);
- }
-
-
- s_CallId = call_id;
-
- //fix bug T106BUG-56
- send_call_state_change();
- return RESULT_OK;
+ send_call_state_change(call_id);
+ }
+ return RESULT_OK;
}
int lynq_call_hungup_all()
{
@@ -1115,6 +1119,11 @@
LYERRLOG("handle is NULL");
return LYNQ_E_PARAMETER_ANONALY;
}
+ if((*handle) <= 0)
+ {
+ LYINFLOG("lynq_get_current_call_state input error %d\n ", *handle);
+ return LYNQ_E_INVALID_ID_ANONALY;
+ }
LYINFLOG("lynq_get_current_call_state %d\n ", *handle);
lynq_call_id = find_call_id_with_call_id(*handle);
if(lynq_call_id==INVALID_ID)