diff --git a/services/distributeddataservice/app/src/kvstore_data_service.cpp b/services/distributeddataservice/app/src/kvstore_data_service.cpp index 70a3feaed3070ec9a5b1c5f845e021272b434df1..05b09a0be6475e00b3569cf3cbdad09208cee039 100644 --- a/services/distributeddataservice/app/src/kvstore_data_service.cpp +++ b/services/distributeddataservice/app/src/kvstore_data_service.cpp @@ -326,15 +326,18 @@ Status KvStoreDataService::GetSecretKey(const Options &options, const GetKvStore &secretKey, [](std::vector *ptr) { ptr->assign(ptr->size(), 0); }); std::vector metaSecretKey; + std::string secretKeyFile; if (kvParas.funType == KvStoreType::MULTI_VERSION) { metaSecretKey = KvStoreMetaManager::GetMetaKey(deviceAccountId, "default", bundleName, storeIdTmp, "KEY"); + secretKeyFile = KvStoreMetaManager::GetSecretKeyFile( + deviceAccountId, bundleName, storeIdTmp, options.securityLevel); } else { metaSecretKey = KvStoreMetaManager::GetMetaKey(deviceAccountId, "default", bundleName, storeIdTmp, "SINGLE_KEY"); + secretKeyFile = KvStoreMetaManager::GetSecretSingleKeyFile( + deviceAccountId, bundleName, storeIdTmp, options.securityLevel); } - auto secretKeyFile = KvStoreMetaManager::GetSecretKeyFile( - deviceAccountId, bundleName, storeIdTmp, options.securityLevel); bool outdated = false; Status alreadyCreated = KvStoreMetaManager::GetInstance().CheckUpdateServiceMeta(metaSecretKey, CHECK_EXIST_LOCAL); if (options.encrypt) { diff --git a/services/distributeddataservice/app/src/uninstaller/uninstaller_impl.cpp b/services/distributeddataservice/app/src/uninstaller/uninstaller_impl.cpp index 21af997669700bd8cc2608dcff3c5c9f25665202..a12e49682ac6f8e7b7849bf3b88d4262c4f03b58 100755 --- a/services/distributeddataservice/app/src/uninstaller/uninstaller_impl.cpp +++ b/services/distributeddataservice/app/src/uninstaller/uninstaller_impl.cpp @@ -28,6 +28,7 @@ namespace OHOS::DistributedKv { using namespace OHOS::EventFwk; using namespace OHOS::AAFwk; +using namespace OHOS::AppExecFwk; const std::string UninstallEventSubscriber::USER_ID = "userId"; const std::string PACKAGE_SCHEME = "package"; const std::string SCHEME_SPLIT = ":"; @@ -60,12 +61,8 @@ void UninstallEventSubscriber::OnReceiveEvent(const CommonEventData &event) } } - auto uri = want.GetUri().ToString(); - if (uri.size() < (PACKAGE_SCHEME.size() + SCHEME_SPLIT.size())) { - ZLOGW("invalid intent Uri!"); - return; - } - std::string bundleName = uri.substr(PACKAGE_SCHEME.size() + SCHEME_SPLIT.size()); + ElementName elementName = want.GetElement(); + std::string bundleName = elementName.GetBundleName(); ZLOGI("bundleName is %s", bundleName.c_str()); int userId = want.GetIntParam(USER_ID, -1); @@ -87,7 +84,6 @@ Status UninstallerImpl::Init(KvStoreDataService *kvStoreDataService) return Status::INVALID_ARGUMENT; } MatchingSkills matchingSkills; - matchingSkills.AddScheme(PACKAGE_SCHEME); matchingSkills.AddEvent(CommonEventSupport::COMMON_EVENT_PACKAGE_REMOVED); CommonEventSubscribeInfo info(matchingSkills); auto callback = [kvStoreDataService](const std::string &bundleName, int userId) {