1 /*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "SensorsHidlEnvironmentV1_0.h"
18 #include "sensors-vts-utils/SensorsHidlTestBase.h"
19
20 #include <android/hardware/sensors/1.0/ISensors.h>
21 #include <android/hardware/sensors/1.0/types.h>
22 #include <hidl/GtestPrinter.h>
23 #include <hidl/ServiceManagement.h>
24 #include <log/log.h>
25 #include <utils/SystemClock.h>
26
27 #include <algorithm>
28 #include <cinttypes>
29 #include <unordered_map>
30 #include <vector>
31
32 using ::android::hardware::Return;
33 using ::android::hardware::Void;
34 using ::android::sp;
35 using namespace ::android::hardware::sensors::V1_0;
36
37 // The main test class for SENSORS HIDL HAL.
38 class SensorsHidlTest : public SensorsHidlTestBase<SensorType, Event, SensorInfo> {
39 public:
SetUp()40 virtual void SetUp() override {
41 mEnvironment = new SensorsHidlEnvironmentV1_0(GetParam());
42 mEnvironment->HidlSetUp();
43 // Ensure that we have a valid environment before performing tests
44 ASSERT_NE(S(), nullptr);
45 }
46
TearDown()47 virtual void TearDown() override { mEnvironment->HidlTearDown(); }
48
49 protected:
50 SensorInfo defaultSensorByType(SensorType type) override;
51 std::vector<SensorInfo> getSensorsList();
52 // implementation wrapper
getSensorsList(ISensors::getSensorsList_cb _hidl_cb)53 Return<void> getSensorsList(ISensors::getSensorsList_cb _hidl_cb) override {
54 return S()->getSensorsList(_hidl_cb);
55 }
56
57 Return<Result> activate(int32_t sensorHandle, bool enabled) override;
58
batch(int32_t sensorHandle,int64_t samplingPeriodNs,int64_t maxReportLatencyNs)59 Return<Result> batch(int32_t sensorHandle, int64_t samplingPeriodNs,
60 int64_t maxReportLatencyNs) override {
61 return S()->batch(sensorHandle, samplingPeriodNs, maxReportLatencyNs);
62 }
63
flush(int32_t sensorHandle)64 Return<Result> flush(int32_t sensorHandle) override { return S()->flush(sensorHandle); }
65
injectSensorData(const Event & event)66 Return<Result> injectSensorData(const Event& event) override {
67 return S()->injectSensorData(event);
68 }
69
70 Return<void> registerDirectChannel(const SharedMemInfo& mem,
71 ISensors::registerDirectChannel_cb _hidl_cb) override;
72
unregisterDirectChannel(int32_t channelHandle)73 Return<Result> unregisterDirectChannel(int32_t channelHandle) override {
74 return S()->unregisterDirectChannel(channelHandle);
75 }
76
configDirectReport(int32_t sensorHandle,int32_t channelHandle,RateLevel rate,ISensors::configDirectReport_cb _hidl_cb)77 Return<void> configDirectReport(int32_t sensorHandle, int32_t channelHandle, RateLevel rate,
78 ISensors::configDirectReport_cb _hidl_cb) override {
79 return S()->configDirectReport(sensorHandle, channelHandle, rate, _hidl_cb);
80 }
81
S()82 inline sp<ISensors>& S() { return mEnvironment->sensors; }
83
getEnvironment()84 SensorsHidlEnvironmentBase<Event>* getEnvironment() override { return mEnvironment; }
85
86 private:
87 // Test environment for sensors HAL.
88 SensorsHidlEnvironmentV1_0* mEnvironment;
89 };
90
activate(int32_t sensorHandle,bool enabled)91 Return<Result> SensorsHidlTest::activate(int32_t sensorHandle, bool enabled) {
92 // If activating a sensor, add the handle in a set so that when test fails it can be turned off.
93 // The handle is not removed when it is deactivating on purpose so that it is not necessary to
94 // check the return value of deactivation. Deactivating a sensor more than once does not have
95 // negative effect.
96 if (enabled) {
97 mSensorHandles.insert(sensorHandle);
98 }
99 return S()->activate(sensorHandle, enabled);
100 }
101
registerDirectChannel(const SharedMemInfo & mem,ISensors::registerDirectChannel_cb cb)102 Return<void> SensorsHidlTest::registerDirectChannel(
103 const SharedMemInfo& mem, ISensors::registerDirectChannel_cb cb) {
104 // If registeration of a channel succeeds, add the handle of channel to a set so that it can be
105 // unregistered when test fails. Unregister a channel does not remove the handle on purpose.
106 // Unregistering a channel more than once should not have negative effect.
107 S()->registerDirectChannel(mem,
108 [&] (auto result, auto channelHandle) {
109 if (result == Result::OK) {
110 mDirectChannelHandles.insert(channelHandle);
111 }
112 cb(result, channelHandle);
113 });
114 return Void();
115 }
116
defaultSensorByType(SensorType type)117 SensorInfo SensorsHidlTest::defaultSensorByType(SensorType type) {
118 SensorInfo ret;
119
120 ret.type = (SensorType) -1;
121 S()->getSensorsList(
122 [&] (const auto &list) {
123 const size_t count = list.size();
124 for (size_t i = 0; i < count; ++i) {
125 if (list[i].type == type) {
126 ret = list[i];
127 return;
128 }
129 }
130 });
131
132 return ret;
133 }
134
getSensorsList()135 std::vector<SensorInfo> SensorsHidlTest::getSensorsList() {
136 std::vector<SensorInfo> ret;
137
138 S()->getSensorsList(
139 [&] (const auto &list) {
140 const size_t count = list.size();
141 ret.reserve(list.size());
142 for (size_t i = 0; i < count; ++i) {
143 ret.push_back(list[i]);
144 }
145 });
146
147 return ret;
148 }
149
150 // Test if sensor list returned is valid
TEST_P(SensorsHidlTest,SensorListValid)151 TEST_P(SensorsHidlTest, SensorListValid) {
152 S()->getSensorsList([&](const auto& list) {
153 const size_t count = list.size();
154 std::unordered_map<int32_t, std::vector<std::string>> sensorTypeNameMap;
155 for (size_t i = 0; i < count; ++i) {
156 const auto& s = list[i];
157 SCOPED_TRACE(::testing::Message()
158 << i << "/" << count << ": "
159 << " handle=0x" << std::hex << std::setw(8) << std::setfill('0')
160 << s.sensorHandle << std::dec << " type=" << static_cast<int>(s.type)
161 << " name=" << s.name);
162
163 // Test non-empty type string
164 EXPECT_FALSE(s.typeAsString.empty());
165
166 // Test defined type matches defined string type
167 EXPECT_NO_FATAL_FAILURE(assertTypeMatchStringType(s.type, s.typeAsString));
168
169 // Test if all sensor has name and vendor
170 EXPECT_FALSE(s.name.empty());
171 EXPECT_FALSE(s.vendor.empty());
172
173 // Make sure that sensors of the same type have a unique name.
174 std::vector<std::string>& v = sensorTypeNameMap[static_cast<int32_t>(s.type)];
175 bool isUniqueName = std::find(v.begin(), v.end(), s.name) == v.end();
176 EXPECT_TRUE(isUniqueName) << "Duplicate sensor Name: " << s.name;
177 if (isUniqueName) {
178 v.push_back(s.name);
179 }
180
181 // Test power > 0, maxRange > 0
182 EXPECT_LE(0, s.power);
183 EXPECT_LT(0, s.maxRange);
184
185 // Info type, should have no sensor
186 EXPECT_FALSE(s.type == SensorType::ADDITIONAL_INFO || s.type == SensorType::META_DATA);
187
188 // Test fifoMax >= fifoReserved
189 EXPECT_GE(s.fifoMaxEventCount, s.fifoReservedEventCount)
190 << "max=" << s.fifoMaxEventCount << " reserved=" << s.fifoReservedEventCount;
191
192 // Test Reporting mode valid
193 EXPECT_NO_FATAL_FAILURE(assertTypeMatchReportMode(s.type, extractReportMode(s.flags)));
194
195 // Test min max are in the right order
196 EXPECT_LE(s.minDelay, s.maxDelay);
197 // Test min/max delay matches reporting mode
198 EXPECT_NO_FATAL_FAILURE(
199 assertDelayMatchReportMode(s.minDelay, s.maxDelay, extractReportMode(s.flags)));
200 }
201 });
202 }
203
204 // Test if sensor hal can switch to different operation modes
TEST_P(SensorsHidlTest,SetOperationMode)205 TEST_P(SensorsHidlTest, SetOperationMode) {
206 std::vector<SensorInfo> sensorList = getSensorsList();
207
208 bool needOperationModeSupport =
209 std::any_of(sensorList.begin(), sensorList.end(),
210 [] (const auto& s) {
211 return (s.flags & SensorFlagBits::DATA_INJECTION) != 0;
212 });
213 if (!needOperationModeSupport) {
214 return;
215 }
216
217 ASSERT_EQ(Result::OK, S()->setOperationMode(OperationMode::NORMAL));
218 ASSERT_EQ(Result::OK, S()->setOperationMode(OperationMode::DATA_INJECTION));
219 ASSERT_EQ(Result::OK, S()->setOperationMode(OperationMode::NORMAL));
220 }
221
222 // Test if sensor hal can receive injected events in loopback mode
TEST_P(SensorsHidlTest,InjectSensorEventData)223 TEST_P(SensorsHidlTest, InjectSensorEventData) {
224 std::vector<SensorInfo> sensorList = getSensorsList();
225 std::vector<SensorInfo> sensorSupportInjection;
226
227 bool needOperationModeSupport =
228 std::any_of(sensorList.begin(), sensorList.end(),
229 [&sensorSupportInjection] (const auto& s) {
230 bool ret = (s.flags & SensorFlagBits::DATA_INJECTION) != 0;
231 if (ret) {
232 sensorSupportInjection.push_back(s);
233 }
234 return ret;
235 });
236 if (!needOperationModeSupport) {
237 return;
238 }
239
240 ASSERT_EQ(Result::OK, S()->setOperationMode(OperationMode::NORMAL));
241 ASSERT_EQ(Result::OK, S()->setOperationMode(OperationMode::DATA_INJECTION));
242
243 for (const auto &s : sensorSupportInjection) {
244 switch (s.type) {
245 case SensorType::ACCELEROMETER:
246 case SensorType::GYROSCOPE:
247 case SensorType::MAGNETIC_FIELD: {
248 usleep(100000); // sleep 100ms
249
250 Event dummy;
251 dummy.timestamp = android::elapsedRealtimeNano();
252 dummy.sensorType = s.type;
253 dummy.sensorHandle = s.sensorHandle;
254 Vec3 v = {1, 2, 3, SensorStatus::ACCURACY_HIGH};
255 dummy.u.vec3 = v;
256
257 EXPECT_EQ(Result::OK, S()->injectSensorData(dummy));
258 break;
259 }
260 default:
261 break;
262 }
263 }
264 ASSERT_EQ(Result::OK, S()->setOperationMode(OperationMode::NORMAL));
265 }
266
267 // Test if sensor hal can do UI speed accelerometer streaming properly
TEST_P(SensorsHidlTest,AccelerometerStreamingOperationSlow)268 TEST_P(SensorsHidlTest, AccelerometerStreamingOperationSlow) {
269 testStreamingOperation(SensorType::ACCELEROMETER, std::chrono::milliseconds(200),
270 std::chrono::seconds(5), mAccelNormChecker);
271 }
272
273 // Test if sensor hal can do normal speed accelerometer streaming properly
TEST_P(SensorsHidlTest,AccelerometerStreamingOperationNormal)274 TEST_P(SensorsHidlTest, AccelerometerStreamingOperationNormal) {
275 testStreamingOperation(SensorType::ACCELEROMETER, std::chrono::milliseconds(20),
276 std::chrono::seconds(5), mAccelNormChecker);
277 }
278
279 // Test if sensor hal can do game speed accelerometer streaming properly
TEST_P(SensorsHidlTest,AccelerometerStreamingOperationFast)280 TEST_P(SensorsHidlTest, AccelerometerStreamingOperationFast) {
281 testStreamingOperation(SensorType::ACCELEROMETER, std::chrono::milliseconds(5),
282 std::chrono::seconds(5), mAccelNormChecker);
283 }
284
285 // Test if sensor hal can do UI speed gyroscope streaming properly
TEST_P(SensorsHidlTest,GyroscopeStreamingOperationSlow)286 TEST_P(SensorsHidlTest, GyroscopeStreamingOperationSlow) {
287 testStreamingOperation(SensorType::GYROSCOPE, std::chrono::milliseconds(200),
288 std::chrono::seconds(5), mGyroNormChecker);
289 }
290
291 // Test if sensor hal can do normal speed gyroscope streaming properly
TEST_P(SensorsHidlTest,GyroscopeStreamingOperationNormal)292 TEST_P(SensorsHidlTest, GyroscopeStreamingOperationNormal) {
293 testStreamingOperation(SensorType::GYROSCOPE, std::chrono::milliseconds(20),
294 std::chrono::seconds(5), mGyroNormChecker);
295 }
296
297 // Test if sensor hal can do game speed gyroscope streaming properly
TEST_P(SensorsHidlTest,GyroscopeStreamingOperationFast)298 TEST_P(SensorsHidlTest, GyroscopeStreamingOperationFast) {
299 testStreamingOperation(SensorType::GYROSCOPE, std::chrono::milliseconds(5),
300 std::chrono::seconds(5), mGyroNormChecker);
301 }
302
303 // Test if sensor hal can do UI speed magnetometer streaming properly
TEST_P(SensorsHidlTest,MagnetometerStreamingOperationSlow)304 TEST_P(SensorsHidlTest, MagnetometerStreamingOperationSlow) {
305 testStreamingOperation(SensorType::MAGNETIC_FIELD, std::chrono::milliseconds(200),
306 std::chrono::seconds(5), NullChecker<Event>());
307 }
308
309 // Test if sensor hal can do normal speed magnetometer streaming properly
TEST_P(SensorsHidlTest,MagnetometerStreamingOperationNormal)310 TEST_P(SensorsHidlTest, MagnetometerStreamingOperationNormal) {
311 testStreamingOperation(SensorType::MAGNETIC_FIELD, std::chrono::milliseconds(20),
312 std::chrono::seconds(5), NullChecker<Event>());
313 }
314
315 // Test if sensor hal can do game speed magnetometer streaming properly
TEST_P(SensorsHidlTest,MagnetometerStreamingOperationFast)316 TEST_P(SensorsHidlTest, MagnetometerStreamingOperationFast) {
317 testStreamingOperation(SensorType::MAGNETIC_FIELD, std::chrono::milliseconds(5),
318 std::chrono::seconds(5), NullChecker<Event>());
319 }
320
321 // Test if sensor hal can do accelerometer sampling rate switch properly when sensor is active
TEST_P(SensorsHidlTest,AccelerometerSamplingPeriodHotSwitchOperation)322 TEST_P(SensorsHidlTest, AccelerometerSamplingPeriodHotSwitchOperation) {
323 testSamplingRateHotSwitchOperation(SensorType::ACCELEROMETER);
324 testSamplingRateHotSwitchOperation(SensorType::ACCELEROMETER, false /*fastToSlow*/);
325 }
326
327 // Test if sensor hal can do gyroscope sampling rate switch properly when sensor is active
TEST_P(SensorsHidlTest,GyroscopeSamplingPeriodHotSwitchOperation)328 TEST_P(SensorsHidlTest, GyroscopeSamplingPeriodHotSwitchOperation) {
329 testSamplingRateHotSwitchOperation(SensorType::GYROSCOPE);
330 testSamplingRateHotSwitchOperation(SensorType::GYROSCOPE, false /*fastToSlow*/);
331 }
332
333 // Test if sensor hal can do magnetometer sampling rate switch properly when sensor is active
TEST_P(SensorsHidlTest,MagnetometerSamplingPeriodHotSwitchOperation)334 TEST_P(SensorsHidlTest, MagnetometerSamplingPeriodHotSwitchOperation) {
335 testSamplingRateHotSwitchOperation(SensorType::MAGNETIC_FIELD);
336 testSamplingRateHotSwitchOperation(SensorType::MAGNETIC_FIELD, false /*fastToSlow*/);
337 }
338
339 // Test if sensor hal can do accelerometer batching properly
TEST_P(SensorsHidlTest,AccelerometerBatchingOperation)340 TEST_P(SensorsHidlTest, AccelerometerBatchingOperation) {
341 testBatchingOperation(SensorType::ACCELEROMETER);
342 }
343
344 // Test if sensor hal can do gyroscope batching properly
TEST_P(SensorsHidlTest,GyroscopeBatchingOperation)345 TEST_P(SensorsHidlTest, GyroscopeBatchingOperation) {
346 testBatchingOperation(SensorType::GYROSCOPE);
347 }
348
349 // Test if sensor hal can do magnetometer batching properly
TEST_P(SensorsHidlTest,MagnetometerBatchingOperation)350 TEST_P(SensorsHidlTest, MagnetometerBatchingOperation) {
351 testBatchingOperation(SensorType::MAGNETIC_FIELD);
352 }
353
354 // Test sensor event direct report with ashmem for accel sensor at normal rate
TEST_P(SensorsHidlTest,AccelerometerAshmemDirectReportOperationNormal)355 TEST_P(SensorsHidlTest, AccelerometerAshmemDirectReportOperationNormal) {
356 testDirectReportOperation(SensorType::ACCELEROMETER, SharedMemType::ASHMEM, RateLevel::NORMAL,
357 mAccelNormChecker);
358 }
359
360 // Test sensor event direct report with ashmem for accel sensor at fast rate
TEST_P(SensorsHidlTest,AccelerometerAshmemDirectReportOperationFast)361 TEST_P(SensorsHidlTest, AccelerometerAshmemDirectReportOperationFast) {
362 testDirectReportOperation(SensorType::ACCELEROMETER, SharedMemType::ASHMEM, RateLevel::FAST,
363 mAccelNormChecker);
364 }
365
366 // Test sensor event direct report with ashmem for accel sensor at very fast rate
TEST_P(SensorsHidlTest,AccelerometerAshmemDirectReportOperationVeryFast)367 TEST_P(SensorsHidlTest, AccelerometerAshmemDirectReportOperationVeryFast) {
368 testDirectReportOperation(SensorType::ACCELEROMETER, SharedMemType::ASHMEM,
369 RateLevel::VERY_FAST, mAccelNormChecker);
370 }
371
372 // Test sensor event direct report with ashmem for gyro sensor at normal rate
TEST_P(SensorsHidlTest,GyroscopeAshmemDirectReportOperationNormal)373 TEST_P(SensorsHidlTest, GyroscopeAshmemDirectReportOperationNormal) {
374 testDirectReportOperation(SensorType::GYROSCOPE, SharedMemType::ASHMEM, RateLevel::NORMAL,
375 mGyroNormChecker);
376 }
377
378 // Test sensor event direct report with ashmem for gyro sensor at fast rate
TEST_P(SensorsHidlTest,GyroscopeAshmemDirectReportOperationFast)379 TEST_P(SensorsHidlTest, GyroscopeAshmemDirectReportOperationFast) {
380 testDirectReportOperation(SensorType::GYROSCOPE, SharedMemType::ASHMEM, RateLevel::FAST,
381 mGyroNormChecker);
382 }
383
384 // Test sensor event direct report with ashmem for gyro sensor at very fast rate
TEST_P(SensorsHidlTest,GyroscopeAshmemDirectReportOperationVeryFast)385 TEST_P(SensorsHidlTest, GyroscopeAshmemDirectReportOperationVeryFast) {
386 testDirectReportOperation(SensorType::GYROSCOPE, SharedMemType::ASHMEM, RateLevel::VERY_FAST,
387 mGyroNormChecker);
388 }
389
390 // Test sensor event direct report with ashmem for mag sensor at normal rate
TEST_P(SensorsHidlTest,MagnetometerAshmemDirectReportOperationNormal)391 TEST_P(SensorsHidlTest, MagnetometerAshmemDirectReportOperationNormal) {
392 testDirectReportOperation(SensorType::MAGNETIC_FIELD, SharedMemType::ASHMEM, RateLevel::NORMAL,
393 NullChecker<Event>());
394 }
395
396 // Test sensor event direct report with ashmem for mag sensor at fast rate
TEST_P(SensorsHidlTest,MagnetometerAshmemDirectReportOperationFast)397 TEST_P(SensorsHidlTest, MagnetometerAshmemDirectReportOperationFast) {
398 testDirectReportOperation(SensorType::MAGNETIC_FIELD, SharedMemType::ASHMEM, RateLevel::FAST,
399 NullChecker<Event>());
400 }
401
402 // Test sensor event direct report with ashmem for mag sensor at very fast rate
TEST_P(SensorsHidlTest,MagnetometerAshmemDirectReportOperationVeryFast)403 TEST_P(SensorsHidlTest, MagnetometerAshmemDirectReportOperationVeryFast) {
404 testDirectReportOperation(SensorType::MAGNETIC_FIELD, SharedMemType::ASHMEM,
405 RateLevel::VERY_FAST, NullChecker<Event>());
406 }
407
408 // Test sensor event direct report with gralloc for accel sensor at normal rate
TEST_P(SensorsHidlTest,AccelerometerGrallocDirectReportOperationNormal)409 TEST_P(SensorsHidlTest, AccelerometerGrallocDirectReportOperationNormal) {
410 testDirectReportOperation(SensorType::ACCELEROMETER, SharedMemType::GRALLOC, RateLevel::NORMAL,
411 mAccelNormChecker);
412 }
413
414 // Test sensor event direct report with gralloc for accel sensor at fast rate
TEST_P(SensorsHidlTest,AccelerometerGrallocDirectReportOperationFast)415 TEST_P(SensorsHidlTest, AccelerometerGrallocDirectReportOperationFast) {
416 testDirectReportOperation(SensorType::ACCELEROMETER, SharedMemType::GRALLOC, RateLevel::FAST,
417 mAccelNormChecker);
418 }
419
420 // Test sensor event direct report with gralloc for accel sensor at very fast rate
TEST_P(SensorsHidlTest,AccelerometerGrallocDirectReportOperationVeryFast)421 TEST_P(SensorsHidlTest, AccelerometerGrallocDirectReportOperationVeryFast) {
422 testDirectReportOperation(SensorType::ACCELEROMETER, SharedMemType::GRALLOC,
423 RateLevel::VERY_FAST, mAccelNormChecker);
424 }
425
426 // Test sensor event direct report with gralloc for gyro sensor at normal rate
TEST_P(SensorsHidlTest,GyroscopeGrallocDirectReportOperationNormal)427 TEST_P(SensorsHidlTest, GyroscopeGrallocDirectReportOperationNormal) {
428 testDirectReportOperation(SensorType::GYROSCOPE, SharedMemType::GRALLOC, RateLevel::NORMAL,
429 mGyroNormChecker);
430 }
431
432 // Test sensor event direct report with gralloc for gyro sensor at fast rate
TEST_P(SensorsHidlTest,GyroscopeGrallocDirectReportOperationFast)433 TEST_P(SensorsHidlTest, GyroscopeGrallocDirectReportOperationFast) {
434 testDirectReportOperation(SensorType::GYROSCOPE, SharedMemType::GRALLOC, RateLevel::FAST,
435 mGyroNormChecker);
436 }
437
438 // Test sensor event direct report with gralloc for gyro sensor at very fast rate
TEST_P(SensorsHidlTest,GyroscopeGrallocDirectReportOperationVeryFast)439 TEST_P(SensorsHidlTest, GyroscopeGrallocDirectReportOperationVeryFast) {
440 testDirectReportOperation(SensorType::GYROSCOPE, SharedMemType::GRALLOC, RateLevel::VERY_FAST,
441 mGyroNormChecker);
442 }
443
444 // Test sensor event direct report with gralloc for mag sensor at normal rate
TEST_P(SensorsHidlTest,MagnetometerGrallocDirectReportOperationNormal)445 TEST_P(SensorsHidlTest, MagnetometerGrallocDirectReportOperationNormal) {
446 testDirectReportOperation(SensorType::MAGNETIC_FIELD, SharedMemType::GRALLOC, RateLevel::NORMAL,
447 NullChecker<Event>());
448 }
449
450 // Test sensor event direct report with gralloc for mag sensor at fast rate
TEST_P(SensorsHidlTest,MagnetometerGrallocDirectReportOperationFast)451 TEST_P(SensorsHidlTest, MagnetometerGrallocDirectReportOperationFast) {
452 testDirectReportOperation(SensorType::MAGNETIC_FIELD, SharedMemType::GRALLOC, RateLevel::FAST,
453 NullChecker<Event>());
454 }
455
456 // Test sensor event direct report with gralloc for mag sensor at very fast rate
TEST_P(SensorsHidlTest,MagnetometerGrallocDirectReportOperationVeryFast)457 TEST_P(SensorsHidlTest, MagnetometerGrallocDirectReportOperationVeryFast) {
458 testDirectReportOperation(SensorType::MAGNETIC_FIELD, SharedMemType::GRALLOC,
459 RateLevel::VERY_FAST, NullChecker<Event>());
460 }
461
462 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SensorsHidlTest);
463 INSTANTIATE_TEST_SUITE_P(
464 PerInstance, SensorsHidlTest,
465 testing::ValuesIn(android::hardware::getAllHalInstanceNames(ISensors::descriptor)),
466 android::hardware::PrintInstanceNameToString);
467 // vim: set ts=2 sw=2
468