3434using aidl::android::hardware::vibrator::Braking;
3535using aidl::android::hardware::vibrator::CompositeEffect;
3636using aidl::android::hardware::vibrator::CompositePrimitive;
37+ using aidl::android::hardware::vibrator::CompositePwleV2;
3738using aidl::android::hardware::vibrator::Effect;
3839using aidl::android::hardware::vibrator::EffectStrength;
40+ using aidl::android::hardware::vibrator::FrequencyAccelerationMapEntry;
3941using aidl::android::hardware::vibrator::IVibrator;
4042using aidl::android::hardware::vibrator::IVibratorCallback;
4143using aidl::android::hardware::vibrator::PrimitivePwle;
42- using aidl::android::hardware::vibrator::PwleV2OutputMapEntry;
4344using aidl::android::hardware::vibrator::PwleV2Primitive;
4445using aidl::android::hardware::vibrator::VendorEffect;
4546using aidl::android::os::PersistableBundle;
@@ -243,11 +244,11 @@ TEST_F(VibratorHalWrapperAidlTest, TestGetInfoDoesNotCacheFailedResult) {
243244 std::vector<CompositePrimitive> supportedPrimitives = {CompositePrimitive::CLICK};
244245 std::vector<Braking> supportedBraking = {Braking::CLAB};
245246 std::vector<float > amplitudes = {0 .f , 1 .f , 0 .f };
246- std::vector<PwleV2OutputMapEntry>
247- frequencyToOutputAccelerationMap{ PwleV2OutputMapEntry (/* frequency=*/ 30 .0f ,
248- /* maxOutputAcceleration=*/ 0.2 ),
249- PwleV2OutputMapEntry (/* frequency=*/ 60 .0f ,
250- /* maxOutputAcceleration=*/ 0.8 )};
247+ std::vector<FrequencyAccelerationMapEntry> frequencyToOutputAccelerationMap{
248+ FrequencyAccelerationMapEntry (/* frequency=*/ 30 .0f ,
249+ /* maxOutputAcceleration=*/ 0.2 ),
250+ FrequencyAccelerationMapEntry (/* frequency=*/ 60 .0f ,
251+ /* maxOutputAcceleration=*/ 0.8 )};
251252
252253 std::vector<std::chrono::milliseconds> primitiveDurations;
253254 constexpr auto primitiveRange = ndk::enum_range<CompositePrimitive>();
@@ -329,7 +330,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestGetInfoDoesNotCacheFailedResult) {
329330 .WillOnce (Return (ndk::ScopedAStatus::fromExceptionCode (EX_SECURITY)))
330331 .WillOnce (DoAll (SetArgPointee<0 >(PWLE_V2_MIN_REQUIRED_PRIMITIVE_MAX_DURATION_MS),
331332 Return (ndk::ScopedAStatus::ok ())));
332- EXPECT_CALL (*mMockHal .get (), getPwleV2FrequencyToOutputAccelerationMap (_))
333+ EXPECT_CALL (*mMockHal .get (), getFrequencyToOutputAccelerationMap (_))
333334 .Times (Exactly (2 ))
334335 .WillOnce (Return (ndk::ScopedAStatus::fromExceptionCode (EX_SECURITY)))
335336 .WillOnce (DoAll (SetArgPointee<0 >(frequencyToOutputAccelerationMap),
@@ -391,11 +392,11 @@ TEST_F(VibratorHalWrapperAidlTest, TestGetInfoCachesResult) {
391392 constexpr int32_t PWLE_V2_MAX_ALLOWED_PRIMITIVE_MIN_DURATION_MS = 20 ;
392393 constexpr int32_t PWLE_V2_MIN_REQUIRED_PRIMITIVE_MAX_DURATION_MS = 1000 ;
393394 std::vector<Effect> supportedEffects = {Effect::CLICK, Effect::TICK};
394- std::vector<PwleV2OutputMapEntry>
395- frequencyToOutputAccelerationMap{ PwleV2OutputMapEntry (/* frequency=*/ 30 .0f ,
396- /* maxOutputAcceleration=*/ 0.2 ),
397- PwleV2OutputMapEntry (/* frequency=*/ 60 .0f ,
398- /* maxOutputAcceleration=*/ 0.8 )};
395+ std::vector<FrequencyAccelerationMapEntry> frequencyToOutputAccelerationMap{
396+ FrequencyAccelerationMapEntry (/* frequency=*/ 30 .0f ,
397+ /* maxOutputAcceleration=*/ 0.2 ),
398+ FrequencyAccelerationMapEntry (/* frequency=*/ 60 .0f ,
399+ /* maxOutputAcceleration=*/ 0.8 )};
399400
400401 EXPECT_CALL (*mMockHal .get (), getCapabilities (_))
401402 .Times (Exactly (1 ))
@@ -451,7 +452,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestGetInfoCachesResult) {
451452 .Times (Exactly (1 ))
452453 .WillOnce (DoAll (SetArgPointee<0 >(PWLE_V2_MIN_REQUIRED_PRIMITIVE_MAX_DURATION_MS),
453454 Return (ndk::ScopedAStatus::ok ())));
454- EXPECT_CALL (*mMockHal .get (), getPwleV2FrequencyToOutputAccelerationMap (_))
455+ EXPECT_CALL (*mMockHal .get (), getFrequencyToOutputAccelerationMap (_))
455456 .Times (Exactly (1 ))
456457 .WillOnce (DoAll (SetArgPointee<0 >(frequencyToOutputAccelerationMap),
457458 Return (ndk::ScopedAStatus::ok ())));
@@ -754,7 +755,8 @@ TEST_F(VibratorHalWrapperAidlTest, TestPerformPwleEffect) {
754755}
755756
756757TEST_F (VibratorHalWrapperAidlTest, TestComposePwleV2) {
757- auto pwleEffect = {
758+ CompositePwleV2 composite;
759+ composite.pwlePrimitives = {
758760 PwleV2Primitive (/* amplitude=*/ 0.2 , /* frequency=*/ 50 , /* time=*/ 100 ),
759761 PwleV2Primitive (/* amplitude=*/ 0.5 , /* frequency=*/ 150 , /* time=*/ 100 ),
760762 PwleV2Primitive (/* amplitude=*/ 0.8 , /* frequency=*/ 250 , /* time=*/ 100 ),
@@ -773,17 +775,17 @@ TEST_F(VibratorHalWrapperAidlTest, TestComposePwleV2) {
773775 std::unique_ptr<int32_t > callbackCounter = std::make_unique<int32_t >();
774776 auto callback = vibrator::TestFactory::createCountingCallback (callbackCounter.get ());
775777
776- auto result = mWrapper ->composePwleV2 (pwleEffect , callback);
778+ auto result = mWrapper ->composePwleV2 (composite , callback);
777779 ASSERT_TRUE (result.isUnsupported ());
778780 // Callback not triggered on failure
779781 ASSERT_EQ (0 , *callbackCounter.get ());
780782
781- result = mWrapper ->composePwleV2 (pwleEffect , callback);
783+ result = mWrapper ->composePwleV2 (composite , callback);
782784 ASSERT_TRUE (result.isFailed ());
783785 // Callback not triggered for unsupported
784786 ASSERT_EQ (0 , *callbackCounter.get ());
785787
786- result = mWrapper ->composePwleV2 (pwleEffect , callback);
788+ result = mWrapper ->composePwleV2 (composite , callback);
787789 ASSERT_TRUE (result.isOk ());
788790 ASSERT_EQ (1 , *callbackCounter.get ());
789791}
0 commit comments