diff options
author | Wei Chen <weic@codeaurora.org> | 2019-12-12 12:53:04 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2020-01-08 12:01:36 -0800 |
commit | 8400fc771740f62536e454ecf97289d689158043 (patch) | |
tree | 0b614c1aa886799906a4d89da2818654471ec3f2 /location | |
parent | 7a736851d49f0eb3fffb0c3bf4ecbf4036086d46 (diff) | |
download | gps-8400fc771740f62536e454ecf97289d689158043.tar.gz |
Location integration API: misc fix
1: Socket name for location integration api client to share same
prefix as location client API, so HAL daemon can notify both
when restarted
2: Add 2 seconds timeout for datagram socket send operation
3: Make the location api destroy more robust when callback gets
updated
Change-Id: If4764afc29d9e3650dd847766d412c6b4e15b2d5
CRs-fixed: 2579959
Diffstat (limited to 'location')
-rw-r--r-- | location/LocationAPI.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/location/LocationAPI.cpp b/location/LocationAPI.cpp index 7c125b8..d38c023 100644 --- a/location/LocationAPI.cpp +++ b/location/LocationAPI.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -121,7 +121,6 @@ void LocationAPI::onRemoveClientCompleteCb (LocationAdapterTypeMask adapterType) if ((true == invokeCallback) && (nullptr != destroyCompleteCb)) { LOC_LOGd("invoke client destroy cb"); (destroyCompleteCb) (); - LOC_LOGd("finish invoke client destroy cb"); delete this; } @@ -143,7 +142,7 @@ void onGeofenceRemoveClientCompleteCb (LocationAPI* client) } LocationAPI* -LocationAPI::createInstance(LocationCallbacks& locationCallbacks) +LocationAPI::createInstance (LocationCallbacks& locationCallbacks) { if (nullptr == locationCallbacks.capabilitiesCb || nullptr == locationCallbacks.responseCb || @@ -234,15 +233,12 @@ LocationAPI::destroy(locationApiDestroyCompleteCallback destroyCompleteCb) pthread_mutex_lock(&gDataMutex); auto it = gData.clientData.find(this); if (it != gData.clientData.end()) { - bool removeFromGnssInf = - (isGnssClient(it->second) && NULL != gData.gnssInterface); - bool removeFromBatchingInf = - (isBatchingClient(it->second) && NULL != gData.batchingInterface); - bool removeFromGeofenceInf = - (isGeofenceClient(it->second) && NULL != gData.geofenceInterface); + bool removeFromGnssInf = (NULL != gData.gnssInterface); + bool removeFromBatchingInf = (NULL != gData.batchingInterface); + bool removeFromGeofenceInf = (NULL != gData.geofenceInterface); bool needToWait = (removeFromGnssInf || removeFromBatchingInf || removeFromGeofenceInf); LOC_LOGe("removeFromGnssInf: %d, removeFromBatchingInf: %d, removeFromGeofenceInf: %d," - "need %d", removeFromGnssInf, removeFromBatchingInf, removeFromGeofenceInf, + "needToWait: %d", removeFromGnssInf, removeFromBatchingInf, removeFromGeofenceInf, needToWait); if ((NULL != destroyCompleteCb) && (true == needToWait)) { @@ -258,7 +254,7 @@ LocationAPI::destroy(locationApiDestroyCompleteCallback destroyCompleteCb) destroyCbData.waitAdapterMask |= (removeFromGeofenceInf ? LOCATION_ADAPTER_GEOFENCE_TYPE_BIT : 0); gData.destroyClientData[this] = destroyCbData; - LOC_LOGe("destroy data stored in the map: 0x%x", destroyCbData.waitAdapterMask); + LOC_LOGi("destroy data stored in the map: 0x%x", destroyCbData.waitAdapterMask); } if (removeFromGnssInf) { |