From 1283656edbcf9b9c1e11a4b5fef47ca4810e6ee0 Mon Sep 17 00:00:00 2001 From: zuojiangjiang Date: Fri, 19 Nov 2021 14:50:32 +0800 Subject: [PATCH 1/2] fix uninstaller/uninstaller_impl.cpp commonEvent,modify the parameter in the comment subscribe. Signed-off-by: zuojiangjiang --- .../app/src/kvstore_data_service.cpp | 7 +++++-- .../app/src/uninstaller/uninstaller_impl.cpp | 10 +++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/services/distributeddataservice/app/src/kvstore_data_service.cpp b/services/distributeddataservice/app/src/kvstore_data_service.cpp index 70a3feaed..dc68b2b44 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 21af99766..a12e49682 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) { -- Gitee From 841bbba6ff49777acc51dfaafcdb2f480da78b61 Mon Sep 17 00:00:00 2001 From: zuojiangjiang Date: Fri, 19 Nov 2021 15:36:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E6=BB=A1=E8=B6=B3=E7=BC=96=E7=A8=8B=E8=A7=84?= =?UTF-8?q?=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zuojiangjiang --- .../distributeddataservice/app/src/kvstore_data_service.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/distributeddataservice/app/src/kvstore_data_service.cpp b/services/distributeddataservice/app/src/kvstore_data_service.cpp index dc68b2b44..05b09a0be 100644 --- a/services/distributeddataservice/app/src/kvstore_data_service.cpp +++ b/services/distributeddataservice/app/src/kvstore_data_service.cpp @@ -330,12 +330,12 @@ Status KvStoreDataService::GetSecretKey(const Options &options, const GetKvStore if (kvParas.funType == KvStoreType::MULTI_VERSION) { metaSecretKey = KvStoreMetaManager::GetMetaKey(deviceAccountId, "default", bundleName, storeIdTmp, "KEY"); secretKeyFile = KvStoreMetaManager::GetSecretKeyFile( - deviceAccountId, bundleName, storeIdTmp, options.securityLevel); + deviceAccountId, bundleName, storeIdTmp, options.securityLevel); } else { metaSecretKey = KvStoreMetaManager::GetMetaKey(deviceAccountId, "default", bundleName, storeIdTmp, "SINGLE_KEY"); secretKeyFile = KvStoreMetaManager::GetSecretSingleKeyFile( - deviceAccountId, bundleName, storeIdTmp, options.securityLevel); + deviceAccountId, bundleName, storeIdTmp, options.securityLevel); } bool outdated = false; -- Gitee