diff --git a/services/bundlemgr/include/bundle_common_event_mgr.h b/services/bundlemgr/include/bundle_common_event_mgr.h index c38a5529330fa3bbbff56f09cf55802e3e233a27..68f07203abb66353cd41d074f3dce7c4d99ac961 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 d51f9f3c99865d3b3d03a3a18e4bcd4b647dab47..8115f07c7aae0ed1a09c41b5f73df48fdca9bff0 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 52b88deeed79cd4b2d7a437a4b47cbf94e4c23b8..d490f6e62a05afb20e12554a7200b22f9cedc912 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);