diff options
Diffstat (limited to 'android/1.1/Gnss.cpp')
-rw-r--r-- | android/1.1/Gnss.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/android/1.1/Gnss.cpp b/android/1.1/Gnss.cpp index 8d5d8a8..bea556f 100644 --- a/android/1.1/Gnss.cpp +++ b/android/1.1/Gnss.cpp @@ -19,6 +19,7 @@ */ #define LOG_TAG "LocSvc_GnssInterface" +#define LOG_NDEBUG 0 #include <fstream> #include <log_util.h> @@ -27,6 +28,8 @@ #include "Gnss.h" #include <LocationUtil.h> +#include "battery_listener.h" + typedef const GnssInterface* (getLocationInterface)(); #define IMAGES_INFO_FILE "/sys/devices/soc0/images" @@ -38,6 +41,7 @@ namespace gnss { namespace V1_1 { namespace implementation { +static sp<Gnss> sGnss; static std::string getVersionString() { static std::string version; if (!version.empty()) @@ -84,8 +88,17 @@ void Gnss::GnssDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who } } +void location_on_battery_status_changed(bool charging) { + LOC_LOGd("battery status changed to %s charging", charging ? "" : "not"); + if (sGnss != nullptr) { + sGnss->getGnssInterface()->updateBatteryStatus(charging); + } +} Gnss::Gnss() { ENTRY_LOG_CALLFLOW(); + sGnss = this; + // 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)); @@ -98,6 +111,7 @@ Gnss::~Gnss() { delete mApi; mApi = nullptr; } + sGnss = nullptr; } GnssAPIClient* Gnss::getApi() { |