Check gnssPowerStats increase after getting a location
Bug: 168123084
Test: on device
Change-Id: I5a306f91d1223cdc9f3616583d59cd2c707c80ea
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index 435afa3..6061eec 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -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 {
@@ -73,8 +72,11 @@
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();
}