From b7d5f6337566345611e081041178e7344671993e Mon Sep 17 00:00:00 2001 From: zhouyanxu Date: Mon, 21 Aug 2023 10:46:03 +0800 Subject: [PATCH] add vibrator ndk Signed-off-by: zhouyanxu --- bundle.json | 38 +- frameworks/capi/BUILD.gn | 39 + frameworks/capi/test/unittest/BUILD.gn | 64 + .../resource/json_file/test_128_event.json | 0 .../capi/test/unittest/resource/ohos_test.xml | 22 + .../capi/test/unittest/vibrator_test.cpp | 202 +++ frameworks/capi/vibrator.cpp | 92 ++ .../plugin => frameworks/js/napi}/BUILD.gn | 14 +- .../vibrator/include/vibrator_napi_error.h | 0 .../vibrator/include/vibrator_napi_utils.h | 0 .../js/napi}/vibrator/src/vibrator_js.cpp | 0 .../vibrator/src/vibrator_napi_error.cpp | 0 .../vibrator/src/vibrator_napi_utils.cpp | 6 +- .../js/napi}/vibrator/test/unittest/BUILD.gn | 2 +- .../test/unittest/ExampleJsunit.test.js | 0 .../napi}/vibrator/test/unittest/config.json | 0 .../vibrator/test/unittest/openharmony_sx.p7b | Bin .../native/light/BUILD.gn | 14 +- .../native/light/liblight.json | 0 .../native/light}/light_agent.cpp | 0 .../native/light/test/BUILD.gn | 4 +- .../native/light/test/fuzztest/BUILD.gn | 0 .../test/fuzztest/startlight_fuzzer/BUILD.gn | 8 +- .../fuzztest/startlight_fuzzer/corpus/init | 0 .../fuzztest/startlight_fuzzer/project.xml | 0 .../startlight_fuzzer/startlight_fuzzer.cpp | 0 .../startlight_fuzzer/startlight_fuzzer.h | 0 .../test/fuzztest/stoplight_fuzzer/BUILD.gn | 8 +- .../fuzztest/stoplight_fuzzer/corpus/init | 0 .../fuzztest/stoplight_fuzzer/project.xml | 0 .../stoplight_fuzzer/stoplight_fuzzer.cpp | 0 .../stoplight_fuzzer/stoplight_fuzzer.h | 0 .../light/test/unittest/light_agent_test.cpp | 0 frameworks/native/miscdevice/BUILD.gn | 6 +- .../miscdevice/include/i_miscdevice_service.h | 2 +- .../native/miscdevice/include/light_client.h | 2 +- .../include/miscdevice_service_proxy.h | 2 +- .../include/sensors_ipc_interface_code.h | 2 +- .../include/vibrator_service_client.h | 2 +- .../native/miscdevice/src/light_client.cpp | 2 +- .../src/miscdevice_service_proxy.cpp | 2 +- .../src/vibrator_service_client.cpp | 2 +- .../native/vibrator/BUILD.gn | 17 +- .../native/vibrator/libvibrator.json | 0 .../native/vibrator/test/BUILD.gn | 7 +- .../native/vibrator/test/fuzztest/BUILD.gn | 0 .../fuzztest/issupporteffect_fuzzer/BUILD.gn | 8 +- .../issupporteffect_fuzzer/corpus/init | 0 .../issupporteffect_fuzzer.cpp | 0 .../issupporteffect_fuzzer.h | 0 .../issupporteffect_fuzzer/project.xml | 0 .../playvibratorcustom_fuzzer/BUILD.gn | 8 +- .../playvibratorcustom_fuzzer/corpus/init | 0 .../playvibratorcustom_fuzzer.cpp | 0 .../playvibratorcustom_fuzzer.h | 0 .../playvibratorcustom_fuzzer/project.xml | 0 .../fuzztest/setloopcount_fuzzer/BUILD.gn | 8 +- .../fuzztest/setloopcount_fuzzer/corpus/init | 0 .../fuzztest/setloopcount_fuzzer/project.xml | 0 .../setloopcount_fuzzer.cpp | 0 .../setloopcount_fuzzer/setloopcount_fuzzer.h | 0 .../test/fuzztest/setusage_fuzzer/BUILD.gn | 8 +- .../test/fuzztest/setusage_fuzzer/corpus/init | 0 .../test/fuzztest/setusage_fuzzer/project.xml | 0 .../setusage_fuzzer/setusage_fuzzer.cpp | 0 .../setusage_fuzzer/setusage_fuzzer.h | 0 .../fuzztest/startvibrator_fuzzer/BUILD.gn | 8 +- .../fuzztest/startvibrator_fuzzer/corpus/init | 0 .../fuzztest/startvibrator_fuzzer/project.xml | 0 .../startvibrator_fuzzer.cpp | 0 .../startvibrator_fuzzer.h | 0 .../startvibratoronce_fuzzer/BUILD.gn | 8 +- .../startvibratoronce_fuzzer/corpus/init | 0 .../startvibratoronce_fuzzer/project.xml | 0 .../startvibratoronce_fuzzer.cpp | 0 .../startvibratoronce_fuzzer.h | 0 .../fuzztest/stopvibrator_fuzzer/BUILD.gn | 8 +- .../fuzztest/stopvibrator_fuzzer/corpus/init | 0 .../fuzztest/stopvibrator_fuzzer/project.xml | 0 .../stopvibrator_fuzzer.cpp | 0 .../stopvibrator_fuzzer/stopvibrator_fuzzer.h | 0 .../resource/json_file/coin_drop.json | 0 .../resource/json_file/on_carpet.json | 0 .../resource/json_file/test_128_event.json | 1377 +++++++++++++++++ .../resource/json_file/test_129_event.json | 0 .../json_file/test_big_file_size.json | 0 .../json_file/test_event_overlap_1.json | 0 .../json_file/test_event_overlap_2.json | 0 .../json_file/test_invalid_duration.json | 0 .../json_file/test_invalid_frequency.json | 0 .../json_file/test_invalid_intensity.json | 0 .../json_file/test_invalid_startTime.json | 0 .../resource/json_file/test_invalid_type.json | 0 .../test/unittest/resource/ohos_test.xml | 0 .../test/unittest/vibrator_agent_test.cpp | 60 +- .../native/vibrator}/vibrator_agent.cpp | 8 +- .../include => inner_api/light}/light_agent.h | 0 .../light}/light_agent_type.h | 0 .../vibrator}/vibrator_agent.h | 6 +- .../vibrator}/vibrator_agent_type.h | 2 +- interfaces/kits/c/BUILD.gn | 36 + interfaces/kits/c/lib_vibrator.ndk.json | 6 + interfaces/kits/c/vibrator.h | 81 + interfaces/kits/c/vibrator_type.h | 100 ++ services/miscdevice_service/BUILD.gn | 4 +- .../vibratoronremoterequest_fuzzer/BUILD.gn | 8 +- 106 files changed, 2171 insertions(+), 132 deletions(-) create mode 100755 frameworks/capi/BUILD.gn create mode 100755 frameworks/capi/test/unittest/BUILD.gn rename {interfaces/native/vibrator => frameworks/capi}/test/unittest/resource/json_file/test_128_event.json (100%) mode change 100644 => 100755 create mode 100755 frameworks/capi/test/unittest/resource/ohos_test.xml create mode 100755 frameworks/capi/test/unittest/vibrator_test.cpp create mode 100755 frameworks/capi/vibrator.cpp rename {interfaces/plugin => frameworks/js/napi}/BUILD.gn (72%) mode change 100644 => 100755 rename {interfaces/plugin => frameworks/js/napi}/vibrator/include/vibrator_napi_error.h (100%) rename {interfaces/plugin => frameworks/js/napi}/vibrator/include/vibrator_napi_utils.h (100%) mode change 100644 => 100755 rename {interfaces/plugin => frameworks/js/napi}/vibrator/src/vibrator_js.cpp (100%) mode change 100644 => 100755 rename {interfaces/plugin => frameworks/js/napi}/vibrator/src/vibrator_napi_error.cpp (100%) rename {interfaces/plugin => frameworks/js/napi}/vibrator/src/vibrator_napi_utils.cpp (98%) mode change 100644 => 100755 rename {interfaces/plugin => frameworks/js/napi}/vibrator/test/unittest/BUILD.gn (95%) rename {interfaces/plugin => frameworks/js/napi}/vibrator/test/unittest/ExampleJsunit.test.js (100%) mode change 100644 => 100755 rename {interfaces/plugin => frameworks/js/napi}/vibrator/test/unittest/config.json (100%) mode change 100644 => 100755 rename {interfaces/plugin => frameworks/js/napi}/vibrator/test/unittest/openharmony_sx.p7b (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/light/BUILD.gn (79%) rename {interfaces => frameworks}/native/light/liblight.json (100%) rename {interfaces/native/light/src => frameworks/native/light}/light_agent.cpp (100%) rename {interfaces => frameworks}/native/light/test/BUILD.gn (90%) rename {interfaces => frameworks}/native/light/test/fuzztest/BUILD.gn (100%) rename {interfaces => frameworks}/native/light/test/fuzztest/startlight_fuzzer/BUILD.gn (82%) rename {interfaces => frameworks}/native/light/test/fuzztest/startlight_fuzzer/corpus/init (100%) rename {interfaces => frameworks}/native/light/test/fuzztest/startlight_fuzzer/project.xml (100%) rename {interfaces => frameworks}/native/light/test/fuzztest/startlight_fuzzer/startlight_fuzzer.cpp (100%) rename {interfaces => frameworks}/native/light/test/fuzztest/startlight_fuzzer/startlight_fuzzer.h (100%) rename {interfaces => frameworks}/native/light/test/fuzztest/stoplight_fuzzer/BUILD.gn (82%) rename {interfaces => frameworks}/native/light/test/fuzztest/stoplight_fuzzer/corpus/init (100%) rename {interfaces => frameworks}/native/light/test/fuzztest/stoplight_fuzzer/project.xml (100%) rename {interfaces => frameworks}/native/light/test/fuzztest/stoplight_fuzzer/stoplight_fuzzer.cpp (100%) rename {interfaces => frameworks}/native/light/test/fuzztest/stoplight_fuzzer/stoplight_fuzzer.h (100%) rename {interfaces => frameworks}/native/light/test/unittest/light_agent_test.cpp (100%) rename {interfaces => frameworks}/native/vibrator/BUILD.gn (76%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/libvibrator.json (100%) rename {interfaces => frameworks}/native/vibrator/test/BUILD.gn (86%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/BUILD.gn (100%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/issupporteffect_fuzzer/BUILD.gn (83%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/issupporteffect_fuzzer/corpus/init (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/issupporteffect_fuzzer/issupporteffect_fuzzer.cpp (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/issupporteffect_fuzzer/issupporteffect_fuzzer.h (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/issupporteffect_fuzzer/project.xml (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/BUILD.gn (83%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/corpus/init (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/playvibratorcustom_fuzzer.cpp (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/playvibratorcustom_fuzzer.h (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/project.xml (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/setloopcount_fuzzer/BUILD.gn (82%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/setloopcount_fuzzer/corpus/init (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/setloopcount_fuzzer/project.xml (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/setloopcount_fuzzer/setloopcount_fuzzer.cpp (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/setloopcount_fuzzer/setloopcount_fuzzer.h (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/setusage_fuzzer/BUILD.gn (82%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/setusage_fuzzer/corpus/init (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/setusage_fuzzer/project.xml (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/setusage_fuzzer/setusage_fuzzer.cpp (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/setusage_fuzzer/setusage_fuzzer.h (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/startvibrator_fuzzer/BUILD.gn (82%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/startvibrator_fuzzer/corpus/init (100%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/startvibrator_fuzzer/project.xml (100%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/startvibrator_fuzzer/startvibrator_fuzzer.cpp (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/startvibrator_fuzzer/startvibrator_fuzzer.h (100%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/BUILD.gn (82%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/corpus/init (100%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/project.xml (100%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/startvibratoronce_fuzzer.cpp (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/startvibratoronce_fuzzer.h (100%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/stopvibrator_fuzzer/BUILD.gn (82%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/stopvibrator_fuzzer/corpus/init (100%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/stopvibrator_fuzzer/project.xml (100%) rename {interfaces => frameworks}/native/vibrator/test/fuzztest/stopvibrator_fuzzer/stopvibrator_fuzzer.cpp (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/fuzztest/stopvibrator_fuzzer/stopvibrator_fuzzer.h (100%) rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/json_file/coin_drop.json (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/json_file/on_carpet.json (100%) mode change 100644 => 100755 create mode 100755 frameworks/native/vibrator/test/unittest/resource/json_file/test_128_event.json rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/json_file/test_129_event.json (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/json_file/test_big_file_size.json (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/json_file/test_event_overlap_1.json (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/json_file/test_event_overlap_2.json (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/json_file/test_invalid_duration.json (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/json_file/test_invalid_frequency.json (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/json_file/test_invalid_intensity.json (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/json_file/test_invalid_startTime.json (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/json_file/test_invalid_type.json (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/unittest/resource/ohos_test.xml (100%) mode change 100644 => 100755 rename {interfaces => frameworks}/native/vibrator/test/unittest/vibrator_agent_test.cpp (94%) rename {interfaces/native/vibrator/src => frameworks/native/vibrator}/vibrator_agent.cpp (96%) rename interfaces/{native/light/include => inner_api/light}/light_agent.h (100%) rename interfaces/{native/light/include => inner_api/light}/light_agent_type.h (100%) rename interfaces/{native/vibrator/include => inner_api/vibrator}/vibrator_agent.h (93%) rename interfaces/{native/vibrator/include => inner_api/vibrator}/vibrator_agent_type.h (93%) create mode 100755 interfaces/kits/c/BUILD.gn create mode 100755 interfaces/kits/c/lib_vibrator.ndk.json create mode 100755 interfaces/kits/c/vibrator.h create mode 100755 interfaces/kits/c/vibrator_type.h diff --git a/bundle.json b/bundle.json index 7b5a22d..2eec3e0 100644 --- a/bundle.json +++ b/bundle.json @@ -42,11 +42,12 @@ "group_type": { "base_group": [], "fwk_group": [ - "//base/sensors/miscdevice/interfaces/plugin:vibrator_js_target", - "//base/sensors/miscdevice/interfaces/native/vibrator:vibrator_target", - "//base/sensors/miscdevice/interfaces/native/light:light_target", + "//base/sensors/miscdevice/frameworks/js/napi:vibrator_js_target", + "//base/sensors/miscdevice/frameworks/native/vibrator:vibrator_target", + "//base/sensors/miscdevice/frameworks/native/light:light_target", "//base/sensors/miscdevice/frameworks/native/miscdevice:miscdevice_native_target", - "//base/sensors/miscdevice/utils:miscdevice_utils_target" + "//base/sensors/miscdevice/utils:miscdevice_utils_target", + "//base/sensors/miscdevice/frameworks/capi:ndk_vibrator" ], "service_group": [ "//base/sensors/miscdevice/services/miscdevice_service:miscdevice_service_target", @@ -55,32 +56,43 @@ }, "inner_kits": [ { - "name": "//base/sensors/miscdevice/interfaces/native/vibrator:vibrator_interface_native", + "name": "//base/sensors/miscdevice/frameworks/native/vibrator:vibrator_interface_native", "header": { "header_files": [ "vibrator_agent.h", "vibrator_agent_type.h" ], - "header_base": "//base/sensors/miscdevice/interfaces/native/vibrator/include" + "header_base": "//base/sensors/miscdevice/interfaces/inner_api/vibrator" } }, { - "name": "//base/sensors/miscdevice/interfaces/native/light:light_interface_native", + "name": "//base/sensors/miscdevice/frameworks/native/light:light_interface_native", "header": { "header_files": [ "light_agent_type.h", "light_agent.h" ], - "header_base": "//base/sensors/miscdevice/interfaces/native/light/include" + "header_base": "//base/sensors/miscdevice/interfaces/inner_api/light" + } + }, + { + "name": "//base/sensors/miscdevice/frameworks/capi:ndk_vibrator", + "header": { + "header_files": [ + "vibrator_type.h", + "vibrator.h" + ], + "header_base": "//base/sensors/miscdevice/interfaces/kits/c" } } ], "test": [ - "//base/sensors/miscdevice/interfaces/plugin/vibrator/test/unittest:unittest", - "//base/sensors/miscdevice/interfaces/native/vibrator/test/fuzztest:fuzztest", - "//base/sensors/miscdevice/interfaces/native/light/test/fuzztest:fuzztest", - "//base/sensors/miscdevice/interfaces/native/vibrator/test:unittest", - "//base/sensors/miscdevice/interfaces/native/light/test:unittest", + "//base/sensors/miscdevice/frameworks/js/napi/vibrator/test/unittest:unittest", + "//base/sensors/miscdevice/frameworks/native/vibrator/test/fuzztest:fuzztest", + "//base/sensors/miscdevice/frameworks/native/light/test/fuzztest:fuzztest", + "//base/sensors/miscdevice/frameworks/native/vibrator/test:unittest", + "//base/sensors/miscdevice/frameworks/capi/test/unittest:unittest", + "//base/sensors/miscdevice/frameworks/native/light/test:unittest", "//base/sensors/miscdevice/services/miscdevice_service/test/fuzztest:fuzztest" ] } diff --git a/frameworks/capi/BUILD.gn b/frameworks/capi/BUILD.gn new file mode 100755 index 0000000..3191735 --- /dev/null +++ b/frameworks/capi/BUILD.gn @@ -0,0 +1,39 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") +import("./../../miscdevice.gni") + +ohos_shared_library("ndk_vibrator") { + include_dirs = [ + "$SUBSYSTEM_DIR/interfaces/kits/c", + "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator", + "$SUBSYSTEM_DIR/utils", + "$SUBSYSTEM_DIR/utils/include", + ] + sources = [ "vibrator.cpp" ] + + defines = [ "API_EXPORT=__attribute__((visibility (\"default\")))" ] + + deps = + [ "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_interface_native" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + ] + + relative_install_dir = "ndk" + part_name = "miscdevice" + subsystem_name = "sensors" +} diff --git a/frameworks/capi/test/unittest/BUILD.gn b/frameworks/capi/test/unittest/BUILD.gn new file mode 100755 index 0000000..446b236 --- /dev/null +++ b/frameworks/capi/test/unittest/BUILD.gn @@ -0,0 +1,64 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build/test.gni") +import("./../../../../miscdevice.gni") + +module_output_path = "miscdevice/vibrator" + +############################################################################### + +ohos_unittest("VibratorTest") { + module_out_path = module_output_path + + include_dirs = [ + "$SUBSYSTEM_DIR/interfaces/kits/c", + "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator", + "$SUBSYSTEM_DIR/utils/include", + ] + + sources = [ + "$SUBSYSTEM_DIR/frameworks/capi/vibrator.cpp", + "vibrator_test.cpp", + ] + + #configs = [ ":module_private_config" ] + + external_deps = [ + "access_token:libaccesstoken_sdk", + "access_token:libnativetoken", + "access_token:libtoken_setproc", + "c_utils:utils", + "hilog:libhilog", + "init:libbegetutil", + "ipc:ipc_core", + ] + + deps = [ + "$SUBSYSTEM_DIR/frameworks/capi:ndk_vibrator", + "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_interface_native", + "$SUBSYSTEM_DIR/utils:libmiscdevice_utils", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest_main", + "//third_party/googletest:gtest_main", + ] + if (miscdevice_feature_vibrator_custom) { + resource_config_file = + "$SUBSYSTEM_DIR/frameworks/capi/test/unittest/resource/ohos_test.xml" + } +} + +############################################################################### +group("unittest") { + testonly = true + deps = [ ":VibratorTest" ] +} diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/test_128_event.json b/frameworks/capi/test/unittest/resource/json_file/test_128_event.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/test_128_event.json rename to frameworks/capi/test/unittest/resource/json_file/test_128_event.json diff --git a/frameworks/capi/test/unittest/resource/ohos_test.xml b/frameworks/capi/test/unittest/resource/ohos_test.xml new file mode 100755 index 0000000..bcb79b1 --- /dev/null +++ b/frameworks/capi/test/unittest/resource/ohos_test.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/frameworks/capi/test/unittest/vibrator_test.cpp b/frameworks/capi/test/unittest/vibrator_test.cpp new file mode 100755 index 0000000..f965362 --- /dev/null +++ b/frameworks/capi/test/unittest/vibrator_test.cpp @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#include "accesstoken_kit.h" +#include "nativetoken_kit.h" +#include "parameters.h" +#include "token_setproc.h" + +#include "sensors_errors.h" +#include "vibrator.h" + +namespace OHOS { +namespace Sensors { +using namespace testing::ext; +using namespace OHOS::HiviewDFX; +using namespace Security::AccessToken; +using Security::AccessToken::AccessTokenID; + +namespace { +std::string g_deviceType; +constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "NativeVibratorTest" }; +PermissionDef infoManagerTestPermDef_ = { + .permissionName = "ohos.permission.VIBRATE", + .bundleName = "accesstoken_test", + .grantMode = 1, + .label = "label", + .labelId = 1, + .description = "native vibrator test", + .descriptionId = 1, + .availableLevel = APL_NORMAL +}; + +PermissionStateFull infoManagerTestState_ = { + .grantFlags = {1}, + .grantStatus = {PermissionState::PERMISSION_GRANTED}, + .isGeneral = true, + .permissionName = "ohos.permission.VIBRATE", + .resDeviceID = {"local"} +}; + +HapPolicyParams infoManagerTestPolicyPrams_ = { + .apl = APL_NORMAL, + .domain = "test.domain", + .permList = {infoManagerTestPermDef_}, + .permStateList = {infoManagerTestState_} +}; + +HapInfoParams infoManagerTestInfoParms_ = { + .bundleName = "vibratoragent_test", + .userID = 1, + .instIndex = 0, + .appIDDesc = "NativeVibratorTest" +}; +} // namespace + +class NativeVibratorTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp(); + void TearDown(); + +private: + static AccessTokenID tokenID_; +}; + +AccessTokenID NativeVibratorTest::tokenID_ = 0; + +void NativeVibratorTest::SetUpTestCase() +{ + AccessTokenIDEx tokenIdEx = {0}; + tokenIdEx = AccessTokenKit::AllocHapToken(infoManagerTestInfoParms_, infoManagerTestPolicyPrams_); + tokenID_ = tokenIdEx.tokenIdExStruct.tokenID; + ASSERT_NE(0, tokenID_); + ASSERT_EQ(0, SetSelfTokenID(tokenID_)); + g_deviceType = OHOS::system::GetDeviceType(); + MISC_HILOGI("deviceType:%{public}s", g_deviceType.c_str()); +} + +void NativeVibratorTest::TearDownTestCase() +{ + int32_t ret = AccessTokenKit::DeleteToken(tokenID_); + if (tokenID_ != 0) { + ASSERT_EQ(RET_SUCCESS, ret); + } +} + +void NativeVibratorTest::SetUp() +{} + +void NativeVibratorTest::TearDown() +{} + +HWTEST_F(NativeVibratorTest, OH_Vibrator_PlayVibrationTest_001, TestSize.Level1) +{ + CALL_LOG_ENTER; + struct VibrateAttribute attribute; + attribute.usage = USAGE_ALARM; + attribute.id = 123; + int32_t ret = OH_Vibrator_PlayVibration(3000, attribute); + std::this_thread::sleep_for(std::chrono::milliseconds(3000)); + MISC_HILOGI("ret is %d\n\t", ret); + ASSERT_EQ(ret, 0); +} + +HWTEST_F(NativeVibratorTest, OH_Vibrator_PlayVibrationTest_002, TestSize.Level1) +{ + CALL_LOG_ENTER; + struct VibrateAttribute attribute; + attribute.usage = USAGE_UNKNOWN; + int32_t ret = OH_Vibrator_PlayVibration(0, attribute); + MISC_HILOGI("ret is %d\n\t", ret); + ASSERT_NE(ret, 0); +} + +HWTEST_F(NativeVibratorTest, OH_Vibrator_PlayVibrationTest_003, TestSize.Level1) +{ + CALL_LOG_ENTER; + struct VibrateAttribute attribute; + attribute.usage = USAGE_ALARM; + attribute.id = 123; + int32_t ret = OH_Vibrator_PlayVibration(18000, attribute); + MISC_HILOGI("ret is %d\n\t", ret); + std::this_thread::sleep_for(std::chrono::milliseconds(18001)); + ASSERT_EQ(ret, 0); +} + +HWTEST_F(NativeVibratorTest, OH_Vibrator_PlayVibrationTest_004, TestSize.Level1) +{ + CALL_LOG_ENTER; + struct VibrateAttribute attribute; + attribute.usage = USAGE_UNKNOWN; + attribute.id = 124; + int32_t ret = OH_Vibrator_PlayVibration(1800001, attribute); + MISC_HILOGI("ret is %d\n\t", ret); + ASSERT_NE(ret, 0); +} + +HWTEST_F(NativeVibratorTest, OH_Vibrator_PlayVibrationCustom_001, TestSize.Level1) +{ + CALL_LOG_ENTER; + struct VibrateFileDescription fileDescription; + struct VibrateAttribute attribute; + + int32_t ret = OH_Vibrator_PlayVibrationCustom(fileDescription, attribute); + MISC_HILOGI("ret is %d\n\t", ret); + ASSERT_EQ(ret, PARAMETER_ERROR); + + int32_t fd = open("/data/test/vibrator/test_128_event.json", O_RDONLY); + MISC_HILOGD("Test fd:%{public}d", fd); + struct stat64 statbuf = { 0 }; + fileDescription.fd = fd; + fileDescription.offset = 0; + fileDescription.length = statbuf.st_size; + ret = OH_Vibrator_PlayVibrationCustom(fileDescription, attribute); + MISC_HILOGI("ret is %d\n\t", ret); + ASSERT_EQ(ret, PARAMETER_ERROR); + + attribute.id = 0; + attribute.usage = USAGE_UNKNOWN; + ret = OH_Vibrator_PlayVibrationCustom(fileDescription, attribute); + MISC_HILOGI("ret is %d\n\t", ret); + ASSERT_EQ(ret, PARAMETER_ERROR); +} + +HWTEST_F(NativeVibratorTest, OH_Vibrator_PlayVibrationCustom_002, TestSize.Level1) +{ + CALL_LOG_ENTER; + int32_t fd = open("/data/test/vibrator/test_128_event.json", O_RDONLY); + MISC_HILOGD("Test fd:%{public}d", fd); + struct VibrateFileDescription fileDescription; + struct stat64 statbuf = { 0 }; + fileDescription.fd = fd; + fileDescription.offset = 0; + fileDescription.length = statbuf.st_size; + struct VibrateAttribute attribute; + attribute.id = 123; + attribute.usage = USAGE_RING; + + int32_t ret = OH_Vibrator_PlayVibrationCustom(fileDescription, attribute); + MISC_HILOGI("ret is %d\n\t", ret); + ASSERT_EQ(ret, SUCCESS); +} + +} // namespace Sensors +} // namespace OHOS diff --git a/frameworks/capi/vibrator.cpp b/frameworks/capi/vibrator.cpp new file mode 100755 index 0000000..405c59c --- /dev/null +++ b/frameworks/capi/vibrator.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "vibrator.h" +#include "vibrator_type.h" + +#include "vibrator_agent.h" + +#include "miscdevice_log.h" +#include "sensors_errors.h" + +namespace OHOS { +namespace Sensors { +using OHOS::HiviewDFX::HiLog; +using namespace OHOS::HiviewDFX; + +namespace { +constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "NATIVEVIBRATORIF" }; +constexpr int32_t DEFAULT_VIBRATOR_ID = 123; +} // namespace + +int32_t OH_Vibrator_PlayVibration(int32_t duration, struct VibrateAttribute attribute) +{ + if (duration <= 0) { + MISC_HILOGE("duration is invalid, duration is %{public}d", duration); + return PARAMETER_ERROR; + } + //CHKCR(attribute, PARAMETER_ERROR); + if (attribute.id != DEFAULT_VIBRATOR_ID || attribute.usage < USAGE_UNKNOWN || attribute.usage > USAGE_MAX) { + MISC_HILOGE("vibrate attribute value is invalid"); + return PARAMETER_ERROR; + } + if (!SetUsage(attribute.usage)) { + MISC_HILOGE("SetUsage fail"); + return PARAMETER_ERROR; + } + int32_t ret = StartVibratorOnce(duration); + if (ret != OHOS::ERR_OK) { + MISC_HILOGE("start Vibrator failed, ret is %{public}d", ret); + } + return ret; +} + +int32_t OH_Vibrator_PlayVibrationCustom(struct VibrateFileDescription fileDescription, struct VibrateAttribute attribute) +{ + if (attribute.id != DEFAULT_VIBRATOR_ID || attribute.usage < USAGE_UNKNOWN || attribute.usage > USAGE_MAX) { + MISC_HILOGE("vibrate attribute value is invalid"); + return PARAMETER_ERROR; + } + //CHKCR(attribute, PARAMETER_ERROR); + if (!SetUsage(attribute.usage)) { + MISC_HILOGE("SetUsage fail"); + return PARAMETER_ERROR; + } + int32_t ret = PlayVibratorCustom(fileDescription.fd, fileDescription.offset, fileDescription.length); + if (ret != OHOS::ERR_OK) { + MISC_HILOGE("play vibrator custom failed, ret is %{public}d", ret); + } + return ret; +} + +// int32_t OH_Vibrator_PlayVibrationEvent(struct VibrateEffect vibrateEffect, struct VibrateAttribute attribute) +// { +// if (attribute.id != DEFAULT_VIBRATOR_ID || attribute.usage < USAGE_UNKNOWN || attribute.usage > USAGE_MAX) { +// MISC_HILOGE("vibrate attribute value is invalid"); +// return PARAMETER_ERROR; +// } +// //CHKCR(attribute, PARAMETER_ERROR); +// if (!SetUsage(attribute.usage)) { +// MISC_HILOGE("SetUsage fail"); +// return PARAMETER_ERROR; +// } +// int32_t ret = PlayVibrationEvent(vibrateEffect); +// if (ret != OHOS::ERR_OK) { +// MISC_HILOGE("play vibration event, ret is %{public}d", ret); +// } +// return ret; +// } +} +} \ No newline at end of file diff --git a/interfaces/plugin/BUILD.gn b/frameworks/js/napi/BUILD.gn old mode 100644 new mode 100755 similarity index 72% rename from interfaces/plugin/BUILD.gn rename to frameworks/js/napi/BUILD.gn index 16b730d..4eea2a5 --- a/interfaces/plugin/BUILD.gn +++ b/frameworks/js/napi/BUILD.gn @@ -12,12 +12,12 @@ # limitations under the License. import("//build/ohos.gni") -import("./../../miscdevice.gni") +import("./../../../miscdevice.gni") ohos_shared_library("vibrator") { include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/vibrator/include", - "$SUBSYSTEM_DIR/interfaces/plugin/vibrator/include", + "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator", + "$SUBSYSTEM_DIR/frameworks/js/napi/vibrator/include", "$SUBSYSTEM_DIR/utils/include", "//third_party/node/src", ] @@ -27,13 +27,13 @@ ohos_shared_library("vibrator") { ] sources = [ - "$SUBSYSTEM_DIR/interfaces/plugin/vibrator/src/vibrator_js.cpp", - "$SUBSYSTEM_DIR/interfaces/plugin/vibrator/src/vibrator_napi_error.cpp", - "$SUBSYSTEM_DIR/interfaces/plugin/vibrator/src/vibrator_napi_utils.cpp", + "$SUBSYSTEM_DIR/frameworks/js/napi/vibrator/src/vibrator_js.cpp", + "$SUBSYSTEM_DIR/frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp", + "$SUBSYSTEM_DIR/frameworks/js/napi/vibrator/src/vibrator_napi_utils.cpp", ] deps = [ - "$SUBSYSTEM_DIR/interfaces/native/vibrator:vibrator_interface_native", + "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_interface_native", "$SUBSYSTEM_DIR/utils:libmiscdevice_utils", ] diff --git a/interfaces/plugin/vibrator/include/vibrator_napi_error.h b/frameworks/js/napi/vibrator/include/vibrator_napi_error.h similarity index 100% rename from interfaces/plugin/vibrator/include/vibrator_napi_error.h rename to frameworks/js/napi/vibrator/include/vibrator_napi_error.h diff --git a/interfaces/plugin/vibrator/include/vibrator_napi_utils.h b/frameworks/js/napi/vibrator/include/vibrator_napi_utils.h old mode 100644 new mode 100755 similarity index 100% rename from interfaces/plugin/vibrator/include/vibrator_napi_utils.h rename to frameworks/js/napi/vibrator/include/vibrator_napi_utils.h diff --git a/interfaces/plugin/vibrator/src/vibrator_js.cpp b/frameworks/js/napi/vibrator/src/vibrator_js.cpp old mode 100644 new mode 100755 similarity index 100% rename from interfaces/plugin/vibrator/src/vibrator_js.cpp rename to frameworks/js/napi/vibrator/src/vibrator_js.cpp diff --git a/interfaces/plugin/vibrator/src/vibrator_napi_error.cpp b/frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp similarity index 100% rename from interfaces/plugin/vibrator/src/vibrator_napi_error.cpp rename to frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp diff --git a/interfaces/plugin/vibrator/src/vibrator_napi_utils.cpp b/frameworks/js/napi/vibrator/src/vibrator_napi_utils.cpp old mode 100644 new mode 100755 similarity index 98% rename from interfaces/plugin/vibrator/src/vibrator_napi_utils.cpp rename to frameworks/js/napi/vibrator/src/vibrator_napi_utils.cpp index 179f227..db620d3 --- a/interfaces/plugin/vibrator/src/vibrator_napi_utils.cpp +++ b/frameworks/js/napi/vibrator/src/vibrator_napi_utils.cpp @@ -292,8 +292,7 @@ void EmitAsyncCallbackWork(sptr asyncCallbackInfo) }, asyncCallbackInfo.GetRefPtr(), &asyncCallbackInfo->asyncWork); if (status != napi_ok - || napi_queue_async_work_with_qos( - asyncCallbackInfo->env, asyncCallbackInfo->asyncWork, napi_qos_default) != napi_ok) { + || napi_queue_async_work(asyncCallbackInfo->env, asyncCallbackInfo->asyncWork) != napi_ok) { MISC_HILOGE("Create async work fail"); asyncCallbackInfo->DecStrongRef(nullptr); } @@ -343,8 +342,7 @@ void EmitPromiseWork(sptr asyncCallbackInfo) } }, asyncCallbackInfo.GetRefPtr(), &asyncCallbackInfo->asyncWork); if (status != napi_ok - || napi_queue_async_work_with_qos( - asyncCallbackInfo->env, asyncCallbackInfo->asyncWork, napi_qos_default) != napi_ok) { + || napi_queue_async_work(asyncCallbackInfo->env, asyncCallbackInfo->asyncWork) != napi_ok) { MISC_HILOGE("Create async work fail"); asyncCallbackInfo->DecStrongRef(nullptr); } diff --git a/interfaces/plugin/vibrator/test/unittest/BUILD.gn b/frameworks/js/napi/vibrator/test/unittest/BUILD.gn similarity index 95% rename from interfaces/plugin/vibrator/test/unittest/BUILD.gn rename to frameworks/js/napi/vibrator/test/unittest/BUILD.gn index 4029e53..3fd5da9 100755 --- a/interfaces/plugin/vibrator/test/unittest/BUILD.gn +++ b/frameworks/js/napi/vibrator/test/unittest/BUILD.gn @@ -12,7 +12,7 @@ # limitations under the License. import("//build/test.gni") -import("./../../../../../miscdevice.gni") +import("./../../../../../../miscdevice.gni") module_output_path = "miscdevice/interfaces" ohos_js_unittest("VibratorJsTest") { diff --git a/interfaces/plugin/vibrator/test/unittest/ExampleJsunit.test.js b/frameworks/js/napi/vibrator/test/unittest/ExampleJsunit.test.js old mode 100644 new mode 100755 similarity index 100% rename from interfaces/plugin/vibrator/test/unittest/ExampleJsunit.test.js rename to frameworks/js/napi/vibrator/test/unittest/ExampleJsunit.test.js diff --git a/interfaces/plugin/vibrator/test/unittest/config.json b/frameworks/js/napi/vibrator/test/unittest/config.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/plugin/vibrator/test/unittest/config.json rename to frameworks/js/napi/vibrator/test/unittest/config.json diff --git a/interfaces/plugin/vibrator/test/unittest/openharmony_sx.p7b b/frameworks/js/napi/vibrator/test/unittest/openharmony_sx.p7b old mode 100644 new mode 100755 similarity index 100% rename from interfaces/plugin/vibrator/test/unittest/openharmony_sx.p7b rename to frameworks/js/napi/vibrator/test/unittest/openharmony_sx.p7b diff --git a/interfaces/native/light/BUILD.gn b/frameworks/native/light/BUILD.gn similarity index 79% rename from interfaces/native/light/BUILD.gn rename to frameworks/native/light/BUILD.gn index f25dfc3..516a6ba 100755 --- a/interfaces/native/light/BUILD.gn +++ b/frameworks/native/light/BUILD.gn @@ -23,31 +23,31 @@ ohos_ndk_library("liblight_ndk") { ohos_ndk_headers("light_ndk_header") { dest_dir = "$ndk_headers_out_dir/sensors" sources = [ - "include/light_agent.h", - "include/light_agent_type.h", + "$SUBSYSTEM_DIR/interfaces/inner_api/light/light_agent.h", + "$SUBSYSTEM_DIR/interfaces/inner_api/light/light_agent_type.h", ] } config("light_config") { - include_dirs = [ "include" ] + include_dirs = [ "$SUBSYSTEM_DIR/interfaces/inner_api/light" ] } ohos_shared_library("light_interface_native") { output_name = "light_agent" - sources = [ "src/light_agent.cpp" ] + sources = [ "light_agent.cpp" ] include_dirs = [ "$SUBSYSTEM_DIR/frameworks/native/miscdevice/include", - "$SUBSYSTEM_DIR/interfaces/native/light/include", + "$SUBSYSTEM_DIR/interfaces/inner_api/light", "$SUBSYSTEM_DIR/utils/include", ] cflags = [ "-Wno-error=inconsistent-missing-override" ] deps = [ + "$SUBSYSTEM_DIR/frameworks/native/light:liblight_ndk", + "$SUBSYSTEM_DIR/frameworks/native/light:light_ndk_header", "$SUBSYSTEM_DIR/frameworks/native/miscdevice:liblight_native", - "$SUBSYSTEM_DIR/interfaces/native/light:liblight_ndk", - "$SUBSYSTEM_DIR/interfaces/native/light:light_ndk_header", ] external_deps = [ diff --git a/interfaces/native/light/liblight.json b/frameworks/native/light/liblight.json similarity index 100% rename from interfaces/native/light/liblight.json rename to frameworks/native/light/liblight.json diff --git a/interfaces/native/light/src/light_agent.cpp b/frameworks/native/light/light_agent.cpp similarity index 100% rename from interfaces/native/light/src/light_agent.cpp rename to frameworks/native/light/light_agent.cpp diff --git a/interfaces/native/light/test/BUILD.gn b/frameworks/native/light/test/BUILD.gn similarity index 90% rename from interfaces/native/light/test/BUILD.gn rename to frameworks/native/light/test/BUILD.gn index c974322..8b9cf8f 100755 --- a/interfaces/native/light/test/BUILD.gn +++ b/frameworks/native/light/test/BUILD.gn @@ -20,12 +20,12 @@ ohos_unittest("LightAgentTest") { sources = [ "unittest/light_agent_test.cpp" ] include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/light/include", + "$SUBSYSTEM_DIR/interfaces/inner_api/light", "$SUBSYSTEM_DIR/utils/include", ] deps = [ - "$SUBSYSTEM_DIR/interfaces/native/light:light_interface_native", + "$SUBSYSTEM_DIR/frameworks/native/light:light_interface_native", "$SUBSYSTEM_DIR/utils:libmiscdevice_utils", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", diff --git a/interfaces/native/light/test/fuzztest/BUILD.gn b/frameworks/native/light/test/fuzztest/BUILD.gn similarity index 100% rename from interfaces/native/light/test/fuzztest/BUILD.gn rename to frameworks/native/light/test/fuzztest/BUILD.gn diff --git a/interfaces/native/light/test/fuzztest/startlight_fuzzer/BUILD.gn b/frameworks/native/light/test/fuzztest/startlight_fuzzer/BUILD.gn similarity index 82% rename from interfaces/native/light/test/fuzztest/startlight_fuzzer/BUILD.gn rename to frameworks/native/light/test/fuzztest/startlight_fuzzer/BUILD.gn index cfed654..e81079f 100755 --- a/interfaces/native/light/test/fuzztest/startlight_fuzzer/BUILD.gn +++ b/frameworks/native/light/test/fuzztest/startlight_fuzzer/BUILD.gn @@ -20,11 +20,11 @@ ohos_fuzztest("StartLightFuzzTest") { module_out_path = "sensors/light" fuzz_config_file = - "$SUBSYSTEM_DIR/interfaces/native/light/test/fuzztest/startlight_fuzzer" + "$SUBSYSTEM_DIR/frameworks/native/light/test/fuzztest/startlight_fuzzer" include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/light/test/fuzztest/startlight_fuzzer", - "$SUBSYSTEM_DIR/interfaces/native/light/include", + "$SUBSYSTEM_DIR/frameworks/native/light/test/fuzztest/startlight_fuzzer", + "$SUBSYSTEM_DIR/interfaces/inner_api/light", ] cflags = [ @@ -36,7 +36,7 @@ ohos_fuzztest("StartLightFuzzTest") { sources = [ "startlight_fuzzer.cpp" ] - deps = [ "$SUBSYSTEM_DIR/interfaces/native/light:light_interface_native" ] + deps = [ "$SUBSYSTEM_DIR/frameworks/native/light:light_interface_native" ] external_deps = [ "c_utils:utils" ] } diff --git a/interfaces/native/light/test/fuzztest/startlight_fuzzer/corpus/init b/frameworks/native/light/test/fuzztest/startlight_fuzzer/corpus/init similarity index 100% rename from interfaces/native/light/test/fuzztest/startlight_fuzzer/corpus/init rename to frameworks/native/light/test/fuzztest/startlight_fuzzer/corpus/init diff --git a/interfaces/native/light/test/fuzztest/startlight_fuzzer/project.xml b/frameworks/native/light/test/fuzztest/startlight_fuzzer/project.xml similarity index 100% rename from interfaces/native/light/test/fuzztest/startlight_fuzzer/project.xml rename to frameworks/native/light/test/fuzztest/startlight_fuzzer/project.xml diff --git a/interfaces/native/light/test/fuzztest/startlight_fuzzer/startlight_fuzzer.cpp b/frameworks/native/light/test/fuzztest/startlight_fuzzer/startlight_fuzzer.cpp similarity index 100% rename from interfaces/native/light/test/fuzztest/startlight_fuzzer/startlight_fuzzer.cpp rename to frameworks/native/light/test/fuzztest/startlight_fuzzer/startlight_fuzzer.cpp diff --git a/interfaces/native/light/test/fuzztest/startlight_fuzzer/startlight_fuzzer.h b/frameworks/native/light/test/fuzztest/startlight_fuzzer/startlight_fuzzer.h similarity index 100% rename from interfaces/native/light/test/fuzztest/startlight_fuzzer/startlight_fuzzer.h rename to frameworks/native/light/test/fuzztest/startlight_fuzzer/startlight_fuzzer.h diff --git a/interfaces/native/light/test/fuzztest/stoplight_fuzzer/BUILD.gn b/frameworks/native/light/test/fuzztest/stoplight_fuzzer/BUILD.gn similarity index 82% rename from interfaces/native/light/test/fuzztest/stoplight_fuzzer/BUILD.gn rename to frameworks/native/light/test/fuzztest/stoplight_fuzzer/BUILD.gn index 6efbe9d..3c2de49 100755 --- a/interfaces/native/light/test/fuzztest/stoplight_fuzzer/BUILD.gn +++ b/frameworks/native/light/test/fuzztest/stoplight_fuzzer/BUILD.gn @@ -20,11 +20,11 @@ ohos_fuzztest("StopLightFuzzTest") { module_out_path = "sensors/light" fuzz_config_file = - "$SUBSYSTEM_DIR/interfaces/native/light/test/fuzztest/stoplight_fuzzer" + "$SUBSYSTEM_DIR/frameworks/native/light/test/fuzztest/stoplight_fuzzer" include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/light/test/fuzztest/stoplight_fuzzer", - "$SUBSYSTEM_DIR/interfaces/native/light/include", + "$SUBSYSTEM_DIR/frameworks/native/light/test/fuzztest/stoplight_fuzzer", + "$SUBSYSTEM_DIR/interfaces/inner_api/light", ] cflags = [ @@ -36,7 +36,7 @@ ohos_fuzztest("StopLightFuzzTest") { sources = [ "stoplight_fuzzer.cpp" ] - deps = [ "$SUBSYSTEM_DIR/interfaces/native/light:light_interface_native" ] + deps = [ "$SUBSYSTEM_DIR/frameworks/native/light:light_interface_native" ] external_deps = [ "c_utils:utils" ] } diff --git a/interfaces/native/light/test/fuzztest/stoplight_fuzzer/corpus/init b/frameworks/native/light/test/fuzztest/stoplight_fuzzer/corpus/init similarity index 100% rename from interfaces/native/light/test/fuzztest/stoplight_fuzzer/corpus/init rename to frameworks/native/light/test/fuzztest/stoplight_fuzzer/corpus/init diff --git a/interfaces/native/light/test/fuzztest/stoplight_fuzzer/project.xml b/frameworks/native/light/test/fuzztest/stoplight_fuzzer/project.xml similarity index 100% rename from interfaces/native/light/test/fuzztest/stoplight_fuzzer/project.xml rename to frameworks/native/light/test/fuzztest/stoplight_fuzzer/project.xml diff --git a/interfaces/native/light/test/fuzztest/stoplight_fuzzer/stoplight_fuzzer.cpp b/frameworks/native/light/test/fuzztest/stoplight_fuzzer/stoplight_fuzzer.cpp similarity index 100% rename from interfaces/native/light/test/fuzztest/stoplight_fuzzer/stoplight_fuzzer.cpp rename to frameworks/native/light/test/fuzztest/stoplight_fuzzer/stoplight_fuzzer.cpp diff --git a/interfaces/native/light/test/fuzztest/stoplight_fuzzer/stoplight_fuzzer.h b/frameworks/native/light/test/fuzztest/stoplight_fuzzer/stoplight_fuzzer.h similarity index 100% rename from interfaces/native/light/test/fuzztest/stoplight_fuzzer/stoplight_fuzzer.h rename to frameworks/native/light/test/fuzztest/stoplight_fuzzer/stoplight_fuzzer.h diff --git a/interfaces/native/light/test/unittest/light_agent_test.cpp b/frameworks/native/light/test/unittest/light_agent_test.cpp similarity index 100% rename from interfaces/native/light/test/unittest/light_agent_test.cpp rename to frameworks/native/light/test/unittest/light_agent_test.cpp diff --git a/frameworks/native/miscdevice/BUILD.gn b/frameworks/native/miscdevice/BUILD.gn index ac30837..837e2a2 100644 --- a/frameworks/native/miscdevice/BUILD.gn +++ b/frameworks/native/miscdevice/BUILD.gn @@ -22,14 +22,14 @@ ohos_shared_library("liblight_native") { include_dirs = [ "$SUBSYSTEM_DIR/frameworks/native/miscdevice/include", - "$SUBSYSTEM_DIR/interfaces/native/light/include", + "$SUBSYSTEM_DIR/interfaces/inner_api/light", "$SUBSYSTEM_DIR/utils/include", ] cflags = [ "-fstack-protector-all" ] deps = [ - "$SUBSYSTEM_DIR/interfaces/native/light:light_ndk_header", + "$SUBSYSTEM_DIR/frameworks/native/light:light_ndk_header", "$SUBSYSTEM_DIR/utils:libmiscdevice_utils", ] @@ -56,7 +56,7 @@ ohos_shared_library("libvibrator_native") { include_dirs = [ "$SUBSYSTEM_DIR/frameworks/native/miscdevice/include", - "$SUBSYSTEM_DIR/interfaces/native/light/include", + "$SUBSYSTEM_DIR/interfaces/inner_api/light", "$SUBSYSTEM_DIR/utils/include", ] diff --git a/frameworks/native/miscdevice/include/i_miscdevice_service.h b/frameworks/native/miscdevice/include/i_miscdevice_service.h index 7018033..a94a548 100755 --- a/frameworks/native/miscdevice/include/i_miscdevice_service.h +++ b/frameworks/native/miscdevice/include/i_miscdevice_service.h @@ -48,4 +48,4 @@ public: }; } // namespace Sensors } // namespace OHOS -#endif // I_MISCDEVICE_SERVICE_H +#endif // I_MISCDEVICE_SERVICE_H \ No newline at end of file diff --git a/frameworks/native/miscdevice/include/light_client.h b/frameworks/native/miscdevice/include/light_client.h index 2354556..1ddf2f7 100755 --- a/frameworks/native/miscdevice/include/light_client.h +++ b/frameworks/native/miscdevice/include/light_client.h @@ -49,4 +49,4 @@ private: }; } // namespace Sensors } // namespace OHOS -#endif // LIGHT_CLIENT_H +#endif // LIGHT_CLIENT_H \ No newline at end of file diff --git a/frameworks/native/miscdevice/include/miscdevice_service_proxy.h b/frameworks/native/miscdevice/include/miscdevice_service_proxy.h index 6384f13..205fde0 100755 --- a/frameworks/native/miscdevice/include/miscdevice_service_proxy.h +++ b/frameworks/native/miscdevice/include/miscdevice_service_proxy.h @@ -46,4 +46,4 @@ private: }; } // namespace Sensors } // namespace OHOS -#endif // MISCDEVICE_SERVICE_PROXY_H +#endif // MISCDEVICE_SERVICE_PROXY_H \ No newline at end of file diff --git a/frameworks/native/miscdevice/include/sensors_ipc_interface_code.h b/frameworks/native/miscdevice/include/sensors_ipc_interface_code.h index 4bb2d16..431e9ad 100644 --- a/frameworks/native/miscdevice/include/sensors_ipc_interface_code.h +++ b/frameworks/native/miscdevice/include/sensors_ipc_interface_code.h @@ -34,4 +34,4 @@ enum class MiscdeviceInterfaceCode { }; } // namespace Sensors } // namespace OHOS -#endif // SENSORS_IPC_INTERFACE_CODE_H +#endif // SENSORS_IPC_INTERFACE_CODE_H \ No newline at end of file diff --git a/frameworks/native/miscdevice/include/vibrator_service_client.h b/frameworks/native/miscdevice/include/vibrator_service_client.h index 687eb7b..4536919 100755 --- a/frameworks/native/miscdevice/include/vibrator_service_client.h +++ b/frameworks/native/miscdevice/include/vibrator_service_client.h @@ -46,4 +46,4 @@ private: }; } // namespace Sensors } // namespace OHOS -#endif // VIBRATOR_SERVICE_CLIENT_H +#endif // VIBRATOR_SERVICE_CLIENT_H \ No newline at end of file diff --git a/frameworks/native/miscdevice/src/light_client.cpp b/frameworks/native/miscdevice/src/light_client.cpp index 5fcd110..17d869f 100755 --- a/frameworks/native/miscdevice/src/light_client.cpp +++ b/frameworks/native/miscdevice/src/light_client.cpp @@ -197,4 +197,4 @@ int32_t LightClient::ConvertLightInfos() return SUCCESS; } } // namespace Sensors -} // namespace OHOS +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/native/miscdevice/src/miscdevice_service_proxy.cpp b/frameworks/native/miscdevice/src/miscdevice_service_proxy.cpp index 2c0f4dd..c5d4b14 100644 --- a/frameworks/native/miscdevice/src/miscdevice_service_proxy.cpp +++ b/frameworks/native/miscdevice/src/miscdevice_service_proxy.cpp @@ -333,4 +333,4 @@ int32_t MiscdeviceServiceProxy::TurnOff(int32_t lightId) return ret; } } // namespace Sensors -} // namespace OHOS +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/native/miscdevice/src/vibrator_service_client.cpp b/frameworks/native/miscdevice/src/vibrator_service_client.cpp index ea091b5..4b7b121 100644 --- a/frameworks/native/miscdevice/src/vibrator_service_client.cpp +++ b/frameworks/native/miscdevice/src/vibrator_service_client.cpp @@ -205,4 +205,4 @@ void VibratorServiceClient::ProcessDeathObserver(const wptr &obje } } } // namespace Sensors -} // namespace OHOS +} // namespace OHOS \ No newline at end of file diff --git a/interfaces/native/vibrator/BUILD.gn b/frameworks/native/vibrator/BUILD.gn old mode 100644 new mode 100755 similarity index 76% rename from interfaces/native/vibrator/BUILD.gn rename to frameworks/native/vibrator/BUILD.gn index 293b6e9..b2a815c --- a/interfaces/native/vibrator/BUILD.gn +++ b/frameworks/native/vibrator/BUILD.gn @@ -23,24 +23,25 @@ ohos_ndk_library("libvibrator_ndk") { ohos_ndk_headers("vibrator_ndk_header") { dest_dir = "$ndk_headers_out_dir/sensors" sources = [ - "include/vibrator_agent.h", - "include/vibrator_agent_type.h", + "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator/vibrator_agent.h", + "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator/vibrator_agent_type.h", ] } config("vibrator_config") { - include_dirs = [ "include" ] + include_dirs = [ "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator" ] } ohos_shared_library("vibrator_interface_native") { output_name = "vibrator_agent" - sources = [ "src/vibrator_agent.cpp" ] + sources = [ "vibrator_agent.cpp" ] include_dirs = [ "$SUBSYSTEM_DIR/frameworks/native/miscdevice/include", - "$SUBSYSTEM_DIR/interfaces/native/light/include", - "$SUBSYSTEM_DIR/interfaces/native/vibrator/include", + "$SUBSYSTEM_DIR/interfaces/inner_api/light", + "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator", "$SUBSYSTEM_DIR/utils/include", + "$SUBSYSTEM_DIR/interfaces/kits/c", ] defines = miscdevice_default_defines @@ -48,9 +49,9 @@ ohos_shared_library("vibrator_interface_native") { cflags = [ "-Wno-error=inconsistent-missing-override" ] deps = [ + "$SUBSYSTEM_DIR/frameworks/native/light:light_ndk_header", "$SUBSYSTEM_DIR/frameworks/native/miscdevice:libvibrator_native", - "$SUBSYSTEM_DIR/interfaces/native/light:light_ndk_header", - "$SUBSYSTEM_DIR/interfaces/native/vibrator:libvibrator_ndk", + "$SUBSYSTEM_DIR/frameworks/native/vibrator:libvibrator_ndk", ] external_deps = [ diff --git a/interfaces/native/vibrator/libvibrator.json b/frameworks/native/vibrator/libvibrator.json similarity index 100% rename from interfaces/native/vibrator/libvibrator.json rename to frameworks/native/vibrator/libvibrator.json diff --git a/interfaces/native/vibrator/test/BUILD.gn b/frameworks/native/vibrator/test/BUILD.gn similarity index 86% rename from interfaces/native/vibrator/test/BUILD.gn rename to frameworks/native/vibrator/test/BUILD.gn index ad59846..9263ddb 100755 --- a/interfaces/native/vibrator/test/BUILD.gn +++ b/frameworks/native/vibrator/test/BUILD.gn @@ -20,12 +20,13 @@ ohos_unittest("VibratorAgentTest") { sources = [ "unittest/vibrator_agent_test.cpp" ] include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/vibrator/include", + "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator", "$SUBSYSTEM_DIR/utils/include", + "$SUBSYSTEM_DIR/interfaces/kits/c", ] deps = [ - "$SUBSYSTEM_DIR/interfaces/native/vibrator:vibrator_target", + "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_target", "$SUBSYSTEM_DIR/utils:libmiscdevice_utils", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", @@ -41,7 +42,7 @@ ohos_unittest("VibratorAgentTest") { ] if (miscdevice_feature_vibrator_custom) { - resource_config_file = "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/unittest/resource/ohos_test.xml" + resource_config_file = "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/unittest/resource/ohos_test.xml" } } diff --git a/interfaces/native/vibrator/test/fuzztest/BUILD.gn b/frameworks/native/vibrator/test/fuzztest/BUILD.gn similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/BUILD.gn rename to frameworks/native/vibrator/test/fuzztest/BUILD.gn diff --git a/interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer/BUILD.gn b/frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer/BUILD.gn old mode 100644 new mode 100755 similarity index 83% rename from interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer/BUILD.gn rename to frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer/BUILD.gn index 5e18ad2..0d5f09b --- a/interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer/BUILD.gn +++ b/frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer/BUILD.gn @@ -19,11 +19,11 @@ import("./../../../../../../miscdevice.gni") ohos_fuzztest("IsSupportEffectFuzzTest") { module_out_path = "sensors/vibrator" - fuzz_config_file = "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer" + fuzz_config_file = "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer" include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/vibrator/include", - "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer", + "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator", + "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer", ] cflags = [ @@ -36,7 +36,7 @@ ohos_fuzztest("IsSupportEffectFuzzTest") { sources = [ "issupporteffect_fuzzer.cpp" ] deps = - [ "$SUBSYSTEM_DIR/interfaces/native/vibrator:vibrator_interface_native" ] + [ "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_interface_native" ] external_deps = [ "c_utils:utils" ] } diff --git a/interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer/corpus/init b/frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer/corpus/init old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer/corpus/init rename to frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer/corpus/init diff --git a/interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer/issupporteffect_fuzzer.cpp b/frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer/issupporteffect_fuzzer.cpp old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer/issupporteffect_fuzzer.cpp rename to frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer/issupporteffect_fuzzer.cpp diff --git a/interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer/issupporteffect_fuzzer.h b/frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer/issupporteffect_fuzzer.h old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer/issupporteffect_fuzzer.h rename to frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer/issupporteffect_fuzzer.h diff --git a/interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer/project.xml b/frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer/project.xml old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/issupporteffect_fuzzer/project.xml rename to frameworks/native/vibrator/test/fuzztest/issupporteffect_fuzzer/project.xml diff --git a/interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/BUILD.gn b/frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/BUILD.gn old mode 100644 new mode 100755 similarity index 83% rename from interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/BUILD.gn rename to frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/BUILD.gn index a2bd702..dcf2fb7 --- a/interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/BUILD.gn +++ b/frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/BUILD.gn @@ -19,11 +19,11 @@ import("./../../../../../../miscdevice.gni") ohos_fuzztest("PlayVibratorCustomFuzzTest") { module_out_path = "sensors/vibrator" - fuzz_config_file = "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer" + fuzz_config_file = "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer" include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/vibrator/include", - "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer", + "$SUBSYSTEM_DIR/frameworks/inner_api/vibrator", + "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer", ] cflags = [ @@ -36,7 +36,7 @@ ohos_fuzztest("PlayVibratorCustomFuzzTest") { sources = [ "playvibratorcustom_fuzzer.cpp" ] deps = - [ "$SUBSYSTEM_DIR/interfaces/native/vibrator:vibrator_interface_native" ] + [ "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_interface_native" ] external_deps = [ "c_utils:utils" ] } diff --git a/interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/corpus/init b/frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/corpus/init old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/corpus/init rename to frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/corpus/init diff --git a/interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/playvibratorcustom_fuzzer.cpp b/frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/playvibratorcustom_fuzzer.cpp old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/playvibratorcustom_fuzzer.cpp rename to frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/playvibratorcustom_fuzzer.cpp diff --git a/interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/playvibratorcustom_fuzzer.h b/frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/playvibratorcustom_fuzzer.h old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/playvibratorcustom_fuzzer.h rename to frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/playvibratorcustom_fuzzer.h diff --git a/interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/project.xml b/frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/project.xml old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/project.xml rename to frameworks/native/vibrator/test/fuzztest/playvibratorcustom_fuzzer/project.xml diff --git a/interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer/BUILD.gn b/frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer/BUILD.gn old mode 100644 new mode 100755 similarity index 82% rename from interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer/BUILD.gn rename to frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer/BUILD.gn index 46769dd..2b12901 --- a/interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer/BUILD.gn +++ b/frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer/BUILD.gn @@ -19,11 +19,11 @@ import("./../../../../../../miscdevice.gni") ohos_fuzztest("SetLoopCountFuzzTest") { module_out_path = "sensors/vibrator" - fuzz_config_file = "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer" + fuzz_config_file = "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer" include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/vibrator/include", - "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer", + "$SUBSYSTEM_DIR/frameworks/native/vibrator", + "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer", ] cflags = [ @@ -36,7 +36,7 @@ ohos_fuzztest("SetLoopCountFuzzTest") { sources = [ "setloopcount_fuzzer.cpp" ] deps = - [ "$SUBSYSTEM_DIR/interfaces/native/vibrator:vibrator_interface_native" ] + [ "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_interface_native" ] } group("fuzztest") { diff --git a/interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer/corpus/init b/frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer/corpus/init old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer/corpus/init rename to frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer/corpus/init diff --git a/interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer/project.xml b/frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer/project.xml old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer/project.xml rename to frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer/project.xml diff --git a/interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer/setloopcount_fuzzer.cpp b/frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer/setloopcount_fuzzer.cpp old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer/setloopcount_fuzzer.cpp rename to frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer/setloopcount_fuzzer.cpp diff --git a/interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer/setloopcount_fuzzer.h b/frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer/setloopcount_fuzzer.h old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/setloopcount_fuzzer/setloopcount_fuzzer.h rename to frameworks/native/vibrator/test/fuzztest/setloopcount_fuzzer/setloopcount_fuzzer.h diff --git a/interfaces/native/vibrator/test/fuzztest/setusage_fuzzer/BUILD.gn b/frameworks/native/vibrator/test/fuzztest/setusage_fuzzer/BUILD.gn old mode 100644 new mode 100755 similarity index 82% rename from interfaces/native/vibrator/test/fuzztest/setusage_fuzzer/BUILD.gn rename to frameworks/native/vibrator/test/fuzztest/setusage_fuzzer/BUILD.gn index dff11de..2d25c15 --- a/interfaces/native/vibrator/test/fuzztest/setusage_fuzzer/BUILD.gn +++ b/frameworks/native/vibrator/test/fuzztest/setusage_fuzzer/BUILD.gn @@ -20,11 +20,11 @@ ohos_fuzztest("SetUsageFuzzTest") { module_out_path = "sensors/vibrator" fuzz_config_file = - "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/setusage_fuzzer" + "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/setusage_fuzzer" include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/vibrator/include", - "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/setusage_fuzzer", + "$SUBSYSTEM_DIR/frameworks/native/vibrator", + "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/setusage_fuzzer", ] cflags = [ @@ -37,7 +37,7 @@ ohos_fuzztest("SetUsageFuzzTest") { sources = [ "setusage_fuzzer.cpp" ] deps = - [ "$SUBSYSTEM_DIR/interfaces/native/vibrator:vibrator_interface_native" ] + [ "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_interface_native" ] } group("fuzztest") { diff --git a/interfaces/native/vibrator/test/fuzztest/setusage_fuzzer/corpus/init b/frameworks/native/vibrator/test/fuzztest/setusage_fuzzer/corpus/init old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/setusage_fuzzer/corpus/init rename to frameworks/native/vibrator/test/fuzztest/setusage_fuzzer/corpus/init diff --git a/interfaces/native/vibrator/test/fuzztest/setusage_fuzzer/project.xml b/frameworks/native/vibrator/test/fuzztest/setusage_fuzzer/project.xml old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/setusage_fuzzer/project.xml rename to frameworks/native/vibrator/test/fuzztest/setusage_fuzzer/project.xml diff --git a/interfaces/native/vibrator/test/fuzztest/setusage_fuzzer/setusage_fuzzer.cpp b/frameworks/native/vibrator/test/fuzztest/setusage_fuzzer/setusage_fuzzer.cpp old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/setusage_fuzzer/setusage_fuzzer.cpp rename to frameworks/native/vibrator/test/fuzztest/setusage_fuzzer/setusage_fuzzer.cpp diff --git a/interfaces/native/vibrator/test/fuzztest/setusage_fuzzer/setusage_fuzzer.h b/frameworks/native/vibrator/test/fuzztest/setusage_fuzzer/setusage_fuzzer.h old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/setusage_fuzzer/setusage_fuzzer.h rename to frameworks/native/vibrator/test/fuzztest/setusage_fuzzer/setusage_fuzzer.h diff --git a/interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer/BUILD.gn b/frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer/BUILD.gn similarity index 82% rename from interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer/BUILD.gn rename to frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer/BUILD.gn index fa03310..6771bec 100755 --- a/interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer/BUILD.gn +++ b/frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer/BUILD.gn @@ -19,11 +19,11 @@ import("./../../../../../../miscdevice.gni") ohos_fuzztest("StartVibratorFuzzTest") { module_out_path = "sensors/vibrator" - fuzz_config_file = "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer" + fuzz_config_file = "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer" include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/vibrator/include", - "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer", + "$SUBSYSTEM_DIR/frameworks/native/vibrator", + "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer", ] cflags = [ @@ -36,7 +36,7 @@ ohos_fuzztest("StartVibratorFuzzTest") { sources = [ "startvibrator_fuzzer.cpp" ] deps = - [ "$SUBSYSTEM_DIR/interfaces/native/vibrator:vibrator_interface_native" ] + [ "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_interface_native" ] } group("fuzztest") { diff --git a/interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer/corpus/init b/frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer/corpus/init similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer/corpus/init rename to frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer/corpus/init diff --git a/interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer/project.xml b/frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer/project.xml similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer/project.xml rename to frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer/project.xml diff --git a/interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer/startvibrator_fuzzer.cpp b/frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer/startvibrator_fuzzer.cpp old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer/startvibrator_fuzzer.cpp rename to frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer/startvibrator_fuzzer.cpp diff --git a/interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer/startvibrator_fuzzer.h b/frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer/startvibrator_fuzzer.h similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/startvibrator_fuzzer/startvibrator_fuzzer.h rename to frameworks/native/vibrator/test/fuzztest/startvibrator_fuzzer/startvibrator_fuzzer.h diff --git a/interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/BUILD.gn b/frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/BUILD.gn similarity index 82% rename from interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/BUILD.gn rename to frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/BUILD.gn index a554485..79ce065 100755 --- a/interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/BUILD.gn +++ b/frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/BUILD.gn @@ -19,11 +19,11 @@ import("./../../../../../../miscdevice.gni") ohos_fuzztest("StartVibratorOnceFuzzTest") { module_out_path = "sensors/vibrator" - fuzz_config_file = "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer" + fuzz_config_file = "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer" include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/vibrator/include", - "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer", + "$SUBSYSTEM_DIR/frameworks/native/vibrator", + "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer", ] cflags = [ @@ -36,7 +36,7 @@ ohos_fuzztest("StartVibratorOnceFuzzTest") { sources = [ "startvibratoronce_fuzzer.cpp" ] deps = - [ "$SUBSYSTEM_DIR/interfaces/native/vibrator:vibrator_interface_native" ] + [ "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_interface_native" ] } group("fuzztest") { diff --git a/interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/corpus/init b/frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/corpus/init similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/corpus/init rename to frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/corpus/init diff --git a/interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/project.xml b/frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/project.xml similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/project.xml rename to frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/project.xml diff --git a/interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/startvibratoronce_fuzzer.cpp b/frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/startvibratoronce_fuzzer.cpp old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/startvibratoronce_fuzzer.cpp rename to frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/startvibratoronce_fuzzer.cpp diff --git a/interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/startvibratoronce_fuzzer.h b/frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/startvibratoronce_fuzzer.h similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/startvibratoronce_fuzzer.h rename to frameworks/native/vibrator/test/fuzztest/startvibratoronce_fuzzer/startvibratoronce_fuzzer.h diff --git a/interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer/BUILD.gn b/frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer/BUILD.gn similarity index 82% rename from interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer/BUILD.gn rename to frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer/BUILD.gn index 91e84cd..bcb9c42 100755 --- a/interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer/BUILD.gn +++ b/frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer/BUILD.gn @@ -19,11 +19,11 @@ import("./../../../../../../miscdevice.gni") ohos_fuzztest("StopVibratorFuzzTest") { module_out_path = "sensors/vibrator" - fuzz_config_file = "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer" + fuzz_config_file = "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer" include_dirs = [ - "$SUBSYSTEM_DIR/interfaces/native/vibrator/include", - "$SUBSYSTEM_DIR/interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer", + "$SUBSYSTEM_DIR/frameworks/native/vibrator", + "$SUBSYSTEM_DIR/frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer", ] cflags = [ @@ -36,7 +36,7 @@ ohos_fuzztest("StopVibratorFuzzTest") { sources = [ "stopvibrator_fuzzer.cpp" ] deps = - [ "$SUBSYSTEM_DIR/interfaces/native/vibrator:vibrator_interface_native" ] + [ "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_interface_native" ] } group("fuzztest") { diff --git a/interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer/corpus/init b/frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer/corpus/init similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer/corpus/init rename to frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer/corpus/init diff --git a/interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer/project.xml b/frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer/project.xml similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer/project.xml rename to frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer/project.xml diff --git a/interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer/stopvibrator_fuzzer.cpp b/frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer/stopvibrator_fuzzer.cpp old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer/stopvibrator_fuzzer.cpp rename to frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer/stopvibrator_fuzzer.cpp diff --git a/interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer/stopvibrator_fuzzer.h b/frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer/stopvibrator_fuzzer.h similarity index 100% rename from interfaces/native/vibrator/test/fuzztest/stopvibrator_fuzzer/stopvibrator_fuzzer.h rename to frameworks/native/vibrator/test/fuzztest/stopvibrator_fuzzer/stopvibrator_fuzzer.h diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/coin_drop.json b/frameworks/native/vibrator/test/unittest/resource/json_file/coin_drop.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/coin_drop.json rename to frameworks/native/vibrator/test/unittest/resource/json_file/coin_drop.json diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/on_carpet.json b/frameworks/native/vibrator/test/unittest/resource/json_file/on_carpet.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/on_carpet.json rename to frameworks/native/vibrator/test/unittest/resource/json_file/on_carpet.json diff --git a/frameworks/native/vibrator/test/unittest/resource/json_file/test_128_event.json b/frameworks/native/vibrator/test/unittest/resource/json_file/test_128_event.json new file mode 100755 index 0000000..0334faf --- /dev/null +++ b/frameworks/native/vibrator/test/unittest/resource/json_file/test_128_event.json @@ -0,0 +1,1377 @@ +{ + "MetaData": { + "Create": "2023-01-09", + "Description": "a haptic testcase", + "Version": 1.0, + "ChannelNumber": 1 + }, + "Channels": [ + { + "Parameters": { + "Index": 1 + }, + "Pattern": [ + { + "Event": { + "Type": "continuous", + "StartTime": 0, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 100, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 150, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 200, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 250, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 300, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 350, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 400, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 450, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 500, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 550, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 600, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 650, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 700, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 750, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 800, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 850, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 900, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 950, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1000, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1050, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 1100, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1150, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1200, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 1250, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1300, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 1350, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1400, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1450, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 1500, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1550, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1600, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 1650, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1700, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 1750, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1800, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1850, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 1900, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 1950, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2000, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 2050, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2100, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 2150, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2200, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2250, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 2300, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2350, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2400, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 2450, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2500, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 2550, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2600, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2650, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 2700, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2750, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2800, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 2850, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 2900, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 2950, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3000, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3050, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 3100, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3150, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3200, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 3250, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3300, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 3350, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3400, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3450, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 3500, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3550, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3600, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 3650, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3700, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 3750, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3800, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3850, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 3900, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 3950, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4000, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 4050, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4100, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 4150, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4200, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4250, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 4300, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4350, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4400, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 4450, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4500, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 4550, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4600, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4650, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 4700, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4750, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4800, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 4850, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 4900, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 4950, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5000, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5050, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 5100, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5150, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5200, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 5250, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5300, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 5350, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5400, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5450, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 5500, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5550, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5600, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 5650, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5700, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 5750, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5800, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5850, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 5900, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 5950, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 6000, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 6050, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 6100, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 6150, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 6200, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 6250, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "transient", + "StartTime": 6300, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + }, + { + "Event": { + "Type": "continuous", + "StartTime": 6350, + "Duration": 50, + "Parameters": { + "Intensity": 100, + "Frequency": 50 + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/test_129_event.json b/frameworks/native/vibrator/test/unittest/resource/json_file/test_129_event.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/test_129_event.json rename to frameworks/native/vibrator/test/unittest/resource/json_file/test_129_event.json diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/test_big_file_size.json b/frameworks/native/vibrator/test/unittest/resource/json_file/test_big_file_size.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/test_big_file_size.json rename to frameworks/native/vibrator/test/unittest/resource/json_file/test_big_file_size.json diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/test_event_overlap_1.json b/frameworks/native/vibrator/test/unittest/resource/json_file/test_event_overlap_1.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/test_event_overlap_1.json rename to frameworks/native/vibrator/test/unittest/resource/json_file/test_event_overlap_1.json diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/test_event_overlap_2.json b/frameworks/native/vibrator/test/unittest/resource/json_file/test_event_overlap_2.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/test_event_overlap_2.json rename to frameworks/native/vibrator/test/unittest/resource/json_file/test_event_overlap_2.json diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/test_invalid_duration.json b/frameworks/native/vibrator/test/unittest/resource/json_file/test_invalid_duration.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/test_invalid_duration.json rename to frameworks/native/vibrator/test/unittest/resource/json_file/test_invalid_duration.json diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/test_invalid_frequency.json b/frameworks/native/vibrator/test/unittest/resource/json_file/test_invalid_frequency.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/test_invalid_frequency.json rename to frameworks/native/vibrator/test/unittest/resource/json_file/test_invalid_frequency.json diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/test_invalid_intensity.json b/frameworks/native/vibrator/test/unittest/resource/json_file/test_invalid_intensity.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/test_invalid_intensity.json rename to frameworks/native/vibrator/test/unittest/resource/json_file/test_invalid_intensity.json diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/test_invalid_startTime.json b/frameworks/native/vibrator/test/unittest/resource/json_file/test_invalid_startTime.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/test_invalid_startTime.json rename to frameworks/native/vibrator/test/unittest/resource/json_file/test_invalid_startTime.json diff --git a/interfaces/native/vibrator/test/unittest/resource/json_file/test_invalid_type.json b/frameworks/native/vibrator/test/unittest/resource/json_file/test_invalid_type.json old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/json_file/test_invalid_type.json rename to frameworks/native/vibrator/test/unittest/resource/json_file/test_invalid_type.json diff --git a/interfaces/native/vibrator/test/unittest/resource/ohos_test.xml b/frameworks/native/vibrator/test/unittest/resource/ohos_test.xml old mode 100644 new mode 100755 similarity index 100% rename from interfaces/native/vibrator/test/unittest/resource/ohos_test.xml rename to frameworks/native/vibrator/test/unittest/resource/ohos_test.xml diff --git a/interfaces/native/vibrator/test/unittest/vibrator_agent_test.cpp b/frameworks/native/vibrator/test/unittest/vibrator_agent_test.cpp similarity index 94% rename from interfaces/native/vibrator/test/unittest/vibrator_agent_test.cpp rename to frameworks/native/vibrator/test/unittest/vibrator_agent_test.cpp index 6ec73df..bdefa89 100755 --- a/interfaces/native/vibrator/test/unittest/vibrator_agent_test.cpp +++ b/frameworks/native/vibrator/test/unittest/vibrator_agent_test.cpp @@ -256,7 +256,7 @@ HWTEST_F(VibratorAgentTest, PlayVibratorCustom_001, TestSize.Level1) ASSERT_EQ(ret, 0); } close(fd); - std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP)); + std::this_thread::sleep_for(std::chrono::milliseconds(2)); } else { ASSERT_EQ(0, 0); } @@ -275,7 +275,7 @@ HWTEST_F(VibratorAgentTest, PlayVibratorCustom_002, TestSize.Level1) ASSERT_EQ(ret, 0); } close(fd); - std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP)); + std::this_thread::sleep_for(std::chrono::milliseconds(2)); } else { ASSERT_EQ(0, 0); } @@ -298,7 +298,7 @@ HWTEST_F(VibratorAgentTest, PlayVibratorCustom_003, TestSize.Level1) ASSERT_NE(ret, 0); } close(fd); - std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP)); + std::this_thread::sleep_for(std::chrono::milliseconds(2)); } else { ASSERT_EQ(0, 0); } @@ -321,7 +321,7 @@ HWTEST_F(VibratorAgentTest, PlayVibratorCustom_004, TestSize.Level1) ASSERT_NE(ret, 0); } close(fd); - std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP)); + std::this_thread::sleep_for(std::chrono::milliseconds(2)); } else { ASSERT_EQ(0, 0); } @@ -459,7 +459,7 @@ HWTEST_F(VibratorAgentTest, PlayVibratorCustom_010, TestSize.Level1) ASSERT_NE(ret, 0); } close(fd); - std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); } else { ASSERT_EQ(0, 0); } @@ -482,7 +482,7 @@ HWTEST_F(VibratorAgentTest, PlayVibratorCustom_011, TestSize.Level1) ASSERT_EQ(ret, 0); } close(fd); - std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); } else { ASSERT_EQ(0, 0); } @@ -721,30 +721,30 @@ HWTEST_F(VibratorAgentTest, IsSupportVibratorCustom_001, TestSize.Level1) } } -HWTEST_F(VibratorAgentTest, IsSupportEffect_001, TestSize.Level1) -{ - CALL_LOG_ENTER; - bool state { false }; - int32_t ret = IsSupportEffect("haptic.clock.timer", &state); - ASSERT_EQ(ret, 0); - if (state) { - ret = StartVibrator("haptic.clock.timer"); - ASSERT_EQ(ret, 0); - ret = Cancel(); - ASSERT_EQ(ret, 0); - } else { - MISC_HILOGI("Do not support haptic.clock.timer"); - } -} - -HWTEST_F(VibratorAgentTest, IsSupportEffect_002, TestSize.Level1) -{ - CALL_LOG_ENTER; - bool state { false }; - int32_t ret = IsSupportEffect("haptic.xxx.yyy", &state); - ASSERT_EQ(ret, 0); - ASSERT_FALSE(state); -} +// HWTEST_F(VibratorAgentTest, IsSupportEffect_001, TestSize.Level1) +// { +// CALL_LOG_ENTER; +// bool state { false }; +// int32_t ret = IsSupportEffect("haptic.clock.timer", &state); +// ASSERT_EQ(ret, 0); +// if (state) { +// ret = StartVibrator("haptic.clock.timer"); +// ASSERT_EQ(ret, 0); +// ret = Cancel(); +// ASSERT_EQ(ret, 0); +// } else { +// MISC_HILOGI("Do not support haptic.clock.timer"); +// } +// } + +// HWTEST_F(VibratorAgentTest, IsSupportEffect_002, TestSize.Level1) +// { +// CALL_LOG_ENTER; +// bool state { false }; +// int32_t ret = IsSupportEffect("haptic.xxx.yyy", &state); +// ASSERT_EQ(ret, 0); +// ASSERT_FALSE(state); +// } HWTEST_F(VibratorAgentTest, IsSupportEffect_003, TestSize.Level1) { diff --git a/interfaces/native/vibrator/src/vibrator_agent.cpp b/frameworks/native/vibrator/vibrator_agent.cpp similarity index 96% rename from interfaces/native/vibrator/src/vibrator_agent.cpp rename to frameworks/native/vibrator/vibrator_agent.cpp index 988d3da..184f246 100755 --- a/interfaces/native/vibrator/src/vibrator_agent.cpp +++ b/frameworks/native/vibrator/vibrator_agent.cpp @@ -94,7 +94,8 @@ int32_t StartVibratorOnce(int32_t duration) bool IsSupportVibratorCustom() { - return (OHOS::system::GetDeviceType() == PHONE_TYPE); + //return (OHOS::system::GetDeviceType() == PHONE_TYPE); + return true; } int32_t PlayVibratorCustom(int32_t fd, int64_t offset, int64_t length) @@ -172,5 +173,10 @@ int32_t IsSupportEffect(const char *effectId, bool *state) } return SUCCESS; } + +// int32_t PlayVibrationEvent(struct VibrateEffect vibrateEffect) +// { +// return SUCCESS; +// } } // namespace Sensors } // namespace OHOS \ No newline at end of file diff --git a/interfaces/native/light/include/light_agent.h b/interfaces/inner_api/light/light_agent.h similarity index 100% rename from interfaces/native/light/include/light_agent.h rename to interfaces/inner_api/light/light_agent.h diff --git a/interfaces/native/light/include/light_agent_type.h b/interfaces/inner_api/light/light_agent_type.h similarity index 100% rename from interfaces/native/light/include/light_agent_type.h rename to interfaces/inner_api/light/light_agent_type.h diff --git a/interfaces/native/vibrator/include/vibrator_agent.h b/interfaces/inner_api/vibrator/vibrator_agent.h similarity index 93% rename from interfaces/native/vibrator/include/vibrator_agent.h rename to interfaces/inner_api/vibrator/vibrator_agent.h index 6f79ebd..a50b19d 100755 --- a/interfaces/native/vibrator/include/vibrator_agent.h +++ b/interfaces/inner_api/vibrator/vibrator_agent.h @@ -43,14 +43,14 @@ namespace Sensors { * * @since 6 */ -const char *VIBRATOR_STOP_MODE_TIME = "time"; +static const char *VIBRATOR_STOP_MODE_TIME = "time"; /** * @brief Indicates the mode of stopping a preset vibration effect. * * @since 6 */ -const char *VIBRATOR_STOP_MODE_PRESET = "preset"; +static const char *VIBRATOR_STOP_MODE_PRESET = "preset"; /** * @brief Controls this vibrator to perform a vibration with a preset vibration effect. @@ -144,6 +144,8 @@ bool SetUsage(int32_t usage); * @since 10 */ int32_t IsSupportEffect(const char *effectId, bool *state); + +// int32_t PlayVibrationEvent(struct VibrateEffect vibrateEffect); } // namespace Sensors } // namespace OHOS #ifdef __cplusplus diff --git a/interfaces/native/vibrator/include/vibrator_agent_type.h b/interfaces/inner_api/vibrator/vibrator_agent_type.h similarity index 93% rename from interfaces/native/vibrator/include/vibrator_agent_type.h rename to interfaces/inner_api/vibrator/vibrator_agent_type.h index 090b594..1aa9e70 100755 --- a/interfaces/native/vibrator/include/vibrator_agent_type.h +++ b/interfaces/inner_api/vibrator/vibrator_agent_type.h @@ -25,7 +25,7 @@ extern "C" { * * @since 1 */ -const char *VIBRATOR_TYPE_CLOCK_TIMER = "haptic.clock.timer"; +static const char *VIBRATOR_TYPE_CLOCK_TIMER = "haptic.clock.timer"; /** * @brief Enumerates vibration usages. diff --git a/interfaces/kits/c/BUILD.gn b/interfaces/kits/c/BUILD.gn new file mode 100755 index 0000000..08e3ff7 --- /dev/null +++ b/interfaces/kits/c/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") +import("./../../../miscdevice.gni") + +ohos_ndk_headers("ndk_vibrator_header") { + dest_dir = "$ndk_headers_out_dir/database/vibrator/" + sources = [ + "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator", + "./vibrator.h", + "./vibrator_type.h", + ] +} + +ohos_ndk_library("lib_vibrator_ndk") { + output_name = "vibrator_ndk" + system_capability = "SystemCapability.Sensors.MiscDevice" + ndk_description_file = "./lib_vibrator.ndk.json" + min_compact_version = "10" + system_capability_headers = [ + "$ndk_headers_out_dir/miscdevice/vibrator.h", + "$ndk_headers_out_dir/miscdevice/vibrator_type.h", + ] +} diff --git a/interfaces/kits/c/lib_vibrator.ndk.json b/interfaces/kits/c/lib_vibrator.ndk.json new file mode 100755 index 0000000..9257876 --- /dev/null +++ b/interfaces/kits/c/lib_vibrator.ndk.json @@ -0,0 +1,6 @@ +[ + { "name": "OH_Vibrator_PlayVibration" }, + { "name": "OH_Vibrator_PlayVibrationCustom" }, + { "name": "OH_Vibrator_PlayVibrationEvent" } + +] \ No newline at end of file diff --git a/interfaces/kits/c/vibrator.h b/interfaces/kits/c/vibrator.h new file mode 100755 index 0000000..3726417 --- /dev/null +++ b/interfaces/kits/c/vibrator.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup 马达 + * @{ + * + * @brief 提为马达服务提供统一的API以访问马达驱动程序。 + * @since 11 + */ + +/** + * @file vibrator.h + * + * @brief 声明用于启动或停止马达的函数。 + * @since 11 + */ + +#ifndef VIBRATOR_H +#include +#include "vibrator_type.h" +#include "vibrator_agent.h" +#define VIBRATOR_H + +#ifdef __cplusplus +extern "C" { +#endif + +namespace OHOS { +namespace Sensors { +/** + * @brief 控制马达执行给定持续时间的单次振动。 + * + * @param duration 表示单次振动持续的持续时间,以毫秒为单位。 + * @param attribute 表示马达的属性。关于细节,请参阅{@link VibrateAttribute}。 + * @return 如果操作成功,则返回0;否则返回负值。 + * + * @since 11 + */ +int32_t OH_Vibrator_PlayVibration(int32_t duration, struct VibrateAttribute attribute); +/** + * @brief 根据传入的振动效果启动马达。 + * + * @param effect 表示振动效果。关于细节,请参阅{@link VibrateEffect}。 + * @param attribute 表示马达的属性。关于细节,请参阅{@link VibrateAttribute}。 + * @return 如果操作成功,则返回0;否则返回负值。 + * + * @since 11 + */ +int32_t OH_Vibrator_PlayVibrationCustom(struct VibrateFileDescription fileDescription, + struct VibrateAttribute attribute); +/** + * @brief 播放自定义振动序列。 + * + * @param fd 表示自定义振动序列的文件描述。关于细节,请参阅{@link HapticFileDiscriptor}。 + * @param attribute 表示马达的属性。关于细节,请参阅{@link VibrateAttribute}。 + * @return 如果操作成功,则返回0;否则返回负值。 + * + * @since 11 + */ +int32_t OH_Vibrator_PlayVibrationEvent(struct VibrateEffect vibrateEffect, struct VibrateAttribute attribute); + +#ifdef __cplusplus +}; +} +} +#endif +/** @} */ +#endif // endif VIBRATOR_H \ No newline at end of file diff --git a/interfaces/kits/c/vibrator_type.h b/interfaces/kits/c/vibrator_type.h new file mode 100755 index 0000000..6694eda --- /dev/null +++ b/interfaces/kits/c/vibrator_type.h @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef VIBRATOR_TYPE_H +#define VIBRATOR_TYPE_H + +#include +#include "vibrator_agent_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 振动事件类型。 + * + * @since 11 + */ +enum VibrateEventType { + /**< 无效振动类型 */ + VIBRATE_TYPE_INVALID = 0, + /**< 瞬时振动类型 */ + VIBRATE_TYPE_TRANSIENT = 1, + /**< 连续振动类型 */ + VIBRATE_TYPE_CONTINUOUS = 2 +}; + +/** + * @brief 自定义振动效果。 + * + * @since 11 + */ +struct VibrateEvent { + /**< 振动事件类型 */ + enum VibrateEventType type; + /**< 振动开始时间 */ + int32_t startTime; + /**< 振动持续时长 */ + int32_t duration; + /**< 振动强度 */ + int32_t intensity; + /**< 振动频率 */ + int32_t frequency; +}; + +/** + * @brief 马达属性。 + * + * @since 11 + */ +struct VibrateAttribute { + /**< 马达ID */ + int32_t id; + /**< 振动场景 */ + enum VibratorUsage usage; +}; + +/** + * @brief 振动效果。 + * + * @since 11 + */ +struct VibrateEffect { + /**< 事件个数 */ + int32_t count; + /**< 振动事件 */ + struct VibrateEvent* vibrateEvents; +}; + +/** + * @brief 振动文件描述。 + * + * @since 11 + */ +struct VibrateFileDescription { + /**< 自定义振动序列的文件句柄。 */ + int32_t fd; + /**< 自定义振动序列的偏移地址。 */ + int64_t offset; + /**< 自定义振动序列的总长度。 */ + int64_t length; +}; +/** @} */ +#ifdef __cplusplus +}; +#endif + +#endif // endif VIBRATOR_TYPE_H \ No newline at end of file diff --git a/services/miscdevice_service/BUILD.gn b/services/miscdevice_service/BUILD.gn index 6637598..52fe719 100755 --- a/services/miscdevice_service/BUILD.gn +++ b/services/miscdevice_service/BUILD.gn @@ -31,7 +31,7 @@ ohos_shared_library("libmiscdevice_service") { include_dirs = [ "include", "$SUBSYSTEM_DIR/frameworks/native/miscdevice/include", - "$SUBSYSTEM_DIR/interfaces/native/light/include", + "$SUBSYSTEM_DIR/interfaces/inner_api/light", "$SUBSYSTEM_DIR/services/miscdevice_service/hdi_connection/adapter/include", "$SUBSYSTEM_DIR/services/miscdevice_service/hdi_connection/interface/include", "$SUBSYSTEM_DIR/utils/include", @@ -93,7 +93,7 @@ ohos_shared_library("libmiscdevice_service_static") { include_dirs = [ "include", "$SUBSYSTEM_DIR/frameworks/native/miscdevice/include", - "$SUBSYSTEM_DIR/interfaces/native/light/include", + "$SUBSYSTEM_DIR/interfaces/inner_api/light", "$SUBSYSTEM_DIR/services/miscdevice_service/hdi_connection/adapter/include", "$SUBSYSTEM_DIR/services/miscdevice_service/hdi_connection/interface/include", "$SUBSYSTEM_DIR/utils/include", diff --git a/services/miscdevice_service/test/fuzztest/vibratoronremoterequest_fuzzer/BUILD.gn b/services/miscdevice_service/test/fuzztest/vibratoronremoterequest_fuzzer/BUILD.gn index cb49109..beb50f9 100644 --- a/services/miscdevice_service/test/fuzztest/vibratoronremoterequest_fuzzer/BUILD.gn +++ b/services/miscdevice_service/test/fuzztest/vibratoronremoterequest_fuzzer/BUILD.gn @@ -23,9 +23,9 @@ ohos_fuzztest("VibratorOnRemoteRequestFuzzTest") { include_dirs = [ "//third_party/cJSON", - "$SUBSYSTEM_DIR/interfaces/native/vibrator/include", + "$SUBSYSTEM_DIR/interfaces/inner_api/vibrator", "$SUBSYSTEM_DIR/frameworks/native/miscdevice/include", - "$SUBSYSTEM_DIR/frameworks/native/light/include", + "$SUBSYSTEM_DIR/interfaces/inner_api/light", "$SUBSYSTEM_DIR/services/miscdevice_service/include", "$SUBSYSTEM_DIR/services/miscdevice_service/hdi_connection/adapter/include", "$SUBSYSTEM_DIR/services/miscdevice_service/hdi_connection/interface/include", @@ -43,8 +43,8 @@ ohos_fuzztest("VibratorOnRemoteRequestFuzzTest") { sources = [ "vibratoronremoterequest_fuzzer.cpp" ] deps = [ - "$SUBSYSTEM_DIR/interfaces/native/light:light_interface_native", - "$SUBSYSTEM_DIR/interfaces/native/vibrator:vibrator_interface_native", + "$SUBSYSTEM_DIR/frameworks/native/light:light_interface_native", + "$SUBSYSTEM_DIR/frameworks/native/vibrator:vibrator_interface_native", "$SUBSYSTEM_DIR/services/miscdevice_service:libmiscdevice_service_static", "$SUBSYSTEM_DIR/utils:libmiscdevice_utils", ] -- Gitee