From d2631e794886b8d4eb63bfe129a1e9a4ba35abe5 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Wed, 28 Aug 2024 08:59:11 +0800 Subject: [PATCH 1/2] vibrator yaml modification Signed-off-by: cff-gite Change-Id: Ie9138be8f28fb9d15283e1cd380023a2bd45cd20 --- hisysevent.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hisysevent.yaml b/hisysevent.yaml index 0ecb9ec..2352bf1 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -14,26 +14,26 @@ domain: MISCDEVICE VIBRATOR_PERMISSIONS_EXCEPTION: - __BASE: {type: SECURITY, level: MINOR, desc: sensor verify access token fail} + __BASE: {type: SECURITY, level: MINOR, desc: vibrate verify access token fail} PKG_NAME: {type: STRING, desc: package name} ERROR_CODE: {type: INT32, desc: error code} LIGHT_PERMISSIONS_EXCEPTION: - __BASE: {type: SECURITY, level: MINOR, desc: sensor verify access token fail} + __BASE: {type: SECURITY, level: MINOR, desc: light verify access token fail} PKG_NAME: {type: STRING, desc: package name} ERROR_CODE: {type: INT32, desc: error code} MISC_SERVICE_IPC_EXCEPTION: - __BASE: {type: FAULT, level: MINOR, desc: sensor service ipc exception} + __BASE: {type: FAULT, level: MINOR, desc: vibrate service ipc exception} PKG_NAME: {type: STRING, desc: package name} ERROR_CODE: {type: INT32, desc: error code} VIBRATOR_HDF_SERVICE_EXCEPTION: - __BASE: {type: FAULT, level: MINOR, desc: sensor hdf service exception} + __BASE: {type: FAULT, level: MINOR, desc: vibrate hdf service exception} PKG_NAME: {type: STRING, desc: package name} ERROR_CODE: {type: INT32, desc: error code} MISC_SERVICE_EXCEPTION: - __BASE: {type: FAULT, level: MINOR, desc: sensor service exception} + __BASE: {type: FAULT, level: MINOR, desc: vibrate service exception} PKG_NAME: {type: STRING, desc: package name} ERROR_CODE: {type: INT32, desc: error code} \ No newline at end of file -- Gitee From efeb75e1cc02b764a5a893b332e32c3a3b2edd6b Mon Sep 17 00:00:00 2001 From: cff-gite Date: Wed, 28 Aug 2024 14:12:01 +0800 Subject: [PATCH 2/2] vibrator test modification Signed-off-by: cff-gite Change-Id: I215fb12656c3313911853110317b84a3b575fe25 --- hisysevent.yaml | 10 +++++----- .../vibrator/native/vibrator_agent_test.cpp | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/hisysevent.yaml b/hisysevent.yaml index 2352bf1..0ecb9ec 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -14,26 +14,26 @@ domain: MISCDEVICE VIBRATOR_PERMISSIONS_EXCEPTION: - __BASE: {type: SECURITY, level: MINOR, desc: vibrate verify access token fail} + __BASE: {type: SECURITY, level: MINOR, desc: sensor verify access token fail} PKG_NAME: {type: STRING, desc: package name} ERROR_CODE: {type: INT32, desc: error code} LIGHT_PERMISSIONS_EXCEPTION: - __BASE: {type: SECURITY, level: MINOR, desc: light verify access token fail} + __BASE: {type: SECURITY, level: MINOR, desc: sensor verify access token fail} PKG_NAME: {type: STRING, desc: package name} ERROR_CODE: {type: INT32, desc: error code} MISC_SERVICE_IPC_EXCEPTION: - __BASE: {type: FAULT, level: MINOR, desc: vibrate service ipc exception} + __BASE: {type: FAULT, level: MINOR, desc: sensor service ipc exception} PKG_NAME: {type: STRING, desc: package name} ERROR_CODE: {type: INT32, desc: error code} VIBRATOR_HDF_SERVICE_EXCEPTION: - __BASE: {type: FAULT, level: MINOR, desc: vibrate hdf service exception} + __BASE: {type: FAULT, level: MINOR, desc: sensor hdf service exception} PKG_NAME: {type: STRING, desc: package name} ERROR_CODE: {type: INT32, desc: error code} MISC_SERVICE_EXCEPTION: - __BASE: {type: FAULT, level: MINOR, desc: vibrate service exception} + __BASE: {type: FAULT, level: MINOR, desc: sensor service exception} PKG_NAME: {type: STRING, desc: package name} ERROR_CODE: {type: INT32, desc: error code} \ No newline at end of file diff --git a/test/unittest/vibrator/native/vibrator_agent_test.cpp b/test/unittest/vibrator/native/vibrator_agent_test.cpp index 28a012b..7b6f6f6 100644 --- a/test/unittest/vibrator/native/vibrator_agent_test.cpp +++ b/test/unittest/vibrator/native/vibrator_agent_test.cpp @@ -1291,8 +1291,19 @@ HWTEST_F(VibratorAgentTest, PlayPrimitiveEffect_005, TestSize.Level1) HWTEST_F(VibratorAgentTest, IsHdHapticSupported_001, TestSize.Level1) { MISC_HILOGI("IsHdHapticSupported_001 in"); - bool ret = IsHdHapticSupported(); - MISC_HILOGI("IsHdHapticSupported:%{public}s", ret ? "true" : "false"); + if (IsSupportVibratorCustom() && IsHdHapticSupported()) { + FileDescriptor fileDescriptor("/data/test/vibrator/coin_drop.json"); + MISC_HILOGD("Test fd:%{public}d", fileDescriptor.fd); + struct stat64 statbuf = { 0 }; + if (fstat64(fileDescriptor.fd, &statbuf) == 0) { + int32_t ret = PlayVibratorCustom(fileDescriptor.fd, 0, statbuf.st_size); + ASSERT_EQ(ret, 0); + } + std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP)); + } else { + ASSERT_EQ(0, 0); + } + Cancel(); } } // namespace Sensors } // namespace OHOS -- Gitee