!7481 驱动应用拷贝包到安装目录

Merge pull request !7481 from Zhou Shihui/driver
This commit is contained in:
openharmony_ci 2024-11-16 08:49:09 +00:00 committed by Gitee
commit 7f8b4605a8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -4870,6 +4870,7 @@ ErrCode BaseBundleInstaller::SaveHapToInstallPath(const std::unordered_map<std::
}
// 1. copy hsp or hap file to temp installation dir
ErrCode result = ERR_OK;
bool isDriver = HasDriverExtensionAbility(bundleName_);
for (const auto &hapPathRecord : hapPathRecords_) {
LOG_D(BMS_TAG_INSTALLER, "Save from %{public}s to %{public}s",
hapPathRecord.first.c_str(), hapPathRecord.second.c_str());
@ -4879,10 +4880,18 @@ ErrCode BaseBundleInstaller::SaveHapToInstallPath(const std::unordered_map<std::
signatureFileMap_.at(hapPathRecord.first));
CHECK_RESULT(result, "Copy hap to install path failed or code signature hap failed %{public}d");
} else {
if (InstalldClient::GetInstance()->MoveHapToCodeDir(
hapPathRecord.first, hapPathRecord.second) != ERR_OK) {
LOG_E(BMS_TAG_INSTALLER, "Copy hap to install path failed");
return ERR_APPEXECFWK_INSTALLD_MOVE_FILE_FAILED;
if (isDriver) {
if (InstalldClient::GetInstance()->CopyFile(
hapPathRecord.first, hapPathRecord.second) != ERR_OK) {
LOG_E(BMS_TAG_INSTALLER, "Copy hap to install path failed");
return ERR_APPEXECFWK_INSTALL_COPY_HAP_FAILED;
}
} else {
if (InstalldClient::GetInstance()->MoveHapToCodeDir(
hapPathRecord.first, hapPathRecord.second) != ERR_OK) {
LOG_E(BMS_TAG_INSTALLER, "Move hap to install path failed");
return ERR_APPEXECFWK_INSTALLD_MOVE_FILE_FAILED;
}
}
if (VerifyCodeSignatureForHap(infos, hapPathRecord.first, hapPathRecord.second) != ERR_OK) {
LOG_E(BMS_TAG_INSTALLER, "enable code signature failed");