From 00935cc2b744187b290c24ac13ed1190c829a522 Mon Sep 17 00:00:00 2001 From: jiangminsen Date: Wed, 30 Apr 2025 11:20:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E5=B9=BF=E6=92=AD=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=98=AF=E5=90=A6=E6=9B=B4=E6=96=B0=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=8C=91=E5=8D=955.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jiangminsen --- services/bundlemgr/include/bundle_common_event_mgr.h | 1 + services/bundlemgr/src/base_bundle_installer.cpp | 7 ++++++- services/bundlemgr/src/bundle_common_event_mgr.cpp | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/services/bundlemgr/include/bundle_common_event_mgr.h b/services/bundlemgr/include/bundle_common_event_mgr.h index c38a552933..68f07203ab 100755 --- a/services/bundlemgr/include/bundle_common_event_mgr.h +++ b/services/bundlemgr/include/bundle_common_event_mgr.h @@ -53,6 +53,7 @@ struct NotifyBundleEvents { bool isAgingUninstall = false; bool isBmsExtensionUninstalled = false; bool isModuleUpdate = false; + bool isAppUpdate = false; NotifyType type = NotifyType::INSTALL; ErrCode resultCode = ERR_OK; uint32_t accessTokenId = 0; diff --git a/services/bundlemgr/src/base_bundle_installer.cpp b/services/bundlemgr/src/base_bundle_installer.cpp index d51f9f3c99..8115f07c7a 100644 --- a/services/bundlemgr/src/base_bundle_installer.cpp +++ b/services/bundlemgr/src/base_bundle_installer.cpp @@ -172,6 +172,10 @@ void BaseBundleInstaller::SendStartInstallNotify(const InstallParam &installPara LOG_NOFUNC_W(BMS_TAG_INSTALLER, "SendStartInstallNotify bundleName is empty"); return; } + bool isAppExist; + if (InitDataMgr()) { + isAppExist = dataMgr_->HasUserInstallInBundle(bundleName_, userId_); + } for (const auto &item : infos) { LOG_D(BMS_TAG_INSTALLER, "SendStartInstallNotify %{public}s %{public}s %{public}s %{public}s", bundleName_.c_str(), item.second.GetCurModuleName().c_str(), @@ -181,7 +185,8 @@ void BaseBundleInstaller::SendStartInstallNotify(const InstallParam &installPara .bundleName = bundleName_, .modulePackage = item.second.GetCurModuleName(), .appId = item.second.GetAppId(), - .appIdentifier = item.second.GetAppIdentifier() + .appIdentifier = item.second.GetAppIdentifier(), + .isAppUpdate = isAppExist }; if (NotifyBundleStatus(installRes) != ERR_OK) { LOG_W(BMS_TAG_INSTALLER, "notify status failed for start install"); diff --git a/services/bundlemgr/src/bundle_common_event_mgr.cpp b/services/bundlemgr/src/bundle_common_event_mgr.cpp index 52b88deeed..d490f6e62a 100755 --- a/services/bundlemgr/src/bundle_common_event_mgr.cpp +++ b/services/bundlemgr/src/bundle_common_event_mgr.cpp @@ -42,6 +42,7 @@ constexpr const char* BUNDLE_RESOURCE_CHANGE_TYPE = "bundleResourceChangeType"; constexpr const char* APP_INDEX = "appIndex"; constexpr const char* TYPE = "type"; constexpr const char* RESULT_CODE = "resultCode"; +constexpr const char* IS_APP_UPDATE = "isAppUpdate"; constexpr const char* PERMISSION_GET_DISPOSED_STATUS = "ohos.permission.GET_DISPOSED_APP_STATUS"; constexpr const char* ASSET_ACCESS_GROUPS = "assetAccessGroups"; constexpr const char* DEVELOPERID = "developerId"; @@ -155,6 +156,7 @@ void BundleCommonEventMgr::SetNotifyWant(OHOS::AAFwk::Want& want, const NotifyBu want.SetParam(APP_INDEX, installResult.appIndex); want.SetParam(TYPE, static_cast(installResult.type)); want.SetParam(RESULT_CODE, installResult.resultCode); + want.SetParam(IS_APP_UPDATE, installResult.isAppUpdate); if (want.GetAction() == EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_REMOVED && !installResult.assetAccessGroups.empty()) { want.SetParam(ASSET_ACCESS_GROUPS, installResult.assetAccessGroups); -- Gitee