From 06a8f1a4663f9c0fb8f0eedc41953f22ea6a084a Mon Sep 17 00:00:00 2001 From: wangzhen Date: Mon, 16 Jun 2025 18:46:46 +0800 Subject: [PATCH 1/2] Code simplify Signed-off-by: wangzhen Change-Id: I36b993e2e8a093617aaec8ab54d95a039b1bf23d --- .../include/appmgr/app_mgr_interface.h | 13 -- .../appmgr/app_mgr_ipc_interface_code.h | 1 - .../include/appmgr/app_mgr_proxy.h | 10 - .../app_manager/include/appmgr/app_mgr_stub.h | 1 - .../app_manager/src/appmgr/app_mgr_proxy.cpp | 23 --- .../app_manager/src/appmgr/app_mgr_stub.cpp | 14 -- services/abilitymgr/abilitymgr.gni | 1 - .../include/ability_record_death_manager.h | 46 ----- .../include/app_exit_reason_helper.h | 2 +- .../src/ability_record_death_manager.cpp | 72 ------- .../abilitymgr/src/app_exit_reason_helper.cpp | 53 ++--- .../ui_ability_lifecycle_manager.cpp | 3 - services/appmgr/include/app_mgr_service.h | 10 - .../appmgr/include/app_mgr_service_inner.h | 1 - services/appmgr/include/app_running_manager.h | 4 - services/appmgr/src/app_mgr_service.cpp | 18 -- services/appmgr/src/app_mgr_service_inner.cpp | 22 --- services/appmgr/src/app_running_manager.cpp | 53 ----- test/unittest/BUILD.gn | 1 - .../BUILD.gn | 1 - .../BUILD.gn | 1 - .../abilitymgr.gni | 1 - .../BUILD.gn | 1 - .../BUILD.gn | 115 ----------- .../ability_record_death_manager_test.cpp | 182 ------------------ .../mock_ability_token.h | 59 ------ .../app_exit_reason_helper_fourth_test.cpp | 5 +- .../mock/include/mock_iapp_mgr.h | 9 - .../app_exit_reason_helper_test.cpp | 2 +- .../app_mgr_service_inner_eighth_test.cpp | 59 ------ .../mock/include/mock_my_status.h | 1 - .../mock/src/mock_app_running_manager.cpp | 13 -- .../mock/include/mock_my_status.h | 1 - .../mock/src/mock_app_running_manager.cpp | 12 -- .../mock/src/mock_app_running_manager.cpp | 13 -- .../app_mgr_service_second_test.cpp | 27 --- .../app_running_manager_fourth_test.cpp | 102 ---------- .../mock_iapp_mgr.h | 9 - 38 files changed, 16 insertions(+), 945 deletions(-) delete mode 100644 services/abilitymgr/include/ability_record_death_manager.h delete mode 100644 services/abilitymgr/src/ability_record_death_manager.cpp delete mode 100644 test/unittest/ability_record_death_manager_test/BUILD.gn delete mode 100644 test/unittest/ability_record_death_manager_test/ability_record_death_manager_test.cpp delete mode 100644 test/unittest/ability_record_death_manager_test/mock_ability_token.h diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h index 622624c434b..ea1a4f30f04 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h @@ -988,19 +988,6 @@ public: return 0; } - /** - * Get killed process info by process id and uid. - * - * @param pid Process id. - * @param uid Process uid. - * @param info result KilledProcessInfo. - * @return Returns ERR_OK on success, others on failure. - */ - virtual int32_t GetKilledProcessInfo(int pid, int uid, KilledProcessInfo &info) - { - return 0; - } - /** * Launch ability when reuseDelegatorWindow is true. * diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_ipc_interface_code.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_ipc_interface_code.h index b852253ee47..6ea71ba12fd 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_ipc_interface_code.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_ipc_interface_code.h @@ -124,7 +124,6 @@ enum class AppMgrInterfaceCode { IS_SPECIFIED_MODULE_LOADED = 98, GET_RUNNING_PROCESS_INFO_BY_CHILD_PROCESS_PID = 99, UPDATE_PROCESS_MEMORY_STATE = 100, - GET_KILLED_PROCESS_INFO = 101, LAUNCH_ABILITY = 102, IS_PROCESS_CACHE_SUPPORTED = 103, SET_PROCESS_CACHE_ENABLE = 104, diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_proxy.h index 86c8f05f0d1..0944bf858eb 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_proxy.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_proxy.h @@ -837,16 +837,6 @@ public: */ virtual int32_t UpdateProcessMemoryState(const std::vector &procMemState) override; - /** - * Get killed process info by process id and uid. - * - * @param pid Process id. - * @param uid Process uid. - * @param info result KilledProcessInfo. - * @return Returns ERR_OK on success, others on failure. - */ - int32_t GetKilledProcessInfo(int pid, int uid, KilledProcessInfo &info) override; - /** * Launch ability when reuseDelegatorWindow is true. * diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_stub.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_stub.h index 013ef767f90..8eab23403a1 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_stub.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_stub.h @@ -196,7 +196,6 @@ private: MessageParcel &reply, MessageOption &option); int32_t HandleGetSupportedProcessCachePids(MessageParcel &data, MessageParcel &reply); int32_t HandleUpdateProcessMemoryState(MessageParcel &data, MessageParcel &reply); - int32_t HandleGetKilledProcessInfo(MessageParcel &data, MessageParcel &reply); int32_t HandleLaunchAbility(MessageParcel &data, MessageParcel &reply); int32_t HandlePromoteCurrentToCandidateMasterProcess(MessageParcel &data, MessageParcel &reply); int32_t HandleDemoteCurrentFromCandidateMasterProcess(MessageParcel &data, MessageParcel &reply); diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_mgr_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_mgr_proxy.cpp index 73273c68866..e60b1aa6c52 100644 --- a/interfaces/inner_api/app_manager/src/appmgr/app_mgr_proxy.cpp +++ b/interfaces/inner_api/app_manager/src/appmgr/app_mgr_proxy.cpp @@ -2399,29 +2399,6 @@ int32_t AppMgrProxy::UpdateProcessMemoryState(const std::vector infoReply(reply.ReadParcelable()); - if (infoReply == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "KilledProcessInfo ReadParcelable nullptr"); - return AAFwk::ERR_READ_RESULT_PARCEL_FAILED; - } - - info = *infoReply; - return ERR_OK; -} - int32_t AppMgrProxy::LaunchAbility(sptr token) { MessageParcel data; diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp index d4ad9218a9d..71f236fa8da 100644 --- a/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp +++ b/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp @@ -396,8 +396,6 @@ int32_t AppMgrStub::OnRemoteRequestInnerEighth(uint32_t code, MessageParcel &dat return HandleUpdateInstanceKeyBySpecifiedId(data, reply); case static_cast(AppMgrInterfaceCode::UPDATE_PROCESS_MEMORY_STATE): return HandleUpdateProcessMemoryState(data, reply); - case static_cast(AppMgrInterfaceCode::GET_KILLED_PROCESS_INFO): - return HandleGetKilledProcessInfo(data, reply); case static_cast(AppMgrInterfaceCode::LAUNCH_ABILITY): return HandleLaunchAbility(data, reply); case static_cast(AppMgrInterfaceCode::UPDATE_CONFIGURATION_POLICY): @@ -2002,18 +2000,6 @@ ErrCode AppMgrStub::HandleUpdateProcessMemoryState(MessageParcel &data, MessageP return NO_ERROR; } -int32_t AppMgrStub::HandleGetKilledProcessInfo(MessageParcel &data, MessageParcel &reply) -{ - int pid = data.ReadInt32(); - int uid = data.ReadInt32(); - KilledProcessInfo info; - auto ret = GetKilledProcessInfo(pid, uid, info); - if (ret == ERR_OK && !reply.WriteParcelable(&info)) { - ret = IPC_STUB_ERR; - } - return ret; -} - int32_t AppMgrStub::HandleLaunchAbility(MessageParcel &data, MessageParcel &reply) { sptr token = data.ReadRemoteObject(); diff --git a/services/abilitymgr/abilitymgr.gni b/services/abilitymgr/abilitymgr.gni index f763e919007..50f196326c2 100644 --- a/services/abilitymgr/abilitymgr.gni +++ b/services/abilitymgr/abilitymgr.gni @@ -150,7 +150,6 @@ abilityms_files = [ "src/keep_alive/keep_alive_process_manager.cpp", "src/ability_manager_event_subscriber.cpp", - "src/ability_record_death_manager.cpp", "src/exit_info_data_manager.cpp", diff --git a/services/abilitymgr/include/ability_record_death_manager.h b/services/abilitymgr/include/ability_record_death_manager.h deleted file mode 100644 index 59343b61621..00000000000 --- a/services/abilitymgr/include/ability_record_death_manager.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_ABILITY_RECORD_DEATH_MANAGER_H -#define OHOS_ABILITY_RUNTIME_ABILITY_RECORD_DEATH_MANAGER_H - -#include -#include -#include - -#include "ability_record.h" - -namespace OHOS { -namespace AAFwk { -class AbilityRecordDeathManager { -public: - static AbilityRecordDeathManager &GetInstance(); - AbilityRecordDeathManager(AbilityRecordDeathManager &) = delete; - void operator=(AbilityRecordDeathManager &) = delete; - - void AddRecordToDeadList(std::shared_ptr abilityRecord); - std::list> QueryDeadAbilityRecord(int32_t pid, int32_t uid); -protected: - AbilityRecordDeathManager() = default; - - void RemoveTimeoutDeadAbilityRecord(); -private: - std::mutex deadAbilityRecordListMutex_; - std::list>> deadAbilityRecordList_; -}; -} // namespace AAFwk -} // namespace OHOS - -#endif // OHOS_ABILITY_RUNTIME_ABILITY_RECORD_DEATH_MANAGER_H \ No newline at end of file diff --git a/services/abilitymgr/include/app_exit_reason_helper.h b/services/abilitymgr/include/app_exit_reason_helper.h index 32dcfaf009b..d734c4e0d63 100644 --- a/services/abilitymgr/include/app_exit_reason_helper.h +++ b/services/abilitymgr/include/app_exit_reason_helper.h @@ -43,7 +43,7 @@ public: private: int32_t RecordProcessExitReason(const int32_t pid, const std::string bundleName, const int32_t uid, const uint32_t accessTokenId, const ExitReason &exitReason, - const AppExecFwk::RunningProcessInfo &processInfo, bool fromKillWithReason, bool searchDead); + const AppExecFwk::RunningProcessInfo &processInfo, bool fromKillWithReason); void GetActiveAbilityList(int32_t uid, std::vector &abilityLists, const int32_t pid); void GetActiveAbilityListFromUIAbilityManager(int32_t uid, std::vector &abilityLists, const int32_t pid); diff --git a/services/abilitymgr/src/ability_record_death_manager.cpp b/services/abilitymgr/src/ability_record_death_manager.cpp deleted file mode 100644 index 47ab6d0a390..00000000000 --- a/services/abilitymgr/src/ability_record_death_manager.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 "ability_record_death_manager.h" - -#include "task_handler_wrap.h" -#include "time_util.h" - -namespace OHOS { -namespace AAFwk { -constexpr int32_t DEAD_APP_RECORD_CLEAR_TIME = 3000; // ms -AbilityRecordDeathManager &AbilityRecordDeathManager::GetInstance() -{ - static AbilityRecordDeathManager instance; - return instance; -} - -void AbilityRecordDeathManager::AddRecordToDeadList(std::shared_ptr abilityRecord) -{ - if (abilityRecord == nullptr) { - return; - } - std::lock_guard lock(deadAbilityRecordListMutex_); - deadAbilityRecordList_.emplace_back(AbilityRuntime::TimeUtil::CurrentTimeMillis(), abilityRecord); - if (deadAbilityRecordList_.size() == 1) { - AAFwk::TaskHandlerWrap::GetFfrtHandler()->SubmitTask([]() { - AbilityRecordDeathManager::GetInstance().RemoveTimeoutDeadAbilityRecord(); - }, DEAD_APP_RECORD_CLEAR_TIME); - } -} - -std::list> AbilityRecordDeathManager::QueryDeadAbilityRecord(int32_t pid, int32_t uid) -{ - std::list> result; - std::lock_guard lock(deadAbilityRecordListMutex_); - for (const auto &[deadTime, abilityRecord] : deadAbilityRecordList_) { - if (abilityRecord && abilityRecord->GetPid() == pid && abilityRecord->GetUid() == uid) { - result.emplace_back(abilityRecord); - } - } - return result; -} - -void AbilityRecordDeathManager::RemoveTimeoutDeadAbilityRecord() -{ - std::lock_guard lock(deadAbilityRecordListMutex_); - auto timeEnd = AbilityRuntime::TimeUtil::CurrentTimeMillis() - DEAD_APP_RECORD_CLEAR_TIME; - auto it = deadAbilityRecordList_.begin(); - while (it != deadAbilityRecordList_.end() && it->first <= timeEnd) { - it = deadAbilityRecordList_.erase(it); - } - - if (!deadAbilityRecordList_.empty()) { - AAFwk::TaskHandlerWrap::GetFfrtHandler()->SubmitTask([]() { - AbilityRecordDeathManager::GetInstance().RemoveTimeoutDeadAbilityRecord(); - }, DEAD_APP_RECORD_CLEAR_TIME); - } -} -} // namespace AAFwk -} // namespace OHOS \ No newline at end of file diff --git a/services/abilitymgr/src/app_exit_reason_helper.cpp b/services/abilitymgr/src/app_exit_reason_helper.cpp index 8ee5f52de45..25010a0a48e 100644 --- a/services/abilitymgr/src/app_exit_reason_helper.cpp +++ b/services/abilitymgr/src/app_exit_reason_helper.cpp @@ -15,37 +15,17 @@ #include "app_exit_reason_helper.h" -#include "ability_record_death_manager.h" #include "accesstoken_kit.h" #include "app_exit_reason_data_manager.h" #include "app_mgr_util.h" #include "bundle_mgr_helper.h" +#include "exit_info_data_manager.h" #include "os_account_manager_wrapper.h" #include "scene_board_judgement.h" namespace OHOS { namespace AAFwk { namespace { -void AppendAbilities(const std::list> &abilityRecords, - std::vector &abilities) -{ - for (const auto &abilityRecord : abilityRecords) { - if (abilityRecord == nullptr) { - continue; - } - - const auto &abilityInfo = abilityRecord->GetAbilityInfo(); - if (!abilityInfo.name.empty()) { - std::string abilityName = abilityInfo.name; - if (abilityInfo.launchMode == AppExecFwk::LaunchMode::STANDARD && - abilityRecord->GetSessionInfo() != nullptr) { - abilityName += std::to_string(abilityRecord->GetSessionInfo()->persistentId); - } - TAG_LOGD(AAFwkTag::ABILITYMGR, "find ability name is %{public}s.", abilityName.c_str()); - abilities.emplace_back(std::move(abilityName)); - } - } -} } AppExitReasonHelper::AppExitReasonHelper(std::shared_ptr subManagersHelper) @@ -125,7 +105,7 @@ int32_t AppExitReasonHelper::RecordProcessExitReason(const int32_t pid, const Ex } return RecordProcessExitReason(pid, bundleName, application.uid, application.accessTokenId, exitReason, - processInfo, fromKillWithReason, false); + processInfo, fromKillWithReason); } int32_t AppExitReasonHelper::RecordAppExitReason(const std::string &bundleName, int32_t uid, int32_t appIndex, @@ -143,30 +123,24 @@ int32_t AppExitReasonHelper::RecordAppExitReason(const std::string &bundleName, uint32_t accessTokenId = Security::AccessToken::AccessTokenKit::GetHapTokenID(userId, bundleName, appIndex); AppExecFwk::RunningProcessInfo processInfo; GetRunningProcessInfo(NO_PID, userId, bundleName, processInfo); - return RecordProcessExitReason(NO_PID, bundleName, uid, accessTokenId, exitReason, processInfo, false, false); + return RecordProcessExitReason(NO_PID, bundleName, uid, accessTokenId, exitReason, processInfo, false); } int32_t AppExitReasonHelper::RecordProcessExitReason(int32_t pid, int32_t uid, const ExitReason &exitReason) { - auto appMgr = AppMgrUtil::GetAppMgr(); - if (appMgr == nullptr) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "appMgr null"); - return ERR_NULL_APP_MGR_PROXY; - } - AppExecFwk::KilledProcessInfo appInfo; - auto ret = IN_PROCESS_CALL(appMgr->GetKilledProcessInfo(pid, uid, appInfo)); - if (ret != ERR_OK) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "GetKilledProcessInfo failed"); - return ret; - } - - return RecordProcessExitReason(pid, appInfo.bundleName, uid, appInfo.accessTokenId, exitReason, - appInfo.processInfo, false, true); + uint32_t accessTokenId = 0; + AbilityRuntime::ExitCacheInfo cacheInfo = {}; + if (!AbilityRuntime::ExitInfoDataManager::GetInstance().GetExitInfo(pid, uid, accessTokenId, cacheInfo)) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "not found, pid: %{public}d, uid: %{public}d", pid, uid); + return ERR_NO_APP_RECORD; + } + return DelayedSingleton::GetInstance()->SetAppExitReason( + cacheInfo.bundleName, accessTokenId, cacheInfo.abilityNames, exitReason, cacheInfo.exitInfo, false); } int32_t AppExitReasonHelper::RecordProcessExitReason(const int32_t pid, const std::string bundleName, const int32_t uid, const uint32_t accessTokenId, const ExitReason &exitReason, - const AppExecFwk::RunningProcessInfo &processInfo, bool fromKillWithReason, bool searchDead) + const AppExecFwk::RunningProcessInfo &processInfo, bool fromKillWithReason) { if (!IsExitReasonValid(exitReason)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "reason invalid"); @@ -184,9 +158,6 @@ int32_t AppExitReasonHelper::RecordProcessExitReason(const int32_t pid, const st std::vector abilityLists; if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { GetActiveAbilityListFromUIAbilityManager(uid, abilityLists, pid); - if (searchDead) { - AppendAbilities(AbilityRecordDeathManager::GetInstance().QueryDeadAbilityRecord(pid, uid), abilityLists); - } } else { GetActiveAbilityList(uid, abilityLists, pid); } 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 ac0008c1cdf..506a36790cb 100644 --- a/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp +++ b/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp @@ -17,7 +17,6 @@ #include "ability_manager_service.h" #include "ability_permission_util.h" -#include "ability_record_death_manager.h" #include "ability_start_with_wait_observer_manager.h" #include "ability_start_with_wait_observer_utils.h" #include "appfreeze_manager.h" @@ -1131,14 +1130,12 @@ void UIAbilityLifecycleManager::EraseAbilityRecord(const std::shared_ptrsecond != nullptr && iter->second->GetToken()->AsObject() == abilityRecord->GetToken()->AsObject()) { sessionAbilityMap_.erase(iter); - AbilityRecordDeathManager::GetInstance().AddRecordToDeadList(abilityRecord); break; } } for (auto iter = lowMemKillAbilityMap_.begin(); iter != lowMemKillAbilityMap_.end(); iter++) { if (iter->second != nullptr && iter->second->GetToken()->AsObject() == abilityRecord->GetToken()->AsObject()) { lowMemKillAbilityMap_.erase(iter); - AbilityRecordDeathManager::GetInstance().AddRecordToDeadList(abilityRecord); break; } } diff --git a/services/appmgr/include/app_mgr_service.h b/services/appmgr/include/app_mgr_service.h index 5487983efa6..0f068249d02 100644 --- a/services/appmgr/include/app_mgr_service.h +++ b/services/appmgr/include/app_mgr_service.h @@ -882,16 +882,6 @@ public: */ virtual int32_t UpdateProcessMemoryState(const std::vector &procMemState) override; - /** - * Get killed process info by process id and uid. - * - * @param pid Process id. - * @param uid Process uid. - * @param info result KilledProcessInfo. - * @return Returns ERR_OK on success, others on failure. - */ - int32_t GetKilledProcessInfo(int pid, int uid, KilledProcessInfo &info) override; - /** * Launch ability when reuseDelegatorWindow is true. * diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 34d7b6ca738..77ed0dce9cf 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -1551,7 +1551,6 @@ public: void UpdateInstanceKeyBySpecifiedId(int32_t specifiedId, std::string &instanceKey); bool IsSpecifiedModuleLoaded(const AAFwk::Want &want, const AbilityInfo &abilityInfo, bool &isDebug); - int32_t GetKilledProcessInfo(int pid, int uid, KilledProcessInfo &info); std::shared_ptr GetTaskHandler() const { diff --git a/services/appmgr/include/app_running_manager.h b/services/appmgr/include/app_running_manager.h index d157cd58c2c..90934c52e86 100644 --- a/services/appmgr/include/app_running_manager.h +++ b/services/appmgr/include/app_running_manager.h @@ -430,7 +430,6 @@ public: bool CheckAppRunningRecordIsLast(const std::shared_ptr &appRecord); void UpdateInstanceKeyBySpecifiedId(int32_t specifiedId, std::string &instanceKey); - std::shared_ptr QueryAppRecordPlus(int32_t pid, int32_t uid); int32_t AddUIExtensionBindItem(int32_t uiExtensionBindAbilityId, UIExtensionProcessBindInfo &bindInfo); int32_t QueryUIExtensionBindItemById(int32_t uiExtensionBindAbilityId, UIExtensionProcessBindInfo &bindInfo); int32_t RemoveUIExtensionBindItemById(int32_t uiExtensionBindAbilityId); @@ -450,8 +449,6 @@ private: bool isCollaboratorReserveType(const std::shared_ptr &appRecord); void NotifyAppPreCache(const std::shared_ptr& appRecord, const std::shared_ptr& appMgrServiceInner); - void AddRecordToDeadList(std::shared_ptr appRecord); - void RemoveTimeoutDeadAppRecord(); void ExecuteConfigurationTask(const BackgroundAppInfo& info, const int32_t userId); bool UpdateConfiguration(std::shared_ptr &appRecord, Rosen::ConfigMode configMode); bool IsSameAbilityType( @@ -459,7 +456,6 @@ private: private: std::mutex runningRecordMapMutex_; std::map> appRunningRecordMap_; - std::list>> deadAppRecordList_; // dead time and record std::mutex uiExtensionMapLock_; std::map> uiExtensionLauncherMap_; diff --git a/services/appmgr/src/app_mgr_service.cpp b/services/appmgr/src/app_mgr_service.cpp index aba4e8d4815..029fa3063d1 100644 --- a/services/appmgr/src/app_mgr_service.cpp +++ b/services/appmgr/src/app_mgr_service.cpp @@ -1890,24 +1890,6 @@ int32_t AppMgrService::UpdateProcessMemoryState(const std::vectorUpdateProcessMemoryState(procMemState); } -int32_t AppMgrService::GetKilledProcessInfo(int pid, int uid, KilledProcessInfo &info) -{ - if (!IsReady()) { - return AAFwk::ERR_APP_MGR_SERVICE_NOT_READY; - } - pid_t callingPid = IPCSkeleton::GetCallingPid(); - pid_t currentPid = getprocpid(); - if (callingPid != currentPid) { - TAG_LOGE(AAFwkTag::APPMGR, "other process"); - return AAFwk::ERR_NO_ALLOW_OUTSIDE_CALL; - } - if (!appMgrServiceInner_) { - TAG_LOGE(AAFwkTag::APPMGR, "appMgrServiceInner_ is nullptr"); - return AAFwk::ERR_NULL_APP_MGR_SERVICE_INNER; - } - return appMgrServiceInner_->GetKilledProcessInfo(pid, uid, info); -} - int32_t AppMgrService::LaunchAbility(sptr token) { if (!IsReady()) { diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 9b5e90ae6e0..149c1bd7a75 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -9918,28 +9918,6 @@ bool AppMgrServiceInner::IsSpecifiedModuleLoaded(const AAFwk::Want &want, const return moduleRecord->IsLoaded(); } -int32_t AppMgrServiceInner::GetKilledProcessInfo(int pid, int uid, KilledProcessInfo &info) -{ - if (!appRunningManager_) { - TAG_LOGE(AAFwkTag::APPMGR, "appRunningManager null"); - return AAFwk::ERR_NULL_APP_RUNNING_MANAGER; - } - auto appRecord = appRunningManager_->QueryAppRecordPlus(pid, uid); - if (appRecord == nullptr) { - TAG_LOGI(AAFwkTag::APPMGR, "appRecord not found"); - return AAFwk::ERR_NO_APP_RECORD; - } - auto appInfo = appRecord->GetApplicationInfo(); - if (appInfo) { - info.accessTokenId = appInfo->accessTokenId; - } else { - TAG_LOGW(AAFwkTag::APPMGR, "appInfo null"); - } - info.bundleName = appRecord->GetBundleName(); - appRunningManager_->AssignRunningProcessInfoByAppRecord(appRecord, info.processInfo); - return ERR_OK; -} - void AppMgrServiceInner::SendAbilityEvent(const std::shared_ptr &abilityRecord, const AbilityState &state) { diff --git a/services/appmgr/src/app_running_manager.cpp b/services/appmgr/src/app_running_manager.cpp index 74e14e9ce7a..e78da739dca 100644 --- a/services/appmgr/src/app_running_manager.cpp +++ b/services/appmgr/src/app_running_manager.cpp @@ -697,7 +697,6 @@ std::shared_ptr AppRunningManager::OnRemoteDied(const wptrsecond; appRunningRecordMap_.erase(iter); } - AddRecordToDeadList(appRecord); if (appRecord != nullptr) { { std::lock_guard guard(updateConfigurationDelayedLock_); @@ -2209,58 +2208,6 @@ void AppRunningManager::UpdateInstanceKeyBySpecifiedId(int32_t specifiedId, std: } } -std::shared_ptr AppRunningManager::QueryAppRecordPlus(int32_t pid, int32_t uid) -{ - std::lock_guard guard(runningRecordMapMutex_); - for (const auto &[id, appRecord] : appRunningRecordMap_) { - if (appRecord && appRecord->GetPid() == pid && appRecord->GetUid() == uid) { - return appRecord; - } - } - - for (const auto &[deadTime, appRecord] : deadAppRecordList_) { - if (appRecord && appRecord->GetPid() == pid && appRecord->GetUid() == uid) { - return appRecord; - } - } - return nullptr; -} - -void AppRunningManager::AddRecordToDeadList(std::shared_ptr appRecord) -{ - if (appRecord == nullptr) { - return; - } - std::lock_guard guard(runningRecordMapMutex_); - deadAppRecordList_.emplace_back(AbilityRuntime::TimeUtil::CurrentTimeMillis(), appRecord); - if (deadAppRecordList_.size() == 1) { - AAFwk::TaskHandlerWrap::GetFfrtHandler()->SubmitTask([wThis = weak_from_this()]() { - auto pThis = wThis.lock(); - if (pThis) { - pThis->RemoveTimeoutDeadAppRecord(); - } - }, DEAD_APP_RECORD_CLEAR_TIME); - } -} - -void AppRunningManager::RemoveTimeoutDeadAppRecord() -{ - std::lock_guard guard(runningRecordMapMutex_); - auto timeEnd = AbilityRuntime::TimeUtil::CurrentTimeMillis() - DEAD_APP_RECORD_CLEAR_TIME; - auto it = deadAppRecordList_.begin(); - while (it != deadAppRecordList_.end() && it->first <= timeEnd) { - it = deadAppRecordList_.erase(it); - } - if (!deadAppRecordList_.empty()) { - AAFwk::TaskHandlerWrap::GetFfrtHandler()->SubmitTask([wThis = weak_from_this()]() { - auto pThis = wThis.lock(); - if (pThis) { - pThis->RemoveTimeoutDeadAppRecord(); - } - }, DEAD_APP_RECORD_CLEAR_TIME); - } -} - int32_t AppRunningManager::AddUIExtensionBindItem( int32_t uiExtensionBindAbilityId, UIExtensionProcessBindInfo &bindInfo) { diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 84bcd0b3ba4..65c370b8929 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -179,7 +179,6 @@ group("unittest") { "ability_manager_stub_test:unittest", "ability_permission_util_second_test:unittest", "ability_permission_util_test:unittest", - "ability_record_death_manager_test:unittest", "ability_record_dump_test:unittest", "ability_record_first_test:unittest", "ability_record_mgr_test:unittest", diff --git a/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn b/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn index 582ec922491..99082ef1800 100644 --- a/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn +++ b/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn @@ -82,7 +82,6 @@ ohos_unittest("ability_manager_service_fourteenth_test") { "${ability_runtime_services_path}/abilitymgr/src/ability_manager_event_subscriber.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_manager_service.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_manager_stub.cpp", - "${ability_runtime_services_path}/abilitymgr/src/ability_record_death_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_running_info.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_scheduler_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_start_with_wait_observer_manager/ability_start_with_wait_observer_manager.cpp", diff --git a/test/unittest/ability_manager_service_second_test/BUILD.gn b/test/unittest/ability_manager_service_second_test/BUILD.gn index 56d4846b0c4..c93548bcae5 100644 --- a/test/unittest/ability_manager_service_second_test/BUILD.gn +++ b/test/unittest/ability_manager_service_second_test/BUILD.gn @@ -84,7 +84,6 @@ ohos_unittest("ability_manager_service_second_test") { "${ability_runtime_services_path}/abilitymgr/src/ability_manager_event_subscriber.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_manager_service.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_manager_stub.cpp", - "${ability_runtime_services_path}/abilitymgr/src/ability_record_death_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_running_info.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_scheduler_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_start_with_wait_observer_manager/ability_start_with_wait_observer_manager.cpp", diff --git a/test/unittest/ability_manager_service_third_test/abilitymgr.gni b/test/unittest/ability_manager_service_third_test/abilitymgr.gni index 571d2a93527..d488d898c10 100644 --- a/test/unittest/ability_manager_service_third_test/abilitymgr.gni +++ b/test/unittest/ability_manager_service_third_test/abilitymgr.gni @@ -145,7 +145,6 @@ abilityms_files = [ "${ability_runtime_services_path}/abilitymgr/src/keep_alive/keep_alive_process_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_manager_event_subscriber.cpp", - "${ability_runtime_services_path}/abilitymgr/src/ability_record_death_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/exit_info_data_manager.cpp", diff --git a/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn b/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn index 18da7f65c4d..d1b54c53e43 100644 --- a/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn +++ b/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn @@ -83,7 +83,6 @@ ohos_unittest("ability_manager_service_thirteenth_test") { "${ability_runtime_services_path}/abilitymgr/src/ability_manager_event_subscriber.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_manager_service.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_manager_stub.cpp", - "${ability_runtime_services_path}/abilitymgr/src/ability_record_death_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_running_info.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_scheduler_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_start_with_wait_observer_manager/ability_start_with_wait_observer_manager.cpp", diff --git a/test/unittest/ability_record_death_manager_test/BUILD.gn b/test/unittest/ability_record_death_manager_test/BUILD.gn deleted file mode 100644 index 76a98138381..00000000000 --- a/test/unittest/ability_record_death_manager_test/BUILD.gn +++ /dev/null @@ -1,115 +0,0 @@ -# Copyright (c) 2021-2024 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. - -import("//build/test.gni") -import("//foundation/ability/ability_runtime/ability_runtime.gni") - -module_output_path = "ability_runtime/ability_runtime/abilitymgr" - -ohos_unittest("ability_record_death_manager_test") { - module_out_path = module_output_path - include_dirs = [ - "${ability_runtime_services_path}/appdfr/include", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", - "${ability_runtime_test_path}/mock/common/include", - "${ability_runtime_services_path}/abilitymgr/include/utils", - ] - - sources = [ - "${ability_runtime_native_path}/appkit/ability_bundle_manager_helper/bundle_mgr_helper.cpp", - "${ability_runtime_services_path}/abilitymgr/src/lifecycle_deal.cpp", - "${ability_runtime_services_path}/abilitymgr/src/utils/uri_utils.cpp", - "ability_record_death_manager_test.cpp", - ] - - configs = [ - "${ability_runtime_services_path}/abilitymgr:abilityms_config", - "${ability_runtime_test_path}/mock/services_abilitymgr_test:aafwk_mock_config", - ] - cflags = [] - if (target_cpu == "arm") { - cflags += [ "-DBINDER_IPC_32BIT" ] - } - deps = [ - "${ability_runtime_innerkits_path}/ability_manager:ability_manager", - "${ability_runtime_innerkits_path}/ability_manager:ability_start_setting", - "${ability_runtime_innerkits_path}/ability_manager:mission_info", - "${ability_runtime_native_path}/ability/native:abilitykit_native", - "${ability_runtime_native_path}/ability/native:auto_startup_callback", - "${ability_runtime_services_path}/abilitymgr:abilityms", - "${ability_runtime_services_path}/abilitymgr:mission_list", - "${ability_runtime_services_path}/common:event_report", - "${ability_runtime_services_path}/common:perm_verification", - "${ability_runtime_services_path}/common:record_cost_time_util", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit:aakit_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_appmgr_mock", - "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", - ] - - external_deps = [ - "ability_base:configuration", - "ability_base:extractortool", - "ability_base:session_info", - "ability_base:want", - "ability_base:zuri", - "ability_runtime:ability_deps_wrapper", - "access_token:libaccesstoken_sdk", - "access_token:libtokenid_sdk", - "bundle_framework:appexecfwk_base", - "c_utils:utils", - "common_event_service:cesfwk_innerkits", - "eventhandler:libeventhandler", - "ffrt:libffrt", - "googletest:gmock_main", - "googletest:gtest_main", - "hilog:libhilog", - "hisysevent:libhisysevent", - "hitrace:hitrace_meter", - "init:libbeget_proxy", - "init:libbegetutil", - "ipc:ipc_core", - "napi:ace_napi", - "resource_management:global_resmgr", - "samgr:samgr_proxy", - "storage_service:storage_manager_sa_proxy", - ] - - defines = [ "SUPPORT_UPMS" ] - - if (background_task_mgr_continuous_task_enable) { - external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] - } - - if (ability_runtime_graphics) { - external_deps += [ "image_framework:image_native" ] - } - if (ability_runtime_upms) { - configs += [ "${ability_runtime_innerkits_path}/uri_permission:uripermkit_public_config" ] - deps += [ - "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr", - "${ability_runtime_services_path}/uripermmgr:libupms_static", - ] - } - cflags_cc = [] - if (os_dlp_part_enabled) { - cflags_cc += [ "-DWITH_DLP" ] - } -} - -group("unittest") { - testonly = true - - deps = [ - ":ability_record_death_manager_test", - ] -} diff --git a/test/unittest/ability_record_death_manager_test/ability_record_death_manager_test.cpp b/test/unittest/ability_record_death_manager_test/ability_record_death_manager_test.cpp deleted file mode 100644 index 1187822110c..00000000000 --- a/test/unittest/ability_record_death_manager_test/ability_record_death_manager_test.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 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 -#include -#include -#define private public -#define protected public -#include "ability_record_death_manager.h" -#undef protected -#undef private -#include "ability_record.h" -#include "application_info.h" -#include "time_util.h" -#include "mock_ability_token.h" - -using namespace testing::ext; - -namespace OHOS { -namespace AAFwk { -namespace { - const int32_t DEFAULT_PID = 1001; - const int32_t DEFAULT_UID = 10001; - const std::string DEFAULT_BUNDLE_NAME = "com.example.test"; - const std::string DEFAULT_ABILITY_NAME = "TestAbility"; - const int32_t WAIT_TIME_MS = 3500; // Wait time should be longer than DEAD_APP_RECORD_CLEAR_TIME -} - -class AbilityRecordDeathManagerTest : public testing::Test { -public: - static void SetUpTestCase(); - static void TearDownTestCase(); - void SetUp() override; - void TearDown() override; - - std::shared_ptr CreateMockAbilityRecord(int32_t pid, int32_t uid) const; -}; - -void AbilityRecordDeathManagerTest::SetUpTestCase() -{} - -void AbilityRecordDeathManagerTest::TearDownTestCase() -{} - -void AbilityRecordDeathManagerTest::SetUp() -{} - -void AbilityRecordDeathManagerTest::TearDown() -{} - -std::shared_ptr AbilityRecordDeathManagerTest::CreateMockAbilityRecord(int32_t pid, int32_t uid) const -{ - sptr token = new AppExecFwk::MockAbilityToken(); - std::shared_ptr abilityInfo = std::make_shared(); - abilityInfo->bundleName = DEFAULT_BUNDLE_NAME; - abilityInfo->name = DEFAULT_ABILITY_NAME; - AppExecFwk::ApplicationInfo applicationInfo; - Want want; - std::shared_ptr abilityRecord = std::make_shared(want, *abilityInfo, applicationInfo); - abilityRecord->Init(); - abilityRecord->SetPid(pid); - abilityRecord->SetUid(uid); - return abilityRecord; -} - -/** - * @tc.name: AbilityRecordDeathManager_GetInstance_001 - * @tc.desc: Test GetInstance returns a valid singleton instance. - * @tc.type: FUNC - */ -HWTEST_F(AbilityRecordDeathManagerTest, GetInstance_001, TestSize.Level1) -{ - auto& instance1 = AbilityRecordDeathManager::GetInstance(); - auto& instance2 = AbilityRecordDeathManager::GetInstance(); - EXPECT_EQ(&instance1, &instance2); -} - -/** - * @tc.name: AbilityRecordDeathManager_AddRecordToDeadList_001 - * @tc.desc: Test adding a null ability record does nothing. - * @tc.type: FUNC - */ -HWTEST_F(AbilityRecordDeathManagerTest, AddRecordToDeadList_001, TestSize.Level1) -{ - AbilityRecordDeathManager& manager = AbilityRecordDeathManager::GetInstance(); - std::shared_ptr nullRecord = nullptr; - manager.AddRecordToDeadList(nullRecord); - auto result = manager.QueryDeadAbilityRecord(DEFAULT_PID, DEFAULT_UID); - EXPECT_EQ(result.size(), 0); - manager.deadAbilityRecordList_.clear(); -} - -/** - * @tc.name: AbilityRecordDeathManager_AddRecordToDeadList_002 - * @tc.desc: Test adding and querying an ability record. - * @tc.type: FUNC - */ -HWTEST_F(AbilityRecordDeathManagerTest, AddRecordToDeadList_002, TestSize.Level1) -{ - AbilityRecordDeathManager& manager = AbilityRecordDeathManager::GetInstance(); - auto record = CreateMockAbilityRecord(DEFAULT_PID, DEFAULT_UID); - manager.AddRecordToDeadList(record); - auto result = manager.QueryDeadAbilityRecord(DEFAULT_PID, DEFAULT_UID); - EXPECT_EQ(result.size(), 1); - manager.deadAbilityRecordList_.clear(); -} - -/** - * @tc.name: AbilityRecordDeathManager_QueryDeadAbilityRecord_001 - * @tc.desc: Test querying for non-existent records. - * @tc.type: FUNC - */ -HWTEST_F(AbilityRecordDeathManagerTest, QueryDeadAbilityRecord_001, TestSize.Level1) -{ - AbilityRecordDeathManager& manager = AbilityRecordDeathManager::GetInstance(); - auto result = manager.QueryDeadAbilityRecord(DEFAULT_PID, DEFAULT_UID); - EXPECT_EQ(result.size(), 0); -} - -/** - * @tc.name: AbilityRecordDeathManager_QueryDeadAbilityRecord_002 - * @tc.desc: Test querying for multiple records with same pid/uid. - * @tc.type: FUNC - */ -HWTEST_F(AbilityRecordDeathManagerTest, QueryDeadAbilityRecord_002, TestSize.Level1) -{ - AbilityRecordDeathManager& manager = AbilityRecordDeathManager::GetInstance(); - auto record1 = CreateMockAbilityRecord(DEFAULT_PID, DEFAULT_UID); - manager.AddRecordToDeadList(record1); - auto result = manager.QueryDeadAbilityRecord(DEFAULT_PID, DEFAULT_UID); - EXPECT_EQ(result.size(), 1); - manager.deadAbilityRecordList_.clear(); -} - -/** - * @tc.name: AbilityRecordDeathManager_RemoveTimeoutDeadAbilityRecord_001 - * @tc.desc: Test removing timed-out records. - * @tc.type: FUNC - */ -HWTEST_F(AbilityRecordDeathManagerTest, RemoveTimeoutDeadAbilityRecord_001, TestSize.Level1) -{ - AbilityRecordDeathManager& manager = AbilityRecordDeathManager::GetInstance(); - auto record = CreateMockAbilityRecord(DEFAULT_PID, DEFAULT_UID); - manager.AddRecordToDeadList(record); - auto result = manager.QueryDeadAbilityRecord(DEFAULT_PID, DEFAULT_UID); - EXPECT_EQ(result.size(), 1); - std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_TIME_MS)); - manager.RemoveTimeoutDeadAbilityRecord(); - result = manager.QueryDeadAbilityRecord(DEFAULT_PID, DEFAULT_UID); - EXPECT_EQ(result.size(), 0); - manager.deadAbilityRecordList_.clear(); -} - -/** - * @tc.name: AbilityRecordDeathManager_RemoveTimeoutDeadAbilityRecord_002 - * @tc.desc: Test removing timed-out records. - * @tc.type: FUNC - */ -HWTEST_F(AbilityRecordDeathManagerTest, RemoveTimeoutDeadAbilityRecord_002, TestSize.Level1) -{ - AbilityRecordDeathManager& manager = AbilityRecordDeathManager::GetInstance(); - auto record = CreateMockAbilityRecord(DEFAULT_PID, DEFAULT_UID); - manager.AddRecordToDeadList(record); - manager.RemoveTimeoutDeadAbilityRecord(); - auto result = manager.QueryDeadAbilityRecord(DEFAULT_PID, DEFAULT_UID); - EXPECT_EQ(result.size(), 1); - manager.deadAbilityRecordList_.clear(); -} -} // namespace AAFwk -} // namespace OHOS diff --git a/test/unittest/ability_record_death_manager_test/mock_ability_token.h b/test/unittest/ability_record_death_manager_test/mock_ability_token.h deleted file mode 100644 index ca420703639..00000000000 --- a/test/unittest/ability_record_death_manager_test/mock_ability_token.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2021 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. - */ - -#ifndef MOCK_OHOS_ABILITY_RUNTIME_MOCK_ABILITY_TOKEN_H -#define MOCK_OHOS_ABILITY_RUNTIME_MOCK_ABILITY_TOKEN_H - -#include "nocopyable.h" -#include "iremote_broker.h" -#include "iremote_object.h" -#include "iremote_proxy.h" -#include "iremote_stub.h" - -namespace OHOS { -namespace AppExecFwk { -class IAbilityToken : public IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.AbilityToken"); -}; -DECLARE_INTERFACE_DESCRIPTOR(u"IAbilityToken"); - -class MockAbilityToken : public IRemoteStub { -public: - MockAbilityToken() = default; - virtual ~MockAbilityToken() = default; - - virtual int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) - { - return 0; - } - -private: - DISALLOW_COPY_AND_MOVE(MockAbilityToken); -}; - -class AbilityTokenProxy : public IRemoteProxy { -public: - explicit AbilityTokenProxy(const sptr& impl) : IRemoteProxy(impl) - {} - - virtual ~AbilityTokenProxy() = default; - -private: - DISALLOW_COPY_AND_MOVE(AbilityTokenProxy); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // MOCK_OHOS_ABILITY_RUNTIME_MOCK_ABILITY_TOKEN_H diff --git a/test/unittest/app_exit_reason_helper_fourth_test/app_exit_reason_helper_fourth_test.cpp b/test/unittest/app_exit_reason_helper_fourth_test/app_exit_reason_helper_fourth_test.cpp index 9e2f387d09e..b6ebbdd82e6 100644 --- a/test/unittest/app_exit_reason_helper_fourth_test/app_exit_reason_helper_fourth_test.cpp +++ b/test/unittest/app_exit_reason_helper_fourth_test/app_exit_reason_helper_fourth_test.cpp @@ -179,10 +179,9 @@ HWTEST_F(AppExitReasonHelperTest, RecordProcessExitReason_0400, TestSize.Level1) ExitReason exitReason; AppExecFwk::RunningProcessInfo processInfo; bool fromKillWithReason = false; - bool searchDead = true; appExitReasonHelper->subManagersHelper_ = nullptr; int32_t result = appExitReasonHelper->RecordProcessExitReason( - pid, bundleName, uid, accessTokenId, exitReason, processInfo, fromKillWithReason, searchDead); + pid, bundleName, uid, accessTokenId, exitReason, processInfo, fromKillWithReason); EXPECT_NE(result, 0); EXPECT_CALL(Rosen::SceneBoardJudgement::GetInstance(), MockIsSceneBoardEnabled()) @@ -196,7 +195,7 @@ HWTEST_F(AppExitReasonHelperTest, RecordProcessExitReason_0400, TestSize.Level1) EXPECT_NE(missionListManager, nullptr); appExitReasonHelper->subManagersHelper_->missionListManagers_.emplace(0, missionListManager); result = appExitReasonHelper->RecordProcessExitReason( - pid, bundleName, uid, accessTokenId, exitReason, processInfo, fromKillWithReason, searchDead); + pid, bundleName, uid, accessTokenId, exitReason, processInfo, fromKillWithReason); EXPECT_NE(result, 0); GTEST_LOG_(INFO) << "RecordProcessExitReason_0400 end"; diff --git a/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h b/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h index 9a36d76d172..6abdc3e5b3a 100644 --- a/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h +++ b/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h @@ -536,15 +536,6 @@ public: { return 0; } - - virtual int32_t GetKilledProcessInfo(int pid, int uid, KilledProcessInfo& info) - { - if (pid == 0 || uid == 0) { - return -1; - } else { - return 0; - } - } }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_exit_reason_helper_test/app_exit_reason_helper_test.cpp b/test/unittest/app_exit_reason_helper_test/app_exit_reason_helper_test.cpp index 67937a7448b..f32cd8266be 100644 --- a/test/unittest/app_exit_reason_helper_test/app_exit_reason_helper_test.cpp +++ b/test/unittest/app_exit_reason_helper_test/app_exit_reason_helper_test.cpp @@ -155,7 +155,7 @@ HWTEST_F(AppExitReasonHelperTest, RecordProcessExitReason_0200, TestSize.Level1) uint32_t accessTokenId = 0; AAFwk::ExitReason exitReason; int32_t result = appExitReasonHelper_->RecordProcessExitReason(pid, bundleName, uid, accessTokenId, - exitReason, {}, false, false); + exitReason, {}, false); EXPECT_NE(result, ERR_OK); } diff --git a/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp b/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp index a7a4952ece3..a50bac3fd31 100644 --- a/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp +++ b/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp @@ -2555,65 +2555,6 @@ HWTEST_F(AppMgrServiceInnerEighthTest, IsSpecifiedModuleLoaded_001, TestSize.Lev TAG_LOGI(AAFwkTag::TEST, "IsSpecifiedModuleLoaded_001 end"); } -/** - * @tc.name: GetKilledProcessInfo_001 - * @tc.desc: test GetKilledProcessInfo_001 - * @tc.type: FUNC - */ -HWTEST_F(AppMgrServiceInnerEighthTest, GetKilledProcessInfo_001, TestSize.Level1) -{ - TAG_LOGI(AAFwkTag::TEST, "GetKilledProcessInfo_001 start"); - auto appMgrServiceInner = std::make_shared(); - appMgrServiceInner->appRunningManager_ = nullptr; - - int pid = 0; - int uid = 0; - KilledProcessInfo info; - auto ret = appMgrServiceInner->GetKilledProcessInfo(pid, uid, info); - EXPECT_EQ(ret, AAFwk::ERR_NULL_APP_RUNNING_MANAGER); - TAG_LOGI(AAFwkTag::TEST, "GetKilledProcessInfo_001 end"); -} - -/** - * @tc.name: GetKilledProcessInfo_002 - * @tc.desc: test GetKilledProcessInfo_002 - * @tc.type: FUNC - */ -HWTEST_F(AppMgrServiceInnerEighthTest, GetKilledProcessInfo_002, TestSize.Level1) -{ - TAG_LOGI(AAFwkTag::TEST, "GetKilledProcessInfo_002 start"); - auto appMgrServiceInner = std::make_shared(); - std::shared_ptr info1 = std::make_shared(); - AAFwk::MyStatus::GetInstance().queryAppRecordPlus_ = std::make_shared(info1, 0, ""); - - int pid = 0; - int uid = 0; - KilledProcessInfo info; - auto ret = appMgrServiceInner->GetKilledProcessInfo(pid, uid, info); - EXPECT_EQ(ret, ERR_OK); - TAG_LOGI(AAFwkTag::TEST, "GetKilledProcessInfo_002 end"); -} - -/** - * @tc.name: GetKilledProcessInfo_003 - * @tc.desc: test GetKilledProcessInfo_003 - * @tc.type: FUNC - */ -HWTEST_F(AppMgrServiceInnerEighthTest, GetKilledProcessInfo_003, TestSize.Level1) -{ - TAG_LOGI(AAFwkTag::TEST, "GetKilledProcessInfo_003 start"); - auto appMgrServiceInner = std::make_shared(); - std::shared_ptr info1 = nullptr; - AAFwk::MyStatus::GetInstance().queryAppRecordPlus_ = std::make_shared(info1, 0, ""); - - int pid = 0; - int uid = 0; - KilledProcessInfo info; - auto ret = appMgrServiceInner->GetKilledProcessInfo(pid, uid, info); - EXPECT_EQ(ret, ERR_OK); - TAG_LOGI(AAFwkTag::TEST, "GetKilledProcessInfo_003 end"); -} - /** * @tc.name: LaunchAbility_001 * @tc.desc: test LaunchAbility_001 diff --git a/test/unittest/app_mgr_service_inner_eighth_test/mock/include/mock_my_status.h b/test/unittest/app_mgr_service_inner_eighth_test/mock/include/mock_my_status.h index f300dd1e78f..c2df9d805f1 100755 --- a/test/unittest/app_mgr_service_inner_eighth_test/mock/include/mock_my_status.h +++ b/test/unittest/app_mgr_service_inner_eighth_test/mock/include/mock_my_status.h @@ -84,7 +84,6 @@ public: pid_t handleUserRequestCleanUid_ = 0; bool handleUserRequestClean_ = false; ErrCode checkIsKiaProcess_ = ERR_OK; - std::shared_ptr queryAppRecordPlus_ = nullptr; // mock accesstoken_kit int clearUserGranted_ = 0; // mock bundle diff --git a/test/unittest/app_mgr_service_inner_eighth_test/mock/src/mock_app_running_manager.cpp b/test/unittest/app_mgr_service_inner_eighth_test/mock/src/mock_app_running_manager.cpp index 42bdfa15d4f..52086cdaea0 100644 --- a/test/unittest/app_mgr_service_inner_eighth_test/mock/src/mock_app_running_manager.cpp +++ b/test/unittest/app_mgr_service_inner_eighth_test/mock/src/mock_app_running_manager.cpp @@ -478,18 +478,5 @@ bool AppRunningManager::CheckAppRunningRecordIsLast(const std::shared_ptr AppRunningManager::QueryAppRecordPlus(int32_t pid, int32_t uid) -{ - return AAFwk::MyStatus::GetInstance().queryAppRecordPlus_; -} - -void AppRunningManager::AddRecordToDeadList(std::shared_ptr appRecord) -{ -} - -void AppRunningManager::RemoveTimeoutDeadAppRecord() -{ -} } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_mgr_service_inner_ninth_test/mock/include/mock_my_status.h b/test/unittest/app_mgr_service_inner_ninth_test/mock/include/mock_my_status.h index 28b42852fcd..ae4ac6e5198 100644 --- a/test/unittest/app_mgr_service_inner_ninth_test/mock/include/mock_my_status.h +++ b/test/unittest/app_mgr_service_inner_ninth_test/mock/include/mock_my_status.h @@ -85,7 +85,6 @@ public: pid_t handleUserRequestCleanUid_ = 0; bool handleUserRequestClean_ = false; ErrCode checkIsKiaProcess_ = ERR_OK; - std::shared_ptr queryAppRecordPlus_ = nullptr; // mock accesstoken_kit int clearUserGranted_ = 0; // mock bundle diff --git a/test/unittest/app_mgr_service_inner_ninth_test/mock/src/mock_app_running_manager.cpp b/test/unittest/app_mgr_service_inner_ninth_test/mock/src/mock_app_running_manager.cpp index 3175230791a..bf28faf787d 100644 --- a/test/unittest/app_mgr_service_inner_ninth_test/mock/src/mock_app_running_manager.cpp +++ b/test/unittest/app_mgr_service_inner_ninth_test/mock/src/mock_app_running_manager.cpp @@ -497,18 +497,6 @@ void AppRunningManager::UpdateInstanceKeyBySpecifiedId(int32_t specifiedId, std: AAFwk::MyStatus::GetInstance().updateInstanceKeyBySpecifiedIdCalled_ = true; } -std::shared_ptr AppRunningManager::QueryAppRecordPlus(int32_t pid, int32_t uid) -{ - return AAFwk::MyStatus::GetInstance().queryAppRecordPlus_; -} - -void AppRunningManager::AddRecordToDeadList(std::shared_ptr appRecord) -{ -} - -void AppRunningManager::RemoveTimeoutDeadAppRecord() -{ -} int32_t AppRunningManager::RemoveUIExtensionBindItemById(int32_t uiExtensionBindAbilityId) { AAFwk::MyStatus::GetInstance().removeUIExtensionBindItemByIdCalled_ = true; diff --git a/test/unittest/app_mgr_service_inner_seventh_test/mock/src/mock_app_running_manager.cpp b/test/unittest/app_mgr_service_inner_seventh_test/mock/src/mock_app_running_manager.cpp index 700387d2a55..82743cedc5c 100644 --- a/test/unittest/app_mgr_service_inner_seventh_test/mock/src/mock_app_running_manager.cpp +++ b/test/unittest/app_mgr_service_inner_seventh_test/mock/src/mock_app_running_manager.cpp @@ -475,18 +475,5 @@ bool AppRunningManager::CheckAppRunningRecordIsLast(const std::shared_ptr AppRunningManager::QueryAppRecordPlus(int32_t pid, int32_t uid) -{ - return nullptr; -} - -void AppRunningManager::AddRecordToDeadList(std::shared_ptr appRecord) -{ -} - -void AppRunningManager::RemoveTimeoutDeadAppRecord() -{ -} } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_mgr_service_second_test/app_mgr_service_second_test.cpp b/test/unittest/app_mgr_service_second_test/app_mgr_service_second_test.cpp index 8b738a10007..0b21ad65d19 100644 --- a/test/unittest/app_mgr_service_second_test/app_mgr_service_second_test.cpp +++ b/test/unittest/app_mgr_service_second_test/app_mgr_service_second_test.cpp @@ -428,33 +428,6 @@ HWTEST_F(AppMgrServiceSecondTest, UpdateProcessMemoryState_0100, TestSize.Level1 EXPECT_NE(ret, ERR_INVALID_OPERATION); } -/** - * @tc.name: GetKilledProcessInfo_0100 - * @tc.desc: GetKilledProcessInfo. - * @tc.type: FUNC - */ -HWTEST_F(AppMgrServiceSecondTest, GetKilledProcessInfo_0100, TestSize.Level1) -{ - auto appMgrService = std::make_shared(); - int pid = 1; - int uid = 0; - KilledProcessInfo info; - auto ret = appMgrService->GetKilledProcessInfo(pid, uid, info); - EXPECT_EQ(ret, AAFwk::ERR_APP_MGR_SERVICE_NOT_READY); - - appMgrService->taskHandler_ = AAFwk::TaskHandlerWrap::CreateQueueHandler(Constants::APP_MGR_SERVICE_NAME); - appMgrService->appMgrServiceInner_ = std::make_shared(); - appMgrService->eventHandler_ = std::make_shared(appMgrService->taskHandler_, - appMgrService->appMgrServiceInner_); - IPCSkeleton::pid_ = 0; - ret = appMgrService->GetKilledProcessInfo(pid, uid, info); - EXPECT_EQ(ret, AAFwk::ERR_NO_ALLOW_OUTSIDE_CALL); - - IPCSkeleton::pid_ = getprocpid(); - ret = appMgrService->GetKilledProcessInfo(pid, uid, info); - EXPECT_NE(ret, AAFwk::ERR_APP_MGR_SERVICE_NOT_READY); -} - /** * @tc.name: IsProcessCacheSupported_0100 * @tc.desc: IsProcessCacheSupported. diff --git a/test/unittest/app_running_manager_fourth_test/app_running_manager_fourth_test.cpp b/test/unittest/app_running_manager_fourth_test/app_running_manager_fourth_test.cpp index 8dfbee31db0..3e759a0ca74 100644 --- a/test/unittest/app_running_manager_fourth_test/app_running_manager_fourth_test.cpp +++ b/test/unittest/app_running_manager_fourth_test/app_running_manager_fourth_test.cpp @@ -616,108 +616,6 @@ HWTEST_F(AppRunningManagerFourthTest, AppRunningManager_CheckAppRunningRecordIsL TAG_LOGI(AAFwkTag::TEST, "AppRunningManager_CheckAppRunningRecordIsLast_0100 end"); } -/** - * @tc.name: QueryAppRecordPlus_0100 - * @tc.desc: test QueryAppRecordPlus - * @tc.type: FUNC - */ -HWTEST_F(AppRunningManagerFourthTest, QueryAppRecordPlus_0100, TestSize.Level1) -{ - static std::shared_ptr appRunningManager = std::make_shared(); - ASSERT_NE(appRunningManager, nullptr); - - std::shared_ptr info = nullptr; - int32_t recordId = 100; - std::string processName = "processName"; - auto appRunningRecord = std::make_shared(info, recordId, processName); - ASSERT_NE(appRunningRecord, nullptr); - - appRunningRecord->priorityObject_ = std::make_shared(); - int32_t priorityPid = 8; - appRunningRecord->priorityObject_->SetPid(priorityPid); - int32_t priorityUid = 6; - appRunningRecord->SetUid(priorityUid); - int32_t num = 100; - appRunningManager->appRunningRecordMap_.insert(std::make_pair(num, appRunningRecord)); - EXPECT_NE(appRunningManager->QueryAppRecordPlus(priorityPid, priorityUid), nullptr); - int32_t uid1 = 66; - EXPECT_EQ(appRunningManager->QueryAppRecordPlus(priorityPid, uid1), nullptr); - int32_t pid1 = 88; - EXPECT_EQ(appRunningManager->QueryAppRecordPlus(pid1, priorityUid), nullptr); - int32_t pid2 = 88; - int32_t uid2 = 66; - EXPECT_EQ(appRunningManager->QueryAppRecordPlus(pid2, uid2), nullptr); -} - -/** - * @tc.name: QueryAppRecordPlus_0200 - * @tc.desc: test QueryAppRecordPlus - * @tc.type: FUNC - */ -HWTEST_F(AppRunningManagerFourthTest, QueryAppRecordPlus_0200, TestSize.Level1) -{ - static std::shared_ptr appRunningManager = std::make_shared(); - ASSERT_NE(appRunningManager, nullptr); - - std::shared_ptr appRunningRecord = nullptr; - int32_t num = 100; - appRunningManager->appRunningRecordMap_.insert(std::make_pair(num, appRunningRecord)); - int32_t pid = 100; - int32_t uid = 10; - EXPECT_EQ(appRunningManager->QueryAppRecordPlus(pid, uid), nullptr); -} - -/** - * @tc.name: QueryAppRecordPlus_0300 - * @tc.desc: test QueryAppRecordPlus - * @tc.type: FUNC - */ -HWTEST_F(AppRunningManagerFourthTest, QueryAppRecordPlus_0300, TestSize.Level1) -{ - static std::shared_ptr appRunningManager = std::make_shared(); - ASSERT_NE(appRunningManager, nullptr); - - std::shared_ptr appRunningRecord = nullptr; - int32_t num = 100; - appRunningManager->deadAppRecordList_.push_back(std::make_pair(num, appRunningRecord)); - int32_t pid = 100; - int32_t uid = 10; - EXPECT_EQ(appRunningManager->QueryAppRecordPlus(pid, uid), nullptr); -} - -/** - * @tc.name: QueryAppRecordPlus_0400 - * @tc.desc: test QueryAppRecordPlus - * @tc.type: FUNC - */ -HWTEST_F(AppRunningManagerFourthTest, QueryAppRecordPlus_0400, TestSize.Level1) -{ - static std::shared_ptr appRunningManager = std::make_shared(); - ASSERT_NE(appRunningManager, nullptr); - - std::shared_ptr info = nullptr; - int32_t recordId = 100; - std::string processName = "processName"; - auto appRunningRecord = std::make_shared(info, recordId, processName); - ASSERT_NE(appRunningRecord, nullptr); - - appRunningRecord->priorityObject_ = std::make_shared(); - int32_t priorityPid = 8; - appRunningRecord->priorityObject_->SetPid(priorityPid); - int32_t priorityUid = 6; - appRunningRecord->SetUid(priorityUid); - int32_t num = 100; - appRunningManager->deadAppRecordList_.push_back(std::make_pair(num, appRunningRecord)); - EXPECT_NE(appRunningManager->QueryAppRecordPlus(priorityPid, priorityUid), nullptr); - int32_t uid1 = 66; - EXPECT_EQ(appRunningManager->QueryAppRecordPlus(priorityPid, uid1), nullptr); - int32_t pid1 = 88; - EXPECT_EQ(appRunningManager->QueryAppRecordPlus(pid1, priorityUid), nullptr); - int32_t pid2 = 88; - int32_t uid2 = 66; - EXPECT_EQ(appRunningManager->QueryAppRecordPlus(pid2, uid2), nullptr); -} - /** * @tc.name: ProcessExitByBundleNameAndAppIndex_0100 * @tc.desc: test ProcessExitByBundleNameAndAppIndex diff --git a/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h b/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h index 536be151058..991ec6a6c4c 100644 --- a/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h +++ b/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h @@ -533,15 +533,6 @@ public: { return 0; } - - virtual int32_t GetKilledProcessInfo(int pid, int uid, KilledProcessInfo& info) - { - if (pid == 0 || uid == 0) { - return -1; - } else { - return 0; - } - } }; } // namespace AppExecFwk } // namespace OHOS -- Gitee From 1e5df9f66b44a66b10a6743e7e1416ada5a175e1 Mon Sep 17 00:00:00 2001 From: wangzhen Date: Tue, 17 Jun 2025 16:05:13 +0800 Subject: [PATCH 2/2] tdd modify Signed-off-by: wangzhen Change-Id: I81ec2ccda26d098bed735eb3e5ccfc47d3b3a360 --- interfaces/inner_api/app_manager/BUILD.gn | 1 - .../include/appmgr/app_mgr_interface.h | 1 - .../include/appmgr/killed_process_info.h | 38 -- .../src/appmgr/killed_process_info.cpp | 54 -- .../appmgr/include/app_mgr_service_inner.h | 1 - .../abilitymgrappexitreasonhelper_fuzzer.cpp | 4 +- .../BUILD.gn | 1 + .../app_exit_reason_helper_fourth_test.cpp | 15 +- .../mock/include/mock_iapp_mgr.h | 542 ------------------ .../mock_iapp_mgr.h | 1 - 10 files changed, 11 insertions(+), 647 deletions(-) delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/killed_process_info.h delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/killed_process_info.cpp delete mode 100644 test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index 6c85b3e5d4c..4ce5ac63d54 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -101,7 +101,6 @@ ohos_shared_library("app_manager") { "src/appmgr/fault_data.cpp", "src/appmgr/kia_interceptor_proxy.cpp", "src/appmgr/kia_interceptor_stub.cpp", - "src/appmgr/killed_process_info.cpp", "src/appmgr/memory_level_info.cpp", "src/appmgr/native_child_notify_proxy.cpp", "src/appmgr/native_child_notify_stub.cpp", diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h index ea1a4f30f04..170813ecaec 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h @@ -40,7 +40,6 @@ #include "iremote_broker.h" #include "iremote_object.h" #include "irender_state_observer.h" -#include "killed_process_info.h" #include "memory_level_info.h" #include "page_state_data.h" #include "process_memory_state.h" diff --git a/interfaces/inner_api/app_manager/include/appmgr/killed_process_info.h b/interfaces/inner_api/app_manager/include/appmgr/killed_process_info.h deleted file mode 100644 index 658421e1aa2..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/killed_process_info.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_KILLED_PROCESS_INFO_H -#define OHOS_ABILITY_RUNTIME_KILLED_PROCESS_INFO_H - -#include - -#include "parcel.h" -#include "running_process_info.h" - -namespace OHOS { -namespace AppExecFwk { -struct KilledProcessInfo : public Parcelable { - uint32_t accessTokenId = 0; - std::string bundleName; - RunningProcessInfo processInfo; - - bool ReadFromParcel(Parcel &parcel); - virtual bool Marshalling(Parcel &parcel) const override; - static KilledProcessInfo *Unmarshalling(Parcel &parcel); -}; -} // namespace AppExecFwk -} // namespace OHOS - -#endif // OHOS_ABILITY_RUNTIME_KILLED_PROCESS_INFO_H diff --git a/interfaces/inner_api/app_manager/src/appmgr/killed_process_info.cpp b/interfaces/inner_api/app_manager/src/appmgr/killed_process_info.cpp deleted file mode 100644 index e5adcc7028a..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/killed_process_info.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 "killed_process_info.h" - -#include "hilog_tag_wrapper.h" -#include "parcel_macro_base.h" - -namespace OHOS { -namespace AppExecFwk { -bool KilledProcessInfo::ReadFromParcel(Parcel &parcel) -{ - accessTokenId = parcel.ReadUint32(); - bundleName = parcel.ReadString(); - std::unique_ptr tmpInfo(parcel.ReadParcelable()); - if (tmpInfo == nullptr) { - return false; - } - processInfo = *tmpInfo; - return true; -} - -KilledProcessInfo *KilledProcessInfo::Unmarshalling(Parcel &parcel) -{ - KilledProcessInfo *info = new (std::nothrow) KilledProcessInfo(); - if (info && !info->ReadFromParcel(parcel)) { - TAG_LOGW(AAFwkTag::APPMGR, "read from parcel failed"); - delete info; - info = nullptr; - } - return info; -} - -bool KilledProcessInfo::Marshalling(Parcel &parcel) const -{ - WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Uint32, parcel, accessTokenId); - WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, bundleName); - WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &processInfo); - return true; -} -} // namespace AppExecFwk -} // namespace OHOS \ No newline at end of file diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 77ed0dce9cf..922dccc32af 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -66,7 +66,6 @@ #include "istart_specified_ability_response.h" #include "kia_interceptor_interface.h" #include "kill_process_config.h" -#include "killed_process_info.h" #include "process_memory_state.h" #include "process_util.h" #include "record_query_result.h" diff --git a/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/abilitymgrappexitreasonhelper_fuzzer.cpp b/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/abilitymgrappexitreasonhelper_fuzzer.cpp index a21072b0795..f376e9c3c36 100644 --- a/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/abilitymgrappexitreasonhelper_fuzzer.cpp +++ b/test/fuzztest/abilitymgrappexitreasonhelper_fuzzer/abilitymgrappexitreasonhelper_fuzzer.cpp @@ -52,7 +52,6 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) int32_t appIndex; uint32_t accessTokenId; int32_t userId; - bool searchDead; bool withKillMsg; bool fromKillWithReason; FuzzedDataProvider fdp(data, size); @@ -64,7 +63,6 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) appIndex = fdp.ConsumeIntegral(); accessTokenId = fdp.ConsumeIntegral(); userId = fdp.ConsumeIntegral(); - searchDead = fdp.ConsumeBool(); withKillMsg = fdp.ConsumeBool(); abilities = AbilityFuzzUtil::GenerateStringArray(fdp); abilityLists = AbilityFuzzUtil::GenerateStringArray(fdp); @@ -74,7 +72,7 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) infos->RecordAppExitReason(bundleName, uid, appIndex, exitReason); infos->RecordProcessExitReason(pid, uid, exitReason); infos->RecordProcessExitReason(pid, bundleName, uid, accessTokenId, - exitReason, processInfo, fromKillWithReason, searchDead); + exitReason, processInfo, fromKillWithReason); infos->RecordProcessExtensionExitReason(pid, bundleName, exitReason, processInfo, withKillMsg); infos->GetActiveAbilityList(uid, abilityLists, pid); infos->GetActiveAbilityListFromUIAbilityManager(uid, abilityLists, pid); 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 f94798e77b6..845eeea20c9 100644 --- a/test/unittest/app_exit_reason_helper_fourth_test/BUILD.gn +++ b/test/unittest/app_exit_reason_helper_fourth_test/BUILD.gn @@ -41,6 +41,7 @@ ohos_unittest("app_exit_reason_helper_fourth_test") { sources = [ "${ability_runtime_services_path}/abilitymgr/src/ability_cache_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/app_exit_reason_helper.cpp", + "${ability_runtime_services_path}/abilitymgr/src/exit_info_data_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/process_options.cpp", "${ability_runtime_services_path}/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/start_window_option.cpp", diff --git a/test/unittest/app_exit_reason_helper_fourth_test/app_exit_reason_helper_fourth_test.cpp b/test/unittest/app_exit_reason_helper_fourth_test/app_exit_reason_helper_fourth_test.cpp index b6ebbdd82e6..86ded1fde55 100644 --- a/test/unittest/app_exit_reason_helper_fourth_test/app_exit_reason_helper_fourth_test.cpp +++ b/test/unittest/app_exit_reason_helper_fourth_test/app_exit_reason_helper_fourth_test.cpp @@ -20,13 +20,12 @@ #include "ability_manager_service.h" #include "app_exit_reason_helper.h" #include "bundle_mgr_helper.h" -#include "mock_iapp_mgr.h" +#include "exit_info_data_manager.h" #include "mock_mission_list_manager_interface.h" #include "mock_os_account_manager_wrapper.h" #include "mock_scene_board_judgement.h" #include "utils/ability_util.h" -#include "utils/app_mgr_util.h" using namespace testing; using namespace testing::ext; @@ -147,14 +146,18 @@ HWTEST_F(AppExitReasonHelperTest, RecordProcessExitReason_0300, TestSize.Level1) auto appExitReasonHelper = std::make_shared(nullptr); EXPECT_NE(appExitReasonHelper, nullptr); - AAFwk::AppMgrUtil::appMgr_ = new AppExecFwk::MockIAppMgr(); - EXPECT_NE(AAFwk::AppMgrUtil::appMgr_, nullptr); ExitReason exitReason; int32_t result = appExitReasonHelper->RecordProcessExitReason(0, 0, exitReason); - EXPECT_EQ(result, -1); + EXPECT_EQ(result, AAFwk::ERR_NO_APP_RECORD); + ExitCacheInfo cacheInfo; + cacheInfo.exitInfo.pid_ = 1; + cacheInfo.exitInfo.uid_ = 1; + uint32_t accessTokenId = 0; + ExitInfoDataManager::GetInstance().AddExitInfo(accessTokenId, cacheInfo); result = appExitReasonHelper->RecordProcessExitReason(1, 1, exitReason); - EXPECT_NE(result, 0); + EXPECT_EQ(result, ERR_INVALID_VALUE); + ExitInfoDataManager::GetInstance().DeleteExitInfo(accessTokenId); GTEST_LOG_(INFO) << "RecordProcessExitReason_0300 end"; } diff --git a/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h b/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h deleted file mode 100644 index 6abdc3e5b3a..00000000000 --- a/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h +++ /dev/null @@ -1,542 +0,0 @@ -/* - * 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. - */ -#ifndef MOCK_IAPP_MGR_H -#define MOCK_IAPP_MGR_H - -#include "ability_foreground_state_observer_interface.h" -#include "ability_info.h" -#include "app_foreground_state_observer_interface.h" -#include "app_malloc_info.h" -#include "app_mgr_ipc_interface_code.h" -#include "app_record_id.h" -#include "application_info.h" -#include "bundle_info.h" -#include "child_process_info.h" -#ifdef SUPPORT_CHILD_PROCESS -#include "child_process_request.h" -#endif // SUPPORT_CHILD_PROCESS -#include "app_jsheap_mem_info.h" -#include "app_cjheap_mem_info.h" -#include "app_mgr_interface.h" -#include "fault_data.h" -#include "iapp_state_callback.h" -#include "iapplication_state_observer.h" -#include "iconfiguration_observer.h" -#include "iquick_fix_callback.h" -#include "iremote_broker.h" -#include "iremote_object.h" -#include "irender_state_observer.h" -#include "kia_interceptor_interface.h" -#include "killed_process_info.h" -#include "memory_level_info.h" -#include "page_state_data.h" -#include "process_memory_state.h" -#include "render_process_info.h" -#include "running_multi_info.h" -#include "running_process_info.h" -#include "system_memory_attr.h" -#include "want.h" - -namespace OHOS { -namespace AppExecFwk { -class MockIAppMgr : public AppExecFwk::IAppMgr { -public: - virtual void AttachApplication(const sptr& app) {} - - virtual void ApplicationForegrounded(const int32_t recordId) {} - - virtual void ApplicationBackgrounded(const int32_t recordId) {} - - virtual void ApplicationTerminated(const int32_t recordId) {} - - virtual void AbilityCleaned(const sptr& token) {} - - virtual sptr GetAmsMgr() - { - return nullptr; - } - - virtual int32_t ClearUpApplicationData(const std::string& bundleName, int32_t appCloneIndex, int32_t userId = -1) - { - return 0; - } - - virtual int32_t ClearUpApplicationDataBySelf(int32_t userId = -1) - { - return 0; - } - - virtual int GetAllRunningProcesses(std::vector& info) - { - return 0; - } - - virtual int32_t GetRunningMultiAppInfoByBundleName(const std::string& bundleName, RunningMultiAppInfo& info) - { - return 0; - } - - virtual int32_t GetAllRunningInstanceKeysBySelf(std::vector& instanceKeys) - { - return 0; - } - - virtual int32_t GetAllRunningInstanceKeysByBundleName( - const std::string& bundleName, std::vector& instanceKeys, int32_t userId = -1) - { - return 0; - } - - virtual sptr AsObject() - { - return nullptr; - } - - virtual int GetRunningProcessesByBundleType(const BundleType bundleType, std::vector& info) - { - return 0; - } - - virtual int GetAllRenderProcesses(std::vector& info) - { - return 0; - } - - virtual int GetAllChildrenProcesses(std::vector& info) - { - return 0; - } - - virtual int32_t JudgeSandboxByPid(pid_t pid, bool& isSandbox) - { - return 0; - } - - virtual int32_t IsTerminatingByPid(pid_t pid, bool& isTerminating) - { - return 0; - } - - virtual int GetProcessRunningInfosByUserId(std::vector& info, int32_t userId) - { - return 0; - } - - virtual int32_t GetProcessRunningInformation(RunningProcessInfo& info) - { - return 0; - } - - virtual int NotifyMemoryLevel(int32_t level) - { - return 0; - } - - virtual int32_t NotifyProcMemoryLevel(const std::map& procLevelMap) - { - return 0; - } - - virtual int DumpHeapMemory(const int32_t pid, OHOS::AppExecFwk::MallocInfo& mallocInfo) - { - return 0; - } - - virtual void AddAbilityStageDone(const int32_t recordId) {} - - virtual int DumpJsHeapMemory(OHOS::AppExecFwk::JsHeapDumpInfo& info) - { - return 0; - } - - virtual int DumpCjHeapMemory(OHOS::AppExecFwk::CjHeapDumpInfo& info) - { - return 0; - } - - virtual void StartupResidentProcess(const std::vector& bundleInfos) {} - - virtual int32_t RegisterApplicationStateObserver( - const sptr& observer, const std::vector& bundleNameList = {}) - { - return 0; - } - - virtual int32_t UnregisterApplicationStateObserver(const sptr& observer) - { - return 0; - } - - virtual int32_t RegisterAbilityForegroundStateObserver(const sptr& observer) - { - return 0; - } - - virtual int32_t UnregisterAbilityForegroundStateObserver(const sptr& observer) - { - return 0; - } - - virtual int32_t GetForegroundApplications(std::vector& list) - { - return 0; - } - - virtual int StartUserTestProcess( - const AAFwk::Want& want, const sptr& observer, const BundleInfo& bundleInfo, int32_t userId) - { - return 0; - } - - virtual int FinishUserTest(const std::string& msg, const int64_t& resultCode, const std::string& bundleName) - { - return 0; - } - - virtual void ScheduleAcceptWantDone(const int32_t recordId, const AAFwk::Want& want, const std::string& flag) {} - virtual void ScheduleNewProcessRequestDone(const int32_t recordId, const AAFwk::Want& want, const std::string& flag) - {} - - virtual int GetAbilityRecordsByProcessID(const int pid, std::vector>& tokens) - { - return 0; - } - - virtual int PreStartNWebSpawnProcess() - { - return 0; - } - - virtual int StartRenderProcess(const std::string& renderParam, int32_t ipcFd, int32_t sharedFd, int32_t crashFd, - pid_t& renderPid, bool isGPU = false) - { - return 0; - } - - virtual void AttachRenderProcess(const sptr& renderScheduler) {} - - virtual int GetRenderProcessTerminationStatus(pid_t renderPid, int& status) - { - return 0; - } - - virtual int32_t GetConfiguration(Configuration& config) - { - return 0; - } - - virtual int32_t UpdateConfiguration(const Configuration& config, const int32_t userId = -1) - { - return 0; - } - - virtual int32_t UpdateConfigurationByBundleName( - const Configuration& config, const std::string& name, int32_t appIndex = 0) - { - return 0; - } - - virtual int32_t RegisterConfigurationObserver(const sptr& observer) - { - return 0; - } - - virtual int32_t UnregisterConfigurationObserver(const sptr& observer) - { - return 0; - } - - virtual bool GetAppRunningStateByBundleName(const std::string& bundleName) - { - return false; - } - - virtual int32_t NotifyLoadRepairPatch(const std::string& bundleName, const sptr& callback) - { - return 0; - } - - virtual int32_t NotifyHotReloadPage(const std::string& bundleName, const sptr& callback) - { - return 0; - } - - virtual int32_t NotifyUnLoadRepairPatch(const std::string& bundleName, const sptr& callback) - { - return 0; - } - - virtual int32_t NotifyAppFault(const FaultData& faultData) - { - return 0; - } - - virtual int32_t NotifyAppFaultBySA(const AppFaultDataBySA& faultData) - { - return 0; - } - - virtual bool SetAppFreezeFilter(int32_t pid) - { - return false; - } - -#ifdef BGTASKMGR_CONTINUOUS_TASK_ENABLE - - virtual int32_t SetContinuousTaskProcess(int32_t pid, bool isContinuousTask) - { - return 0; - }; -#endif - - virtual bool IsSharedBundleRunning(const std::string& bundleName, uint32_t versionCode) - { - return false; - } - - virtual int32_t StartNativeProcessForDebugger(const AAFwk::Want& want) - { - return 0; - } - - virtual int32_t GetBundleNameByPid(const int pid, std::string& bundleName, int32_t& uid) - { - return 0; - } - - virtual int32_t GetRunningProcessInfoByPid(const pid_t pid, OHOS::AppExecFwk::RunningProcessInfo& info) - { - return 0; - } - - virtual int32_t GetRunningProcessInfoByChildProcessPid( - const pid_t childPid, OHOS::AppExecFwk::RunningProcessInfo& info) - { - return 0; - } - - virtual int32_t GetProcessMemoryByPid(const int32_t pid, int32_t& memorySize) - { - return 0; - } - - virtual int32_t GetRunningProcessInformation( - const std::string& bundleName, int32_t userId, std::vector& info) - { - return 0; - } - - virtual int32_t NotifyPageShow(const sptr& token, const PageStateData& pageStateData) - { - return 0; - } - - virtual int32_t NotifyPageHide(const sptr& token, const PageStateData& pageStateData) - { - return 0; - } - - virtual int32_t ChangeAppGcState(pid_t pid, int32_t state, uint64_t tid = 0) - { - return 0; - } - - virtual int32_t RegisterAppRunningStatusListener(const sptr& listener) - { - return 0; - } - - virtual int32_t UnregisterAppRunningStatusListener(const sptr& listener) - { - return 0; - } - - virtual int32_t RegisterAppForegroundStateObserver(const sptr& observer) - { - return 0; - } - - virtual int32_t UnregisterAppForegroundStateObserver(const sptr& observer) - { - return 0; - } - - virtual int32_t IsApplicationRunning(const std::string& bundleName, bool& isRunning) - { - return 0; - } - - virtual int32_t IsAppRunning(const std::string& bundleName, int32_t appCloneIndex, bool& isRunning) - { - return 0; - } - - virtual int32_t IsAppRunningByBundleNameAndUserId(const std::string& bundleName, int32_t userId, bool& isRunning) - { - return 0; - } - -#ifdef SUPPORT_CHILD_PROCESS - - virtual int32_t StartChildProcess(pid_t& childPid, const ChildProcessRequest& request) - { - return 0; - } - - virtual int32_t GetChildProcessInfoForSelf(ChildProcessInfo& info) - { - return 0; - } - - virtual void AttachChildProcess(const sptr& childScheduler) {} - - virtual void ExitChildProcessSafely() {} -#endif // SUPPORT_CHILD_PROCESS - - virtual bool IsFinalAppProcess() - { - return false; - } - - virtual int32_t RegisterRenderStateObserver(const sptr& observer) - { - return 0; - } - - virtual int32_t UnregisterRenderStateObserver(const sptr& observer) - { - return 0; - } - - virtual int32_t RegisterKiaInterceptor(const sptr& interceptor) - { - return 0; - } - - virtual int32_t CheckIsKiaProcess(pid_t pid, bool& isKia) - { - return 0; - } - - virtual int32_t UpdateRenderState(pid_t renderPid, int32_t state) - { - return 0; - } - - virtual int32_t SignRestartAppFlag(int32_t uid, const std::string& instanceKey) - { - return 0; - } - - virtual int32_t GetAppRunningUniqueIdByPid(pid_t pid, std::string& appRunningUniqueId) - { - return 0; - } - - virtual int32_t GetAllUIExtensionRootHostPid(pid_t pid, std::vector& hostPids) - { - return 0; - } - - virtual int32_t GetAllUIExtensionProviderPid(pid_t hostPid, std::vector& providerPids) - { - return 0; - } - - virtual int32_t NotifyMemorySizeStateChanged(int32_t memorySizeState) - { - return 0; - } - - virtual int32_t SetSupportedProcessCacheSelf(bool isSupport) - { - return 0; - } - - virtual int32_t SetSupportedProcessCache(int32_t pid, bool isSupport) - { - return 0; - } - - virtual int32_t IsProcessCacheSupported(int32_t pid, bool &isSupported) - { - return 0; - } - - virtual int32_t SetProcessCacheEnable(int32_t pid, bool enable) - { - return 0; - } - - virtual void SetAppAssertionPauseState(bool flag) {} - - virtual void SaveBrowserChannel(sptr browser) {} - - virtual int32_t CheckCallingIsUserTestMode(const pid_t pid, bool& isUserTest) - { - return 0; - } - -#ifdef SUPPORT_CHILD_PROCESS - - virtual int32_t StartNativeChildProcess(const std::string& libName, int32_t childProcessCount, - const sptr& callback, const std::string &customProcessName) - { - return 0; - } -#endif // SUPPORT_CHILD_PROCESS - - virtual int32_t NotifyProcessDependedOnWeb() - { - return 0; - } - - virtual void KillProcessDependedOnWeb() - { - return; - } - - virtual void RestartResidentProcessDependedOnWeb() - { - return; - } - - virtual int32_t GetSupportedProcessCachePids(const std::string& bundleName, std::vector& pidList) - { - return 0; - } - - virtual int32_t KillAppSelfWithInstanceKey( - const std::string& instanceKey, bool clearPageStack, const std::string& reason) - { - return 0; - } - - virtual void UpdateInstanceKeyBySpecifiedId(int32_t specifiedId, std::string& instanceKey) {} - - virtual int32_t IsSpecifiedModuleLoaded(const AAFwk::Want& want, const AbilityInfo& abilityInfo, bool& result, - bool &isDebug) - { - return 0; - } - - virtual int32_t UpdateProcessMemoryState(const std::vector& procMemState) - { - return 0; - } -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // MOCK_IAPP_MGR_H \ No newline at end of file diff --git a/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h b/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h index 991ec6a6c4c..7e5d9b7e1d3 100644 --- a/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h +++ b/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h @@ -38,7 +38,6 @@ #include "iremote_object.h" #include "irender_state_observer.h" #include "kia_interceptor_interface.h" -#include "killed_process_info.h" #include "memory_level_info.h" #include "page_state_data.h" #include "process_memory_state.h" -- Gitee