gps: report session begin/end on gps start/stop

Since modem does not consistently send
SESSON_END/ENGINE_OFF event, always report
SESSION_END on stop gps and SESSION_BEGIN on
start gps so that the icon is turned on/off
correctly.

CRs-fixed: 401664
Change-Id: Ib3954529056a653d7057aedb489be1ccee9eaf1d
This commit is contained in:
Dante Russo 2012-09-26 09:20:41 -07:00
parent 48cd8b423b
commit dc7abf9a3d

View file

@ -536,6 +536,7 @@ static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data)
ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN) ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN)
{ {
loc_eng_data.client_handle->setInSession(TRUE); loc_eng_data.client_handle->setInSession(TRUE);
loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_BEGIN);
} }
} }
@ -589,8 +590,7 @@ static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data)
if (loc_eng_data.client_handle->isInSession()) { if (loc_eng_data.client_handle->isInSession()) {
ret_val = loc_eng_data.client_handle->stopFix(); ret_val = loc_eng_data.client_handle->stopFix();
if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS && if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS)
loc_eng_data.fix_session_status != GPS_STATUS_SESSION_BEGIN)
{ {
loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_END); loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_END);
} }
@ -787,14 +787,6 @@ static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data, GpsStatusVa
{ {
CALLBACK_LOG_CALLFLOW("status_cb", %s, loc_get_gps_status_name(gs.status)); CALLBACK_LOG_CALLFLOW("status_cb", %s, loc_get_gps_status_name(gs.status));
loc_eng_data.status_cb(&gs); loc_eng_data.status_cb(&gs);
// Restore session begin if needed
if (status == GPS_STATUS_ENGINE_ON && last_status == GPS_STATUS_SESSION_BEGIN)
{
GpsStatus gs_sess_begin = { sizeof(gs_sess_begin),GPS_STATUS_SESSION_BEGIN };
CALLBACK_LOG_CALLFLOW("status_cb", %s, loc_get_gps_status_name(gs_sess_begin.status));
loc_eng_data.status_cb(&gs_sess_begin);
}
} }
last_status = status; last_status = status;