summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2022-01-05 08:57:20 -0800
committerLinux Build Service Account <lnxbuild@localhost>2022-01-05 08:57:20 -0800
commit82cc0d1b132e6200e49ddef23ff28d00f3baea4a (patch)
treedbbf04e1ef37505476866352e9c99e69be3c0d08
parentd5766857ffb9418e775d4092ff75d7c077ea4586 (diff)
parentd1fe0cea724eeae0faf1e7d4d25a6864940baed4 (diff)
Merge d1fe0cea724eeae0faf1e7d4d25a6864940baed4 on remote branch
Change-Id: Idda3c8c7b3a3fc020c2fc4c8dba1f49557392d43
-rw-r--r--android/2.1/location_api/MeasurementAPIClient.cpp1
-rw-r--r--android/aidl-impl/Android.mk9
-rw-r--r--android/aidl-impl/location_api/GnssAPIClient.cpp33
-rw-r--r--android/utils/Android.bp3
-rw-r--r--android/utils/battery_listener.cpp13
-rw-r--r--configure.ac8
-rw-r--r--core/LocAdapterBase.h2
-rw-r--r--gnss/GnssAdapter.cpp5
-rw-r--r--gnss/Makefile.am4
-rw-r--r--location/LocationAPIClientBase.cpp6
-rw-r--r--location/LocationAPIClientBase.h6
11 files changed, 47 insertions, 43 deletions
diff --git a/android/2.1/location_api/MeasurementAPIClient.cpp b/android/2.1/location_api/MeasurementAPIClient.cpp
index 0028074..e16858d 100644
--- a/android/2.1/location_api/MeasurementAPIClient.cpp
+++ b/android/2.1/location_api/MeasurementAPIClient.cpp
@@ -438,7 +438,6 @@ static void convertGnssData_2_0(GnssMeasurementsNotification& in,
static void convertGnssMeasurementsCodeType(GnssMeasurementsCodeType& inCodeType,
char* inOtherCodeTypeName, ::android::hardware::hidl_string& out)
{
- memset(&out, 0, sizeof(out));
switch(inCodeType) {
case GNSS_MEASUREMENTS_CODE_TYPE_A:
out = "A";
diff --git a/android/aidl-impl/Android.mk b/android/aidl-impl/Android.mk
index 33652dd..11aaf10 100644
--- a/android/aidl-impl/Android.mk
+++ b/android/aidl-impl/Android.mk
@@ -21,8 +21,7 @@ LOCAL_HEADER_LIBRARIES := \
libgps.utils_headers \
libloc_core_headers \
libloc_pla_headers \
- liblocation_api_headers \
- liblocbatterylistener_headers
+ liblocation_api_headers
LOCAL_SHARED_LIBRARIES := \
libbase \
@@ -36,7 +35,7 @@ LOCAL_SHARED_LIBRARIES := \
libloc_core \
libgps.utils \
libdl \
- liblocation_api \
+ liblocation_api
LOCAL_CFLAGS += $(GNSS_CFLAGS)
@@ -51,7 +50,7 @@ LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_INIT_RC := android.hardware.gnss-aidl-service-qti.rc
LOCAL_SRC_FILES := \
- service.cpp \
+ service.cpp
LOCAL_HEADER_LIBRARIES := \
libgps.utils_headers \
@@ -68,7 +67,7 @@ LOCAL_SHARED_LIBRARIES := \
libgps.utils \
liblocation_api \
libqti_vndfwk_detect_vendor \
- libbinder_ndk \
+ libbinder_ndk
LOCAL_SHARED_LIBRARIES += \
libhidlbase \
diff --git a/android/aidl-impl/location_api/GnssAPIClient.cpp b/android/aidl-impl/location_api/GnssAPIClient.cpp
index 1caa0ad..b9d9b10 100644
--- a/android/aidl-impl/location_api/GnssAPIClient.cpp
+++ b/android/aidl-impl/location_api/GnssAPIClient.cpp
@@ -79,7 +79,7 @@ void GnssAPIClient::gnssUpdateCallbacks(const shared_ptr<IGnssCallback>& gpsCb)
mGnssCbIface = gpsCb;
mMutex.unlock();
- if (mGnssCbIface != nullptr) {
+ if (gpsCb != nullptr) {
setCallbacks();
}
}
@@ -148,23 +148,24 @@ void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
mLocationCapabilitiesMask = capabilitiesMask;
mLocationCapabilitiesCached = true;
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
- if (mGnssCbIface != nullptr) {
- uint32_t capabilities = 0;
- if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT) {
- capabilities |= IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST;
- }
- // CORRELATION_VECTOR not supported.
- capabilities |= IGnssCallback::CAPABILITY_SATELLITE_PVT;
- if (capabilitiesMask & LOCATION_CAPABILITIES_MEASUREMENTS_CORRECTION_BIT) {
- capabilities |= IGnssCallback::CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING;
- }
+ uint32_t capabilities = 0;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT) {
+ capabilities |= IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST;
+ }
+ // CORRELATION_VECTOR not supported.
+ capabilities |= IGnssCallback::CAPABILITY_SATELLITE_PVT;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_MEASUREMENTS_CORRECTION_BIT) {
+ capabilities |= IGnssCallback::CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING;
+ }
- if (mGnssCbIface != nullptr) {
- auto r = mGnssCbIface->gnssSetCapabilitiesCb(capabilities);
- if (!r.isOk()) {
- LOC_LOGe("Error from AIDL gnssSetCapabilitiesCb");
- }
+ if (gnssCbIface != nullptr) {
+ auto r = gnssCbIface->gnssSetCapabilitiesCb(capabilities);
+ if (!r.isOk()) {
+ LOC_LOGe("Error from AIDL gnssSetCapabilitiesCb");
}
}
}
diff --git a/android/utils/Android.bp b/android/utils/Android.bp
index 20fea88..4eb1ecb 100644
--- a/android/utils/Android.bp
+++ b/android/utils/Android.bp
@@ -3,8 +3,6 @@ cc_library_static {
name: "liblocbatterylistener",
vendor: true,
-
-
cflags: GNSS_CFLAGS + ["-DBATTERY_LISTENER_ENABLED"],
local_include_dirs: ["."],
@@ -18,7 +16,6 @@ cc_library_static {
"android.hardware.health@1.0",
"android.hardware.health@2.0",
"android.hardware.health@2.1",
- "android.hardware.power@1.2",
"libbase",
],
diff --git a/android/utils/battery_listener.cpp b/android/utils/battery_listener.cpp
index 9cbfabd..0d5cd03 100644
--- a/android/utils/battery_listener.cpp
+++ b/android/utils/battery_listener.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
+* Copyright (c) 2019-2021, 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
@@ -33,10 +33,8 @@
#define LOG_TAG "LocSvc_BatteryListener"
#define LOG_NDEBUG 0
-#include <android/hidl/manager/1.0/IServiceManager.h>
#include <android/hardware/health/2.1/IHealth.h>
#include <android/hardware/health/2.1/IHealthInfoCallback.h>
-#include <healthhalutils/HealthHalUtils.h>
#include <hidl/HidlTransportSupport.h>
#include <thread>
#include <log_util.h>
@@ -49,7 +47,6 @@ using android::hardware::health::V2_1::HealthInfo;
using android::hardware::health::V2_1::IHealthInfoCallback;
using android::hardware::health::V2_1::IHealth;
using android::hardware::health::V2_0::Result;
-using android::hidl::manager::V1_0::IServiceManager;
using namespace std::literals::chrono_literals;
static bool sIsBatteryListened = false;
@@ -145,8 +142,7 @@ status_t BatteryListenerImpl::init()
case BatteryStatus::NOT_CHARGING : {
auto mStatusnot_ncharging =
[this, local_status]() { return mStatus != local_status; };
- mCond.wait_for(l, 3s, mStatusnot_ncharging);
- if (mStatusnot_ncharging()) // i.e event changed
+ if (mCond.wait_for(l, 3s, mStatusnot_ncharging)) // i.e event changed
break;
[[clang::fallthrough]]; //explicit fall-through between switch labels
}
@@ -222,9 +218,9 @@ void BatteryListenerImpl::serviceDied(uint64_t cookie __unused,
// Replace single var by a list if this assumption is broken
Return<void> BatteryListenerImpl::healthInfoChanged(
const hardware::health::V2_0::HealthInfo& info) {
- LOC_LOGv("healthInfoChanged: %d", info.legacy.batteryStatus);
std::unique_lock<std::mutex> l(mLock);
if (info.legacy.batteryStatus != mStatus) {
+ LOC_LOGv("batteryStatus changed from %d to %d", mStatus, info.legacy.batteryStatus);
mStatus = info.legacy.batteryStatus;
mCond.notify_one();
}
@@ -233,7 +229,6 @@ Return<void> BatteryListenerImpl::healthInfoChanged(
Return<void> BatteryListenerImpl::healthInfoChanged_2_1(
const hardware::health::V2_1::HealthInfo& info) {
- LOC_LOGv("healthInfoChanged_2_1: %d", info.legacy.legacy.batteryStatus);
healthInfoChanged(info.legacy);
return Void();
}
@@ -247,7 +242,7 @@ bool batteryPropertiesListenerIsCharging() {
status_t batteryPropertiesListenerInit(BatteryListenerImpl::cb_fn_t cb) {
batteryListener = new BatteryListenerImpl(cb);
bool isCharging = batteryPropertiesListenerIsCharging();
- LOC_LOGv("charging status: %s charging", isCharging ? "" : "not");;
+ LOC_LOGv("charging status: %s charging", isCharging ? "" : "not");
if (isCharging) {
cb(isCharging);
}
diff --git a/configure.ac b/configure.ac
index 2a44051..56e592d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,14 @@ PKG_CHECK_MODULES([LOCCORE], [loc-core])
AC_SUBST([LOCCORE_CFLAGS])
AC_SUBST([LOCCORE_LIBS])
+AC_ARG_WITH([auto_feature],
+ AC_HELP_STRING([--with-auto_feature=@<:@dir@:>@],
+ [Using Automotive feature]),
+ [],
+ with_auto_feature=no)
+
+AM_CONDITIONAL(USE_FEATURE_AUTOMOTIVE, test "x${with_auto_feature}" = "xyes")
+
AC_ARG_WITH([core_includes],
AC_HELP_STRING([--with-core-includes=@<:@dir@:>@],
[Specify the location of the core headers]),
diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h
index 00a3315..db2e6b6 100644
--- a/core/LocAdapterBase.h
+++ b/core/LocAdapterBase.h
@@ -34,8 +34,6 @@
#include <LocationAPI.h>
#include <map>
-#define MIN_TRACKING_INTERVAL (100) // 100 msec
-
typedef struct LocationSessionKey {
LocationAPI* client;
uint32_t id;
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index 51baa73..2f8e95e 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -53,8 +53,11 @@
#define RAD2DEG (180.0 / M_PI)
#define DEG2RAD (M_PI / 180.0)
#define PROCESS_NAME_ENGINE_SERVICE "engine-service"
+#ifdef FEATURE_AUTOMOTIVE
#define MIN_TRACKING_INTERVAL (100) // 100 msec
-
+#else
+#define MIN_TRACKING_INTERVAL (1000) // 1 sec
+#endif //FEATURE_AUTOMOTIVE
#define BILLION_NSEC (1000000000ULL)
#define NMEA_MIN_THRESHOLD_MSEC (99)
#define NMEA_MAX_THRESHOLD_MSEC (975)
diff --git a/gnss/Makefile.am b/gnss/Makefile.am
index 4642de4..a9fe04d 100644
--- a/gnss/Makefile.am
+++ b/gnss/Makefile.am
@@ -16,6 +16,10 @@ libgnss_la_SOURCES = \
Agps.cpp \
NativeAgpsHandler.cpp
+if USE_FEATURE_AUTOMOTIVE
+AM_CFLAGS += -DFEATURE_AUTOMOTIVE
+endif
+
if USE_GLIB
libgnss_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
libgnss_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -avoid-version
diff --git a/location/LocationAPIClientBase.cpp b/location/LocationAPIClientBase.cpp
index fa2be9a..642226d 100644
--- a/location/LocationAPIClientBase.cpp
+++ b/location/LocationAPIClientBase.cpp
@@ -819,9 +819,9 @@ void LocationAPIClientBase::locAPIResumeGeofences(
void LocationAPIClientBase::locAPIRemoveAllGeofences()
{
- std::vector<uint32_t> sessionsVec = mGeofenceBiDict.getAllSessions();
- if (sessionsVec.size() > 0) {
- locAPIRemoveGeofences(sessionsVec.size(), &sessionsVec[0]);
+ std::vector<uint32_t> idsVec = mGeofenceBiDict.getAllIds();
+ if (idsVec.size() > 0) {
+ locAPIRemoveGeofences(idsVec.size(), &idsVec[0]);
}
}
diff --git a/location/LocationAPIClientBase.h b/location/LocationAPIClientBase.h
index 757db2a..3675671 100644
--- a/location/LocationAPIClientBase.h
+++ b/location/LocationAPIClientBase.h
@@ -392,11 +392,11 @@ private:
pthread_mutex_unlock(&mBiDictMutex);
return ret;
}
- std::vector<uint32_t> getAllSessions() {
+ std::vector<uint32_t> getAllIds() {
std::vector<uint32_t> ret;
pthread_mutex_lock(&mBiDictMutex);
- for (auto it = mBackwardMap.begin(); it != mBackwardMap.end(); it++) {
- ret.push_back(it->first);
+ for (auto idToSessionPair : mForwardMap) {
+ ret.push_back(idToSessionPair.first);
}
pthread_mutex_unlock(&mBiDictMutex);
return ret;