GnssStatus for GnssMeasurement-only VTS test
Update VTS test case: GnssStatus should be reported when only
measurement is registered.
Test: atest VtsHalGnssTargetTest
Bug: 274653052
Change-Id: I53c741d2cee7a4c36ad0a2744ccb8b3e917b7996
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index ec86d2e..f1b9cbf 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -325,6 +325,7 @@
ALOGD("getExtensionGnssMeasurement");
if (mGnssMeasurementInterface == nullptr) {
mGnssMeasurementInterface = SharedRefBase::make<GnssMeasurementInterface>();
+ mGnssMeasurementInterface->setGnssInterface(static_cast<std::shared_ptr<Gnss>>(this));
}
*iGnssMeasurement = mGnssMeasurementInterface;
return ScopedAStatus::ok();
diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h
index df10fc8..00540cd 100644
--- a/gnss/aidl/default/Gnss.h
+++ b/gnss/aidl/default/Gnss.h
@@ -84,13 +84,13 @@
IMeasurementCorrectionsInterface>* iMeasurementCorrections)
override;
+ void reportSvStatus() const;
std::shared_ptr<GnssConfiguration> mGnssConfiguration;
std::shared_ptr<GnssPowerIndication> mGnssPowerIndication;
std::shared_ptr<GnssMeasurementInterface> mGnssMeasurementInterface;
private:
void reportLocation(const GnssLocation&) const;
- void reportSvStatus() const;
void reportSvStatus(const std::vector<IGnssCallback::GnssSvInfo>& svInfoList) const;
std::vector<IGnssCallback::GnssSvInfo> filterBlocklistedSatellites(
std::vector<IGnssCallback::GnssSvInfo> gnssSvInfoList) const;
diff --git a/gnss/aidl/default/GnssMeasurementInterface.cpp b/gnss/aidl/default/GnssMeasurementInterface.cpp
index 90056ce..aab9e03 100644
--- a/gnss/aidl/default/GnssMeasurementInterface.cpp
+++ b/gnss/aidl/default/GnssMeasurementInterface.cpp
@@ -20,6 +20,7 @@
#include <aidl/android/hardware/gnss/BnGnss.h>
#include <log/log.h>
#include "DeviceFileReader.h"
+#include "Gnss.h"
#include "GnssRawMeasurementParser.h"
#include "GnssReplayUtils.h"
#include "Utils.h"
@@ -126,6 +127,9 @@
auto measurement =
Utils::getMockMeasurement(enableCorrVecOutputs, enableFullTracking);
this->reportMeasurement(measurement);
+ if (!mLocationEnabled) {
+ mGnss->reportSvStatus();
+ }
}
intervalMs =
(mLocationEnabled) ? std::min(mLocationIntervalMs, mIntervalMs) : mIntervalMs;
@@ -164,6 +168,10 @@
mLocationEnabled = enabled;
}
+void GnssMeasurementInterface::setGnssInterface(const std::shared_ptr<Gnss>& gnss) {
+ mGnss = gnss;
+}
+
void GnssMeasurementInterface::waitForStoppingThreads() {
for (auto& future : mFutures) {
ALOGD("Stopping previous thread.");
diff --git a/gnss/aidl/default/GnssMeasurementInterface.h b/gnss/aidl/default/GnssMeasurementInterface.h
index d2737e5..926a4e7 100644
--- a/gnss/aidl/default/GnssMeasurementInterface.h
+++ b/gnss/aidl/default/GnssMeasurementInterface.h
@@ -25,6 +25,7 @@
#include "Utils.h"
namespace aidl::android::hardware::gnss {
+class Gnss;
struct GnssMeasurementInterface : public BnGnssMeasurementInterface {
public:
@@ -39,6 +40,7 @@
const Options& options) override;
void setLocationInterval(const int intervalMs);
void setLocationEnabled(const bool enabled);
+ void setGnssInterface(const std::shared_ptr<Gnss>& gnss);
private:
void start(const bool enableCorrVecOutputs, const bool enableFullTracking);
@@ -59,6 +61,8 @@
// Synchronization lock for sCallback
mutable std::mutex mMutex;
+
+ std::shared_ptr<Gnss> mGnss;
};
} // namespace aidl::android::hardware::gnss