summaryrefslogtreecommitdiff
path: root/android/2.0
diff options
context:
space:
mode:
authorYingjie Wang <yingjiewang@codeaurora.org>2019-03-07 18:08:06 +0800
committerYingjie Wang <yingjiewang@codeaurora.org>2019-05-27 11:17:44 +0800
commit89583a78f041efb6213044867650e20013500e35 (patch)
tree4a42b6f9c869f64ca93a2253e0db45f1018132dc /android/2.0
parent51426e477b340950d7614ce6b1a7857b6a9b544f (diff)
downloadgps-89583a78f041efb6213044867650e20013500e35.tar.gz
Add charger indication receiver in Gnss Hidl
Register HEALTH Hal client in all Gnss Hidl impl to acquire charger indication. Change-Id: I3fcc00dd14a95e2375ab27a8c84c260300f9e90d CRs-fixed: 2411445
Diffstat (limited to 'android/2.0')
-rw-r--r--android/2.0/Android.mk11
-rw-r--r--android/2.0/Gnss.cpp7
2 files changed, 16 insertions, 2 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);