summaryrefslogtreecommitdiff
path: root/android/1.1/Gnss.cpp
diff options
context:
space:
mode:
authorChengYou Ho <chengyouho@google.com>2019-07-04 14:49:24 +0800
committerChengYou Ho <chengyouho@google.com>2019-07-04 15:00:46 +0800
commit709263c923bd80fb570469d59d967cff0fe14a94 (patch)
tree6492c5008df54987f61267ac3fa5bb3520d52ccb /android/1.1/Gnss.cpp
parentdc76408df249bd930d3fcf260b986af5989f248f (diff)
parent2625e7083ff118e8da856eb1dd04d39d2a527e22 (diff)
downloadgps-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.cpp14
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() {