Mock blacklisting satellites in default implementation
- Mock GnssDebug to pass the sanity check.
Bug: 73845705
Test: All Gnss v1.1 VTS tests are passing on gce_x86
Change-Id: I258fb1671d2b682f471207192b8a0feb138c16ab
diff --git a/gnss/1.1/default/GnssConfiguration.h b/gnss/1.1/default/GnssConfiguration.h
index 4f7ed2b..9b2699b 100644
--- a/gnss/1.1/default/GnssConfiguration.h
+++ b/gnss/1.1/default/GnssConfiguration.h
@@ -1,9 +1,12 @@
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
+#include <android/hardware/gnss/1.1/IGnssCallback.h>
#include <android/hardware/gnss/1.1/IGnssConfiguration.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
+#include <mutex>
+#include <unordered_set>
namespace android {
namespace hardware {
@@ -19,6 +22,26 @@
using ::android::hardware::Void;
using ::android::sp;
+using BlacklistedSource = ::android::hardware::gnss::V1_1::IGnssConfiguration::BlacklistedSource;
+using GnssConstellationType = V1_0::GnssConstellationType;
+using GnssSvInfo = V1_0::IGnssCallback::GnssSvInfo;
+
+struct BlacklistedSourceHash {
+ inline int operator()(const BlacklistedSource& source) const {
+ return int(source.constellation) * 1000 + int(source.svid);
+ }
+};
+
+struct BlacklistedSourceEqual {
+ inline bool operator()(const BlacklistedSource& s1, const BlacklistedSource& s2) const {
+ return (s1.constellation == s2.constellation) && (s1.svid == s2.svid);
+ }
+};
+
+using BlacklistedSourceSet =
+ std::unordered_set<BlacklistedSource, BlacklistedSourceHash, BlacklistedSourceEqual>;
+using BlacklistedConstellationSet = std::unordered_set<GnssConstellationType>;
+
struct GnssConfiguration : public IGnssConfiguration {
// Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
Return<bool> setSuplEs(bool enabled) override;
@@ -30,11 +53,15 @@
Return<bool> setEmergencySuplPdn(bool enable) override;
// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
- Return<bool> setBlacklist(
- const hidl_vec<::android::hardware::gnss::V1_1::IGnssConfiguration::BlacklistedSource>&
- blacklist) override;
+ Return<bool> setBlacklist(const hidl_vec<BlacklistedSource>& blacklist) override;
- // Methods from ::android::hidl::base::V1_0::IBase follow.
+ Return<bool> isBlacklisted(const GnssSvInfo& gnssSvInfo) const;
+ std::recursive_mutex& getMutex() const;
+
+ private:
+ BlacklistedSourceSet mBlacklistedSourceSet;
+ BlacklistedConstellationSet mBlacklistedConstellationSet;
+ mutable std::recursive_mutex mMutex;
};
} // namespace implementation