Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d32f3784 authored by Zhanghao's avatar Zhanghao
Browse files

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
parent 534c5eee
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -214,9 +214,12 @@ interface IGnssCallback {
    /**
    /**
     * Callback for the HAL to pass a vector of GnssSvInfo back to the client.
     * Callback for the HAL to pass a vector of GnssSvInfo back to the client.
     *
     *
     * If GnssMeasurement is registered, the SvStatus report interval is the same as the measurement
     * If only GnssMeasurement is registered, the SvStatus reporting interval must be
     * interval, i.e., the interval the measurement engine runs at. If GnssMeasurement is not
     * the same as the measurement interval, i.e., the interval the measurement
     * registered, the SvStatus interval is the same as the location interval.
     * engine runs at. If only location is registered, the SvStatus interval must
     * be the same as the location interval. If both GnssMeasurement and location
     * are registered, then the SvStatus interval is the same as the lesser interval
     * between the two.
     *
     *
     * @param svInfo SV status information from HAL.
     * @param svInfo SV status information from HAL.
     */
     */
+1 −0
Original line number Original line Diff line number Diff line
@@ -325,6 +325,7 @@ ScopedAStatus Gnss::getExtensionGnssMeasurement(
    ALOGD("getExtensionGnssMeasurement");
    ALOGD("getExtensionGnssMeasurement");
    if (mGnssMeasurementInterface == nullptr) {
    if (mGnssMeasurementInterface == nullptr) {
        mGnssMeasurementInterface = SharedRefBase::make<GnssMeasurementInterface>();
        mGnssMeasurementInterface = SharedRefBase::make<GnssMeasurementInterface>();
        mGnssMeasurementInterface->setGnssInterface(static_cast<std::shared_ptr<Gnss>>(this));
    }
    }
    *iGnssMeasurement = mGnssMeasurementInterface;
    *iGnssMeasurement = mGnssMeasurementInterface;
    return ScopedAStatus::ok();
    return ScopedAStatus::ok();
+1 −1
Original line number Original line Diff line number Diff line
@@ -84,13 +84,13 @@ class Gnss : public BnGnss {
                                    IMeasurementCorrectionsInterface>* iMeasurementCorrections)
                                    IMeasurementCorrectionsInterface>* iMeasurementCorrections)
            override;
            override;


    void reportSvStatus() const;
    std::shared_ptr<GnssConfiguration> mGnssConfiguration;
    std::shared_ptr<GnssConfiguration> mGnssConfiguration;
    std::shared_ptr<GnssPowerIndication> mGnssPowerIndication;
    std::shared_ptr<GnssPowerIndication> mGnssPowerIndication;
    std::shared_ptr<GnssMeasurementInterface> mGnssMeasurementInterface;
    std::shared_ptr<GnssMeasurementInterface> mGnssMeasurementInterface;


  private:
  private:
    void reportLocation(const GnssLocation&) const;
    void reportLocation(const GnssLocation&) const;
    void reportSvStatus() const;
    void reportSvStatus(const std::vector<IGnssCallback::GnssSvInfo>& svInfoList) const;
    void reportSvStatus(const std::vector<IGnssCallback::GnssSvInfo>& svInfoList) const;
    std::vector<IGnssCallback::GnssSvInfo> filterBlocklistedSatellites(
    std::vector<IGnssCallback::GnssSvInfo> filterBlocklistedSatellites(
            std::vector<IGnssCallback::GnssSvInfo> gnssSvInfoList) const;
            std::vector<IGnssCallback::GnssSvInfo> gnssSvInfoList) const;
+8 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@
#include <aidl/android/hardware/gnss/BnGnss.h>
#include <aidl/android/hardware/gnss/BnGnss.h>
#include <log/log.h>
#include <log/log.h>
#include "DeviceFileReader.h"
#include "DeviceFileReader.h"
#include "Gnss.h"
#include "GnssRawMeasurementParser.h"
#include "GnssRawMeasurementParser.h"
#include "GnssReplayUtils.h"
#include "GnssReplayUtils.h"
#include "Utils.h"
#include "Utils.h"
@@ -126,6 +127,9 @@ void GnssMeasurementInterface::start(const bool enableCorrVecOutputs,
                auto measurement =
                auto measurement =
                        Utils::getMockMeasurement(enableCorrVecOutputs, enableFullTracking);
                        Utils::getMockMeasurement(enableCorrVecOutputs, enableFullTracking);
                this->reportMeasurement(measurement);
                this->reportMeasurement(measurement);
                if (!mLocationEnabled) {
                    mGnss->reportSvStatus();
                }
            }
            }
            intervalMs =
            intervalMs =
                    (mLocationEnabled) ? std::min(mLocationIntervalMs, mIntervalMs) : mIntervalMs;
                    (mLocationEnabled) ? std::min(mLocationIntervalMs, mIntervalMs) : mIntervalMs;
@@ -164,6 +168,10 @@ void GnssMeasurementInterface::setLocationEnabled(const bool enabled) {
    mLocationEnabled = enabled;
    mLocationEnabled = enabled;
}
}


void GnssMeasurementInterface::setGnssInterface(const std::shared_ptr<Gnss>& gnss) {
    mGnss = gnss;
}

void GnssMeasurementInterface::waitForStoppingThreads() {
void GnssMeasurementInterface::waitForStoppingThreads() {
    for (auto& future : mFutures) {
    for (auto& future : mFutures) {
        ALOGD("Stopping previous thread.");
        ALOGD("Stopping previous thread.");
+4 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@
#include "Utils.h"
#include "Utils.h"


namespace aidl::android::hardware::gnss {
namespace aidl::android::hardware::gnss {
class Gnss;


struct GnssMeasurementInterface : public BnGnssMeasurementInterface {
struct GnssMeasurementInterface : public BnGnssMeasurementInterface {
  public:
  public:
@@ -39,6 +40,7 @@ struct GnssMeasurementInterface : public BnGnssMeasurementInterface {
            const Options& options) override;
            const Options& options) override;
    void setLocationInterval(const int intervalMs);
    void setLocationInterval(const int intervalMs);
    void setLocationEnabled(const bool enabled);
    void setLocationEnabled(const bool enabled);
    void setGnssInterface(const std::shared_ptr<Gnss>& gnss);


  private:
  private:
    void start(const bool enableCorrVecOutputs, const bool enableFullTracking);
    void start(const bool enableCorrVecOutputs, const bool enableFullTracking);
@@ -59,6 +61,8 @@ struct GnssMeasurementInterface : public BnGnssMeasurementInterface {


    // Synchronization lock for sCallback
    // Synchronization lock for sCallback
    mutable std::mutex mMutex;
    mutable std::mutex mMutex;

    std::shared_ptr<Gnss> mGnss;
};
};


}  // namespace aidl::android::hardware::gnss
}  // namespace aidl::android::hardware::gnss
Loading