From 747b47c672521fbd51ca0856b012abe48cae59e2 Mon Sep 17 00:00:00 2001 From: chenbingbing Date: Thu, 27 Feb 2025 21:42:52 +0800 Subject: [PATCH] wearable extend load sa timeout Signed-off-by: chenbingbing --- bundle.json | 5 ++++- config.gni | 17 +++++++++++++++++ .../source/system_ability_manager_proxy.cpp | 4 ++++ interfaces/innerkits/samgr_proxy/BUILD.gn | 4 ++++ services/samgr/native/BUILD.gn | 5 +++++ .../native/source/system_ability_manager.cpp | 4 ++++ 6 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 config.gni diff --git a/bundle.json b/bundle.json index a5d063b3..5a87a468 100644 --- a/bundle.json +++ b/bundle.json @@ -14,7 +14,10 @@ "component": { "name": "samgr", "subsystem": "systemabilitymgr", - "features": [ "samgr_feature_coverage" ], + "features": [ + "samgr_feature_coverage", + "samgr_enable_extend_load_timeout" + ], "adapted_system_type": [ "standard" ], diff --git a/config.gni b/config.gni new file mode 100644 index 00000000..97b89d8e --- /dev/null +++ b/config.gni @@ -0,0 +1,17 @@ +# Copyright (c) 2025 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. + +declare_args() { + # enable extend load sa timeout. + samgr_enable_extend_load_timeout = false +} diff --git a/frameworks/native/source/system_ability_manager_proxy.cpp b/frameworks/native/source/system_ability_manager_proxy.cpp index 98e550f9..3a7186e5 100644 --- a/frameworks/native/source/system_ability_manager_proxy.cpp +++ b/frameworks/native/source/system_ability_manager_proxy.cpp @@ -37,7 +37,11 @@ using namespace std; namespace OHOS { namespace { +#ifdef SAMGR_ENABLE_EXTEND_LOAD_TIMEOUT +const int32_t MAX_TIMEOUT = 12; +#else const int32_t MAX_TIMEOUT = 4; +#endif const int32_t MIN_TIMEOUT = 0; const int32_t RETRY_TIME_OUT_NUMBER = 6; const int32_t SLEEP_INTERVAL_TIME = 200; diff --git a/interfaces/innerkits/samgr_proxy/BUILD.gn b/interfaces/innerkits/samgr_proxy/BUILD.gn index deb1feeb..852f0b1c 100644 --- a/interfaces/innerkits/samgr_proxy/BUILD.gn +++ b/interfaces/innerkits/samgr_proxy/BUILD.gn @@ -13,6 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") +import("../../../config.gni") config("samgr_proxy_config") { include_dirs = [ "include" ] @@ -79,6 +80,9 @@ ohos_shared_library("samgr_proxy") { "json:nlohmann_json_static", ] + if (samgr_enable_extend_load_timeout) { + defines += [ "SAMGR_ENABLE_EXTEND_LOAD_TIMEOUT" ] + } part_name = "samgr" } diff --git a/services/samgr/native/BUILD.gn b/services/samgr/native/BUILD.gn index 9e49bdd2..5dc900c0 100644 --- a/services/samgr/native/BUILD.gn +++ b/services/samgr/native/BUILD.gn @@ -13,6 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") +import("../../../config.gni") import("../var.gni") config("distributed_store_config") { @@ -143,6 +144,10 @@ ohos_executable("samgr") { external_deps += [ "preferences:native_preferences" ] defines += [ "PREFERENCES_ENABLE" ] } + + if (samgr_enable_extend_load_timeout) { + defines += [ "SAMGR_ENABLE_EXTEND_LOAD_TIMEOUT" ] + } part_name = "samgr" } diff --git a/services/samgr/native/source/system_ability_manager.cpp b/services/samgr/native/source/system_ability_manager.cpp index e65c34e9..113ab008 100644 --- a/services/samgr/native/source/system_ability_manager.cpp +++ b/services/samgr/native/source/system_ability_manager.cpp @@ -76,7 +76,11 @@ constexpr int32_t DEVICE_INFO_SERVICE_SA = 3902; constexpr int32_t HIDUMPER_SERVICE_SA = 1212; constexpr int32_t MEDIA_ANALYSIS_SERVICE_SA = 10120; constexpr int64_t ONDEMAND_PERF_DELAY_TIME = 60 * 1000; // ms +#ifdef SAMGR_ENABLE_EXTEND_LOAD_TIMEOUT +constexpr int64_t CHECK_LOADED_DELAY_TIME = 12 * 1000; // ms +#else constexpr int64_t CHECK_LOADED_DELAY_TIME = 4 * 1000; // ms +#endif constexpr int32_t SOFTBUS_SERVER_SA_ID = 4700; constexpr int32_t FIRST_DUMP_INDEX = 0; } -- Gitee