}
case ci::RequestMode::USER: {
// if package is globally installed, leave directories
- if (ci::QueryIsPackageInstalled(pkgid, GLOBAL_USER))
+ ci::PkgQueryInterface pkg_query(pkgid, GLOBAL_USER);
+ if (pkg_query.IsPackageInstalled())
return true;
LOG(DEBUG) << "Removing external directories for user: " << uid;
ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
ASSERT_EQ(DisablePackage(pkgid), ci::AppInstaller::Result::OK);
ASSERT_EQ(EnablePackage(pkgid), ci::AppInstaller::Result::OK);
- ASSERT_TRUE(ci::QueryIsPackageInstalled(pkgid, ci::GetRequestMode(
- kTestUserId),
- kTestUserId));
+ ci::PkgQueryInterface pkg_query(pkgid, kTestUserId);
+ ASSERT_TRUE(pkg_query.IsPackageInstalled(ci::GetRequestMode(kTestUserId)));
}
TEST_F(SmokeTest, DisablePkg) {
bf::path pkg_path = ci::GetRootAppPath(false, kTestUserId);
CopyDir(src_path / pkgid, pkg_path / pkgid);
- ASSERT_FALSE(QueryIsPackageInstalled(pkgid, ci::GetRequestMode(kTestUserId),
- kTestUserId));
+ ci::PkgQueryInterface pkg_query(pkgid, kTestUserId);
+ ASSERT_FALSE(pkg_query.IsPackageInstalled(ci::GetRequestMode(kTestUserId)));
ASSERT_EQ(ManifestDirectInstall(pkgid), ci::AppInstaller::Result::OK);
ValidatePackage(pkgid, {appid});
}
bool ValidatePackage(const std::string& pkgid, const std::string& appid,
bool is_readonly) {
- EXTENDED_ASSERT_TRUE(ci::QueryIsPackageInstalled(
- pkgid, ci::GetRequestMode(kTestUserId), kTestUserId));
+ ci::PkgQueryInterface pkg_query(pkgid, kTestUserId);
+ EXTENDED_ASSERT_TRUE(pkg_query.IsPackageInstalled(
+ ci::GetRequestMode(kTestUserId)));
EXTENDED_ASSERT_TRUE(ValidatePackageFS(pkgid, appid, kTestUserId,
kTestGroupId, is_readonly));
if (kTestUserId == kGlobalUserUid) {
bool ValidateExternalPackage(const std::string& pkgid,
const std::string& appid) {
- std::string storage = ci::QueryStorageForPkgId(pkgid, kTestUserId);
+ ci::PkgQueryInterface pkg_query(pkgid, kTestUserId);
+ std::string storage = pkg_query.StorageForPkgId();
bf::path ext_mount_path = ci::GetExternalCardPath();
if (bf::is_empty(ext_mount_path)) {
LOG(INFO) << "Sdcard not exists!";
bool CheckPackageNonExistance(const std::string& pkgid,
const std::string& appid,
bool is_readonly) {
- EXTENDED_ASSERT_FALSE(ci::QueryIsPackageInstalled(
- pkgid, ci::GetRequestMode(kTestUserId), kTestUserId));
+ ci::PkgQueryInterface pkg_query(pkgid, kTestUserId);
+ EXTENDED_ASSERT_FALSE(pkg_query.IsPackageInstalled(
+ ci::GetRequestMode(kTestUserId)));
EXTENDED_ASSERT_TRUE(PackageCheckCleanup(pkgid, appid, is_readonly));
if (kTestUserId == kGlobalUserUid) {
bf::path skel_path(kSkelDir);