From bb24eb07e5aecb3ed504fce7c896d88fb33d6b00 Mon Sep 17 00:00:00 2001 From: fengyang Date: Tue, 1 Apr 2025 10:04:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9D=E8=B5=96=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fengyang --- BUILD.gn | 25 +++---------------- bundle.json | 4 --- .../innerkits/include/bundle_active_client.h | 4 --- .../innerkits/src/bundle_active_client.cpp | 11 ++++---- .../include/bundle_active_group_handler.h | 2 -- .../src/bundle_active_group_controller.cpp | 2 -- .../appgroupcallbackstub_fuzzer/BUILD.gn | 8 ++---- .../bundleactiveobserver_fuzzer/BUILD.gn | 8 ++---- .../BUILD.gn | 8 ++---- .../BUILD.gn | 8 ++---- test/unittest/BUILD.gn | 23 ----------------- 11 files changed, 18 insertions(+), 85 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 450a9ce..09800fb 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -85,7 +85,7 @@ ohos_shared_library("usagestatsinner") { ] external_deps = [ "c_utils:utils", - "eventhandler:libeventhandler", + "ffrt:libffrt", "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_core", @@ -99,7 +99,6 @@ ohos_shared_library("usagestatsinner") { get_target_outputs(":app_group_callback_interface") sources += filter_include(app_group_callback_output_values, [ "*.cpp" ]) - public_external_deps = [ "ffrt:libffrt" ] part_name = "${device_usage_statistics_part_name}" subsystem_name = "resourceschedule" innerapi_tags = [ "platformsdk" ] @@ -148,13 +147,12 @@ ohos_shared_library("bundlestate") { external_deps = [ "c_utils:utils", - "eventhandler:libeventhandler", + "ffrt:libffrt", "hilog:libhilog", "ipc:ipc_single", "napi:ace_napi", "samgr:samgr_proxy", ] - public_external_deps = [ "ffrt:libffrt" ] relative_install_dir = "module" part_name = "${device_usage_statistics_part_name}" subsystem_name = "resourceschedule" @@ -197,7 +195,6 @@ ohos_shared_library("usagestatistics") { external_deps = [ "c_utils:utils", - "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "ipc:ipc_single", @@ -261,31 +258,24 @@ ohos_shared_library("usagestatservice") { ] external_deps = [ - "ability_base:want", "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", "access_token:libtokenid_sdk", - "bundle_framework:appexecfwk_base", - "bundle_framework:appexecfwk_core", - "c_utils:utils", - "common_event_service:cesfwk_innerkits", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "hicollie:libhicollie", "hilog:libhilog", "hisysevent:libhisysevent", "init:libbegetutil", "ipc:ipc_single", + "jsoncpp:jsoncpp", "relational_store:native_rdb", "safwk:system_ability_fwk", "samgr:samgr_proxy", "time_service:time_client", ] - public_external_deps = [ "jsoncpp:jsoncpp" ] - if (os_account_part_enabled) { cflags_cc += [ "-DOS_ACCOUNT_PART_ENABLED" ] external_deps += [ "os_account:os_account_innerkits" ] @@ -347,31 +337,24 @@ ohos_static_library("usagestatservice_static") { ] external_deps = [ - "ability_base:want", "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", "access_token:libtokenid_sdk", - "bundle_framework:appexecfwk_base", - "bundle_framework:appexecfwk_core", - "c_utils:utils", - "common_event_service:cesfwk_innerkits", "config_policy:configpolicy_util", - "eventhandler:libeventhandler", "ffrt:libffrt", "hicollie:libhicollie", "hilog:libhilog", "hisysevent:libhisysevent", "init:libbegetutil", "ipc:ipc_single", + "jsoncpp:jsoncpp", "relational_store:native_rdb", "safwk:system_ability_fwk", "samgr:samgr_proxy", "time_service:time_client", ] - public_external_deps = [ "jsoncpp:jsoncpp" ] - if (os_account_part_enabled) { cflags_cc += [ "-DOS_ACCOUNT_PART_ENABLED" ] external_deps += [ "os_account:os_account_innerkits" ] diff --git a/bundle.json b/bundle.json index e30298b..95085d8 100644 --- a/bundle.json +++ b/bundle.json @@ -23,10 +23,8 @@ "ram": "10240KB", "deps": { "components": [ - "bundle_framework", "relational_store", "safwk", - "common_event_service", "config_policy", "os_account", "ipc", @@ -39,9 +37,7 @@ "cJSON", "c_utils", "napi", - "ability_base", "background_task_mgr", - "eventhandler", "power_manager", "selinux_adapter", "time_service", diff --git a/interfaces/innerkits/include/bundle_active_client.h b/interfaces/innerkits/include/bundle_active_client.h index 03d19bb..0ad98ae 100644 --- a/interfaces/innerkits/include/bundle_active_client.h +++ b/interfaces/innerkits/include/bundle_active_client.h @@ -25,9 +25,6 @@ #include "bundle_active_package_stats.h" #include "bundle_active_module_record.h" #include "bundle_state_inner_errors.h" -#include "event_handler.h" -#include "event_runner.h" -#include "ffrt.h" #include "system_ability_definition.h" #include "if_system_ability_manager.h" @@ -234,7 +231,6 @@ private: ~BundleActiveClient() {} sptr bundleActiveProxy_; sptr recipient_; - ffrt::recursive_mutex mutex_; }; } // namespace DeviceUsageStats } // namespace OHOS diff --git a/interfaces/innerkits/src/bundle_active_client.cpp b/interfaces/innerkits/src/bundle_active_client.cpp index ac99561..e92722e 100644 --- a/interfaces/innerkits/src/bundle_active_client.cpp +++ b/interfaces/innerkits/src/bundle_active_client.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ #include "unistd.h" - +#include "ffrt.h" #include "bundle_active_log.h" #include "bundle_active_client.h" @@ -24,6 +24,7 @@ namespace { static const int32_t SLEEP_TIME_SECOND = 1; static const int32_t MS_TO_US = 1000; } +ffrt::recursive_mutex mutex_; BundleActiveClient& BundleActiveClient::GetInstance() { static BundleActiveClient instance; @@ -225,7 +226,7 @@ ErrCode BundleActiveClient::QueryNotificationEventStats(int64_t beginTime, int64 void BundleActiveClient::BundleActiveClientDeathRecipient::AddObserver(const sptr &observer) { - std::lock_guard lock(BundleActiveClient::GetInstance().mutex_); + std::lock_guard lock(mutex_); if (observer) { observer_ = observer; } @@ -233,7 +234,7 @@ void BundleActiveClient::BundleActiveClientDeathRecipient::AddObserver(const spt void BundleActiveClient::BundleActiveClientDeathRecipient::RemoveObserver() { - std::lock_guard lock(BundleActiveClient::GetInstance().mutex_); + std::lock_guard lock(mutex_); if (observer_) { observer_ = nullptr; } @@ -242,7 +243,7 @@ void BundleActiveClient::BundleActiveClientDeathRecipient::RemoveObserver() void BundleActiveClient::BundleActiveClientDeathRecipient::OnRemoteDied(const wptr &object) { (void)object; - std::lock_guard lock(BundleActiveClient::GetInstance().mutex_); + std::lock_guard lock(mutex_); BundleActiveClient::GetInstance().bundleActiveProxy_ = nullptr; ffrt::submit([this]() { this->OnServiceDiedInner(); @@ -251,7 +252,7 @@ void BundleActiveClient::BundleActiveClientDeathRecipient::OnRemoteDied(const wp void BundleActiveClient::BundleActiveClientDeathRecipient::OnServiceDiedInner() { - std::lock_guard lock(BundleActiveClient::GetInstance().mutex_); + std::lock_guard lock(mutex_); while (BundleActiveClient::GetInstance().GetBundleActiveProxy() != ERR_OK) { sleep(SLEEP_TIME_SECOND); } diff --git a/services/packagegroup/include/bundle_active_group_handler.h b/services/packagegroup/include/bundle_active_group_handler.h index 08dbb38..64d5fbe 100644 --- a/services/packagegroup/include/bundle_active_group_handler.h +++ b/services/packagegroup/include/bundle_active_group_handler.h @@ -16,8 +16,6 @@ #ifndef BUNDLE_ACTIVE_GROUP_HANDLER_H #define BUNDLE_ACTIVE_GROUP_HANDLER_H -#include "event_handler.h" -#include "event_runner.h" #include "ffrt.h" #include #include diff --git a/services/packagegroup/src/bundle_active_group_controller.cpp b/services/packagegroup/src/bundle_active_group_controller.cpp index 1848ee2..3ce28c4 100644 --- a/services/packagegroup/src/bundle_active_group_controller.cpp +++ b/services/packagegroup/src/bundle_active_group_controller.cpp @@ -208,8 +208,6 @@ void BundleActiveGroupController::CheckIdleStatsOneTime() BundleActiveGroupHandlerObject tmpGroupHandlerObj; std::shared_ptr handlerobjToPtr = std::make_shared(tmpGroupHandlerObj); - auto handlerEvent = AppExecFwk::InnerEvent::Get( - BundleActiveGroupHandler::MSG_ONE_TIME_CHECK_BUNDLE_STATE); auto activeGroupHandler = activeGroupHandler_.lock(); if (!activeGroupHandler_.expired()) { activeGroupHandler_.lock()->SendEvent(BundleActiveGroupHandler::MSG_ONE_TIME_CHECK_BUNDLE_STATE, diff --git a/test/fuzztest/appgroupcallbackstub_fuzzer/BUILD.gn b/test/fuzztest/appgroupcallbackstub_fuzzer/BUILD.gn index fff8c6b..c923b47 100644 --- a/test/fuzztest/appgroupcallbackstub_fuzzer/BUILD.gn +++ b/test/fuzztest/appgroupcallbackstub_fuzzer/BUILD.gn @@ -51,23 +51,19 @@ ohos_fuzztest("AppgroupcallbackstubFuzzTest") { public_deps = [ "${usage_statistics_path}:usagestatservice_static" ] external_deps = [ - "ability_base:want", "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "access_token:libtokenid_sdk", - "bundle_framework:appexecfwk_base", - "bundle_framework:appexecfwk_core", "cJSON:cjson", - "c_utils:utils", - "common_event_service:cesfwk_innerkits", - "eventhandler:libeventhandler", + "cJSON:cjson_static", "ffrt:libffrt", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_single", + "jsoncpp:jsoncpp", "relational_store:native_rdb", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/test/fuzztest/bundleactiveobserver_fuzzer/BUILD.gn b/test/fuzztest/bundleactiveobserver_fuzzer/BUILD.gn index 06693f2..7967230 100644 --- a/test/fuzztest/bundleactiveobserver_fuzzer/BUILD.gn +++ b/test/fuzztest/bundleactiveobserver_fuzzer/BUILD.gn @@ -56,23 +56,19 @@ ohos_fuzztest("BundleActiveObserverFuzzTest") { "${usage_statistics_path}:usagestatsinner", ] external_deps = [ - "ability_base:want", "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "access_token:libtokenid_sdk", - "bundle_framework:appexecfwk_base", - "bundle_framework:appexecfwk_core", "cJSON:cjson", - "c_utils:utils", - "common_event_service:cesfwk_innerkits", - "eventhandler:libeventhandler", + "cJSON:cjson_static", "ffrt:libffrt", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_single", + "jsoncpp:jsoncpp", "relational_store:native_rdb", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/test/fuzztest/bundleactiveonremoterequest_fuzzer/BUILD.gn b/test/fuzztest/bundleactiveonremoterequest_fuzzer/BUILD.gn index 1c05cfc..9aa6d34 100644 --- a/test/fuzztest/bundleactiveonremoterequest_fuzzer/BUILD.gn +++ b/test/fuzztest/bundleactiveonremoterequest_fuzzer/BUILD.gn @@ -50,23 +50,19 @@ ohos_fuzztest("BundleActiveOnRemoteRequestFuzzTest") { public_deps = [ "${usage_statistics_path}:usagestatservice_static" ] external_deps = [ - "ability_base:want", "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "access_token:libtokenid_sdk", - "bundle_framework:appexecfwk_base", - "bundle_framework:appexecfwk_core", "cJSON:cjson", - "c_utils:utils", - "common_event_service:cesfwk_innerkits", - "eventhandler:libeventhandler", + "cJSON:cjson_static", "ffrt:libffrt", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_single", + "jsoncpp:jsoncpp", "relational_store:native_rdb", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/test/fuzztest/bundleactivepowerstatecallbackproxy_fuzzer/BUILD.gn b/test/fuzztest/bundleactivepowerstatecallbackproxy_fuzzer/BUILD.gn index 5ec4293..48062b5 100644 --- a/test/fuzztest/bundleactivepowerstatecallbackproxy_fuzzer/BUILD.gn +++ b/test/fuzztest/bundleactivepowerstatecallbackproxy_fuzzer/BUILD.gn @@ -55,23 +55,19 @@ ohos_fuzztest("BundleActivePowerstateCallbackproxyFuzzTest") { "${usage_statistics_path}:usagestatsinner", ] external_deps = [ - "ability_base:want", "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "access_token:libtokenid_sdk", - "bundle_framework:appexecfwk_base", - "bundle_framework:appexecfwk_core", "cJSON:cjson", - "c_utils:utils", - "common_event_service:cesfwk_innerkits", - "eventhandler:libeventhandler", + "cJSON:cjson_static", "ffrt:libffrt", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_single", + "jsoncpp:jsoncpp", "relational_store:native_rdb", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 8a7f852..39bb926 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -49,16 +49,10 @@ ohos_unittest("BundleActiveTotalTest") { ] external_deps = [ - "ability_base:want", "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", "access_token:libtokenid_sdk", - "bundle_framework:appexecfwk_base", - "bundle_framework:appexecfwk_core", - "c_utils:utils", - "common_event_service:cesfwk_innerkits", - "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "init:libbegetutil", @@ -104,8 +98,6 @@ ohos_unittest("DeviceUsageStatsTest") { "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", - "c_utils:utils", - "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "ipc:ipc_single", @@ -148,8 +140,6 @@ ohos_unittest("DeviceUsageStatsMultiTest") { "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", - "c_utils:utils", - "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "ipc:ipc_single", @@ -194,10 +184,6 @@ ohos_unittest("DeviceUsageStatsServiceTest") { "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", - "bundle_framework:appexecfwk_core", - "c_utils:utils", - "common_event_service:cesfwk_innerkits", - "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "ipc:ipc_single", @@ -251,10 +237,6 @@ ohos_unittest("DeviceUsageStatsMockTest") { "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", - "bundle_framework:appexecfwk_core", - "c_utils:utils", - "common_event_service:cesfwk_innerkits", - "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "ipc:ipc_single", @@ -299,11 +281,6 @@ ohos_unittest("DeviceUsagePackageUsageTest") { "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", - "bundle_framework:appexecfwk_base", - "bundle_framework:appexecfwk_core", - "c_utils:utils", - "common_event_service:cesfwk_innerkits", - "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "ipc:ipc_single", -- Gitee