diff options
author | ChengYou Ho <chengyouho@google.com> | 2019-07-04 14:49:24 +0800 |
---|---|---|
committer | ChengYou Ho <chengyouho@google.com> | 2019-07-04 15:00:46 +0800 |
commit | 709263c923bd80fb570469d59d967cff0fe14a94 (patch) | |
tree | 6492c5008df54987f61267ac3fa5bb3520d52ccb /android/1.1/Gnss.cpp | |
parent | dc76408df249bd930d3fcf260b986af5989f248f (diff) | |
parent | 2625e7083ff118e8da856eb1dd04d39d2a527e22 (diff) | |
download | gps-709263c923bd80fb570469d59d967cff0fe14a94.tar.gz |
Merge remote-tracking branch 'goog/qcom/release/LA.UM.8.1.R1.09.00.00.529.057' into qt-r1-dev
Bug: 136707337
Change-Id: I6a5b2d92c938379c676c835037ed9c71cfd59f13
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() { |