Merge "Ulp: Fixes an initialization bug for ULP call-backs"

This commit is contained in:
Linux Build Service Account 2013-05-10 15:24:35 -07:00 committed by Gerrit - the friendly Code Review server
commit 692686e3c2
2 changed files with 34 additions and 2 deletions

View file

@ -187,6 +187,7 @@ static const UlpPhoneContextInterface sLocEngUlpPhoneContextInterface =
};
static loc_eng_data_s_type loc_afw_data;
static UlpCallbacks ulp_cb_data;
static int gss_fd = 0;
/*===========================================================================
@ -323,6 +324,17 @@ static int loc_init(GpsCallbacks* callbacks)
retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event,
loc_ulp_msg_sender);
if (ulp_cb_data.phone_context_cb) {
//ULP initilization already occurred so redo intializations here
//to restore callback table
loc_eng_ulp_phone_context_init(loc_afw_data, ulp_cb_data.phone_context_cb);
}
if (ulp_cb_data.network_location_cb) {
loc_eng_ulp_network_init(loc_afw_data, ulp_cb_data.network_location_cb);
}
int ret_val1 = loc_eng_ulp_init(loc_afw_data, loc_eng_ulp_inf);
//Initialize the cached min_interval
loc_afw_data.min_interval_cached = ULP_MIN_INTERVAL_INVALID;
@ -1123,7 +1135,13 @@ SIDE EFFECTS
static int loc_ulp_phone_context_init(UlpPhoneContextCallbacks *callbacks)
{
ENTRY_LOG();
int ret_val = loc_eng_ulp_phone_context_init(loc_afw_data, callbacks);
int ret_val = -1;
if (loc_afw_data.context) {
ret_val = loc_eng_ulp_phone_context_init(loc_afw_data, callbacks);
} else
{
ulp_cb_data.phone_context_cb = callbacks;
}
EXIT_LOG(%d, ret_val);
return ret_val;
}
@ -1172,7 +1190,14 @@ SIDE EFFECTS
static int loc_ulp_network_init(UlpNetworkLocationCallbacks *callbacks)
{
ENTRY_LOG();
int ret_val = loc_eng_ulp_network_init(loc_afw_data, callbacks);
int ret_val = -1;
if (loc_afw_data.context) {
ret_val = loc_eng_ulp_network_init(loc_afw_data, callbacks);
} else
{
ulp_cb_data.network_location_cb = callbacks;
}
EXIT_LOG(%d, ret_val);
return ret_val;
}
@ -1227,6 +1252,8 @@ static int loc_ulp_engine_init(UlpEngineCallbacks* callbacks)
EXIT_LOG(%d, retVal);
return retVal;
}
//Intilize the ulp call back cache at this point
memset(&ulp_cb_data, 0, sizeof(UlpCallbacks));
ulp_loc_cb = callbacks->location_cb;
retVal = 0;
EXIT_LOG(%d, retVal);

View file

@ -77,6 +77,11 @@ typedef struct {
gps_request_utc_time request_utc_time_cb;
} LocCallbacks;
typedef struct {
UlpNetworkLocationCallbacks* network_location_cb;
UlpPhoneContextCallbacks* phone_context_cb;
} UlpCallbacks;
enum loc_sess_status {
LOC_SESS_SUCCESS,
LOC_SESS_INTERMEDIATE,