Loading gnss/aidl/default/Gnss.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include <log/log.h> #include "GnssConfiguration.h" #include "GnssMeasurementInterface.h" #include "GnssPowerIndication.h" #include "GnssPsds.h" namespace aidl::android::hardware::gnss { Loading Loading @@ -73,8 +72,11 @@ ndk::ScopedAStatus Gnss::getExtensionGnssConfiguration( ndk::ScopedAStatus Gnss::getExtensionGnssPowerIndication( std::shared_ptr<IGnssPowerIndication>* iGnssPowerIndication) { ALOGD("Gnss::getExtensionGnssPowerIndication"); if (mGnssPowerIndication == nullptr) { mGnssPowerIndication = SharedRefBase::make<GnssPowerIndication>(); } *iGnssPowerIndication = SharedRefBase::make<GnssPowerIndication>(); *iGnssPowerIndication = mGnssPowerIndication; return ndk::ScopedAStatus::ok(); } Loading gnss/aidl/default/Gnss.h +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <aidl/android/hardware/gnss/BnGnssPowerIndication.h> #include <aidl/android/hardware/gnss/BnGnssPsds.h> #include "GnssConfiguration.h" #include "GnssPowerIndication.h" namespace aidl::android::hardware::gnss { Loading @@ -38,6 +39,7 @@ class Gnss : public BnGnss { std::shared_ptr<IGnssMeasurementInterface>* iGnssMeasurement) override; std::shared_ptr<GnssConfiguration> mGnssConfiguration; std::shared_ptr<GnssPowerIndication> mGnssPowerIndication; private: static std::shared_ptr<IGnssCallback> sGnssCallback; Loading gnss/aidl/default/GnssHidlHal.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -31,11 +31,19 @@ GnssHidlHal::GnssHidlHal(const std::shared_ptr<Gnss>& gnssAidl) : mGnssAidl(gnss } else { mGnssConfigurationAidl = iGnss->mGnssConfiguration; } std::shared_ptr<IGnssPowerIndication> iGnssPowerIndication; status = iGnss->getExtensionGnssPowerIndication(&iGnssPowerIndication); if (!status.isOk()) { ALOGE("Failed to getExtensionGnssPowerIndication."); } else { mGnssPowerIndicationAidl = iGnss->mGnssPowerIndication; } }; hidl_vec<GnssSvInfo> GnssHidlHal::filterBlocklistedSatellitesV2_1( hidl_vec<GnssSvInfo> gnssSvInfoList) { ALOGD("filterBlocklistSatellitesV2_1 - overridden by GnssHidlHal class"); ALOGD("GnssHidlHal::filterBlocklistSatellitesV2_1"); if (mGnssConfigurationAidl == nullptr) { ALOGE("Handle to AIDL GnssConfiguration is not available."); return gnssSvInfoList; Loading @@ -51,4 +59,8 @@ hidl_vec<GnssSvInfo> GnssHidlHal::filterBlocklistedSatellitesV2_1( return gnssSvInfoList; } void GnssHidlHal::notePowerConsumption() { mGnssPowerIndicationAidl->notePowerConsumption(); } } // namespace aidl::android::hardware::gnss gnss/aidl/default/GnssHidlHal.h +2 −0 Original line number Diff line number Diff line Loading @@ -32,9 +32,11 @@ class GnssHidlHal : public ::android::hardware::gnss::common::implementation::Gn filterBlocklistedSatellitesV2_1( hidl_vec<::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo> gnssSvInfoList) override; void notePowerConsumption() override; std::shared_ptr<Gnss> mGnssAidl; std::shared_ptr<GnssConfiguration> mGnssConfigurationAidl; std::shared_ptr<GnssPowerIndication> mGnssPowerIndicationAidl; }; } // namespace aidl::android::hardware::gnss gnss/aidl/default/GnssPowerIndication.cpp +9 −3 Original line number Diff line number Diff line Loading @@ -50,13 +50,19 @@ ndk::ScopedAStatus GnssPowerIndication::requestGnssPowerStats() { }; GnssPowerStats gnssPowerStats = { .elapsedRealtime = elapsedRealtime, .totalEnergyMilliJoule = 1.59975e+3, .singlebandTrackingModeEnergyMilliJoule = 1.2342e+3, .multibandTrackingModeEnergyMilliJoule = 3.653e+2, .totalEnergyMilliJoule = 1.500e+3 + numLocationReported * 22.0, .singlebandTrackingModeEnergyMilliJoule = 0.0, .multibandTrackingModeEnergyMilliJoule = 1.28e+2 + numLocationReported * 4.0, .singlebandAcquisitionModeEnergyMilliJoule = 0.0, .multibandAcquisitionModeEnergyMilliJoule = 3.65e+2 + numLocationReported * 15.0, .otherModesEnergyMilliJoule = {1.232e+2, 3.234e+3}, }; sCallback->gnssPowerStatsCb(gnssPowerStats); return ndk::ScopedAStatus::ok(); } void GnssPowerIndication::notePowerConsumption() { numLocationReported++; } } // namespace aidl::android::hardware::gnss Loading
gnss/aidl/default/Gnss.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include <log/log.h> #include "GnssConfiguration.h" #include "GnssMeasurementInterface.h" #include "GnssPowerIndication.h" #include "GnssPsds.h" namespace aidl::android::hardware::gnss { Loading Loading @@ -73,8 +72,11 @@ ndk::ScopedAStatus Gnss::getExtensionGnssConfiguration( ndk::ScopedAStatus Gnss::getExtensionGnssPowerIndication( std::shared_ptr<IGnssPowerIndication>* iGnssPowerIndication) { ALOGD("Gnss::getExtensionGnssPowerIndication"); if (mGnssPowerIndication == nullptr) { mGnssPowerIndication = SharedRefBase::make<GnssPowerIndication>(); } *iGnssPowerIndication = SharedRefBase::make<GnssPowerIndication>(); *iGnssPowerIndication = mGnssPowerIndication; return ndk::ScopedAStatus::ok(); } Loading
gnss/aidl/default/Gnss.h +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <aidl/android/hardware/gnss/BnGnssPowerIndication.h> #include <aidl/android/hardware/gnss/BnGnssPsds.h> #include "GnssConfiguration.h" #include "GnssPowerIndication.h" namespace aidl::android::hardware::gnss { Loading @@ -38,6 +39,7 @@ class Gnss : public BnGnss { std::shared_ptr<IGnssMeasurementInterface>* iGnssMeasurement) override; std::shared_ptr<GnssConfiguration> mGnssConfiguration; std::shared_ptr<GnssPowerIndication> mGnssPowerIndication; private: static std::shared_ptr<IGnssCallback> sGnssCallback; Loading
gnss/aidl/default/GnssHidlHal.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -31,11 +31,19 @@ GnssHidlHal::GnssHidlHal(const std::shared_ptr<Gnss>& gnssAidl) : mGnssAidl(gnss } else { mGnssConfigurationAidl = iGnss->mGnssConfiguration; } std::shared_ptr<IGnssPowerIndication> iGnssPowerIndication; status = iGnss->getExtensionGnssPowerIndication(&iGnssPowerIndication); if (!status.isOk()) { ALOGE("Failed to getExtensionGnssPowerIndication."); } else { mGnssPowerIndicationAidl = iGnss->mGnssPowerIndication; } }; hidl_vec<GnssSvInfo> GnssHidlHal::filterBlocklistedSatellitesV2_1( hidl_vec<GnssSvInfo> gnssSvInfoList) { ALOGD("filterBlocklistSatellitesV2_1 - overridden by GnssHidlHal class"); ALOGD("GnssHidlHal::filterBlocklistSatellitesV2_1"); if (mGnssConfigurationAidl == nullptr) { ALOGE("Handle to AIDL GnssConfiguration is not available."); return gnssSvInfoList; Loading @@ -51,4 +59,8 @@ hidl_vec<GnssSvInfo> GnssHidlHal::filterBlocklistedSatellitesV2_1( return gnssSvInfoList; } void GnssHidlHal::notePowerConsumption() { mGnssPowerIndicationAidl->notePowerConsumption(); } } // namespace aidl::android::hardware::gnss
gnss/aidl/default/GnssHidlHal.h +2 −0 Original line number Diff line number Diff line Loading @@ -32,9 +32,11 @@ class GnssHidlHal : public ::android::hardware::gnss::common::implementation::Gn filterBlocklistedSatellitesV2_1( hidl_vec<::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo> gnssSvInfoList) override; void notePowerConsumption() override; std::shared_ptr<Gnss> mGnssAidl; std::shared_ptr<GnssConfiguration> mGnssConfigurationAidl; std::shared_ptr<GnssPowerIndication> mGnssPowerIndicationAidl; }; } // namespace aidl::android::hardware::gnss
gnss/aidl/default/GnssPowerIndication.cpp +9 −3 Original line number Diff line number Diff line Loading @@ -50,13 +50,19 @@ ndk::ScopedAStatus GnssPowerIndication::requestGnssPowerStats() { }; GnssPowerStats gnssPowerStats = { .elapsedRealtime = elapsedRealtime, .totalEnergyMilliJoule = 1.59975e+3, .singlebandTrackingModeEnergyMilliJoule = 1.2342e+3, .multibandTrackingModeEnergyMilliJoule = 3.653e+2, .totalEnergyMilliJoule = 1.500e+3 + numLocationReported * 22.0, .singlebandTrackingModeEnergyMilliJoule = 0.0, .multibandTrackingModeEnergyMilliJoule = 1.28e+2 + numLocationReported * 4.0, .singlebandAcquisitionModeEnergyMilliJoule = 0.0, .multibandAcquisitionModeEnergyMilliJoule = 3.65e+2 + numLocationReported * 15.0, .otherModesEnergyMilliJoule = {1.232e+2, 3.234e+3}, }; sCallback->gnssPowerStatsCb(gnssPowerStats); return ndk::ScopedAStatus::ok(); } void GnssPowerIndication::notePowerConsumption() { numLocationReported++; } } // namespace aidl::android::hardware::gnss