mirror of
https://gitee.com/openharmony/bundlemanager_bundle_framework
synced 2024-11-27 09:20:49 +00:00
修复多用户安装驱动连续发送广播的问题
Signed-off-by: Zhou Shihui <zhoushihui4@huawei.com>
This commit is contained in:
parent
83a1063fae
commit
c21cc1713d
@ -186,6 +186,8 @@ protected:
|
|||||||
|
|
||||||
ErrCode RollbackHmpCommonInfo(const std::string &bundleName);
|
ErrCode RollbackHmpCommonInfo(const std::string &bundleName);
|
||||||
|
|
||||||
|
bool HasDriverExtensionAbility(const std::string &bundleName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief The real procedure for system and normal bundle install.
|
* @brief The real procedure for system and normal bundle install.
|
||||||
|
@ -113,8 +113,6 @@ private:
|
|||||||
|
|
||||||
void RecoverDriverForAllUsers(const std::string &bundleName, const InstallParam &installParam);
|
void RecoverDriverForAllUsers(const std::string &bundleName, const InstallParam &installParam);
|
||||||
|
|
||||||
bool HasDriverExtensionAbility(const std::string &bundleName);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int64_t installerId_ = 0;
|
const int64_t installerId_ = 0;
|
||||||
const sptr<IStatusReceiver> statusReceiver_;
|
const sptr<IStatusReceiver> statusReceiver_;
|
||||||
|
@ -212,7 +212,7 @@ ErrCode BaseBundleInstaller::InstallBundle(
|
|||||||
.abilityName = mainAbility_,
|
.abilityName = mainAbility_,
|
||||||
.appDistributionType = appDistributionType_,
|
.appDistributionType = appDistributionType_,
|
||||||
};
|
};
|
||||||
if (installParam.allUser) {
|
if (installParam.allUser || HasDriverExtensionAbility(bundleName_)) {
|
||||||
AddBundleStatus(installRes);
|
AddBundleStatus(installRes);
|
||||||
} else if (NotifyBundleStatus(installRes) != ERR_OK) {
|
} else if (NotifyBundleStatus(installRes) != ERR_OK) {
|
||||||
LOG_W(BMS_TAG_INSTALLER, "notify status failed for installation");
|
LOG_W(BMS_TAG_INSTALLER, "notify status failed for installation");
|
||||||
@ -6119,5 +6119,28 @@ void BaseBundleInstaller::MarkInstallFinish()
|
|||||||
LOG_W(BMS_TAG_INSTALLER, "save mark failed");
|
LOG_W(BMS_TAG_INSTALLER, "save mark failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BaseBundleInstaller::HasDriverExtensionAbility(const std::string &bundleName)
|
||||||
|
{
|
||||||
|
auto dataMgr = DelayedSingleton<BundleMgrService>::GetInstance()->GetDataMgr();
|
||||||
|
if (dataMgr == nullptr) {
|
||||||
|
APP_LOGE("Get dataMgr shared_ptr nullptr");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
InnerBundleInfo info;
|
||||||
|
bool isAppExist = dataMgr->FetchInnerBundleInfo(bundleName, info);
|
||||||
|
if (isAppExist) {
|
||||||
|
const auto extensions = info.GetInnerExtensionInfos();
|
||||||
|
for (const auto &item : extensions) {
|
||||||
|
if (item.second.type == ExtensionAbilityType::DRIVER) {
|
||||||
|
APP_LOGI("find driver extension ability, bundleName: %{public}s, moduleName: %{public}s",
|
||||||
|
item.second.bundleName.c_str(), item.second.moduleName.c_str());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} // namespace AppExecFwk
|
} // namespace AppExecFwk
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -276,29 +276,6 @@ void BundleInstaller::RecoverDriverForAllUsers(const std::string &bundleName, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BundleInstaller::HasDriverExtensionAbility(const std::string &bundleName)
|
|
||||||
{
|
|
||||||
auto dataMgr = DelayedSingleton<BundleMgrService>::GetInstance()->GetDataMgr();
|
|
||||||
if (dataMgr == nullptr) {
|
|
||||||
APP_LOGE("Get dataMgr shared_ptr nullptr");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
InnerBundleInfo info;
|
|
||||||
bool isAppExist = dataMgr->FetchInnerBundleInfo(bundleName, info);
|
|
||||||
if (isAppExist) {
|
|
||||||
const auto extensions = info.GetInnerExtensionInfos();
|
|
||||||
for (const auto &item : extensions) {
|
|
||||||
if (item.second.type == ExtensionAbilityType::DRIVER) {
|
|
||||||
APP_LOGI("find driver extension ability, bundleName: %{public}s, moduleName: %{public}s",
|
|
||||||
item.second.bundleName.c_str(), item.second.moduleName.c_str());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BundleInstaller::UninstallAndRecover(const std::string &bundleName, const InstallParam &installParam)
|
void BundleInstaller::UninstallAndRecover(const std::string &bundleName, const InstallParam &installParam)
|
||||||
{
|
{
|
||||||
ErrCode resultCode = ERR_OK;
|
ErrCode resultCode = ERR_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user