Merge pull request !5194 from dujingcheng/fixKK
This commit is contained in:
openharmony_ci 2023-12-30 07:41:37 +00:00 committed by Gitee
commit b3b37c35e2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 40 additions and 2 deletions

View File

@ -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

View File

@ -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_;

View File

@ -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 &notifyBundleEvents)
{
auto userMgr = DelayedSingleton<BundleMgrService>::GetInstance()->GetBundleUserMgr();

View File

@ -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);
}