diff --git a/services/abilitymgr/abilitymgr.gni b/services/abilitymgr/abilitymgr.gni index 3f646c121f6c11eb390b711b87e6bcc8b1721f33..510c9014f190db9dbc1121d73a33e327013238a6 100644 --- a/services/abilitymgr/abilitymgr.gni +++ b/services/abilitymgr/abilitymgr.gni @@ -152,6 +152,7 @@ abilityms_files = [ "src/exit_info_data_manager.cpp", #utils + "src/utils/request_id_util.cpp", "src/utils/ability_event_util.cpp", "src/utils/ability_permission_util.cpp", "src/utils/app_mgr_util.cpp", diff --git a/services/abilitymgr/include/ability_connect_manager.h b/services/abilitymgr/include/ability_connect_manager.h index d52b29295d95da15055988766760a10fedff56ae..3f85f0d74a36a684da3089157816d3cdb4a41e88 100644 --- a/services/abilitymgr/include/ability_connect_manager.h +++ b/services/abilitymgr/include/ability_connect_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -63,6 +63,13 @@ public: explicit AbilityConnectManager(int userId); virtual ~AbilityConnectManager(); + struct LoadAbilityContext { + std::shared_ptr loadParam; + std::shared_ptr abilityInfo; + std::shared_ptr appInfo; + std::shared_ptr want; + }; + /** * StartAbility with request. * @@ -386,6 +393,11 @@ public: */ std::shared_ptr GetServiceRecordByAbilityRequest(const AbilityRequest &abilityRequest); + bool HasRequestIdInLoadAbilityQueue(int32_t requestId) const; + void OnStartSpecifiedProcessResponse(const std::string &flag, int32_t requestId); + void OnStartSpecifiedProcessTimeoutResponse(int32_t requestId); + void StartSpecifiedProcess(const LoadAbilityContext &context, const std::shared_ptr &abilityRecord); + private: /** * StartAbilityLocked with request. @@ -428,8 +440,9 @@ private: * @param abilityRecord, the ptr of the ability to load. */ void LoadAbility(const std::shared_ptr &abilityRecord, - std::function&)> updateRecordCallback = nullptr); - + std::function &)> updateRecordCallback = nullptr); + void HandleLoadAbilityOrStartSpecifiedProcess( + const AbilityRuntime::LoadParam &loadParam, const std::shared_ptr &abilityRecord); /** * ConnectAbility.Schedule connect ability * @@ -726,6 +739,8 @@ private: std::mutex uiExtensionMapMutex_; std::mutex windowExtensionMapMutex_; std::mutex startServiceReqListLock_; + ffrt::mutex loadAbilityQueueLock_; + std::map> loadAbilityQueue_; DISALLOW_COPY_AND_MOVE(AbilityConnectManager); }; diff --git a/services/abilitymgr/include/extension_record/extension_record_manager.h b/services/abilitymgr/include/extension_record/extension_record_manager.h index f45a6c553d064e79a6eb81d7cfe200a9fa7d687a..40de7760d76b0953c0cc9f3455c74604fcc8913b 100644 --- a/services/abilitymgr/include/extension_record/extension_record_manager.h +++ b/services/abilitymgr/include/extension_record/extension_record_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-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 @@ -164,7 +164,8 @@ private: std::shared_ptr &extensionRecord, bool &isLoaded); int32_t UpdateProcessName(const AAFwk::AbilityRequest &abilityRequest, std::shared_ptr &record); - + int32_t SetAbilityProcessName(const AAFwk::AbilityRequest &abilityRequest, + const std::shared_ptr &abilityRecord, std::shared_ptr &extensionRecord); bool IsHostSpecifiedProcessValid(const AAFwk::AbilityRequest &abilityRequest, std::shared_ptr &record, const std::string &process); }; diff --git a/services/abilitymgr/include/scene_board/ui_ability_lifecycle_manager.h b/services/abilitymgr/include/scene_board/ui_ability_lifecycle_manager.h index 2106115ca65afd74dc4b740803c0570f19cfed08..1ba3abd59ef8818157c79d4cbb98983103043904 100644 --- a/services/abilitymgr/include/scene_board/ui_ability_lifecycle_manager.h +++ b/services/abilitymgr/include/scene_board/ui_ability_lifecycle_manager.h @@ -490,14 +490,6 @@ private: bool HasAbilityRequest(const AbilityRequest &abilityRequest); void AddAbilityRequest(const AbilityRequest &abilityRequest, int32_t requestId); void RemoveAbilityRequest(int32_t requestId); - inline int32_t GetRequestId() - { - if (requestId_ == 0 || requestId_ == INT32_MAX) { - requestId_ = 1; - } - return requestId_++; - } - void AddSpecifiedRequest(std::shared_ptr request); void StartSpecifiedRequest(SpecifiedRequest &specifiedRequest); std::shared_ptr PopAndGetNextSpecified(int32_t requestId); @@ -531,7 +523,6 @@ private: std::unordered_map, std::list> callRequestCache_; std::list> terminateAbilityList_; sptr rootSceneSession_; - int32_t requestId_ = 0; sptr handler_; ffrt::mutex statusBarDelegateManagerLock_; std::shared_ptr statusBarDelegateManager_; diff --git a/services/abilitymgr/include/utils/request_id_util.h b/services/abilitymgr/include/utils/request_id_util.h new file mode 100644 index 0000000000000000000000000000000000000000..57dfb3f60d1a24416d0e26fca76ee51d8adb3fad --- /dev/null +++ b/services/abilitymgr/include/utils/request_id_util.h @@ -0,0 +1,32 @@ +/* + * 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. + */ + +#pragma once +#include +#include + +namespace OHOS { +namespace AAFwk { + +class RequestIdUtil { +public: + static int32_t GetRequestId(); + +private: + static std::atomic requestId_; +}; + +} // namespace AAFwk +} // namespace OHOS \ No newline at end of file diff --git a/services/abilitymgr/src/ability_connect_manager.cpp b/services/abilitymgr/src/ability_connect_manager.cpp index a61d8618da7ff837123e589c3684f22f35da77a0..6f43ac7ce2cc61f5611c173339ab35c2592c45d8 100644 --- a/services/abilitymgr/src/ability_connect_manager.cpp +++ b/services/abilitymgr/src/ability_connect_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -30,6 +30,7 @@ #include "int_wrapper.h" #include "multi_instance_utils.h" #include "param.h" +#include "request_id_util.h" #include "res_sched_util.h" #include "session/host/include/zidl/session_interface.h" #include "startup_util.h" @@ -81,6 +82,7 @@ constexpr const char* FROZEN_WHITE_DIALOG = "com.huawei.hmos.huaweicast"; constexpr char BUNDLE_NAME_DIALOG[] = "com.ohos.amsdialog"; constexpr char ABILITY_NAME_ASSERT_FAULT_DIALOG[] = "AssertFaultDialog"; constexpr const char* WANT_PARAMS_APP_RESTART_FLAG = "ohos.aafwk.app.restart"; +constexpr const char* PARAM_SPECIFIED_PROCESS_FLAG = "ohoSpecifiedProcessFlag"; constexpr int32_t HALF_TIMEOUT = 2; constexpr uint32_t PROCESS_MODE_RUN_WITH_MAIN_PROCESS = @@ -1617,10 +1619,87 @@ void AbilityConnectManager::LoadAbility(const std::shared_ptr &ab loadParam.customProcessFlag = abilityRecord->GetCustomProcessFlag(); loadParam.extensionProcessMode = abilityRecord->GetExtensionProcessMode(); SetExtensionLoadParam(loadParam, abilityRecord); - AbilityRuntime::FreezeUtil::GetInstance().AddLifecycleEvent(loadParam.token, - "AbilityConnectManager::LoadAbility"); + AbilityRuntime::FreezeUtil::GetInstance().AddLifecycleEvent(loadParam.token, "AbilityConnectManager::LoadAbility"); + HandleLoadAbilityOrStartSpecifiedProcess(loadParam, abilityRecord); +} + +void AbilityConnectManager::HandleLoadAbilityOrStartSpecifiedProcess( + const AbilityRuntime::LoadParam &loadParam, const std::shared_ptr &abilityRecord) +{ + if (abilityRecord->GetAbilityInfo().isolationProcess && + AAFwk::UIExtensionUtils::IsUIExtension(abilityRecord->GetAbilityInfo().extensionAbilityType)) { + TAG_LOGD(AAFwkTag::SERVICE_EXT, "Is UIExtension and isolationProcess, StartSpecifiedProcess"); + LoadAbilityContext context{ std::make_shared(loadParam), + std::make_shared(abilityRecord->GetAbilityInfo()), + std::make_shared(abilityRecord->GetApplicationInfo()), + std::make_shared(abilityRecord->GetWant()) }; + StartSpecifiedProcess(context, abilityRecord); + } else { + DelayedSingleton::GetInstance()->LoadAbility( + loadParam, abilityRecord->GetAbilityInfo(), abilityRecord->GetApplicationInfo(), abilityRecord->GetWant()); + } +} + +void AbilityConnectManager::StartSpecifiedProcess( + const LoadAbilityContext &context, const std::shared_ptr &abilityRecord) +{ + std::lock_guard guard(loadAbilityQueueLock_); + auto requestId = RequestIdUtil::GetRequestId(); + loadAbilityQueue_[requestId].push_back(context); + if (loadAbilityQueue_[requestId].size() > 1) { + return; + } + DelayedSingleton::GetInstance()->StartSpecifiedProcess( + *context.want, *context.abilityInfo, requestId); +} + +void AbilityConnectManager::OnStartSpecifiedProcessResponse(const std::string &flag, int32_t requestId) +{ + std::lock_guard guard(loadAbilityQueueLock_); + auto &queue = loadAbilityQueue_[requestId]; + if (!queue.empty()) { + queue.pop_front(); + if (queue.empty()) { + loadAbilityQueue_.erase(requestId); + } else { + auto &front = queue.front(); + front.want->SetParam(PARAM_SPECIFIED_PROCESS_FLAG, flag); + TAG_LOGI(AAFwkTag::ABILITYMGR, "OnStartSpecifiedProcessResponse, requestId: %{public}d, flag: %{public}s", + requestId, flag.c_str()); + DelayedSingleton::GetInstance()->LoadAbility( + *front.loadParam, *(front.abilityInfo), *(front.appInfo), *(front.want)); + } + } +} + +void AbilityConnectManager::OnStartSpecifiedProcessTimeoutResponse(int32_t requestId) +{ + std::lock_guard guard(loadAbilityQueueLock_); + TAG_LOGI(AAFwkTag::ABILITYMGR, "OnStartSpecifiedProcessTimeout requestId: %{public}d", requestId); + + auto it = loadAbilityQueue_.find(requestId); + if (it == loadAbilityQueue_.end() || it->second.empty()) { + TAG_LOGD(AAFwkTag::ABILITYMGR, "Timeout: no queue for requestId %{public}d", requestId); + return; + } + it->second.pop_front(); + if (it->second.empty()) { + loadAbilityQueue_.erase(it); + TAG_LOGD(AAFwkTag::ABILITYMGR, "Timeout: queue empty, erase requestId %{public}d", requestId); + return; + } + + auto &front = it->second.front(); DelayedSingleton::GetInstance()->LoadAbility( - loadParam, abilityRecord->GetAbilityInfo(), abilityRecord->GetApplicationInfo(), abilityRecord->GetWant()); + *front.loadParam, *(front.abilityInfo), *(front.appInfo), *(front.want)); +} + +bool AbilityConnectManager::HasRequestIdInLoadAbilityQueue(int32_t requestId) const +{ + if (loadAbilityQueue_.find(requestId) == loadAbilityQueue_.end()) { + return false; + } + return true; } void AbilityConnectManager::SetExtensionLoadParam(AbilityRuntime::LoadParam &loadParam, diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index d8f99214ddd8e73e413f6eb7e037214798e2f082..11877c30bc38be26cb44d8ec62fa2548c4261240 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -8459,6 +8459,14 @@ void AbilityManagerService::OnStartSpecifiedAbilityTimeoutResponse(int32_t reque void AbilityManagerService::OnStartSpecifiedProcessResponse(const std::string &flag, int32_t requestId) { TAG_LOGD(AAFwkTag::ABILITYMGR, "flag = %{public}s", flag.c_str()); + auto connectManager = GetCurrentConnectManager(); + CHECK_POINTER(connectManager); + if (connectManager->HasRequestIdInLoadAbilityQueue(requestId)) { + TAG_LOGD(AAFwkTag::ABILITYMGR, "uiextension StartSpecifiedProcessResponse, requestId = %{public}d", requestId); + connectManager->OnStartSpecifiedProcessResponse(flag, requestId); + return; + } + if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { auto uiAbilityManager = GetCurrentUIAbilityManager(); CHECK_POINTER(uiAbilityManager); @@ -8470,6 +8478,13 @@ void AbilityManagerService::OnStartSpecifiedProcessResponse(const std::string &f void AbilityManagerService::OnStartSpecifiedProcessTimeoutResponse(int32_t requestId) { TAG_LOGI(AAFwkTag::ABILITYMGR, "OnStartSpecifiedProcessTimeoutResponse %{public}d", requestId); + auto connectManager = GetCurrentConnectManager(); + CHECK_POINTER(connectManager); + if (connectManager->HasRequestIdInLoadAbilityQueue(requestId)) { + TAG_LOGD(AAFwkTag::ABILITYMGR, "uiextension StartSpecifiedProcessTimeoutResponse"); + connectManager->OnStartSpecifiedProcessTimeoutResponse(requestId); + return; + } if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { auto uiAbilityManager = GetCurrentUIAbilityManager(); CHECK_POINTER(uiAbilityManager); diff --git a/services/abilitymgr/src/extension_record/extension_record_manager.cpp b/services/abilitymgr/src/extension_record/extension_record_manager.cpp index a4167c102ffa038a05214728e1add8b5acf8469f..c60ec32d7080bb0527f7a7ffc3dd4b33cfe11c07 100644 --- a/services/abilitymgr/src/extension_record/extension_record_manager.cpp +++ b/services/abilitymgr/src/extension_record/extension_record_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-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 @@ -456,7 +456,7 @@ int32_t ExtensionRecordManager::GetOrCreateExtensionRecordInner(const AAFwk::Abi extensionRecord->hostBundleName_ = hostBundleName; abilityRecord->SetOwnerMissionUserId(userId_); abilityRecord->SetUIExtensionAbilityId(extensionRecordId); - result = UpdateProcessName(abilityRequest, extensionRecord); + result = SetAbilityProcessName(abilityRequest, abilityRecord, extensionRecord); if (result != ERR_OK) { return result; } @@ -468,6 +468,23 @@ int32_t ExtensionRecordManager::GetOrCreateExtensionRecordInner(const AAFwk::Abi return ERR_OK; } +int32_t ExtensionRecordManager::SetAbilityProcessName(const AAFwk::AbilityRequest &abilityRequest, + const std::shared_ptr &abilityRecord, std::shared_ptr &extensionRecord) +{ + if (abilityRequest.abilityInfo.isolationProcess && + AAFwk::UIExtensionUtils::IsUIExtension(abilityRecord->GetAbilityInfo().extensionAbilityType)) { + abilityRecord->SetProcessName( + abilityRequest.abilityInfo.bundleName + abilityRequest.abilityInfo.extensionTypeName); + return ERR_OK; + } else { + int32_t result = UpdateProcessName(abilityRequest, extensionRecord); + if (result != ERR_OK) { + return result; + } + return ERR_OK; + } +} + int32_t ExtensionRecordManager::StartAbility(const AAFwk::AbilityRequest &abilityRequest) { return ERR_OK; diff --git a/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp b/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp index f7e6980ba13e563952297ff6a624422057b0b723..50b413b5ca1ae74ffe282ea58fb7555bd20d57a4 100644 --- a/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp +++ b/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp @@ -43,6 +43,7 @@ #include "ability_first_frame_state_observer_manager.h" #endif #include "hidden_start_observer_manager.h" +#include "request_id_util.h" namespace OHOS { using AbilityRuntime::FreezeUtil; @@ -592,7 +593,7 @@ int UIAbilityLifecycleManager::NotifySCBToStartUIAbility(AbilityRequest &ability return StartSpecifiedProcessRequest(abilityRequest); } const auto &abilityInfo = abilityRequest.abilityInfo; - auto requestId = GetRequestId(); + auto requestId = RequestIdUtil::GetRequestId(); auto isPlugin = StartupUtil::IsStartPlugin(abilityRequest.want); auto isSpecified = (abilityInfo.launchMode == AppExecFwk::LaunchMode::SPECIFIED); if (isSpecified && !isPlugin) { @@ -650,7 +651,7 @@ int32_t UIAbilityLifecycleManager::NotifySCBToRecoveryAfterInterception(const Ab auto isPlugin = StartupUtil::IsStartPlugin(abilityRequest.want); auto isSpecified = (abilityInfo.launchMode == AppExecFwk::LaunchMode::SPECIFIED); if (isSpecified && !isPlugin) { - auto specifiedRequest = std::make_shared(GetRequestId(), abilityRequest); + auto specifiedRequest = std::make_shared(RequestIdUtil::GetRequestId(), abilityRequest); specifiedRequest->preCreateProcessName = true; AddSpecifiedRequest(specifiedRequest); return ERR_OK; @@ -1234,7 +1235,7 @@ int UIAbilityLifecycleManager::CallAbilityLocked(const AbilityRequest &abilityRe sessionInfo->reuse = reuse; sessionInfo->uiAbilityId = uiAbilityRecord->GetAbilityRecordId(); sessionInfo->isAtomicService = (abilityInfo.applicationInfo.bundleType == AppExecFwk::BundleType::ATOMIC_SERVICE); - sessionInfo->requestId = GetRequestId(); + sessionInfo->requestId = RequestIdUtil::GetRequestId(); if (abilityRequest.want.GetBoolParam(Want::PARAM_RESV_CALL_TO_FOREGROUND, false)) { sessionInfo->state = CallToState::FOREGROUND; } else { @@ -2261,7 +2262,7 @@ int32_t UIAbilityLifecycleManager::StartSpecifiedProcessRequest(const AbilityReq } const_cast(abilityRequest).want.SetParam(Want::APP_INSTANCE_KEY, instanceKey); } - auto requestId = GetRequestId(); + auto requestId = RequestIdUtil::GetRequestId(); TAG_LOGI(AAFwkTag::ABILITYMGR, "StartSpecifiedProcess, requestId:%{public}d", requestId); auto specifiedRequest = std::make_shared(requestId, abilityRequest); specifiedRequest->specifiedProcessState = SpecifiedProcessState::STATE_PROCESS; @@ -2279,8 +2280,7 @@ int32_t UIAbilityLifecycleManager::StartSpecifiedAbilityBySCB(AbilityRequest &ab if (IsStartSpecifiedProcessRequest(abilityRequest)) { return StartSpecifiedProcessRequest(abilityRequest); } - AddSpecifiedRequest(std::make_shared(GetRequestId(), abilityRequest)); - return ERR_OK; + AddSpecifiedRequest(std::make_shared(RequestIdUtil::GetRequestId(), abilityRequest)); } void UIAbilityLifecycleManager::NotifyRestartSpecifiedAbility(const AbilityRequest &request, @@ -3804,7 +3804,7 @@ int32_t UIAbilityLifecycleManager::RevokeDelegator(sptr token) auto abilityInfo = abilityRecord->GetAbilityInfo(); auto isSpecified = (abilityInfo.launchMode == AppExecFwk::LaunchMode::SPECIFIED); if (isSpecified) { - auto requestId = GetRequestId(); + auto requestId = RequestIdUtil::GetRequestId(); hookSpecifiedMap_.emplace(requestId, abilityRecord); DelayedSingleton::GetInstance()->StartSpecifiedAbility(abilityRecord->GetWant(), abilityInfo, requestId); diff --git a/services/abilitymgr/src/utils/request_id_util.cpp b/services/abilitymgr/src/utils/request_id_util.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d1ae75fd505871991a77ad6cf321009c12a71390 --- /dev/null +++ b/services/abilitymgr/src/utils/request_id_util.cpp @@ -0,0 +1,35 @@ +/* + * 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. + */ + +#include "utils/request_id_util.h" + +namespace OHOS { +namespace AAFwk { + +std::atomic RequestIdUtil::requestId_{ 1 }; + +int32_t RequestIdUtil::GetRequestId() +{ + int32_t id = requestId_.fetch_add(1, std::memory_order_relaxed); + if (id == 0 || id == INT32_MAX) { + int32_t expect = id + 1; + requestId_.compare_exchange_strong(expect, 1); + id = requestId_.fetch_add(1, std::memory_order_relaxed); + } + return id; +} + +} // namespace AAFwk +} // namespace OHOS \ No newline at end of file diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index d0e90aca3f71158ffb4e2c2ce6c973b691d9af71..f2df7492b2dbb8d4ed4330d8d7a8cb0d2383368c 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -1170,6 +1170,12 @@ std::string AppMgrServiceInner::GetSpecifiedProcessFlag(const AbilityInfo &abili specifiedProcessFlag = want.GetStringParam(PARAM_SPECIFIED_PROCESS_FLAG); TAG_LOGI(AAFwkTag::APPMGR, "specifiedProcessFlag: %{public}s", specifiedProcessFlag.c_str()); } + if (abilityInfo.isolationProcess && + AAFwk::UIExtensionUtils::IsUIExtension(abilityInfo.extensionAbilityType)) { + specifiedProcessFlag = want.GetStringParam(PARAM_SPECIFIED_PROCESS_FLAG); + TAG_LOGI(AAFwkTag::APPMGR, "UIExtension process, specifiedProcessFlag: %{public}s", + specifiedProcessFlag.c_str()); + } return specifiedProcessFlag; } diff --git a/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/BUILD.gn b/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/BUILD.gn index 2d8b71bfe1f45009d2962af39f9a600eb1df9b65..457cf74e72890b87a1df620dd7a675eae6e2ac97 100644 --- a/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/BUILD.gn +++ b/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-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 @@ -48,6 +48,7 @@ ohos_fuzztest("AbilityMgrAppExitReasonHelperFuzzTest") { "${ability_runtime_services_path}/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/sub_managers_helper.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "${ability_runtime_services_path}/common/src/event_handler_wrap.cpp", "${ability_runtime_services_path}/common/src/ffrt_task_handler_wrap.cpp", "${ability_runtime_services_path}/common/src/queue_task_handler_wrap.cpp", diff --git a/test/fuzztest/uiabilitylifecyclemanagera_fuzzer/BUILD.gn b/test/fuzztest/uiabilitylifecyclemanagera_fuzzer/BUILD.gn index 2b186d7e573a67f58bfce88a8c8718bda47488fd..6721a19e7ebca8e5c0b64ff45f1299a6aedb4c18 100644 --- a/test/fuzztest/uiabilitylifecyclemanagera_fuzzer/BUILD.gn +++ b/test/fuzztest/uiabilitylifecyclemanagera_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-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 @@ -38,6 +38,7 @@ ohos_fuzztest("UiAbilityLifeCycleManagerAFuzzTest") { "${ability_runtime_services_path}/abilitymgr/src/scene_board/status_bar_delegate_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "uiabilitylifecyclemanagera_fuzzer.cpp", ] diff --git a/test/fuzztest/uiabilitylifecyclemanagerb_fuzzer/BUILD.gn b/test/fuzztest/uiabilitylifecyclemanagerb_fuzzer/BUILD.gn index 28ea5577cf3948aa243339878e940d458881f136..ebecb1b7992981cc3214740db7b3117c0ae78fad 100644 --- a/test/fuzztest/uiabilitylifecyclemanagerb_fuzzer/BUILD.gn +++ b/test/fuzztest/uiabilitylifecyclemanagerb_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-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 @@ -39,6 +39,7 @@ ohos_fuzztest("UiAbilityLifeCycleManagerBFuzzTest") { "${ability_runtime_services_path}/abilitymgr/src/scene_board/status_bar_delegate_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "uiabilitylifecyclemanagerb_fuzzer.cpp", ] diff --git a/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn b/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn index eaf02d3fcf9c441f7974754f488df3006f77751b..e89768af579a6d5ca72abfe8f78ffd36a8f6deb4 100644 --- a/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn +++ b/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-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 @@ -28,6 +28,7 @@ ohos_moduletest("specified_ability_service_test") { "${ability_runtime_services_path}/abilitymgr/src/start_window_option.cpp", "${ability_runtime_services_path}/abilitymgr/src/sub_managers_helper.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "specified_ability_service_test.cpp", ] diff --git a/test/unittest/ability_manager_service_eleven_test/BUILD.gn b/test/unittest/ability_manager_service_eleven_test/BUILD.gn index 6337c42c35ab67b09f815a01bcb53fe0ba1769b8..81b99d53d7c242e28383540edc9056273a843ecc 100644 --- a/test/unittest/ability_manager_service_eleven_test/BUILD.gn +++ b/test/unittest/ability_manager_service_eleven_test/BUILD.gn @@ -47,6 +47,7 @@ ohos_unittest("ability_manager_service_eleven_test") { "${ability_runtime_services_path}/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/window_options_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "ability_manager_service_eleven_test.cpp", "mock/src/mock_my_flag.cpp", "mock/src/mock_permission_verification.cpp", diff --git a/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn b/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn index 5728c0916d6161c32ec2cfef76beeb7fef631f5e..ce274a014b33854ec848713b81e2bb1a4220b4ac 100644 --- a/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn +++ b/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn @@ -198,6 +198,7 @@ ohos_unittest("ability_manager_service_fourteenth_test") { "${ability_runtime_services_path}/abilitymgr/src/utils/uri_utils.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/want_utils.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/window_options_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "${ability_runtime_services_path}/abilitymgr/src/want_receiver_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/want_receiver_stub.cpp", "${ability_runtime_services_path}/abilitymgr/src/want_sender_info.cpp", diff --git a/test/unittest/ability_manager_service_sixth_test/BUILD.gn b/test/unittest/ability_manager_service_sixth_test/BUILD.gn index 5985952b21e14a53ec19b4481999ed0609b5481d..bb8166d642be2c07c3674f63e50794016e9ea3fd 100644 --- a/test/unittest/ability_manager_service_sixth_test/BUILD.gn +++ b/test/unittest/ability_manager_service_sixth_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-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 @@ -46,6 +46,7 @@ ohos_unittest("ability_manager_service_sixth_test") { "${ability_runtime_services_path}/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/sub_managers_helper.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "${ability_runtime_test_path}/mock/task_handler_wrap_mock/src/mock_task_handler_wrap.cpp", "ability_manager_service_sixth_test.cpp", "mock/src/mock_my_flag.cpp", diff --git a/test/unittest/ability_manager_service_third_test/BUILD.gn b/test/unittest/ability_manager_service_third_test/BUILD.gn index f309cd0d53ff497c6cd65cd1688ac4b1b3807f82..da5f3fc4c1e4b4acc59f22fe6f0fca6174d406a5 100644 --- a/test/unittest/ability_manager_service_third_test/BUILD.gn +++ b/test/unittest/ability_manager_service_third_test/BUILD.gn @@ -52,6 +52,7 @@ ohos_unittest("ability_manager_service_third_test") { "${ability_runtime_services_path}/common/src/queue_task_handler_wrap.cpp", "${ability_runtime_services_path}/common/src/task_handler_wrap.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_manager_service.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", ] sources += abilityms_files diff --git a/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn b/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn index 0637a9d6e95f58fbb92e4f8954eaf4e7a83c69b8..67bcc1e0f56ceb02effe4ad1b42be72cd2a03626 100644 --- a/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn +++ b/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn @@ -185,6 +185,7 @@ ohos_unittest("ability_manager_service_thirteenth_test") { "${ability_runtime_services_path}/abilitymgr/src/utils/app_mgr_util.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/dms_util.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/dump_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/extension_permissions_util.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/hidden_start_utils.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/keep_alive_utils.cpp", diff --git a/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_ability_connect_manager.cpp b/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_ability_connect_manager.cpp index c206a7fe0c0aeb2c1e51b95b1de0e05e0dc75291..79bc3b35f5edf689e2436e4c697d035e4f5c83b3 100644 --- a/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_ability_connect_manager.cpp +++ b/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_ability_connect_manager.cpp @@ -26,6 +26,22 @@ AbilityConnectManager::AbilityConnectManager(int userId) : userId_(userId) AbilityConnectManager::~AbilityConnectManager() {} +bool AbilityConnectManager::HasRequestIdInLoadAbilityQueue(int32_t requestId) const +{ + return false; +} + +void AbilityConnectManager::OnStartSpecifiedProcessResponse(const std::string &flag, int32_t requestId) +{} + +void AbilityConnectManager::OnStartSpecifiedProcessTimeoutResponse(int32_t requestId) +{} + +void AbilityConnectManager::StartSpecifiedProcess( + const LoadAbilityContext &context, const std::shared_ptr &abilityRecord) +{} + + int AbilityConnectManager::StartAbility(const AbilityRequest &abilityRequest) { return 0; diff --git a/test/unittest/app_exit_reason_helper_fourth_test/BUILD.gn b/test/unittest/app_exit_reason_helper_fourth_test/BUILD.gn index 0893709a1e67b0dd2000ff2024291963d56bb00f..f94798e77b656f8a6fb3cd9a6f9cf4c8bda07885 100644 --- a/test/unittest/app_exit_reason_helper_fourth_test/BUILD.gn +++ b/test/unittest/app_exit_reason_helper_fourth_test/BUILD.gn @@ -47,6 +47,7 @@ ohos_unittest("app_exit_reason_helper_fourth_test") { "${ability_runtime_services_path}/abilitymgr/src/sub_managers_helper.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/app_mgr_util.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "app_exit_reason_helper_fourth_test.cpp", "mock/src/bundle_mgr_helper.cpp", "mock/src/mock_app_scheduler.cpp", diff --git a/test/unittest/app_exit_reason_helper_second_test/BUILD.gn b/test/unittest/app_exit_reason_helper_second_test/BUILD.gn index fde875216b11c06098cb3f4420fe63594c4ac88d..0fd6a0dcf2872f7ca12a1aa6982922bc0f4a05db 100644 --- a/test/unittest/app_exit_reason_helper_second_test/BUILD.gn +++ b/test/unittest/app_exit_reason_helper_second_test/BUILD.gn @@ -43,6 +43,7 @@ ohos_unittest("app_exit_reason_helper_second_test") { "${ability_runtime_services_path}/abilitymgr/src/start_window_option.cpp", "${ability_runtime_services_path}/abilitymgr/src/sub_managers_helper.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "app_exit_reason_helper_second_test.cpp", ] diff --git a/test/unittest/app_exit_reason_helper_third_test/BUILD.gn b/test/unittest/app_exit_reason_helper_third_test/BUILD.gn index a843849286d675c2d5ea22699c8f7c992bf4bea8..d7fb3a42d7166c5172304f0c8eee55d3b68bf488 100644 --- a/test/unittest/app_exit_reason_helper_third_test/BUILD.gn +++ b/test/unittest/app_exit_reason_helper_third_test/BUILD.gn @@ -47,6 +47,7 @@ ohos_unittest("app_exit_reason_helper_third_test") { "${ability_runtime_services_path}/abilitymgr/src/sub_managers_helper.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_start_with_wait_observer_manager/ability_start_with_wait_observer_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp", "app_exit_reason_helper_third_test.cpp", ] diff --git a/test/unittest/native_child_process_test/BUILD.gn b/test/unittest/native_child_process_test/BUILD.gn index b8b179629b7857d0edbb002bebf7dfcdca434fbf..eb3c4ee3b76f6447f1e7966285502994665ecc1f 100644 --- a/test/unittest/native_child_process_test/BUILD.gn +++ b/test/unittest/native_child_process_test/BUILD.gn @@ -51,6 +51,7 @@ ohos_unittest("native_child_process_test") { "${ability_runtime_services_path}/abilitymgr/src/scene_board/status_bar_delegate_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "${ability_runtime_services_path}/common/src/event_report.cpp", "native_child_process_test.cpp", ] diff --git a/test/unittest/status_bar_delegate_manager_test/BUILD.gn b/test/unittest/status_bar_delegate_manager_test/BUILD.gn index 53bcb6ce0817368e3d4be97dff5611705e36e905..5fb460317f2d4c72da081f1311d298ba48b063b0 100644 --- a/test/unittest/status_bar_delegate_manager_test/BUILD.gn +++ b/test/unittest/status_bar_delegate_manager_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-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 @@ -40,6 +40,7 @@ ohos_unittest("status_bar_delegate_manager_test") { "${ability_runtime_services_path}/abilitymgr/src/scene_board/status_bar_delegate_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "${ability_runtime_services_path}/common/src/event_report.cpp", "status_bar_delegate_manager_test.cpp", ] diff --git a/test/unittest/ui_ability_lifecycle_manager_second_test/BUILD.gn b/test/unittest/ui_ability_lifecycle_manager_second_test/BUILD.gn index ad6b0a0c3d9e2fa7cb1ce5ef3d0931962a7b5a4a..9ddaf1dc4a2ce81927ed186bb68a8b3d47ca3f97 100644 --- a/test/unittest/ui_ability_lifecycle_manager_second_test/BUILD.gn +++ b/test/unittest/ui_ability_lifecycle_manager_second_test/BUILD.gn @@ -48,6 +48,7 @@ ohos_unittest("ui_ability_lifecycle_manager_second_test") { "${ability_runtime_services_path}/abilitymgr/src/scene_board/status_bar_delegate_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "${ability_runtime_services_path}/common/src/event_report.cpp", "mock/src/app_utils.cpp", "mock/src/mock_my_flag.cpp", diff --git a/test/unittest/ui_ability_lifecycle_manager_test/BUILD.gn b/test/unittest/ui_ability_lifecycle_manager_test/BUILD.gn index 71428d24e0c18129c70afc5e7ae29fd08e960826..a9e8116224a5221d9337ed9383696b7cf63c33b3 100644 --- a/test/unittest/ui_ability_lifecycle_manager_test/BUILD.gn +++ b/test/unittest/ui_ability_lifecycle_manager_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-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 @@ -44,6 +44,7 @@ ohos_unittest("ui_ability_lifecycle_manager_test") { "${ability_runtime_services_path}/abilitymgr/src/scene_board/status_bar_delegate_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/timeout_state_utils.cpp", + "${ability_runtime_services_path}/abilitymgr/src/utils/request_id_util.cpp", "${ability_runtime_services_path}/common/src/event_report.cpp", "mock/include/ipc_skeleton.cpp", "ui_ability_lifecycle_manager_test.cpp", diff --git a/utils/server/startup/src/startup_util.cpp b/utils/server/startup/src/startup_util.cpp index 9f176c267e07c5b7da2811ff26564a266133088d..54e590daaf90c2fedf2e5802db190941c9e74704 100644 --- a/utils/server/startup/src/startup_util.cpp +++ b/utils/server/startup/src/startup_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 @@ -96,6 +96,7 @@ void StartupUtil::InitAbilityInfoFromExtension(AppExecFwk::ExtensionAbilityInfo abilityInfo.codeLanguage = extensionInfo.codeLanguage; abilityInfo.type = AppExecFwk::AbilityType::EXTENSION; abilityInfo.extensionTypeName = extensionInfo.extensionTypeName; + abilityInfo.isolationProcess = extensionInfo.isolationProcess; if (!extensionInfo.hapPath.empty()) { abilityInfo.hapPath = extensionInfo.hapPath; }