diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2019-06-14 18:48:31 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2019-06-14 18:48:31 -0700 |
commit | 2625e7083ff118e8da856eb1dd04d39d2a527e22 (patch) | |
tree | 72b04289561812bf1a52d5c14cfa2e6986cd76e1 /android/1.1/Gnss.cpp | |
parent | 2d333ab2d898e1119576b2507fa5f1e95b90d124 (diff) | |
parent | 3bbb89aee1a89cc7d268927ac8265a70a330f2fb (diff) | |
download | gps-2625e7083ff118e8da856eb1dd04d39d2a527e22.tar.gz |
Merge 3bbb89aee1a89cc7d268927ac8265a70a330f2fb on remote branch
Change-Id: I8ce184682331aed809cdf4e36611ccd7b84c02e3
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() { |