diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h index 1a472539972c1b5297ae4c0112352ee96cab77e0..b3b4dd7f478f095627dcfbf53e4a2130b5058226 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h @@ -763,6 +763,10 @@ public: * @return Returns RESULT_OK on success, others on failure. */ virtual AppMgrResultCode AttachedToStatusBar(const sptr &token); + + int32_t NotifyProcessDependedOnWeb(); + + void KillProcessDependedOnWeb(); private: void SetServiceManager(std::unique_ptr serviceMgr); /** 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 8b25487054adb046de1743349304aaefe6367617..c0a7ca41691155373354b8689d72378ec57f2d51 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 @@ -727,6 +727,30 @@ public: { return 0; } + + /** + * Notify that the process depends on web by itself. + */ + virtual int32_t NotifyProcessDependedOnWeb() + { + return 0; + } + + /** + * Kill process depended on web by sa. + */ + virtual void KillProcessDependedOnWeb() + { + return; + } + + /** + * Restart resident process depended on web. + */ + virtual void RestartResidentProcessDependedOnWeb() + { + return; + } }; } // namespace AppExecFwk } // namespace OHOS 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 7b0b2b877a86bb9ade2e8def8e1c822e0bc5315a..011190daa90c33adf19adc47a9ccdd0591b6b8b9 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 @@ -107,6 +107,10 @@ enum class AppMgrInterfaceCode { IS_APP_RUNNING = 81, CHECK_CALLING_IS_USER_TEST_MODE = 82, SET_APPFREEZE_FILTER = 83, + // ipc for process depended on arkweb + NOTIFY_PROCESS_DEPENDED_ON_WEB = 84, + KILL_PROCESS_DEPENDED_ON_WEB = 85, + RESTART_RESIDENT_PROCESS_DEPENDED_ON_WEB = 86, }; } // AppExecFwk } // OHOS 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 8d4f61319a9586818c8a1ee9c45c1e773ef99117..7f7f755939b8b5f6349ad8187d9733e2affbd933 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 @@ -637,6 +637,11 @@ public: */ int32_t CheckCallingIsUserTestMode(const pid_t pid, bool &isUserTest) override; + virtual int32_t NotifyProcessDependedOnWeb() override; + + virtual void KillProcessDependedOnWeb() override; + + virtual void RestartResidentProcessDependedOnWeb() override; private: bool SendTransactCmd(AppMgrInterfaceCode code, MessageParcel &data, MessageParcel &reply); bool WriteInterfaceToken(MessageParcel &data); 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 e5e5eb4ba4d45a3dc3cea6229b358dd3c2fc6d4b..5b0cbc82224a56b2d98ea954fa05ddf982c7bd7a 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 @@ -143,6 +143,9 @@ private: int32_t HandleStartNativeChildProcess(MessageParcel &data, MessageParcel &reply); int32_t HandleSaveBrowserChannel(MessageParcel &data, MessageParcel &reply); int32_t HandleCheckCallingIsUserTestMode(MessageParcel &data, MessageParcel &reply); + int32_t HandleNotifyProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply); + int32_t HandleKillProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply); + int32_t HandleRestartResidentProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply); using AppMgrFunc = int32_t (AppMgrStub::*)(MessageParcel &data, MessageParcel &reply); std::map memberFuncMap_; diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_mgr_client.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_mgr_client.cpp index 61beba12c4eaf10360e7b3d65224aebf5809fe3b..e7ac024882fe9eee90e7a166d81f5ef3dec68eed 100644 --- a/interfaces/inner_api/app_manager/src/appmgr/app_mgr_client.cpp +++ b/interfaces/inner_api/app_manager/src/appmgr/app_mgr_client.cpp @@ -1216,5 +1216,27 @@ AppMgrResultCode AppMgrClient::AttachedToStatusBar(const sptr &to TAG_LOGE(AAFwkTag::APPMGR, "Service is not connected."); return AppMgrResultCode::ERROR_SERVICE_NOT_CONNECTED; } + +int32_t AppMgrClient::NotifyProcessDependedOnWeb() +{ + sptr service = iface_cast(mgrHolder_->GetRemoteObject()); + if (service == nullptr) { + TAG_LOGE(AAFwkTag::APPMGR, "Service is nullptr."); + return AppMgrResultCode::ERROR_SERVICE_NOT_CONNECTED; + } + TAG_LOGD(AAFwkTag::APPMGR, "call"); + return service->NotifyProcessDependedOnWeb(); +} + +void AppMgrClient::KillProcessDependedOnWeb() +{ + sptr service = iface_cast(mgrHolder_->GetRemoteObject()); + if (service == nullptr) { + TAG_LOGE(AAFwkTag::APPMGR, "Service is nullptr."); + return; + } + TAG_LOGD(AAFwkTag::APPMGR, "call"); + service->KillProcessDependedOnWeb(); +} } // namespace AppExecFwk } // namespace OHOS 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 cb03c801c834bfcc15536fb2cef8e416310347f5..63aadb998fd52c38be614df07173db0743f939c0 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 @@ -2223,5 +2223,45 @@ int32_t AppMgrProxy::CheckCallingIsUserTestMode(const pid_t pid, bool &isUserTes isUserTest = reply.ReadBool(); return reply.ReadInt32(); } + +int32_t AppMgrProxy::NotifyProcessDependedOnWeb() +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!WriteInterfaceToken(data)) { + TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed."); + return IPC_PROXY_ERR; + } + + PARCEL_UTIL_SENDREQ_RET_INT(AppMgrInterfaceCode::NOTIFY_PROCESS_DEPENDED_ON_WEB, data, reply, option); + return reply.ReadInt32(); +} + +void AppMgrProxy::KillProcessDependedOnWeb() +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!WriteInterfaceToken(data)) { + TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed."); + return; + } + + PARCEL_UTIL_SENDREQ_NORET(AppMgrInterfaceCode::KILL_PROCESS_DEPENDED_ON_WEB, data, reply, option); +} + +void AppMgrProxy::RestartResidentProcessDependedOnWeb() +{ + MessageParcel data; + MessageParcel reply; + MessageOption option(MessageOption::TF_ASYNC); + if (!WriteInterfaceToken(data)) { + TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed."); + return; + } + + PARCEL_UTIL_SENDREQ_NORET(AppMgrInterfaceCode::RESTART_RESIDENT_PROCESS_DEPENDED_ON_WEB, data, reply, option); +} } // namespace AppExecFwk } // namespace OHOS 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 c65d40d24b4d24a2febcb5b30ed16bbe72c79b45..26f9490963aa2d4755f0f59501eb648894d0d043 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 @@ -207,6 +207,12 @@ AppMgrStub::AppMgrStub() &AppMgrStub::HandleIsAppRunning; memberFuncMap_[static_cast(AppMgrInterfaceCode::CHECK_CALLING_IS_USER_TEST_MODE)] = &AppMgrStub::HandleCheckCallingIsUserTestMode; + memberFuncMap_[static_cast(AppMgrInterfaceCode::NOTIFY_PROCESS_DEPENDED_ON_WEB)] = + &AppMgrStub::HandleNotifyProcessDependedOnWeb; + memberFuncMap_[static_cast(AppMgrInterfaceCode::KILL_PROCESS_DEPENDED_ON_WEB)] = + &AppMgrStub::HandleKillProcessDependedOnWeb; + memberFuncMap_[static_cast(AppMgrInterfaceCode::RESTART_RESIDENT_PROCESS_DEPENDED_ON_WEB)] = + &AppMgrStub::HandleRestartResidentProcessDependedOnWeb; } AppMgrStub::~AppMgrStub() @@ -1438,5 +1444,30 @@ int32_t AppMgrStub::HandleCheckCallingIsUserTestMode(MessageParcel &data, Messag return NO_ERROR; } +int32_t AppMgrStub::HandleNotifyProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply) +{ + TAG_LOGD(AAFwkTag::APPMGR, "call"); + int32_t ret = NotifyProcessDependedOnWeb(); + if (!reply.WriteInt32(ret)) { + TAG_LOGE(AAFwkTag::APPMGR, "Write ret error."); + return IPC_STUB_ERR; + } + + return NO_ERROR; +} + +int32_t AppMgrStub::HandleKillProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply) +{ + TAG_LOGD(AAFwkTag::APPMGR, "call"); + KillProcessDependedOnWeb(); + return NO_ERROR; +} + +int32_t AppMgrStub::HandleRestartResidentProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply) +{ + TAG_LOGD(AAFwkTag::APPMGR, "call"); + RestartResidentProcessDependedOnWeb(); + return NO_ERROR; +} } // namespace AppExecFwk } // namespace OHOS diff --git a/services/abilitymgr/include/ability_bundle_event_callback.h b/services/abilitymgr/include/ability_bundle_event_callback.h index f8d8d99bf7b3867c553fe499cca9eca0263736ee..450beb9468d53fb414a6ac94d117d73d0555f49d 100644 --- a/services/abilitymgr/include/ability_bundle_event_callback.h +++ b/services/abilitymgr/include/ability_bundle_event_callback.h @@ -49,6 +49,7 @@ private: void HandleUpdatedModuleInfo(const std::string &bundleName, int32_t uid); void HandleAppUpgradeCompleted(const std::string &bundleName, int32_t uid); void HandleRemoveUriPermission(uint32_t tokenId); + void HandleRestartResidentProcessDependedOnWeb(); DISALLOW_COPY_AND_MOVE(AbilityBundleEventCallback); AbilityEventUtil abilityEventHelper_; diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index bc4656dc9099a2a423f1f6efde37966dcd988a84..26de891666be75ee0e8fa95e049ff3fa80d0e241 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -1693,6 +1693,8 @@ public: */ virtual void NotifyFrozenProcessByRSS(const std::vector &pidList, int32_t uid) override; + void HandleRestartResidentProcessDependedOnWeb(); + // MSG 0 - 20 represents timeout message static constexpr uint32_t LOAD_TIMEOUT_MSG = 0; static constexpr uint32_t ACTIVE_TIMEOUT_MSG = 1; diff --git a/services/abilitymgr/src/ability_bundle_event_callback.cpp b/services/abilitymgr/src/ability_bundle_event_callback.cpp index 768c670283028af94f3468a9b81930c2b7181abe..2f762c19ae93b277827d6e9751f7c588971d5111 100644 --- a/services/abilitymgr/src/ability_bundle_event_callback.cpp +++ b/services/abilitymgr/src/ability_bundle_event_callback.cpp @@ -63,6 +63,7 @@ void AbilityBundleEventCallback::OnReceiveEvent(const EventFwk::CommonEventData // install or uninstall module/bundle HandleUpdatedModuleInfo(bundleName, uid); } else if (action == EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_CHANGED) { + HandleRestartResidentProcessDependedOnWeb(); HandleUpdatedModuleInfo(bundleName, uid); HandleAppUpgradeCompleted(bundleName, uid); if (abilityAutoStartupService_ == nullptr) { @@ -115,5 +116,18 @@ void AbilityBundleEventCallback::HandleAppUpgradeCompleted(const std::string &bu }; taskHandler_->SubmitTask(task); } + +void AbilityBundleEventCallback::HandleRestartResidentProcessDependedOnWeb() +{ + auto task = []() { + auto abilityMgr = DelayedSingleton::GetInstance(); + if (abilityMgr == nullptr) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "abilityMgr is nullptr."); + return; + } + abilityMgr->HandleRestartResidentProcessDependedOnWeb(); + }; + taskHandler_->SubmitTask(task); +} } // namespace AAFwk } // namespace OHOS \ No newline at end of file diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 9b96841d7bbb7adbb7b9db3e8263b22388376761..8aae3fe1b3d5b560c5aaf359b57f5041b4f93d88 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -10846,5 +10846,12 @@ void AbilityManagerService::NotifyFrozenProcessByRSS(const std::vector CHECK_POINTER_LOG(connectManager, "can not find user connect manager"); connectManager->HandleProcessFrozen(pidList, uid); } + +void AbilityManagerService::HandleRestartResidentProcessDependedOnWeb() +{ + auto appMgr = GetAppMgr(); + CHECK_POINTER_LOG(appMgr, "get appMgr fail"); + appMgr->RestartResidentProcessDependedOnWeb(); +} } // namespace AAFwk } // namespace OHOS diff --git a/services/appmgr/include/app_mgr_service.h b/services/appmgr/include/app_mgr_service.h index f68ef66d0fe488b4a47bf6097cb878e9839afcdf..d766628e9b74a0ae608ed71ccdfadcb3b49c32ff 100644 --- a/services/appmgr/include/app_mgr_service.h +++ b/services/appmgr/include/app_mgr_service.h @@ -554,6 +554,12 @@ public: * @return Returns ERR_OK is test ability, others is not test ability. */ int32_t CheckCallingIsUserTestMode(const pid_t pid, bool &isUserTest) override; + + virtual int32_t NotifyProcessDependedOnWeb() override; + + virtual void KillProcessDependedOnWeb() override; + + virtual void RestartResidentProcessDependedOnWeb() override; private: /** * Init, Initialize application services. diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 9865d51cfb1c9fef9d733ea8a17fcea693d780f0..ac5e9d14563dcef2516f7fae1ec3c6735b0c6923 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -1136,6 +1136,12 @@ public: */ void AttachedToStatusBar(const sptr &token); void KillApplicationByRecord(const std::shared_ptr &appRecord); + + int32_t NotifyProcessDependedOnWeb(); + + void KillProcessDependedOnWeb(); + + void RestartResidentProcessDependedOnWeb(); private: std::string FaultTypeToString(FaultDataType type); diff --git a/services/appmgr/include/app_running_record.h b/services/appmgr/include/app_running_record.h index 7e8c361d762267cd341e0a12ea951fdf7da87b3f..de2064f944728ea0019904c492672641a8d76db9 100644 --- a/services/appmgr/include/app_running_record.h +++ b/services/appmgr/include/app_running_record.h @@ -814,6 +814,16 @@ public: { return isStrictMode_; } + + inline void SetIsDependedOnArkWeb(bool isDepend) + { + isDependedOnArkWeb_ = isDepend; + } + + inline bool IsDependedOnArkWeb() + { + return isDependedOnArkWeb_; + } private: /** * SearchTheModuleInfoNeedToUpdated, Get an uninitialized abilityStage data. @@ -975,6 +985,7 @@ private: pid_t gpuPid_ = 0; bool isStrictMode_ = false; bool isAttachedToStatusBar = false; + bool isDependedOnArkWeb_ = false; }; } // namespace AppExecFwk diff --git a/services/appmgr/include/exit_resident_process_manager.h b/services/appmgr/include/exit_resident_process_manager.h index 570f5938cdcc2c28b993853202945c4107facceb..cbf62c37c428c36be21998ab3804429ac4c96913 100644 --- a/services/appmgr/include/exit_resident_process_manager.h +++ b/services/appmgr/include/exit_resident_process_manager.h @@ -38,8 +38,10 @@ public: ~ExitResidentProcessManager(); bool IsMemorySizeSufficent() const; bool RecordExitResidentBundleName(const std::string &bundleName); + bool RecordExitResidentBundleDependedOnWeb(const std::string &bundleName); int32_t HandleMemorySizeInSufficent(); int32_t HandleMemorySizeSufficent(std::vector& bundleNames); + void HandleExitResidentBundleDependedOnWeb(std::vector& bundleNames); void QueryExitBundleInfos(const std::vector& exitBundleNames, std::vector& exitBundleInfos); @@ -47,7 +49,9 @@ private: ExitResidentProcessManager(); MemorySizeState currentMemorySizeState_ = MemorySizeState::MEMORY_SIZE_SUFFICENT; std::vector exitResidentBundleNames_; + std::vector exitResidentBundlesDependedOnWeb_; mutable ffrt::mutex mutexLock_; + mutable ffrt::mutex webMutexLock_; DISALLOW_COPY_AND_MOVE(ExitResidentProcessManager); }; } // namespace AppExecFwk diff --git a/services/appmgr/src/app_mgr_service.cpp b/services/appmgr/src/app_mgr_service.cpp index 7c84254ee9aea5657aca224585ca94afc568dac5..6621a5d7a77c020934c8123d38fbdc1ada8e2a7c 100644 --- a/services/appmgr/src/app_mgr_service.cpp +++ b/services/appmgr/src/app_mgr_service.cpp @@ -1543,5 +1543,40 @@ int32_t AppMgrService::CheckCallingIsUserTestMode(const pid_t pid, bool &isUserT return appMgrServiceInner_->CheckCallingIsUserTestModeInner(pid, isUserTest); } +int32_t AppMgrService::NotifyProcessDependedOnWeb() +{ + TAG_LOGD(AAFwkTag::APPMGR, "called."); + if (!appMgrServiceInner_) { + TAG_LOGE(AAFwkTag::APPMGR, "Not ready."); + return ERR_INVALID_VALUE; + } + return appMgrServiceInner_->NotifyProcessDependedOnWeb(); +} + +void AppMgrService::KillProcessDependedOnWeb() +{ + TAG_LOGD(AAFwkTag::APPMGR, "called."); + if (!AAFwk::PermissionVerification::GetInstance()->IsSACall()) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "caller is not SA."); + return; + } + if (!appMgrServiceInner_) { + return; + } + appMgrServiceInner_->KillProcessDependedOnWeb(); +} + +void AppMgrService::RestartResidentProcessDependedOnWeb() +{ + TAG_LOGD(AAFwkTag::APPMGR, "called."); + if (!AAFwk::PermissionVerification::GetInstance()->CheckSpecificSystemAbilityAccessPermission(FOUNDATION_PROCESS)) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "caller is not foundation."); + return; + } + if (!appMgrServiceInner_) { + return; + } + appMgrServiceInner_->RestartResidentProcessDependedOnWeb(); +} } // namespace AppExecFwk } // namespace OHOS diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index d5c6af132f70781abea8b625d421487392b63f0d..c971d4a810ebcd81e3980eac8f88159073a08d77 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -7009,5 +7009,59 @@ void AppMgrServiceInner::AttachedToStatusBar(const sptr &token) } appRecord->SetAttachedToStatusBar(true); } + +int32_t AppMgrServiceInner::NotifyProcessDependedOnWeb() +{ + int32_t pid = IPCSkeleton::GetCallingPid(); + auto appRecord = GetAppRunningRecordByPid(pid); + if (appRecord == nullptr) { + TAG_LOGE(AAFwkTag::APPMGR, "no such appRecord"); + return ERR_INVALID_VALUE; + } + TAG_LOGD(AAFwkTag::APPMGR, "call"); + appRecord->SetIsDependedOnArkWeb(true); + return ERR_OK; +} + +void AppMgrServiceInner::KillProcessDependedOnWeb() +{ + TAG_LOGD(AAFwkTag::APPMGR, "call"); + CHECK_POINTER_AND_RETURN_LOG(appRunningManager_, "appRunningManager_ is nullptr"); + for (const auto &item : appRunningManager_->GetAppRunningRecordMap()) { + const auto &appRecord = item.second; + if (!appRecord || !appRecord->GetSpawned() || !appRecord->GetPriorityObject()) { + continue; + } + + if (appRecord->IsDependedOnArkWeb()) { + std::string bundleName = appRecord->GetBundleName(); + pid_t pid = appRecord->GetPriorityObject()->GetPid(); + appRecord->IsKeepAliveApp() && + ExitResidentProcessManager::GetInstance().RecordExitResidentBundleDependedOnWeb(bundleName); + KillProcessByPid(pid, "KillProcessDependedOnWeb"); + } + } +} + +void AppMgrServiceInner::RestartResidentProcessDependedOnWeb() +{ + TAG_LOGD(AAFwkTag::APPMGR, "call"); + std::vector bundleNames; + ExitResidentProcessManager::GetInstance().HandleExitResidentBundleDependedOnWeb(bundleNames); + if (bundleNames.empty()) { + TAG_LOGE(AAFwkTag::APPMGR, "exit resident bundle names is empty"); + return; + } + + auto RestartResidentProcessDependedOnWebTask = [bundleNames, innerServicerWeak = weak_from_this()]() { + auto innerServicer = innerServicerWeak.lock(); + CHECK_POINTER_AND_RETURN_LOG(innerServicer, "get AppMgrServiceInner failed"); + std::vector exitBundleInfos; + ExitResidentProcessManager::GetInstance().QueryExitBundleInfos(bundleNames, exitBundleInfos); + + innerServicer->NotifyStartResidentProcess(exitBundleInfos); + }; + taskHandler_->SubmitTask(RestartResidentProcessDependedOnWebTask, "RestartResidentProcessDependedOnWeb"); +} } // namespace AppExecFwk } // namespace OHOS \ No newline at end of file diff --git a/services/appmgr/src/exit_resident_process_manager.cpp b/services/appmgr/src/exit_resident_process_manager.cpp index d7a68f8b8b02d4f4451cadc88d253e87b9151323..1c1bd4486bafe1759365ee4858702ed56fb122e9 100644 --- a/services/appmgr/src/exit_resident_process_manager.cpp +++ b/services/appmgr/src/exit_resident_process_manager.cpp @@ -53,6 +53,14 @@ bool ExitResidentProcessManager::RecordExitResidentBundleName(const std::string return true; } +bool ExitResidentProcessManager::RecordExitResidentBundleDependedOnWeb(const std::string &bundleName) +{ + std::lock_guard lock(webMutexLock_); + TAG_LOGE(AAFwkTag::APPMGR, "call"); + exitResidentBundlesDependedOnWeb_.emplace_back(bundleName); + return true; +} + int32_t ExitResidentProcessManager::HandleMemorySizeInSufficent() { std::lock_guard lock(mutexLock_); @@ -77,6 +85,14 @@ int32_t ExitResidentProcessManager::HandleMemorySizeSufficent(std::vector& bundleNames) +{ + std::lock_guard lock(webMutexLock_); + TAG_LOGE(AAFwkTag::APPMGR, "call"); + bundleNames = exitResidentBundlesDependedOnWeb_; + exitResidentBundlesDependedOnWeb_.clear(); +} + void ExitResidentProcessManager::QueryExitBundleInfos(const std::vector& exitBundleNames, std::vector& exitBundleInfos) {