diff --git a/bundle.json b/bundle.json index a5d063b3546536a2edb15ffb960748806663b755..5a87a4687de7b44d5d85c8a60070cc6db629e088 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 0000000000000000000000000000000000000000..97b89d8e4ce6b3e9513e5e3bd15de56a15fbd350 --- /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 98e550f91c300cf69a8e5e26c2121986c115599c..3a7186e54b9068ee30cb6ce3e18cdb4de5be851b 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 deb1feeb7a86620f96dd51de661d909d5a357923..852f0b1c840202dd788a197029b3d60ae180bf74 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 9e49bdd24fd4514f2dd6dccf16e4818a4ce59d15..5dc900c02d2742f1a01acf8c52fd57a91c127050 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 e65c34e9de8f603469f8ebe72daf218da2e34edc..113ab008ae59f20495a204e5ebbe619304dd4a2d 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; }