mirror of
https://gitee.com/openharmony/bundlemanager_bundle_framework
synced 2024-11-23 07:09:53 +00:00
commit
b3b37c35e2
@ -86,6 +86,7 @@ struct InstallParam : public Parcelable {
|
||||
// for AOT
|
||||
bool isOTA = false;
|
||||
bool isRemoveUser = false;
|
||||
bool allUser = false;
|
||||
// utilizing for code-signature
|
||||
std::map<std::string, std::string> verifyCodeParams;
|
||||
// for MDM self update
|
||||
|
@ -166,6 +166,8 @@ protected:
|
||||
isBootScene ? InstallScene::BOOT : InstallScene::REBOOT;
|
||||
}
|
||||
|
||||
bool NotifyAllBundleStatus();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief The real procedure for system and normal bundle install.
|
||||
@ -469,7 +471,7 @@ private:
|
||||
* @return Returns ERR_OK if result is ok; returns error code otherwise.
|
||||
*/
|
||||
ErrCode CreateBundleUserData(InnerBundleInfo &innerBundleInfo);
|
||||
|
||||
void AddBundleStatus(const NotifyBundleEvents &installRes);
|
||||
ErrCode CheckInstallationFree(const InnerBundleInfo &innerBundleInfo,
|
||||
const std::unordered_map<std::string, InnerBundleInfo> &infos) const;
|
||||
|
||||
@ -665,6 +667,7 @@ private:
|
||||
// utilizing for code-signature
|
||||
std::map<std::string, std::string> verifyCodeParams_;
|
||||
std::vector<std::string> toDeleteTempHapPath_;
|
||||
std::vector<NotifyBundleEvents> bundleEvents_;
|
||||
// key is the temp path of hap or hsp
|
||||
// value is the signature file path
|
||||
std::map<std::string, std::string> signatureFileMap_;
|
||||
|
@ -170,7 +170,9 @@ ErrCode BaseBundleInstaller::InstallBundle(
|
||||
.accessTokenId = accessTokenId_,
|
||||
.isModuleUpdate = isModuleUpdate_
|
||||
};
|
||||
if (NotifyBundleStatus(installRes) != ERR_OK) {
|
||||
if (installParam.allUser) {
|
||||
AddBundleStatus(installRes);
|
||||
} else if (NotifyBundleStatus(installRes) != ERR_OK) {
|
||||
APP_LOGW("notify status failed for installation");
|
||||
}
|
||||
}
|
||||
@ -3884,6 +3886,31 @@ ErrCode BaseBundleInstaller::NotifyBundleStatus(const NotifyBundleEvents &instal
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void BaseBundleInstaller::AddBundleStatus(const NotifyBundleEvents &installRes)
|
||||
{
|
||||
bundleEvents_.emplace_back(installRes);
|
||||
}
|
||||
|
||||
bool BaseBundleInstaller::NotifyAllBundleStatus()
|
||||
{
|
||||
if (bundleEvents_.empty()) {
|
||||
APP_LOGE("bundleEvents is empty.");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto dataMgr = DelayedSingleton<BundleMgrService>::GetInstance()->GetDataMgr();
|
||||
if (!dataMgr) {
|
||||
APP_LOGE("Get dataMgr shared_ptr nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<BundleCommonEventMgr> commonEventMgr = std::make_shared<BundleCommonEventMgr>();
|
||||
for (const auto &bundleEvent : bundleEvents_) {
|
||||
commonEventMgr->NotifyBundleStatus(bundleEvent, dataMgr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void BaseBundleInstaller::AddNotifyBundleEvents(const NotifyBundleEvents ¬ifyBundleEvents)
|
||||
{
|
||||
auto userMgr = DelayedSingleton<BundleMgrService>::GetInstance()->GetBundleUserMgr();
|
||||
|
@ -38,6 +38,7 @@ void BundleInstaller::Install(const std::string &bundleFilePath, const InstallPa
|
||||
ErrCode resultCode = ERR_OK;
|
||||
if (installParam.userId == Constants::ALL_USERID) {
|
||||
auto userInstallParam = installParam;
|
||||
userInstallParam.allUser = true;
|
||||
for (auto userId : GetExistsCommonUserIds()) {
|
||||
userInstallParam.userId = userId;
|
||||
userInstallParam.installFlag = InstallFlag::REPLACE_EXISTING;
|
||||
@ -45,10 +46,13 @@ void BundleInstaller::Install(const std::string &bundleFilePath, const InstallPa
|
||||
bundleFilePath, userInstallParam, Constants::AppType::THIRD_PARTY_APP);
|
||||
ResetInstallProperties();
|
||||
}
|
||||
|
||||
NotifyAllBundleStatus();
|
||||
} else {
|
||||
resultCode = InstallBundle(
|
||||
bundleFilePath, installParam, Constants::AppType::THIRD_PARTY_APP);
|
||||
}
|
||||
|
||||
if (statusReceiver_ != nullptr) {
|
||||
statusReceiver_->OnFinished(resultCode, "");
|
||||
}
|
||||
@ -79,6 +83,7 @@ void BundleInstaller::Install(const std::vector<std::string> &bundleFilePaths, c
|
||||
ErrCode resultCode = ERR_OK;
|
||||
if (installParam.userId == Constants::ALL_USERID) {
|
||||
auto userInstallParam = installParam;
|
||||
userInstallParam.allUser = true;
|
||||
for (auto userId : GetExistsCommonUserIds()) {
|
||||
userInstallParam.userId = userId;
|
||||
userInstallParam.installFlag = InstallFlag::REPLACE_EXISTING;
|
||||
@ -86,6 +91,8 @@ void BundleInstaller::Install(const std::vector<std::string> &bundleFilePaths, c
|
||||
bundleFilePaths, userInstallParam, Constants::AppType::THIRD_PARTY_APP);
|
||||
ResetInstallProperties();
|
||||
}
|
||||
|
||||
NotifyAllBundleStatus();
|
||||
} else {
|
||||
resultCode = InstallBundle(bundleFilePaths, installParam, Constants::AppType::THIRD_PARTY_APP);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user