From 0212cff2722069dce51e543474ad2f0765e3435b Mon Sep 17 00:00:00 2001 From: Zhou Shihui Date: Fri, 5 Jul 2024 10:42:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81ArkWeb=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Zhou Shihui --- .../bundlemgr/include/base_bundle_installer.h | 1 + .../bundlemgr/src/base_bundle_installer.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/services/bundlemgr/include/base_bundle_installer.h b/services/bundlemgr/include/base_bundle_installer.h index fe46af5307..670cd1af8a 100644 --- a/services/bundlemgr/include/base_bundle_installer.h +++ b/services/bundlemgr/include/base_bundle_installer.h @@ -593,6 +593,7 @@ private: ErrCode CheckOverlayInstallation(std::unordered_map &newInfos, int32_t userId); ErrCode CheckOverlayUpdate(const InnerBundleInfo &oldInfo, const InnerBundleInfo &newInfo, int32_t userId) const; NotifyType GetNotifyType(); + void KillRelatedProcessIfArkWeb(const std::string &bundleName, bool isAppExist, bool isOta); ErrCode CheckAppService( const InnerBundleInfo &newInfo, const InnerBundleInfo &oldInfo, bool isAppExist); ErrCode CheckSingleton(const InnerBundleInfo &newInfo, const int32_t userId); diff --git a/services/bundlemgr/src/base_bundle_installer.cpp b/services/bundlemgr/src/base_bundle_installer.cpp index d054715833..6e5911dda1 100644 --- a/services/bundlemgr/src/base_bundle_installer.cpp +++ b/services/bundlemgr/src/base_bundle_installer.cpp @@ -27,6 +27,7 @@ #endif #include "aot/aot_handler.h" #include "app_control_constants.h" +#include "app_mgr_client.h" #ifdef BUNDLE_FRAMEWORK_DEFAULT_APP #include "default_app_mgr.h" #endif @@ -115,6 +116,8 @@ const std::set SINGLETON_WHITE_LIST = { constexpr const char* DATA_EXTENSION_PATH = "/extension/"; const std::string INSTALL_SOURCE_PREINSTALL = "pre-installed"; const std::string INSTALL_SOURCE_UNKNOWN = "unknown"; +const std::string ARK_WEB_BUNDLE_NAME_PARAM = "persist.arkwebcore.package_name"; +const std::string ARK_WEB_BUNDLE_NAME = "com.ohos.nweb"; std::string GetHapPath(const InnerBundleInfo &info, const std::string &moduleName) { @@ -738,6 +741,7 @@ ErrCode BaseBundleInstaller::InnerProcessBundleInstall(std::unordered_mapsecond, oldInfo, isAppExist_); CHECK_RESULT(result, "Check appService failed %{public}d"); @@ -963,6 +967,21 @@ void BaseBundleInstaller::SetAtomicServiceModuleUpgrade(const InnerBundleInfo &o } } +void BaseBundleInstaller::KillRelatedProcessIfArkWeb(const std::string &bundleName, bool isAppExist, bool isOta) +{ + std::string arkWebName = OHOS::system::GetParameter(ARK_WEB_BUNDLE_NAME_PARAM, ARK_WEB_BUNDLE_NAME); + if (bundleName != arkWebName || !isAppExist || isOta) { + return; + } + auto appMgrClient = DelayedSingleton::GetInstance(); + if (appMgrClient == nullptr) { + LOG_E(BMS_TAG_INSTALLER, "AppMgrClient is nullptr, kill ark web process failed"); + return; + } + LOG_I(BMS_TAG_INSTALLER, "start to kill ark web related process"); + appMgrClient->KillProcessDependedOnWeb(); +} + ErrCode BaseBundleInstaller::CheckAppService( const InnerBundleInfo &newInfo, const InnerBundleInfo &oldInfo, bool isAppExist) { -- Gitee