Merge "uwb: Default HAL implementation"
diff --git a/gnss/common/utils/default/include/v2_1/GnssTemplate.h b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
index b834a1f..6f0ced1 100644
--- a/gnss/common/utils/default/include/v2_1/GnssTemplate.h
+++ b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
@@ -45,6 +45,7 @@
constexpr int INPUT_BUFFER_SIZE = 128;
constexpr char CMD_GET_LOCATION[] = "CMD_GET_LOCATION";
constexpr char GNSS_PATH[] = "/dev/gnss0";
+constexpr int TTFF_MILLIS = 2200;
template <class T_IGnss>
struct GnssTemplate : public T_IGnss {
@@ -130,6 +131,7 @@
std::atomic<bool> mHardwareModeChecked;
std::atomic<int> mGnssFd;
std::thread mThread;
+ std::atomic<bool> mFirstFixReceived;
mutable std::mutex mMutex;
virtual hidl_vec<V2_1::IGnssCallback::GnssSvInfo> filterBlocklistedSatellitesV2_1(
@@ -151,7 +153,8 @@
: mMinIntervalMs(1000),
mGnssConfiguration{new V2_1::implementation::GnssConfiguration()},
mHardwareModeChecked(false),
- mGnssFd(-1) {}
+ mGnssFd(-1),
+ mFirstFixReceived(false) {}
template <class T_IGnss>
GnssTemplate<T_IGnss>::~GnssTemplate() {
@@ -186,6 +189,12 @@
mIsActive = true;
this->reportGnssStatusValue(V1_0::IGnssCallback::GnssStatusValue::SESSION_BEGIN);
mThread = std::thread([this]() {
+ auto svStatus = filterBlocklistedSatellitesV2_1(Utils::getMockSvInfoListV2_1());
+ this->reportSvStatus(svStatus);
+ if (!mFirstFixReceived) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(TTFF_MILLIS));
+ mFirstFixReceived = true;
+ }
while (mIsActive == true) {
auto svStatus = filterBlocklistedSatellitesV2_1(Utils::getMockSvInfoListV2_1());
this->reportSvStatus(svStatus);
@@ -288,7 +297,7 @@
template <class T_IGnss>
Return<void> GnssTemplate<T_IGnss>::deleteAidingData(V1_0::IGnss::GnssAidingData) {
- // TODO implement
+ mFirstFixReceived = false;
return Void();
}
diff --git a/neuralnetworks/aidl/vts/functional/Utils.cpp b/neuralnetworks/aidl/vts/functional/Utils.cpp
index 9af362e..325a436 100644
--- a/neuralnetworks/aidl/vts/functional/Utils.cpp
+++ b/neuralnetworks/aidl/vts/functional/Utils.cpp
@@ -153,26 +153,19 @@
.stride = size,
};
- ASSERT_EQ(AHardwareBuffer_allocate(&desc, &mAhwb), 0);
- ASSERT_NE(mAhwb, nullptr);
+ AHardwareBuffer* ahwb = nullptr;
+ ASSERT_EQ(AHardwareBuffer_allocate(&desc, &ahwb), 0);
+ ASSERT_NE(ahwb, nullptr);
- const auto sharedMemory =
- nn::createSharedMemoryFromAHWB(mAhwb, /*takeOwnership=*/false).value();
- mMapping = nn::map(sharedMemory).value();
+ mMemory = nn::createSharedMemoryFromAHWB(ahwb, /*takeOwnership=*/true).value();
+ mMapping = nn::map(mMemory).value();
mPtr = static_cast<uint8_t*>(std::get<void*>(mMapping.pointer));
CHECK_NE(mPtr, nullptr);
- mAidlMemory = utils::convert(sharedMemory).value();
+ mAidlMemory = utils::convert(mMemory).value();
mIsValid = true;
}
-TestBlobAHWB::~TestBlobAHWB() {
- if (mAhwb) {
- AHardwareBuffer_unlock(mAhwb, nullptr);
- AHardwareBuffer_release(mAhwb);
- }
-}
-
std::string gtestCompliantName(std::string name) {
// gtest test names must only contain alphanumeric characters
std::replace_if(
diff --git a/neuralnetworks/aidl/vts/functional/Utils.h b/neuralnetworks/aidl/vts/functional/Utils.h
index 9dd7359..ca81418 100644
--- a/neuralnetworks/aidl/vts/functional/Utils.h
+++ b/neuralnetworks/aidl/vts/functional/Utils.h
@@ -102,11 +102,10 @@
// The constructor calls initialize, which constructs the memory resources. This is a
// workaround that gtest macros cannot be used directly in a constructor.
TestBlobAHWB(uint32_t size) { initialize(size); }
- ~TestBlobAHWB();
private:
void initialize(uint32_t size);
- AHardwareBuffer* mAhwb = nullptr;
+ nn::SharedMemory mMemory;
nn::Mapping mMapping;
};
diff --git a/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp b/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp
index 2ee91f4..c7bab5c 100644
--- a/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp
+++ b/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp
@@ -103,12 +103,11 @@
// Test ThermalChangedCallback::notifyThrottling().
// This just calls into and back from our local ThermalChangedCallback impl.
-// Note: a real thermal throttling event from the Thermal HAL could be
-// inadvertently received here.
TEST_P(ThermalHidlTest, NotifyThrottlingTest) {
- auto ret = mThermalCallback->notifyThrottling(kThrottleTemp);
+ sp<ThermalCallback> thermalCallback = new (std::nothrow) ThermalCallback();
+ auto ret = thermalCallback->notifyThrottling(kThrottleTemp);
ASSERT_TRUE(ret.isOk());
- auto res = mThermalCallback->WaitForCallback(kCallbackNameNotifyThrottling);
+ auto res = thermalCallback->WaitForCallback(kCallbackNameNotifyThrottling);
EXPECT_TRUE(res.no_timeout);
ASSERT_TRUE(res.args);
EXPECT_EQ(kThrottleTemp, res.args->temperature);