From 34058eacca169fc915af45a0f5d5a48026004761 Mon Sep 17 00:00:00 2001 From: gong-guilin Date: Sun, 17 Aug 2025 17:31:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=86=97=E4=BD=99=E4=BE=9D?= =?UTF-8?q?=E8=B5=966.0=20Signed-off-by:=20gong-guilin=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bundle.json | 1 - services/dfx/include/hicollie_helper.h | 27 ---------- services/dfx/source/hicollie_helper.cpp | 31 ----------- .../source/collect/common_event_collect.cpp | 1 - .../source/collect/device_switch_collect.cpp | 1 - services/samgr/native/test/unittest/BUILD.gn | 6 --- .../src/common_event_collect_test.cpp | 54 +------------------ .../src/device_networking_collect_test.cpp | 4 -- ...stem_ability_state_scheduler_proc_test.cpp | 1 - test/fuzztest/samgr_fuzzer/BUILD.gn | 1 - test/fuzztest/samgrcoverage_fuzzer/BUILD.gn | 1 - test/fuzztest/samgrdumper_fuzzer/BUILD.gn | 1 - .../systemabilitymanager_fuzzer/BUILD.gn | 1 - 13 files changed, 1 insertion(+), 129 deletions(-) delete mode 100644 services/dfx/include/hicollie_helper.h delete mode 100644 services/dfx/source/hicollie_helper.cpp diff --git a/bundle.json b/bundle.json index e83679d2..523ce2b4 100644 --- a/bundle.json +++ b/bundle.json @@ -36,7 +36,6 @@ "common_event_service", "device_manager", "dsoftbus", - "eventhandler", "ffrt", "hicollie", "hilog", diff --git a/services/dfx/include/hicollie_helper.h b/services/dfx/include/hicollie_helper.h deleted file mode 100644 index f58fb701..00000000 --- a/services/dfx/include/hicollie_helper.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022 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 SERVICES_DFX_INCLUDE_HICOLLIE_HELLER_H -#define SERVICES_DFX_INCLUDE_HICOLLIE_HELLER_H -#include "event_handler.h" -#include -namespace OHOS { -class HicollieHelper { -public: - static int AddThread(const std::string& name, std::shared_ptr handler, - std::function timeOutCallback, uint64_t interval); -}; -} // namespace OHOS -#endif // SERVICES_DFX_INCLUDE_HICOLLIE_HELLER_H diff --git a/services/dfx/source/hicollie_helper.cpp b/services/dfx/source/hicollie_helper.cpp deleted file mode 100644 index 23c5305f..00000000 --- a/services/dfx/source/hicollie_helper.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2022 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 "hicollie_helper.h" -#ifdef HICOLLIE_ENABLE -#include "xcollie/watchdog.h" -#endif - -namespace OHOS { -int HicollieHelper::AddThread(const std::string& name, std::shared_ptr handler, - std::function timeOutCallback, uint64_t interval) -{ -#ifdef HICOLLIE_ENABLE - return HiviewDFX::Watchdog::GetInstance().AddThread(name, handler, timeOutCallback, interval); -#else - // HICOLLIE_ENABLE is false, do nothing and return 1. - return 1; -#endif -} -} // namespace OHOS \ No newline at end of file diff --git a/services/samgr/native/source/collect/common_event_collect.cpp b/services/samgr/native/source/collect/common_event_collect.cpp index 0510e008..e5a39aef 100644 --- a/services/samgr/native/source/collect/common_event_collect.cpp +++ b/services/samgr/native/source/collect/common_event_collect.cpp @@ -34,7 +34,6 @@ #include "system_ability_manager.h" #include "samgr_xcollie.h" -using namespace OHOS::AppExecFwk; namespace OHOS { namespace { constexpr uint32_t INIT_EVENT = 10; diff --git a/services/samgr/native/source/collect/device_switch_collect.cpp b/services/samgr/native/source/collect/device_switch_collect.cpp index 53bd9f0c..ad3c3ad2 100644 --- a/services/samgr/native/source/collect/device_switch_collect.cpp +++ b/services/samgr/native/source/collect/device_switch_collect.cpp @@ -23,7 +23,6 @@ #include "system_ability_manager.h" using namespace std; -using namespace OHOS::AppExecFwk; namespace OHOS { namespace { diff --git a/services/samgr/native/test/unittest/BUILD.gn b/services/samgr/native/test/unittest/BUILD.gn index c1e31225..f5931c94 100644 --- a/services/samgr/native/test/unittest/BUILD.gn +++ b/services/samgr/native/test/unittest/BUILD.gn @@ -104,7 +104,6 @@ ohos_unittest("SystemAbilityMgrTest") { "access_token:libaccesstoken_sdk", "c_utils:utils", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "googletest:gtest_main", "hilog:libhilog", @@ -231,7 +230,6 @@ ohos_unittest("SystemAbilityMgrCollectTest") { "access_token:libaccesstoken_sdk", "c_utils:utils", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "googletest:gtest_main", "hilog:libhilog", @@ -366,7 +364,6 @@ ohos_unittest("SystemAbilityMgrDeviceNetworkingTest") { "access_token:libaccesstoken_sdk", "c_utils:utils", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "googletest:gtest_main", "hilog:libhilog", @@ -476,7 +473,6 @@ ohos_unittest("SystemAbilityMgrStubTest") { "access_token:libaccesstoken_sdk", "c_utils:utils", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "googletest:gtest_main", "hilog:libhilog", @@ -686,7 +682,6 @@ ohos_unittest("SystemAbilityStateSchedulerTest") { "access_token:libaccesstoken_sdk", "c_utils:utils", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "googletest:gtest_main", "hilog:libhilog", @@ -1047,7 +1042,6 @@ ohos_executable("TestTool") { "access_token:libaccesstoken_sdk", "c_utils:utils", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "hisysevent:libhisysevent", "hisysevent:libhisysevent_easy", diff --git a/services/samgr/native/test/unittest/src/common_event_collect_test.cpp b/services/samgr/native/test/unittest/src/common_event_collect_test.cpp index 2a61f876..6f3bb792 100644 --- a/services/samgr/native/test/unittest/src/common_event_collect_test.cpp +++ b/services/samgr/native/test/unittest/src/common_event_collect_test.cpp @@ -24,7 +24,6 @@ #define private public #include "common_event_collect.h" #include "device_status_collect_manager.h" -#include "event_handler.h" #undef private using namespace std; @@ -181,62 +180,11 @@ HWTEST_F(CommonEventCollectTest, ProcessEvent002, TestSize.Level3) sptr collect = new DeviceStatusCollectManager(); sptr commonEventCollect = new CommonEventCollect(collect); std::shared_ptr commonHandler = std::make_shared(commonEventCollect); - AppExecFwk::InnerEvent *event = nullptr; - auto destructor = [](AppExecFwk::InnerEvent *event) { - if (event != nullptr) { - delete event; - } - }; commonHandler->ProcessEvent(COMMON_DIED_EVENT, 0); - EXPECT_EQ(event, nullptr); + EXPECT_NE(commonEventCollect->commonEventSubscriber_, nullptr); DTEST_LOG << "ProcessEvent002 end" << std::endl; } -/** - * @tc.name: ProcessEvent003 - * @tc.desc: test ProcessEvent, commonCollect_ is nullptr - * @tc.type: FUNC - * @tc.require: I6OU0A - */ -HWTEST_F(CommonEventCollectTest, ProcessEvent003, TestSize.Level3) -{ - DTEST_LOG << "ProcessEvent003 begin" << std::endl; - sptr commonEventCollect = nullptr; - std::shared_ptr commonHandler = std::make_shared(commonEventCollect); - AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent(); - auto destructor = [](AppExecFwk::InnerEvent *event) { - if (event != nullptr) { - delete event; - } - }; - commonHandler->ProcessEvent(COMMON_DIED_EVENT, 0); - EXPECT_NE(event, nullptr); - DTEST_LOG << "ProcessEvent003 end" << std::endl; -} - -/** - * @tc.name: ProcessEvent004 - * @tc.desc: test ProcessEvent, eventId is invalid - * @tc.type: FUNC - * @tc.require: I6OU0A - */ -HWTEST_F(CommonEventCollectTest, ProcessEvent004, TestSize.Level3) -{ - DTEST_LOG << "ProcessEvent004 begin" << std::endl; - sptr commonEventCollect = nullptr; - std::shared_ptr commonHandler = std::make_shared(commonEventCollect); - AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent(); - event->innerEventId_ = static_cast(-1); - auto destructor = [](AppExecFwk::InnerEvent *event) { - if (event != nullptr) { - delete event; - } - }; - commonHandler->ProcessEvent(-1, 0); - EXPECT_NE(event, nullptr); - DTEST_LOG << "ProcessEvent004 end" << std::endl; -} - /** * @tc.name: OnReceiveEvent001 * @tc.desc: test OnReceiveEvent diff --git a/services/samgr/native/test/unittest/src/device_networking_collect_test.cpp b/services/samgr/native/test/unittest/src/device_networking_collect_test.cpp index 0656f2e0..22ad43d2 100644 --- a/services/samgr/native/test/unittest/src/device_networking_collect_test.cpp +++ b/services/samgr/native/test/unittest/src/device_networking_collect_test.cpp @@ -22,7 +22,6 @@ #define private public #include "device_networking_collect.h" -#include "event_handler.h" using namespace std; using namespace testing; @@ -39,12 +38,9 @@ constexpr uint32_t DELAY_TIME = 100; bool DeviceNetworkingCollectTest::isCaseDone_ = false; std::mutex DeviceNetworkingCollectTest::caseDoneLock_; std::condition_variable DeviceNetworkingCollectTest::caseDoneCondition_; -std::shared_ptr collectHandler_ = nullptr; void DeviceNetworkingCollectTest::SetUpTestCase() { - auto runner = AppExecFwk::EventRunner::Create("collect_test2"); - collectHandler_ = std::make_shared(runner); DTEST_LOG << "SetUpTestCase" << std::endl; } diff --git a/services/samgr/native/test/unittest/src/system_ability_state_scheduler_proc_test.cpp b/services/samgr/native/test/unittest/src/system_ability_state_scheduler_proc_test.cpp index 67b7555a..1643e68a 100644 --- a/services/samgr/native/test/unittest/src/system_ability_state_scheduler_proc_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_state_scheduler_proc_test.cpp @@ -22,7 +22,6 @@ #define private public #include "schedule/system_ability_state_scheduler.h" -#include "event_handler.h" #include "system_ability_manager.h" using namespace std; diff --git a/test/fuzztest/samgr_fuzzer/BUILD.gn b/test/fuzztest/samgr_fuzzer/BUILD.gn index 8e9e07f8..daae3343 100644 --- a/test/fuzztest/samgr_fuzzer/BUILD.gn +++ b/test/fuzztest/samgr_fuzzer/BUILD.gn @@ -173,7 +173,6 @@ foreach(item, samgr_fuzztests) { "access_token:libaccesstoken_sdk", "c_utils:utils", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "hisysevent:libhisysevent", diff --git a/test/fuzztest/samgrcoverage_fuzzer/BUILD.gn b/test/fuzztest/samgrcoverage_fuzzer/BUILD.gn index e44b7bab..141bd7ca 100644 --- a/test/fuzztest/samgrcoverage_fuzzer/BUILD.gn +++ b/test/fuzztest/samgrcoverage_fuzzer/BUILD.gn @@ -76,7 +76,6 @@ ohos_fuzztest("SamgrCoverageFuzzTest") { "access_token:libaccesstoken_sdk", "c_utils:utils", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "hisysevent:libhisysevent", diff --git a/test/fuzztest/samgrdumper_fuzzer/BUILD.gn b/test/fuzztest/samgrdumper_fuzzer/BUILD.gn index a4884847..892965e2 100644 --- a/test/fuzztest/samgrdumper_fuzzer/BUILD.gn +++ b/test/fuzztest/samgrdumper_fuzzer/BUILD.gn @@ -75,7 +75,6 @@ ohos_fuzztest("SamgrDumperFuzzTest") { "access_token:libaccesstoken_sdk", "c_utils:utils", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "hisysevent:libhisysevent", diff --git a/test/fuzztest/systemabilitymanager_fuzzer/BUILD.gn b/test/fuzztest/systemabilitymanager_fuzzer/BUILD.gn index 021bffda..0fdc4eb5 100644 --- a/test/fuzztest/systemabilitymanager_fuzzer/BUILD.gn +++ b/test/fuzztest/systemabilitymanager_fuzzer/BUILD.gn @@ -75,7 +75,6 @@ ohos_fuzztest("SystemAbilityManagerFuzzTest") { "access_token:libaccesstoken_sdk", "c_utils:utils", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "hisysevent:libhisysevent", -- Gitee