Adding one level of context swith for Geofence_add

Added one more context switch for geofence add
command. To even out total number of the context
switch as it is for remove/modify/pause command.
This will prevent out of order execution of
sent msg tasks.

Change-Id: Icf1f39ee3526e2e45cfe3e84945f71524941069b
CRs-Fixed: 2516790
This commit is contained in:
Nilesh Gharde 2019-08-29 14:24:46 +05:30
parent 93db35b825
commit 0df749e363
2 changed files with 28 additions and 23 deletions

View file

@ -242,9 +242,11 @@ GeofenceAdapter::addGeofencesCommand(LocationAPI* client, size_t count, Geofence
if (NULL == mIds || NULL == mOptions || NULL == mInfos) { if (NULL == mIds || NULL == mOptions || NULL == mInfos) {
errs[i] = LOCATION_ERROR_INVALID_PARAMETER; errs[i] = LOCATION_ERROR_INVALID_PARAMETER;
} else { } else {
mApi.addGeofence(mIds[i], mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
mOptions[i], [&mAdapter = mAdapter, mCount = mCount, mClient = mClient,
mInfos[i], mOptions = mOptions, mInfos = mInfos, mIds = mIds, &mApi = mApi,
errs, i] (LocationError err ) {
mApi.addGeofence(mIds[i], mOptions[i], mInfos[i],
new LocApiResponseData<LocApiGeofenceData>(*mAdapter.getContext(), new LocApiResponseData<LocApiGeofenceData>(*mAdapter.getContext(),
[&mAdapter = mAdapter, mOptions = mOptions, mClient = mClient, [&mAdapter = mAdapter, mOptions = mOptions, mClient = mClient,
mCount = mCount, mIds = mIds, mInfos = mInfos, errs, i] mCount = mCount, mIds = mIds, mInfos = mInfos, errs, i]
@ -267,6 +269,7 @@ GeofenceAdapter::addGeofencesCommand(LocationAPI* client, size_t count, Geofence
delete[] mInfos; delete[] mInfos;
} }
})); }));
}));
} }
} }
} }

View file

@ -488,6 +488,7 @@ private:
for (size_t i = 0; i < count; i++) { for (size_t i = 0; i < count; i++) {
ids[i] = mAPI.mGeofenceBiDict.getId(sessions[i]); ids[i] = mAPI.mGeofenceBiDict.getId(sessions[i]);
} }
LOC_LOGD("%s:]Returned geofence-id: %d in add geofence", __FUNCTION__, *ids);
mAPI.onAddGeofencesCb(count, errors, ids); mAPI.onAddGeofencesCb(count, errors, ids);
free(ids); free(ids);
} }
@ -505,6 +506,7 @@ private:
for (size_t i = 0; i < count; i++) { for (size_t i = 0; i < count; i++) {
ids[i] = mRemovedGeofenceBiDict->getId(sessions[i]); ids[i] = mRemovedGeofenceBiDict->getId(sessions[i]);
} }
LOC_LOGD("%s:]Returned geofence-id: %d in remove geofence", __FUNCTION__, *ids);
mAPI.onRemoveGeofencesCb(count, errors, ids); mAPI.onRemoveGeofencesCb(count, errors, ids);
free(ids); free(ids);
delete(mRemovedGeofenceBiDict); delete(mRemovedGeofenceBiDict);