summaryrefslogtreecommitdiff
path: root/android/2.0
diff options
context:
space:
mode:
Diffstat (limited to 'android/2.0')
-rw-r--r--android/2.0/Android.mk11
-rw-r--r--android/2.0/Gnss.cpp7
-rw-r--r--android/2.0/location_api/MeasurementAPIClient.cpp2
3 files changed, 17 insertions, 3 deletions
diff --git a/android/2.0/Android.mk b/android/2.0/Android.mk
index c33a792..7c55504 100644
--- a/android/2.0/Android.mk
+++ b/android/2.0/Android.mk
@@ -37,7 +37,8 @@ LOCAL_HEADER_LIBRARIES := \
libgps.utils_headers \
libloc_core_headers \
libloc_pla_headers \
- liblocation_api_headers
+ liblocation_api_headers \
+ liblocbatterylistener_headers
LOCAL_SHARED_LIBRARIES := \
liblog \
@@ -50,7 +51,11 @@ LOCAL_SHARED_LIBRARIES := \
android.hardware.gnss@1.1 \
android.hardware.gnss@2.0 \
android.hardware.gnss.measurement_corrections@1.0 \
- android.hardware.gnss.visibility_control@1.0
+ android.hardware.gnss.visibility_control@1.0 \
+ android.hardware.health@1.0 \
+ android.hardware.health@2.0 \
+ android.hardware.power@1.2 \
+ libbase
LOCAL_SHARED_LIBRARIES += \
libloc_core \
@@ -59,6 +64,8 @@ LOCAL_SHARED_LIBRARIES += \
liblocation_api \
LOCAL_CFLAGS += $(GNSS_CFLAGS)
+LOCAL_STATIC_LIBRARIES := liblocbatterylistener
+LOCAL_STATIC_LIBRARIES += libhealthhalutils
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
diff --git a/android/2.0/Gnss.cpp b/android/2.0/Gnss.cpp
index 0390af7..be4efac 100644
--- a/android/2.0/Gnss.cpp
+++ b/android/2.0/Gnss.cpp
@@ -19,6 +19,7 @@
*/
#define LOG_TAG "LocSvc_GnssInterface"
+#define LOG_NDEBUG 0
#include <fstream>
#include <log_util.h>
@@ -26,6 +27,7 @@
#include <cutils/properties.h>
#include "Gnss.h"
#include "LocationUtil.h"
+#include "battery_listener.h"
typedef const GnssInterface* (getLocationInterface)();
@@ -85,8 +87,13 @@ void Gnss::GnssDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who
}
}
+void location_on_battery_status_changed(bool charging) {
+ LOC_LOGd("%s: battery status changed to %s charging", __func__, charging ? "" : "not ");
+}
Gnss::Gnss() {
ENTRY_LOG_CALLFLOW();
+ // register health client to listen on battery change
+ loc_extn_battery_properties_listener_init(location_on_battery_status_changed);
// clear pending GnssConfig
memset(&mPendingConfig, 0, sizeof(GnssConfig));
mGnssDeathRecipient = new GnssDeathRecipient(this);
diff --git a/android/2.0/location_api/MeasurementAPIClient.cpp b/android/2.0/location_api/MeasurementAPIClient.cpp
index eb0c7d1..dc972ec 100644
--- a/android/2.0/location_api/MeasurementAPIClient.cpp
+++ b/android/2.0/location_api/MeasurementAPIClient.cpp
@@ -217,7 +217,7 @@ void MeasurementAPIClient::onGnssMeasurementsCb(
static void convertGnssMeasurement(GnssMeasurementsData& in,
V1_0::IGnssMeasurementCallback::GnssMeasurement& out)
{
- memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssMeasurement));
+ memset(&out, 0, sizeof(out));
if (in.flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_SNR;
if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT)