!6932 质量加固 优化GetInnerBundleInfo

Merge pull request !6932 from amao/quality
This commit is contained in:
openharmony_ci 2024-09-18 03:25:45 +00:00 committed by Gitee
commit c2329a4e9c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
27 changed files with 60 additions and 69 deletions

View File

@ -91,7 +91,7 @@ private:
std::unordered_map<std::string, InnerBundleInfo> &newInfos,
InstallParam &installParam);
ErrCode UninstallLowerVersion(const std::vector<std::string> &moduleNameList);
bool GetInnerBundleInfo(InnerBundleInfo &info, bool &isAppExist);
bool GetInnerBundleInfoWithDisable(InnerBundleInfo &info, bool &isAppExist);
bool CheckNeedInstall(const std::unordered_map<std::string, InnerBundleInfo> &infos, InnerBundleInfo &oldInfo,
bool &isDowngrade);
bool CheckNeedUpdate(const InnerBundleInfo &newInfo, const InnerBundleInfo &oldInfo);

View File

@ -466,7 +466,7 @@ private:
* @param isAppExist Indicates if the innerBundleInfo is existed or not.
* @return Returns ERR_OK if the innerBundleInfo is obtained successfully; returns error code otherwise.
*/
bool GetInnerBundleInfo(InnerBundleInfo &info, bool &isAppExist);
bool GetInnerBundleInfoWithDisable(InnerBundleInfo &info, bool &isAppExist);
/**
* @brief To check whether the version code is compatible for application or not.
* @param oldInfo Indicates the original innerBundleInfo of the bundle.

View File

@ -131,7 +131,7 @@ public:
* @param info Indicates the obtained InnerBundleInfo object.
* @return Returns true if this function is successfully called; returns false otherwise.
*/
bool GetInnerBundleInfo(const std::string &bundleName, InnerBundleInfo &info);
bool GetInnerBundleInfoWithDisable(const std::string &bundleName, InnerBundleInfo &info);
/**
* @brief Generate UID and GID for a bundle.
* @param innerBundleUserInfo Indicates the InnerBundleUserInfo object.

View File

@ -56,7 +56,7 @@ public:
private:
ErrCode CreateSandboxDataDir(InnerBundleInfo &info, const int32_t &uid, const int32_t &appIndex) const;
void SandboxAppRollBack(InnerBundleInfo &info, const int32_t &userId);
bool GetInnerBundleInfo(InnerBundleInfo &info, bool &isAppExist);
bool GetInnerBundleInfoWithDisable(InnerBundleInfo &info, bool &isAppExist);
ErrCode GetDataMgr();
ErrCode GetSandboxDataMgr();

View File

@ -165,7 +165,7 @@ ErrCode AppServiceFwkInstaller::UnInstall(
return ERR_APPEXECFWK_UNINSTALL_PARAM_ERROR;
}
InnerBundleInfo info;
if (!dataMgr_->GetInnerBundleInfo(bundleName, info)) {
if (!dataMgr_->GetInnerBundleInfoWithDisable(bundleName, info)) {
APP_LOGE("get bundle info for %{public}s failed", bundleName.c_str());
return ERR_BUNDLE_MANAGER_INVALID_PARAMETER;
}
@ -929,7 +929,7 @@ ErrCode AppServiceFwkInstaller::UninstallLowerVersion(const std::vector<std::str
APP_LOGI_NOFUNC("start to uninstall lower version module");
InnerBundleInfo info;
bool isExist = false;
if (!GetInnerBundleInfo(info, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(info, isExist) || !isExist) {
return ERR_APPEXECFWK_UNINSTALL_BUNDLE_MGR_SERVICE_ERROR;
}
@ -957,7 +957,7 @@ ErrCode AppServiceFwkInstaller::UninstallLowerVersion(const std::vector<std::str
return ERR_OK;
}
bool AppServiceFwkInstaller::GetInnerBundleInfo(InnerBundleInfo &info, bool &isAppExist)
bool AppServiceFwkInstaller::GetInnerBundleInfoWithDisable(InnerBundleInfo &info, bool &isAppExist)
{
if (dataMgr_ == nullptr) {
dataMgr_ = DelayedSingleton<BundleMgrService>::GetInstance()->GetDataMgr();
@ -966,7 +966,7 @@ bool AppServiceFwkInstaller::GetInnerBundleInfo(InnerBundleInfo &info, bool &isA
return false;
}
}
isAppExist = dataMgr_->GetInnerBundleInfo(bundleName_, info);
isAppExist = dataMgr_->GetInnerBundleInfoWithDisable(bundleName_, info);
return true;
}

View File

@ -414,7 +414,7 @@ ErrCode BaseBundleInstaller::UninstallBundleByUninstallParam(const UninstallPara
auto &mtx = dataMgr_->GetBundleMutex(bundleName);
std::lock_guard lock {mtx};
InnerBundleInfo info;
if (!dataMgr_->GetInnerBundleInfo(bundleName, info)) {
if (!dataMgr_->GetInnerBundleInfoWithDisable(bundleName, info)) {
LOG_E(BMS_TAG_INSTALLER, "uninstall bundle info missing");
return ERR_APPEXECFWK_UNINSTALL_SHARE_APP_LIBRARY_IS_NOT_EXIST;
}
@ -755,7 +755,7 @@ ErrCode BaseBundleInstaller::InnerProcessBundleInstall(std::unordered_map<std::s
return ERR_APPEXECFWK_INSTALL_BUNDLE_MGR_SERVICE_ERROR;
}
// try to get the bundle info to decide use install or update. Always keep other exceptions below this line.
if (!GetInnerBundleInfo(oldInfo, isAppExist_)) {
if (!GetInnerBundleInfoWithDisable(oldInfo, isAppExist_)) {
return ERR_APPEXECFWK_INSTALL_BUNDLE_MGR_SERVICE_ERROR;
}
LOG_I(BMS_TAG_INSTALLER, "isAppExist:%{public}d", isAppExist_);
@ -894,7 +894,7 @@ ErrCode BaseBundleInstaller::InnerProcessBundleInstall(std::unordered_map<std::s
InnerBundleInfo bundleInfo;
bool isBundleExist = false;
if (!GetInnerBundleInfo(bundleInfo, isBundleExist) || !isBundleExist) {
if (!GetInnerBundleInfoWithDisable(bundleInfo, isBundleExist) || !isBundleExist) {
return ERR_APPEXECFWK_INSTALL_BUNDLE_MGR_SERVICE_ERROR;
}
bool isOldSystemApp = bundleInfo.IsSystemApp();
@ -955,7 +955,7 @@ ErrCode BaseBundleInstaller::InnerProcessUpdateHapToken(const bool isOldSystemAp
{
InnerBundleInfo newBundleInfo;
bool isBundleExist = false;
if (!GetInnerBundleInfo(newBundleInfo, isBundleExist) || !isBundleExist) {
if (!GetInnerBundleInfoWithDisable(newBundleInfo, isBundleExist) || !isBundleExist) {
APP_LOGE("bundleName:%{public}s not exist", bundleName_.c_str());
return ERR_APPEXECFWK_INSTALL_BUNDLE_MGR_SERVICE_ERROR;
}
@ -1347,7 +1347,7 @@ void BaseBundleInstaller::RollBack(const std::unordered_map<std::string, InnerBu
}
InnerBundleInfo preInfo;
bool isExist = false;
if (!GetInnerBundleInfo(preInfo, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(preInfo, isExist) || !isExist) {
LOG_I(BMS_TAG_INSTALLER, "finish rollback due to install failed");
return;
}
@ -1392,7 +1392,7 @@ void BaseBundleInstaller::RemoveInfo(const std::string &bundleName, const std::s
} else {
InnerBundleInfo innerBundleInfo;
bool isExist = false;
if (!GetInnerBundleInfo(innerBundleInfo, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(innerBundleInfo, isExist) || !isExist) {
LOG_I(BMS_TAG_INSTALLER, "finish rollback due to install failed");
return;
}
@ -1410,7 +1410,7 @@ void BaseBundleInstaller::RollBackModuleInfo(const std::string &bundleName, Inne
}
InnerBundleInfo innerBundleInfo;
bool isExist = false;
if (!GetInnerBundleInfo(innerBundleInfo, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(innerBundleInfo, isExist) || !isExist) {
return;
}
dataMgr_->UpdateBundleInstallState(bundleName, InstallState::ROLL_BACK);
@ -1644,7 +1644,7 @@ ErrCode BaseBundleInstaller::ProcessBundleUninstall(
auto &mtx = dataMgr_->GetBundleMutex(bundleName);
std::lock_guard lock {mtx};
InnerBundleInfo oldInfo;
if (!dataMgr_->GetInnerBundleInfo(bundleName, oldInfo)) {
if (!dataMgr_->GetInnerBundleInfoWithDisable(bundleName, oldInfo)) {
LOG_W(BMS_TAG_INSTALLER, "uninstall bundle info missing");
return ERR_APPEXECFWK_UNINSTALL_MISSING_INSTALLED_BUNDLE;
}
@ -1855,9 +1855,8 @@ ErrCode BaseBundleInstaller::InnerProcessInstallByPreInstallInfo(
auto &mtx = dataMgr_->GetBundleMutex(bundleName);
std::lock_guard lock {mtx};
InnerBundleInfo oldInfo;
bool isAppExist = dataMgr_->GetInnerBundleInfo(bundleName, oldInfo);
bool isAppExist = dataMgr_->FetchInnerBundleInfo(bundleName, oldInfo);
if (isAppExist) {
dataMgr_->EnableBundle(bundleName);
if (oldInfo.GetApplicationBundleType() == BundleType::SHARED) {
LOG_D(BMS_TAG_INSTALLER, "shared bundle (%{public}s) is irrelevant to user", bundleName.c_str());
return ERR_OK;
@ -2358,7 +2357,7 @@ void BaseBundleInstaller::ProcessQuickFixWhenInstallNewModule(const InstallParam
// hqf extract diff file or apply diff patch failed does not affect the hap installation
InnerBundleInfo bundleInfo;
bool isBundleExist = false;
if (!GetInnerBundleInfo(bundleInfo, isBundleExist) || !isBundleExist) {
if (!GetInnerBundleInfoWithDisable(bundleInfo, isBundleExist) || !isBundleExist) {
return;
}
for (auto &info : newInfos) {
@ -3012,7 +3011,7 @@ void BaseBundleInstaller::CreateScreenLockProtectionDir()
LOG_NOFUNC_I(BMS_TAG_INSTALLER, "CreateScreenLockProtectionDir start");
InnerBundleInfo info;
bool isExist = false;
if (!GetInnerBundleInfo(info, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(info, isExist) || !isExist) {
LOG_E(BMS_TAG_INSTALLER, "GetInnerBundleInfo failed, bundleName: %{public}s", bundleName_.c_str());
return ;
}
@ -4134,12 +4133,12 @@ ErrCode BaseBundleInstaller::CheckMDMUpdateBundleForSelf(const InstallParam &ins
return ERR_OK;
}
bool BaseBundleInstaller::GetInnerBundleInfo(InnerBundleInfo &info, bool &isAppExist)
bool BaseBundleInstaller::GetInnerBundleInfoWithDisable(InnerBundleInfo &info, bool &isAppExist)
{
if (!InitDataMgr()) {
return false;
}
isAppExist = dataMgr_->GetInnerBundleInfo(bundleName_, info);
isAppExist = dataMgr_->GetInnerBundleInfoWithDisable(bundleName_, info);
return true;
}
@ -4226,7 +4225,7 @@ ErrCode BaseBundleInstaller::UninstallLowerVersionFeature(const std::vector<std:
}
InnerBundleInfo info;
bool isExist = false;
if (!GetInnerBundleInfo(info, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(info, isExist) || !isExist) {
return ERR_APPEXECFWK_UNINSTALL_BUNDLE_MGR_SERVICE_ERROR;
}
@ -4856,7 +4855,7 @@ void BaseBundleInstaller::OnSingletonChange(bool killProcess)
InnerBundleInfo info;
bool isExist = false;
if (!GetInnerBundleInfo(info, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(info, isExist) || !isExist) {
LOG_E(BMS_TAG_INSTALLER, "Get innerBundleInfo failed when singleton changed");
return;
}
@ -4926,7 +4925,7 @@ void BaseBundleInstaller::GetInstallEventInfo(EventInfo &eventInfo)
LOG_D(BMS_TAG_INSTALLER, "GetInstallEventInfo start, bundleName:%{public}s", bundleName_.c_str());
InnerBundleInfo info;
bool isExist = false;
if (!GetInnerBundleInfo(info, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(info, isExist) || !isExist) {
LOG_E(BMS_TAG_INSTALLER, "Get innerBundleInfo failed, bundleName: %{public}s", bundleName_.c_str());
return;
}
@ -5453,7 +5452,7 @@ ErrCode BaseBundleInstaller::CheckHapEncryption(const std::unordered_map<std::st
LOG_D(BMS_TAG_INSTALLER, "begin to check hap encryption");
InnerBundleInfo oldInfo;
bool isExist = false;
if (!GetInnerBundleInfo(oldInfo, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(oldInfo, isExist) || !isExist) {
LOG_E(BMS_TAG_INSTALLER, "Get innerBundleInfo failed, bundleName: %{public}s", bundleName_.c_str());
return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR;
}
@ -5860,7 +5859,7 @@ void BaseBundleInstaller::VerifyDomain()
LOG_D(BMS_TAG_INSTALLER, "start to verify domain");
InnerBundleInfo bundleInfo;
bool isExist = false;
if (!GetInnerBundleInfo(bundleInfo, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(bundleInfo, isExist) || !isExist) {
LOG_E(BMS_TAG_INSTALLER, "Get innerBundleInfo failed, bundleName: %{public}s", bundleName_.c_str());
return;
}
@ -6109,7 +6108,7 @@ void BaseBundleInstaller::MarkInstallFinish()
{
InnerBundleInfo info;
bool isExist = false;
if (!GetInnerBundleInfo(info, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(info, isExist) || !isExist) {
LOG_W(BMS_TAG_INSTALLER, "mark finish failed");
return;
}

View File

@ -4108,9 +4108,9 @@ ErrCode BundleDataMgr::GetInnerBundleInfoWithBundleFlagsV9(const std::string &bu
return ERR_OK;
}
bool BundleDataMgr::GetInnerBundleInfo(const std::string &bundleName, InnerBundleInfo &info)
bool BundleDataMgr::GetInnerBundleInfoWithDisable(const std::string &bundleName, InnerBundleInfo &info)
{
APP_LOGD("GetInnerBundleInfo %{public}s", bundleName.c_str());
APP_LOGD("GetInnerBundleInfoWithDisable %{public}s", bundleName.c_str());
if (bundleName.empty()) {
APP_LOGW("bundleName is empty");
return false;

View File

@ -632,7 +632,7 @@ bool BundleInstallChecker::FindModuleInInstalledPackage(
ScopeGuard enableGuard([&dataMgr, &bundleName] { dataMgr->EnableBundle(bundleName); });
InnerBundleInfo bundleInfo;
bool isBundleExist = dataMgr->GetInnerBundleInfo(bundleName, bundleInfo);
bool isBundleExist = dataMgr->FetchInnerBundleInfo(bundleName, bundleInfo);
if (!isBundleExist) {
LOG_E(BMS_TAG_INSTALLER, "the bundle: %{public}s is not install", bundleName.c_str());
return false;

View File

@ -812,10 +812,7 @@ void BMSEventHandler::SaveInstallInfoToCache(InnerBundleInfo &info)
{
auto &mtx = dataMgr->GetBundleMutex(bundleName);
std::lock_guard lock { mtx };
bundleExist = dataMgr->GetInnerBundleInfo(bundleName, dbInfo);
if (bundleExist) {
dataMgr->EnableBundle(bundleName);
}
bundleExist = dataMgr->FetchInnerBundleInfo(bundleName, dbInfo);
}
if (!bundleExist) {

View File

@ -96,7 +96,7 @@ ErrCode BundleMultiUserInstaller::ProcessBundleInstall(const std::string &bundle
// 1. check whether original application installed or not
ScopeGuard bundleEnabledGuard([&] { dataMgr_->EnableBundle(bundleName); });
InnerBundleInfo info;
bool isExist = dataMgr_->GetInnerBundleInfo(bundleName, info);
bool isExist = dataMgr_->GetInnerBundleInfoWithDisable(bundleName, info);
if (!isExist) {
APP_LOGE("the bundle is not installed");
return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST;

View File

@ -114,7 +114,7 @@ ErrCode BundleCloneInstaller::UninstallAllCloneApps(const std::string &bundleNam
}
ScopeGuard bundleEnabledGuard([&] { dataMgr_->EnableBundle(bundleName); });
InnerBundleInfo info;
bool isExist = dataMgr_->GetInnerBundleInfo(bundleName, info);
bool isExist = dataMgr_->GetInnerBundleInfoWithDisable(bundleName, info);
if (!isExist) {
APP_LOGE("the bundle is not installed");
return ERR_APPEXECFWK_CLONE_UNINSTALL_APP_NOT_EXISTED;

View File

@ -253,14 +253,12 @@ bool QuickFixBootScanner::ProcessWithBundleHasQuickFixInfo(const std::string &bu
invalidQuickFixDir_.emplace_back(hqfPath);
// remove the quick fix info from memory cache and db
InnerBundleInfo innerBundleInfo;
if ((dataMgr_ == nullptr) || (!dataMgr_->GetInnerBundleInfo(bundleName, innerBundleInfo))) {
if ((dataMgr_ == nullptr) || (!dataMgr_->FetchInnerBundleInfo(bundleName, innerBundleInfo))) {
LOG_E(BMS_TAG_DEFAULT, "cannot obtain the innerbundleInfo from data mgr");
return false;
}
AppQuickFix appQuickFix;
innerBundleInfo.SetAppQuickFix(appQuickFix);
innerBundleInfo.SetBundleStatus(InnerBundleInfo::BundleStatus::ENABLED);
dataMgr_->EnableBundle(bundleName);
if (!dataMgr_->UpdateQuickFixInnerBundleInfo(bundleName, innerBundleInfo)) {
LOG_E(BMS_TAG_DEFAULT, "update quickfix innerbundleInfo failed");
return false;

View File

@ -170,7 +170,7 @@ ErrCode QuickFixDeleter::RemoveDeployingInfo(const std::string &bundleName)
return ERR_BUNDLEMANAGER_QUICK_FIX_INTERNAL_ERROR;
}
InnerBundleInfo innerBundleInfo;
auto isExisted = dataMgr_->GetInnerBundleInfo(bundleName, innerBundleInfo);
auto isExisted = dataMgr_->GetInnerBundleInfoWithDisable(bundleName, innerBundleInfo);
if (isExisted) {
AppQuickFix appQuickFix = innerBundleInfo.GetAppQuickFix();
if (appQuickFix.deployingAppqfInfo.hqfInfos.empty()) {

View File

@ -640,7 +640,7 @@ ErrCode QuickFixDeployer::SaveToInnerBundleInfo(const InnerAppQuickFix &newInner
const std::string &bundleName = newInnerAppQuickFix.GetAppQuickFix().bundleName;
InnerBundleInfo innerBundleInfo;
// obtain innerBundleInfo and enableGuard used to enable bundle which is under disable status
if (!dataMgr->GetInnerBundleInfo(bundleName, innerBundleInfo)) {
if (!dataMgr->GetInnerBundleInfoWithDisable(bundleName, innerBundleInfo)) {
LOG_E(BMS_TAG_DEFAULT, "cannot obtain the innerbundleInfo from data mgr");
return ERR_BUNDLEMANAGER_QUICK_FIX_NOT_EXISTED_BUNDLE_INFO;
}

View File

@ -143,7 +143,7 @@ ErrCode QuickFixSwitcher::InnerSwitchQuickFix(const std::string &bundleName, con
}
InnerBundleInfo innerBundleInfo;
// 4. obtain innerBundleInfo and enableGuard used to enable bundle which is under disable status
if (!dataMgr_->GetInnerBundleInfo(bundleName, innerBundleInfo)) {
if (!dataMgr_->GetInnerBundleInfoWithDisable(bundleName, innerBundleInfo)) {
LOG_E(BMS_TAG_DEFAULT, "cannot obtain the innerbundleInfo from data mgr");
return ERR_BUNDLEMANAGER_QUICK_FIX_NOT_EXISTED_BUNDLE_INFO;
}

View File

@ -59,7 +59,7 @@ ErrCode BundleSandboxInstaller::InstallSandboxApp(const std::string &bundleName,
// 1. check whether original application installed or not
InnerBundleInfo info;
bool isExist = false;
if (!GetInnerBundleInfo(info, isExist) || !isExist) {
if (!GetInnerBundleInfoWithDisable(info, isExist) || !isExist) {
APP_LOGE("the bundle is not installed");
return ERR_APPEXECFWK_SANDBOX_INSTALL_APP_NOT_EXISTED;
}
@ -338,13 +338,13 @@ ErrCode BundleSandboxInstaller::UninstallAllSandboxApps(const std::string &bundl
return ERR_OK;
}
bool BundleSandboxInstaller::GetInnerBundleInfo(InnerBundleInfo &info, bool &isAppExist)
bool BundleSandboxInstaller::GetInnerBundleInfoWithDisable(InnerBundleInfo &info, bool &isAppExist)
{
if (GetDataMgr() != ERR_OK) {
APP_LOGE("Get dataMgr shared_ptr failed");
return false;
}
isAppExist = dataMgr_->GetInnerBundleInfo(bundleName_, info);
isAppExist = dataMgr_->GetInnerBundleInfoWithDisable(bundleName_, info);
return true;
}

View File

@ -330,10 +330,7 @@ void BMSEventHandler::SaveInstallInfoToCache(InnerBundleInfo& info)
{
auto& mtx = dataMgr->GetBundleMutex(bundleName);
std::lock_guard lock { mtx };
bundleExist = dataMgr->GetInnerBundleInfo(bundleName, dbInfo);
if (bundleExist) {
dataMgr->EnableBundle(bundleName);
}
bundleExist = dataMgr->FetchInnerBundleInfo(bundleName, dbInfo);
}
if (!bundleExist) {

View File

@ -651,7 +651,7 @@ HWTEST_F(BmsBundleAppServiceFwkInstallerTest, GetInnerBundleInfo_0010, Function
InnerBundleInfo info;
bool isAppExist;
auto res = appServiceFwkInstaller.GetInnerBundleInfo(info, isAppExist);
auto res = appServiceFwkInstaller.GetInnerBundleInfoWithDisable(info, isAppExist);
EXPECT_FALSE(isAppExist);
EXPECT_TRUE(res);
}
@ -977,7 +977,7 @@ HWTEST_F(BmsBundleAppServiceFwkInstallerTest, GetInnerBundleInfo_0020, Function
ClearDataMgr();
InnerBundleInfo info;
bool isAppExist;
auto res = appServiceFwkInstaller.GetInnerBundleInfo(info, isAppExist);
auto res = appServiceFwkInstaller.GetInnerBundleInfoWithDisable(info, isAppExist);
EXPECT_TRUE(res);
ResetDataMgr();
}

View File

@ -1944,7 +1944,7 @@ HWTEST_F(BmsBundleInstallerTest, baseBundleInstaller_2100, Function | SmallTest
"bundleName", installParam, uid);
EXPECT_EQ(ret, ERR_APPEXECFWK_UNINSTALL_BUNDLE_MGR_SERVICE_ERROR);
InnerBundleInfo info;
bool res = installer.GetInnerBundleInfo(info, recoverMode);
bool res = installer.GetInnerBundleInfoWithDisable(info, recoverMode);
EXPECT_EQ(res, false);
ResetDataMgr();

View File

@ -3568,14 +3568,14 @@ HWTEST_F(BmsBundleManagerTest, GetMgrFalseByNoBundle_0006, Function | SmallTest
/**
* @tc.number: GetMgrFalseByNoBundle_0007
* @tc.name: test GetInnerBundleInfo
* @tc.name: test GetInnerBundleInfoWithDisable
* @tc.desc: 1.system run normally
* 2.bundleInfos is empty
*/
HWTEST_F(BmsBundleManagerTest, GetMgrFalseByNoBundle_0007, Function | SmallTest | Level1)
{
InnerBundleInfo info;
bool testRet = GetBundleDataMgr()->GetInnerBundleInfo(
bool testRet = GetBundleDataMgr()->GetInnerBundleInfoWithDisable(
TEST_BUNDLE_NAME, info);
EXPECT_EQ(testRet, false);
}

View File

@ -161,7 +161,7 @@ void BmsBundleSetOverlayEnabledTest::CheckEnabledState(int32_t state)
EXPECT_NE(dataMgr, nullptr);
InnerBundleInfo innerBundleInfo;
auto ret = dataMgr->GetInnerBundleInfo(TEST_BUNDLE_NAME, innerBundleInfo);
auto ret = dataMgr->GetInnerBundleInfoWithDisable(TEST_BUNDLE_NAME, innerBundleInfo);
EXPECT_TRUE(ret);
InnerBundleUserInfo userInfo;

View File

@ -173,7 +173,7 @@ void BmsBundleQuickFixBootScannerTest::CheckQuickFixInfo(const std::string &bund
EXPECT_NE(dataMgr, nullptr) << "the data mgr is nullptr";
InnerBundleInfo innerBundleInfo;
bool result = dataMgr->GetInnerBundleInfo(bundleName, innerBundleInfo);
bool result = dataMgr->GetInnerBundleInfoWithDisable(bundleName, innerBundleInfo);
EXPECT_TRUE(result);
auto appqfInof = innerBundleInfo.GetAppQuickFix();
size_t ret = appqfInof.deployedAppqfInfo.hqfInfos.size();
@ -244,7 +244,7 @@ void BmsBundleQuickFixBootScannerTest::AddInnerBundleInfo(const std::string &bun
EXPECT_NE(dataMgr, nullptr) << "the data mgr is nullptr";
InnerBundleInfo innerBundleInfo;
bool result = dataMgr->GetInnerBundleInfo(bundleName, innerBundleInfo);
bool result = dataMgr->GetInnerBundleInfoWithDisable(bundleName, innerBundleInfo);
EXPECT_TRUE(result);
AppQuickFix appQuickFix;

View File

@ -148,7 +148,7 @@ void BmsBundleQuickFixMgrRdbTest::CheckQuickFixInfo(const std::string &bundleNam
EXPECT_NE(dataMgr, nullptr) << "the data mgr is nullptr";
InnerBundleInfo innerBundleInfo;
bool result = dataMgr->GetInnerBundleInfo(bundleName, innerBundleInfo);
bool result = dataMgr->GetInnerBundleInfoWithDisable(bundleName, innerBundleInfo);
EXPECT_TRUE(result);
auto appqfInof = innerBundleInfo.GetAppQuickFix();
size_t ret = appqfInof.deployedAppqfInfo.hqfInfos.size();

View File

@ -186,7 +186,7 @@ void BmsBundleQuickFixQueryTest::MockEnableQuickFix() const
InnerBundleInfo innerBundleInfo;
auto dataMgr = GetBundleDataMgr();
EXPECT_NE(dataMgr, nullptr);
auto result = dataMgr->GetInnerBundleInfo(BUNDLE_NAME, innerBundleInfo);
auto result = dataMgr->GetInnerBundleInfoWithDisable(BUNDLE_NAME, innerBundleInfo);
EXPECT_TRUE(result);
AppQuickFix appQuickFix = innerBundleInfo.GetAppQuickFix();
@ -214,7 +214,7 @@ void BmsBundleQuickFixQueryTest::MockDisableQuickFix() const
InnerBundleInfo innerBundleInfo;
auto dataMgr = GetBundleDataMgr();
EXPECT_NE(dataMgr, nullptr);
auto result = dataMgr->GetInnerBundleInfo(BUNDLE_NAME, innerBundleInfo);
auto result = dataMgr->GetInnerBundleInfoWithDisable(BUNDLE_NAME, innerBundleInfo);
EXPECT_TRUE(result);
AppQuickFix appQuickFix_1 = innerAppQuickFix.GetAppQuickFix();
@ -248,7 +248,7 @@ void BmsBundleQuickFixQueryTest::MockDeployQuickFix() const
InnerBundleInfo innerBundleInfo;
auto dataMgr = GetBundleDataMgr();
EXPECT_NE(dataMgr, nullptr);
auto result = dataMgr->GetInnerBundleInfo(BUNDLE_NAME, innerBundleInfo);
auto result = dataMgr->GetInnerBundleInfoWithDisable(BUNDLE_NAME, innerBundleInfo);
EXPECT_TRUE(result);
innerBundleInfo.SetAppQuickFix(appQuickFix);
innerBundleInfo.SetBundleStatus(InnerBundleInfo::BundleStatus::ENABLED);

View File

@ -520,7 +520,7 @@ HWTEST_F(BmsBundleQuickFixSwitcherTest, BmsBundleQuickFixSwitcherTest_1300, Func
EXPECT_NE(dataMgr, nullptr) << "the data mgr is nullptr";
InnerBundleInfo innerBundleInfo;
bool result = dataMgr->GetInnerBundleInfo(BUNDLE_NAME, innerBundleInfo);
bool result = dataMgr->GetInnerBundleInfoWithDisable(BUNDLE_NAME, innerBundleInfo);
EXPECT_TRUE(result);
SetAppQuickFix(innerBundleInfo);
result = dataMgr->UpdateQuickFixInnerBundleInfo(BUNDLE_NAME, innerBundleInfo);
@ -577,7 +577,7 @@ HWTEST_F(BmsBundleQuickFixSwitcherTest, BmsBundleQuickFixSwitcherTest_1500, Func
EXPECT_NE(dataMgr, nullptr) << "the data mgr is nullptr";
InnerBundleInfo innerBundleInfo;
bool result = dataMgr->GetInnerBundleInfo(BUNDLE_NAME, innerBundleInfo);
bool result = dataMgr->GetInnerBundleInfoWithDisable(BUNDLE_NAME, innerBundleInfo);
EXPECT_TRUE(result);
SetAppQuickFix(innerBundleInfo);
result = dataMgr->UpdateQuickFixInnerBundleInfo(BUNDLE_NAME, innerBundleInfo);

View File

@ -541,7 +541,7 @@ HWTEST_F(BmsDataMgrTest, AddBundleInfo_0100, Function | SmallTest | Level0)
InnerBundleInfo info1;
bool ret1 = dataMgr->UpdateBundleInstallState(BUNDLE_NAME, InstallState::INSTALL_START);
bool ret2 = dataMgr->AddInnerBundleInfo(BUNDLE_NAME, info);
bool ret3 = dataMgr->GetInnerBundleInfo(BUNDLE_NAME, info1);
bool ret3 = dataMgr->GetInnerBundleInfoWithDisable(BUNDLE_NAME, info1);
EXPECT_TRUE(ret1);
EXPECT_TRUE(ret2);
EXPECT_TRUE(ret3);
@ -626,7 +626,7 @@ HWTEST_F(BmsDataMgrTest, AddBundleInfo_0300, Function | SmallTest | Level0)
InnerBundleInfo info;
InnerBundleInfo info1;
bool ret = dataMgr->AddInnerBundleInfo("", info);
bool ret1 = dataMgr->GetInnerBundleInfo("", info1);
bool ret1 = dataMgr->GetInnerBundleInfoWithDisable("", info1);
EXPECT_FALSE(ret);
EXPECT_FALSE(ret1);
}
@ -707,11 +707,11 @@ HWTEST_F(BmsDataMgrTest, AddBundleInfo_0500, Function | SmallTest | Level0)
bool ret3 = dataMgr->UpdateBundleInstallState(BUNDLE_NAME, InstallState::UPDATING_START);
bool ret4 = dataMgr->UpdateBundleInstallState(BUNDLE_NAME, InstallState::UPDATING_SUCCESS);
bool ret5 = dataMgr->AddNewModuleInfo(BUNDLE_NAME, info2, info1);
bool ret6 = dataMgr->GetInnerBundleInfo(BUNDLE_NAME, info3);
bool ret6 = dataMgr->GetInnerBundleInfoWithDisable(BUNDLE_NAME, info3);
bool ret7 = dataMgr->UpdateBundleInstallState(BUNDLE_NAME, InstallState::INSTALL_SUCCESS);
bool ret8 = dataMgr->UpdateBundleInstallState(BUNDLE_NAME, InstallState::UPDATING_START);
bool ret9 = dataMgr->RemoveModuleInfo(BUNDLE_NAME, PACKAGE_NAME, info1);
bool ret10 = dataMgr->GetInnerBundleInfo(BUNDLE_NAME, info4);
bool ret10 = dataMgr->GetInnerBundleInfoWithDisable(BUNDLE_NAME, info4);
EXPECT_TRUE(ret1);
EXPECT_TRUE(ret2);
EXPECT_TRUE(ret3);

View File

@ -32,7 +32,7 @@ namespace OHOS {
AppServiceFwkInstaller appServiceFwk;
InnerBundleInfo info;
bool isAppExist;
appServiceFwk.GetInnerBundleInfo(info, isAppExist);
appServiceFwk.GetInnerBundleInfoWithDisable(info, isAppExist);
return true;
}
}