Ulp: Fixes an initialization bug for ULP call-backs
Changes that caches ULP call backs if ULP initialization precedes AFW initialization. CRs-Fixed: 477557 Change-Id: Ic2f9de538c5b63958b0bbba5790bf00b52474dc4
This commit is contained in:
parent
ded83e6045
commit
9e74deb689
2 changed files with 34 additions and 2 deletions
|
@ -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;
|
||||
|
@ -1116,7 +1128,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;
|
||||
}
|
||||
|
@ -1165,7 +1183,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;
|
||||
}
|
||||
|
@ -1220,6 +1245,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);
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue