From 1ca6efe82b7885f64fecc2fba348be5ae77b8008 Mon Sep 17 00:00:00 2001 From: caochunlei Date: Fri, 27 May 2022 14:05:23 +0800 Subject: [PATCH] caochunlei1@huawei.com Signed-off-by: caochunlei --- services/abilitymgr/include/ability_manager_service.h | 3 ++- services/abilitymgr/src/ability_record.cpp | 4 +++- services/appmgr/src/app_mgr_service_inner.cpp | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index f7d9b33659c..c6d63cc5390 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -123,7 +123,7 @@ public: const sptr &callerToken, int32_t userId = DEFAULT_INVAL_VALUE, int requestCode = DEFAULT_INVAL_VALUE) override; - + /** * Start extension ability with want, send want to ability manager service. * @@ -762,6 +762,7 @@ public: static constexpr uint32_t FOREGROUNDNEW_TIMEOUT_MSG = 5; static constexpr uint32_t BACKGROUNDNEW_TIMEOUT_MSG = 6; + static constexpr uint32_t COLDSTART_LOAD_TIMEOUT = 10000; // ms static constexpr uint32_t LOAD_TIMEOUT = 3000; // ms static constexpr uint32_t ACTIVE_TIMEOUT = 5000; // ms static constexpr uint32_t INACTIVE_TIMEOUT = 500; // ms diff --git a/services/abilitymgr/src/ability_record.cpp b/services/abilitymgr/src/ability_record.cpp index 2e51dcec274..5f305a9641b 100644 --- a/services/abilitymgr/src/ability_record.cpp +++ b/services/abilitymgr/src/ability_record.cpp @@ -158,7 +158,9 @@ int AbilityRecord::LoadAbility() HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Start load ability, name is %{public}s.", abilityInfo_.name.c_str()); if (abilityInfo_.type != AppExecFwk::AbilityType::DATA) { - SendEvent(AbilityManagerService::LOAD_TIMEOUT_MSG, AbilityManagerService::LOAD_TIMEOUT); + auto loadTimeOut = want_.GetBoolParam("coldStart", false) ? + AbilityManagerService::COLDSTART_LOAD_TIMEOUT : AbilityManagerService::LOAD_TIMEOUT; + SendEvent(AbilityManagerService::LOAD_TIMEOUT_MSG, loadTimeOut); } startTime_ = AbilityUtil::SystemTimeMillis(); diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 1b399119662..1b14be538a6 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -66,6 +66,7 @@ const std::string CLASS_NAME = "ohos.app.MainThread"; const std::string FUNC_NAME = "main"; const std::string SO_PATH = "system/lib64/libmapleappkit.z.so"; const std::string RENDER_PARAM = "invalidparam"; +const std::string COLD_START = "coldStart"; const int32_t SIGNAL_KILL = 9; constexpr int32_t USER_SCALE = 200000; #define ENUM_TO_STRING(s) #s @@ -757,6 +758,9 @@ std::shared_ptr AppMgrServiceInner::CreateAppRunningRecord(con appRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, want); if (want) { appRecord->SetDebugApp(want->GetBoolParam("debugApp", false)); + if (want->GetBoolParam(COLD_START, false)) { + appRecord->SetDebugApp(true); + } } if (preToken) { @@ -1978,6 +1982,9 @@ int AppMgrServiceInner::StartEmptyProcess(const AAFwk::Want &want, const sptrSetDebugApp(isDebug); + if (want.GetBoolParam(COLD_START, false)) { + appRecord->SetDebugApp(true); + } std::shared_ptr testRecord = std::make_shared(); if (!testRecord) { -- Gitee