IssueNo:#IAUKNF

Description:fix bug
Sig:SIG_ApplicaitonFramework
Feature or Bugfix:Bugfix
Binary Source:No
Signed-off-by: wangtiantian <wangtiantian19@huawei.com>
This commit is contained in:
wangtiantian 2024-09-30 14:30:33 +08:00
parent 3f2f617e9a
commit f5047263e6
4 changed files with 12 additions and 12 deletions

View File

@ -5321,7 +5321,7 @@ ErrCode BundleMgrProxy::IsBundleInstalled(const std::string &bundleName, int32_t
MessageParcel reply;
if (!SendTransactCmd(BundleMgrInterfaceCode::IS_BUNDLE_INSTALLED, data, reply)) {
APP_LOGE("Fail to IsBundleInstalled from server");
return ERR_APPEXECFWK_PARCEL_ERROR;
return ERR_BUNDLE_MANAGER_IPC_TRANSACTION;
}
auto ret = reply.ReadInt32();
if (ret != ERR_OK) {

View File

@ -7406,6 +7406,7 @@ HWTEST_F(BmsBundleDataMgrTest, IsBundleInstalled_0001, Function | SmallTest | Le
auto bundleDataMgr = GetBundleDataMgr();
EXPECT_NE(bundleDataMgr, nullptr);
if (bundleDataMgr != nullptr) {
bundleDataMgr->AddUserId(0);
bool isInstalled = false;
ErrCode ret = bundleDataMgr->IsBundleInstalled(BUNDLE_NAME_TEST, 200, 0, isInstalled);
EXPECT_EQ(ret, ERR_BUNDLE_MANAGER_INVALID_USER_ID);
@ -7423,7 +7424,7 @@ HWTEST_F(BmsBundleDataMgrTest, IsBundleInstalled_0001, Function | SmallTest | Le
EXPECT_EQ(ret, ERR_OK);
EXPECT_FALSE(isInstalled);
ret = bundleDataMgr->IsBundleInstalled(BUNDLE_NAME_TEST, 0, Constants::ANY_USERID, isInstalled);
ret = bundleDataMgr->IsBundleInstalled(BUNDLE_NAME_TEST, Constants::ANY_USERID, 0, isInstalled);
EXPECT_EQ(ret, ERR_OK);
EXPECT_FALSE(isInstalled);
}
@ -7439,15 +7440,16 @@ HWTEST_F(BmsBundleDataMgrTest, IsBundleInstalled_0002, Function | SmallTest | Le
auto bundleDataMgr = GetBundleDataMgr();
EXPECT_NE(bundleDataMgr, nullptr);
if (bundleDataMgr != nullptr) {
bundleDataMgr->AddUserId(100);
InnerBundleInfo innerBundleInfo;
innerBundleInfo.baseApplicationInfo_->bundleType = BundleType::SHARED;
innerBundleInfo.baseApplicationInfo_->bundleName = BUNDLE_NAME_TEST;
bundleDataMgr->bundleInfos_.emplace(BUNDLE_NAME_TEST, innerBundleInfo);
bool isInstalled = false;
ErrCode ret = bundleDataMgr->IsBundleInstalled(BUNDLE_NAME_TEST, 100, 0, isInstalled);
EXPECT_EQ(ret, ERR_OK);
EXPECT_TRUE(isInstalled);
bundleDataMgr->AddUserId(100);
bundleDataMgr->bundleInfos_.clear();
innerBundleInfo.baseApplicationInfo_->bundleType = BundleType::APP;
bundleDataMgr->bundleInfos_.emplace(BUNDLE_NAME_TEST, innerBundleInfo);
@ -7504,11 +7506,11 @@ HWTEST_F(BmsBundleDataMgrTest, IsBundleInstalled_0004, Function | SmallTest | Le
bundleDataMgr->AddUserId(100);
InnerBundleInfo innerBundleInfo;
innerBundleInfo.baseApplicationInfo_->bundleType = BundleType::APP;
innerBundleInfo.baseApplicationInfo_->bundleName = BUNDLE_NAME_TEST;
InnerBundleUserInfo innerBundleUserInfo;
innerBundleInfo.innerBundleUserInfos_.emplace(BUNDLE_NAME_TEST + "_100", innerBundleUserInfo);
InnerBundleCloneInfo innerBundleCloneInfo;
innerBundleUserInfo.cloneInfos.emplace("1", innerBundleCloneInfo);
innerBundleInfo.innerBundleUserInfos_.emplace(BUNDLE_NAME_TEST + "_100", innerBundleUserInfo);
bundleDataMgr->bundleInfos_.emplace(BUNDLE_NAME_TEST, innerBundleInfo);
bool isInstalled = false;
auto ret = bundleDataMgr->IsBundleInstalled(BUNDLE_NAME_TEST, 100, 1, isInstalled);

View File

@ -13655,7 +13655,7 @@ HWTEST_F(BmsBundleKitServiceTest, IsBundleInstalled_0001, Function | SmallTest |
auto hostImpl = std::make_unique<BundleMgrHostImpl>();
bool isInstalled = false;
auto testRet = hostImpl->IsBundleInstalled(BUNDLE_NAME_TEST, DEFAULT_USERID, 0, isInstalled);
EXPECT_EQ(testRet, ERR_BUNDLE_MANAGER_PERMISSION_DENIED);
EXPECT_EQ(testRet, ERR_OK);
EXPECT_FALSE(isInstalled);
}
}

View File

@ -9623,7 +9623,7 @@ HWTEST_F(ActsBmsKitSystemTest, GetSignatureInfoByBundleName_0200, Function | Med
/**
* @tc.number: IsBundleInstalled_0001
* @tc.name: test IsBundleInstalled interface
* @tc.desc: 1.ret is no permission
* @tc.desc: 1. bundle not exist
*/
HWTEST_F(ActsBmsKitSystemTest, IsBundleInstalled_0001, Function | MediumTest | Level1)
{
@ -9634,7 +9634,7 @@ HWTEST_F(ActsBmsKitSystemTest, IsBundleInstalled_0001, Function | MediumTest | L
if (bundleMgrProxy != nullptr) {
bool isBundleInstalled = false;
ErrCode ret = bundleMgrProxy->IsBundleInstalled(DEFAULT_APP_BUNDLE_NAME, 0, 0, isBundleInstalled);
EXPECT_EQ(ret, ERR_BUNDLE_MANAGER_PERMISSION_DENIED);
EXPECT_EQ(ret, ERR_OK);
EXPECT_FALSE(isBundleInstalled);
}
@ -9644,7 +9644,7 @@ HWTEST_F(ActsBmsKitSystemTest, IsBundleInstalled_0001, Function | MediumTest | L
/**
* @tc.number: IsBundleInstalled_0002
* @tc.name: test IsBundleInstalled interface
* @tc.desc: 1. has permission
* @tc.desc: 1. bundle exist
*/
HWTEST_F(ActsBmsKitSystemTest, IsBundleInstalled_0002, Function | MediumTest | Level1)
{
@ -9661,7 +9661,6 @@ HWTEST_F(ActsBmsKitSystemTest, IsBundleInstalled_0002, Function | MediumTest | L
sptr<BundleMgrProxy> bundleMgrProxy = GetBundleMgrProxy();
EXPECT_NE(bundleMgrProxy, nullptr);
if (bundleMgrProxy != nullptr) {
setuid(5523);
bool isBundleInstalled = false;
ErrCode ret = bundleMgrProxy->IsBundleInstalled(appName, 200, 0, isBundleInstalled);
EXPECT_EQ(ret, ERR_BUNDLE_MANAGER_INVALID_USER_ID);
@ -9671,6 +9670,7 @@ HWTEST_F(ActsBmsKitSystemTest, IsBundleInstalled_0002, Function | MediumTest | L
EXPECT_EQ(ret, ERR_OK);
EXPECT_TRUE(isBundleInstalled);
isBundleInstalled = false;
ret = bundleMgrProxy->IsBundleInstalled(appName, 100, 3000, isBundleInstalled);
EXPECT_EQ(ret, ERR_APPEXECFWK_CLONE_INSTALL_INVALID_APP_INDEX);
EXPECT_FALSE(isBundleInstalled);
@ -9682,8 +9682,6 @@ HWTEST_F(ActsBmsKitSystemTest, IsBundleInstalled_0002, Function | MediumTest | L
ret = bundleMgrProxy->IsBundleInstalled(appName, 100, 1, isBundleInstalled);
EXPECT_EQ(ret, ERR_OK);
EXPECT_FALSE(isBundleInstalled);
setuid(Constants::ROOT_UID);
}
resvec.clear();
Uninstall(appName, resvec);