[automerger skipped] Mark ab/7061308 as merged in stage. am: 3507c7a450 -s ours am: 656506fe56 -s ours
am skip reason: Change-Id I001cc474c28475b886305627ebb536e0a51d0d23 with SHA-1 45cde3d2f6 is in history
Original change: undetermined
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I5cf2137d286b0dad58f582d310f26c2225028ab1
diff --git a/msm8998/android/Android.mk b/msm8998/android/Android.mk
index 142fdc8..4c6893a 100644
--- a/msm8998/android/Android.mk
+++ b/msm8998/android/Android.mk
@@ -22,8 +22,8 @@
location_api/LocationUtil.cpp \
location_api/GnssAPIClient.cpp \
location_api/GeofenceAPIClient.cpp \
- location_api/FlpAPIClient.cpp \
- location_api/GnssMeasurementAPIClient.cpp \
+ location_api/BatchingAPIClient.cpp \
+ location_api/MeasurementAPIClient.cpp \
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/location_api \
diff --git a/msm8998/android/GnssBatching.cpp b/msm8998/android/GnssBatching.cpp
index b79105c..6ffadc9 100644
--- a/msm8998/android/GnssBatching.cpp
+++ b/msm8998/android/GnssBatching.cpp
@@ -21,7 +21,7 @@
#define LOG_TAG "LocSvc_GnssBatchingInterface"
#include <log_util.h>
-#include <FlpAPIClient.h>
+#include <BatchingAPIClient.h>
#include "GnssBatching.h"
namespace android {
@@ -60,7 +60,7 @@
mApi = nullptr;
}
- mApi = new FlpAPIClient(callback);
+ mApi = new BatchingAPIClient(callback);
if (mApi == nullptr) {
LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
return false;
@@ -82,7 +82,7 @@
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
- ret = mApi->flpGetBatchSize();
+ ret = mApi->getBatchSize();
}
return ret;
}
@@ -92,7 +92,7 @@
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
- ret = mApi->flpStartSession(options);
+ ret = mApi->startSession(options);
}
return ret;
}
@@ -101,7 +101,7 @@
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
- mApi->flpFlushBatchedLocations();
+ mApi->flushBatchedLocations();
}
return Void();
}
@@ -111,7 +111,7 @@
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
} else {
- ret = mApi->flpStopSession();
+ ret = mApi->stopSession();
}
return ret;
}
diff --git a/msm8998/android/GnssBatching.h b/msm8998/android/GnssBatching.h
index b46fae8..de5d5c3 100644
--- a/msm8998/android/GnssBatching.h
+++ b/msm8998/android/GnssBatching.h
@@ -42,7 +42,7 @@
using ::android::hardware::Void;
using ::android::sp;
-class FlpAPIClient;
+class BatchingAPIClient;
struct GnssBatching : public IGnssBatching {
GnssBatching();
~GnssBatching();
@@ -68,7 +68,7 @@
private:
sp<GnssBatchingDeathRecipient> mGnssBatchingDeathRecipient = nullptr;
sp<IGnssBatchingCallback> mGnssBatchingCbIface = nullptr;
- FlpAPIClient* mApi = nullptr;
+ BatchingAPIClient* mApi = nullptr;
};
} // namespace implementation
diff --git a/msm8998/android/GnssMeasurement.cpp b/msm8998/android/GnssMeasurement.cpp
index bc07265..8cbfabd 100644
--- a/msm8998/android/GnssMeasurement.cpp
+++ b/msm8998/android/GnssMeasurement.cpp
@@ -21,7 +21,7 @@
#define LOG_TAG "LocSvc_GnssMeasurementInterface"
#include <log_util.h>
-#include <GnssMeasurementAPIClient.h>
+#include <MeasurementAPIClient.h>
#include "GnssMeasurement.h"
namespace android {
@@ -41,7 +41,7 @@
GnssMeasurement::GnssMeasurement() {
mGnssMeasurementDeathRecipient = new GnssMeasurementDeathRecipient(this);
- mApi = new GnssMeasurementAPIClient();
+ mApi = new MeasurementAPIClient();
}
GnssMeasurement::~GnssMeasurement() {
@@ -74,7 +74,7 @@
mGnssMeasurementCbIface = callback;
mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0 /*cookie*/);
- return mApi->gnssMeasurementSetCallback(callback);
+ return mApi->measurementSetCallback(callback);
}
Return<void> GnssMeasurement::close() {
@@ -87,7 +87,7 @@
mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface = nullptr;
}
- mApi->gnssMeasurementClose();
+ mApi->measurementClose();
return Void();
}
diff --git a/msm8998/android/GnssMeasurement.h b/msm8998/android/GnssMeasurement.h
index cd364c3..5073169 100644
--- a/msm8998/android/GnssMeasurement.h
+++ b/msm8998/android/GnssMeasurement.h
@@ -38,7 +38,7 @@
using ::android::hardware::hidl_string;
using ::android::sp;
-class GnssMeasurementAPIClient;
+class MeasurementAPIClient;
struct GnssMeasurement : public IGnssMeasurement {
GnssMeasurement();
~GnssMeasurement();
@@ -64,7 +64,7 @@
private:
sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
- GnssMeasurementAPIClient* mApi;
+ MeasurementAPIClient* mApi;
};
} // namespace implementation
diff --git a/msm8998/android/location_api/FlpAPIClient.cpp b/msm8998/android/location_api/BatchingAPIClient.cpp
similarity index 89%
rename from msm8998/android/location_api/FlpAPIClient.cpp
rename to msm8998/android/location_api/BatchingAPIClient.cpp
index f3af773..7325592 100644
--- a/msm8998/android/location_api/FlpAPIClient.cpp
+++ b/msm8998/android/location_api/BatchingAPIClient.cpp
@@ -28,13 +28,13 @@
*/
#define LOG_NDDEBUG 0
-#define LOG_TAG "LocSvc_FlpAPIClient"
+#define LOG_TAG "LocSvc_BatchingAPIClient"
#include <log_util.h>
#include <loc_cfg.h>
#include "LocationUtil.h"
-#include "FlpAPIClient.h"
+#include "BatchingAPIClient.h"
namespace android {
namespace hardware {
@@ -45,7 +45,7 @@
static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
LocationCapabilitiesMask mask);
-FlpAPIClient::FlpAPIClient(const sp<IGnssBatchingCallback>& callback) :
+BatchingAPIClient::BatchingAPIClient(const sp<IGnssBatchingCallback>& callback) :
LocationAPIClientBase(),
mGnssBatchingCbIface(callback),
mDefaultId(42),
@@ -74,18 +74,18 @@
locAPISetCallbacks(locationCallbacks);
}
-FlpAPIClient::~FlpAPIClient()
+BatchingAPIClient::~BatchingAPIClient()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
}
-int FlpAPIClient::flpGetBatchSize()
+int BatchingAPIClient::getBatchSize()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
return locAPIGetBatchSize();
}
-int FlpAPIClient::flpStartSession(const IGnssBatching::Options& opts)
+int BatchingAPIClient::startSession(const IGnssBatching::Options& opts)
{
LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
@@ -102,7 +102,7 @@
return retVal;
}
-int FlpAPIClient::flpUpdateSessionOptions(const IGnssBatching::Options& opts)
+int BatchingAPIClient::updateSessionOptions(const IGnssBatching::Options& opts)
{
LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
@@ -120,7 +120,7 @@
return retVal;
}
-int FlpAPIClient::flpStopSession()
+int BatchingAPIClient::stopSession()
{
LOC_LOGD("%s]: ", __FUNCTION__);
int retVal = -1;
@@ -130,25 +130,25 @@
return retVal;
}
-void FlpAPIClient::flpGetBatchedLocation(int last_n_locations)
+void BatchingAPIClient::getBatchedLocation(int last_n_locations)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, last_n_locations);
locAPIGetBatchedLocations(last_n_locations);
}
-void FlpAPIClient::flpFlushBatchedLocations()
+void BatchingAPIClient::flushBatchedLocations()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
locAPIGetBatchedLocations(SIZE_MAX);
}
-void FlpAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
+void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
{
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
mLocationCapabilitiesMask = capabilitiesMask;
}
-void FlpAPIClient::onBatchingCb(size_t count, Location* location)
+void BatchingAPIClient::onBatchingCb(size_t count, Location* location)
{
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count);
if (mGnssBatchingCbIface != nullptr && count > 0) {
diff --git a/msm8998/android/location_api/FlpAPIClient.h b/msm8998/android/location_api/BatchingAPIClient.h
similarity index 78%
rename from msm8998/android/location_api/FlpAPIClient.h
rename to msm8998/android/location_api/BatchingAPIClient.h
index 9fc7e19..da62a51 100644
--- a/msm8998/android/location_api/FlpAPIClient.h
+++ b/msm8998/android/location_api/BatchingAPIClient.h
@@ -27,8 +27,8 @@
*
*/
-#ifndef FLP_API_CLINET_H
-#define FLP_API_CLINET_H
+#ifndef BATCHING_API_CLINET_H
+#define BATCHING_API_CLINET_H
#include <android/hardware/gnss/1.0/IGnssBatching.h>
#include <android/hardware/gnss/1.0/IGnssBatchingCallback.h>
@@ -36,7 +36,6 @@
#include <LocationAPIClientBase.h>
-#define FLP_CONF_FILE "/vendor/etc/flp.conf"
namespace android {
namespace hardware {
@@ -44,19 +43,19 @@
namespace V1_0 {
namespace implementation {
-class FlpAPIClient : public LocationAPIClientBase
+class BatchingAPIClient : public LocationAPIClientBase
{
public:
- FlpAPIClient(const sp<IGnssBatchingCallback>& callback);
- ~FlpAPIClient();
- int flpGetBatchSize();
- int flpStartSession(const IGnssBatching::Options& options);
- int flpUpdateSessionOptions(const IGnssBatching::Options& options);
- int flpStopSession();
- void flpGetBatchedLocation(int last_n_locations);
- void flpFlushBatchedLocations();
+ BatchingAPIClient(const sp<IGnssBatchingCallback>& callback);
+ ~BatchingAPIClient();
+ int getBatchSize();
+ int startSession(const IGnssBatching::Options& options);
+ int updateSessionOptions(const IGnssBatching::Options& options);
+ int stopSession();
+ void getBatchedLocation(int last_n_locations);
+ void flushBatchedLocations();
- inline LocationCapabilitiesMask flpGetCapabilities() { return mLocationCapabilitiesMask; }
+ inline LocationCapabilitiesMask getCapabilities() { return mLocationCapabilitiesMask; }
// callbacks
void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
@@ -74,4 +73,4 @@
} // namespace gnss
} // namespace hardware
} // namespace android
-#endif // FLP_API_CLINET_H
+#endif // BATCHING_API_CLINET_H
diff --git a/msm8998/android/location_api/GnssMeasurementAPIClient.cpp b/msm8998/android/location_api/MeasurementAPIClient.cpp
similarity index 85%
rename from msm8998/android/location_api/GnssMeasurementAPIClient.cpp
rename to msm8998/android/location_api/MeasurementAPIClient.cpp
index 6e915b0..075ef69 100644
--- a/msm8998/android/location_api/GnssMeasurementAPIClient.cpp
+++ b/msm8998/android/location_api/MeasurementAPIClient.cpp
@@ -28,13 +28,13 @@
*/
#define LOG_NDDEBUG 0
-#define LOG_TAG "LocSvc_GnssMeasurementAPIClient"
+#define LOG_TAG "LocSvc_MeasurementAPIClient"
#include <log_util.h>
#include <loc_cfg.h>
#include "LocationUtil.h"
-#include "GnssMeasurementAPIClient.h"
+#include "MeasurementAPIClient.h"
namespace android {
namespace hardware {
@@ -48,32 +48,21 @@
IGnssMeasurementCallback::GnssMeasurement& out);
static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out);
-GnssMeasurementAPIClient::GnssMeasurementAPIClient() :
+MeasurementAPIClient::MeasurementAPIClient() :
mGnssMeasurementCbIface(nullptr),
- mLocationCapabilitiesMask(0)
+ mTracking(false)
{
LOC_LOGD("%s]: ()", __FUNCTION__);
- pthread_mutex_init(&mLock, nullptr);
- pthread_cond_init (&mCond, nullptr);
-
- // set default LocationOptions.
- memset(&mLocationOptions, 0, sizeof(LocationOptions));
- mLocationOptions.size = sizeof(LocationOptions);
- mLocationOptions.minInterval = 1000;
- mLocationOptions.minDistance = 0;
- mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE;
}
-GnssMeasurementAPIClient::~GnssMeasurementAPIClient()
+MeasurementAPIClient::~MeasurementAPIClient()
{
LOC_LOGD("%s]: ()", __FUNCTION__);
- pthread_cond_destroy(&mCond);
- pthread_mutex_destroy(&mLock);
}
// for GpsInterface
Return<IGnssMeasurement::GnssMeasurementStatus>
-GnssMeasurementAPIClient::gnssMeasurementSetCallback(const sp<IGnssMeasurementCallback>& callback)
+MeasurementAPIClient::measurementSetCallback(const sp<IGnssMeasurementCallback>& callback)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
@@ -100,50 +89,32 @@
}
locAPISetCallbacks(locationCallbacks);
-
- while (!mLocationCapabilitiesMask) {
- LOC_LOGD("%s]: wait for capabilities...", __FUNCTION__);
- pthread_mutex_lock(&mLock);
- pthread_cond_wait(&mCond, &mLock);
- pthread_mutex_unlock(&mLock);
- }
- if (mLocationCapabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
- mLocationOptions.mode = GNSS_SUPL_MODE_MSB;
- else
- mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE;
+ LocationOptions options;
+ memset(&options, 0, sizeof(LocationOptions));
+ options.size = sizeof(LocationOptions);
+ options.minInterval = 1000;
+ options.mode = GNSS_SUPL_MODE_STANDALONE;
+ mTracking = true;
LOC_LOGD("%s]: start tracking session", __FUNCTION__);
- locAPIStartTracking(mLocationOptions);
+ locAPIStartTracking(options);
return IGnssMeasurement::GnssMeasurementStatus::SUCCESS;
}
// for GpsMeasurementInterface
-void GnssMeasurementAPIClient::gnssMeasurementClose() {
+void MeasurementAPIClient::measurementClose() {
LOC_LOGD("%s]: ()", __FUNCTION__);
- pthread_mutex_lock(&mLock);
- mGnssMeasurementCbIface = nullptr;
- pthread_mutex_unlock(&mLock);
+ mTracking = false;
locAPIStopTracking();
}
// callbacks
-void GnssMeasurementAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
-{
- LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
- mLocationCapabilitiesMask = capabilitiesMask;
- pthread_mutex_lock(&mLock);
- pthread_cond_signal(&mCond);
- pthread_mutex_unlock(&mLock);
-}
-
-void GnssMeasurementAPIClient::onGnssMeasurementsCb(
+void MeasurementAPIClient::onGnssMeasurementsCb(
GnssMeasurementsNotification gnssMeasurementsNotification)
{
- LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, gnssMeasurementsNotification.count);
- // we don't need to lock the mutext
- // if mGnssMeasurementCbIface is set to nullptr
- if (mGnssMeasurementCbIface != nullptr) {
- pthread_mutex_lock(&mLock);
+ LOC_LOGD("%s]: (count: %zu active: %zu)",
+ __FUNCTION__, gnssMeasurementsNotification.count, mTracking);
+ if (mTracking) {
if (mGnssMeasurementCbIface != nullptr) {
IGnssMeasurementCallback::GnssData gnssData;
convertGnssData(gnssMeasurementsNotification, gnssData);
@@ -153,7 +124,6 @@
__func__, r.description().c_str());
}
}
- pthread_mutex_unlock(&mLock);
}
}
diff --git a/msm8998/android/location_api/GnssMeasurementAPIClient.h b/msm8998/android/location_api/MeasurementAPIClient.h
similarity index 76%
rename from msm8998/android/location_api/GnssMeasurementAPIClient.h
rename to msm8998/android/location_api/MeasurementAPIClient.h
index 02fe89a..422564d 100644
--- a/msm8998/android/location_api/GnssMeasurementAPIClient.h
+++ b/msm8998/android/location_api/MeasurementAPIClient.h
@@ -27,8 +27,8 @@
*
*/
-#ifndef GNSS_MEASUREMENT_API_CLINET_H
-#define GNSS_MEASUREMENT_API_CLINET_H
+#ifndef MEASUREMENT_API_CLINET_H
+#define MEASUREMENT_API_CLINET_H
#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
@@ -45,32 +45,26 @@
using ::android::hardware::gnss::V1_0::IGnssMeasurement;
using ::android::sp;
-class GnssMeasurementAPIClient : public LocationAPIClientBase
+class MeasurementAPIClient : public LocationAPIClientBase
{
public:
- GnssMeasurementAPIClient();
- virtual ~GnssMeasurementAPIClient();
- GnssMeasurementAPIClient(const GnssMeasurementAPIClient&) = delete;
- GnssMeasurementAPIClient& operator=(const GnssMeasurementAPIClient&) = delete;
+ MeasurementAPIClient();
+ virtual ~MeasurementAPIClient();
+ MeasurementAPIClient(const MeasurementAPIClient&) = delete;
+ MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
// for GpsMeasurementInterface
- Return<IGnssMeasurement::GnssMeasurementStatus> gnssMeasurementSetCallback(
+ Return<IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
const sp<IGnssMeasurementCallback>& callback);
- void gnssMeasurementClose();
+ void measurementClose();
// callbacks we are interested in
- void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
private:
- pthread_mutex_t mLock;
- pthread_cond_t mCond;
-
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface;
- LocationCapabilitiesMask mLocationCapabilitiesMask;
-
- LocationOptions mLocationOptions;
+ bool mTracking;
};
} // namespace implementation
@@ -78,4 +72,4 @@
} // namespace gnss
} // namespace hardware
} // namespace android
-#endif // GNSS_MEASUREMENT_API_CLINET_H
+#endif // MEASUREMENT_API_CLINET_H
diff --git a/msm8998/location/LocationAPIClientBase.cpp b/msm8998/location/LocationAPIClientBase.cpp
index 606a7b7..ea7f5a5 100644
--- a/msm8998/location/LocationAPIClientBase.cpp
+++ b/msm8998/location/LocationAPIClientBase.cpp
@@ -33,7 +33,7 @@
#include <loc_cfg.h>
#include "LocationAPIClientBase.h"
-#define FLP_CONF_FILE "/vendor/etc/flp.conf"
+#define BATCHING_CONF_FILE "/vendor/etc/flp.conf"
#define GEOFENCE_SESSION_ID -1
LocationAPIClientBase::LocationAPIClientBase() :
@@ -201,11 +201,11 @@
int32_t LocationAPIClientBase::locAPIGetBatchSize()
{
if (mBatchSize == -1) {
- const loc_param_s_type flp_conf_param_table[] =
+ const loc_param_s_type batching_conf_param_table[] =
{
{"BATCH_SIZE", &mBatchSize, nullptr, 'n'},
};
- UTIL_READ_CONF(FLP_CONF_FILE, flp_conf_param_table);
+ UTIL_READ_CONF(BATCHING_CONF_FILE, batching_conf_param_table);
if (mBatchSize < 0) {
// set mBatchSize to 0 if we got an illegal value from config file
mBatchSize = 0;