diff options
author | qctecmdr <qctecmdr@localhost> | 2019-06-05 22:06:13 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-06-05 22:06:13 -0700 |
commit | 9fc8d7444d5f68d3978973dacf7618293f1fd4cd (patch) | |
tree | ffe5bf589f9594dedbce4bfd3c6ecff6b15a98fe /android | |
parent | 22e008e8d1a85c90056dd528ed12061afb3b538a (diff) | |
parent | 2e7c04a82d85a3ddec7a7a024e00f65e1ee0b0c3 (diff) | |
download | gps-9fc8d7444d5f68d3978973dacf7618293f1fd4cd.tar.gz |
Merge "Update SystemStatus with battery info in HealthHAL"
Diffstat (limited to 'android')
-rw-r--r-- | android/1.0/Gnss.cpp | 8 | ||||
-rw-r--r-- | android/1.1/Gnss.cpp | 8 | ||||
-rw-r--r-- | android/2.0/Gnss.cpp | 9 |
3 files changed, 21 insertions, 4 deletions
diff --git a/android/1.0/Gnss.cpp b/android/1.0/Gnss.cpp index 873cf37..d85e0a4 100644 --- a/android/1.0/Gnss.cpp +++ b/android/1.0/Gnss.cpp @@ -37,6 +37,7 @@ namespace gnss { namespace V1_0 { namespace implementation { +static sp<Gnss> sGnss; void Gnss::GnssDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who) { LOC_LOGE("%s] service died. cookie: %llu, who: %p", __FUNCTION__, static_cast<unsigned long long>(cookie), &who); @@ -47,10 +48,14 @@ 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 "); + 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 @@ -65,6 +70,7 @@ Gnss::~Gnss() { delete mApi; mApi = nullptr; } + sGnss = nullptr; } GnssAPIClient* Gnss::getApi() { diff --git a/android/1.1/Gnss.cpp b/android/1.1/Gnss.cpp index f0d74da..bea556f 100644 --- a/android/1.1/Gnss.cpp +++ b/android/1.1/Gnss.cpp @@ -41,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()) @@ -88,10 +89,14 @@ 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 "); + 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 @@ -106,6 +111,7 @@ Gnss::~Gnss() { delete mApi; mApi = nullptr; } + sGnss = nullptr; } GnssAPIClient* Gnss::getApi() { diff --git a/android/2.0/Gnss.cpp b/android/2.0/Gnss.cpp index be4efac..4fa5b63 100644 --- a/android/2.0/Gnss.cpp +++ b/android/2.0/Gnss.cpp @@ -41,7 +41,7 @@ namespace V2_0 { namespace implementation { using ::android::hardware::gnss::visibility_control::V1_0::implementation::GnssVisibilityControl; - +static sp<Gnss> sGnss; static std::string getVersionString() { static std::string version; if (!version.empty()) @@ -88,10 +88,14 @@ 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 "); + 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 @@ -105,6 +109,7 @@ Gnss::~Gnss() { delete mApi; mApi = nullptr; } + sGnss = nullptr; } GnssAPIClient* Gnss::getApi() { |