From c24a49f9902b8580513e5f79f25651406aee67aa Mon Sep 17 00:00:00 2001 From: zuojiangjiang Date: Thu, 19 May 2022 11:23:20 +0800 Subject: [PATCH 1/2] fix exit error Signed-off-by: zuojiangjiang --- .../app/src/kvstore_data_service.cpp | 10 ++++++++++ services/distributeddataservice/app/test/BUILD.gn | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/services/distributeddataservice/app/src/kvstore_data_service.cpp b/services/distributeddataservice/app/src/kvstore_data_service.cpp index 978953627..5535df3b2 100644 --- a/services/distributeddataservice/app/src/kvstore_data_service.cpp +++ b/services/distributeddataservice/app/src/kvstore_data_service.cpp @@ -25,6 +25,7 @@ #include #include +#include "accesstoken_kit.h" #include "auth_delegate.h" #include "auto_launch_export.h" #include "bootstrap.h" @@ -35,6 +36,7 @@ #include "dds_trace.h" #include "device_kvstore_impl.h" #include "executor_factory.h" +#include "hap_token_info.h" #include "if_system_ability_manager.h" #include "iservice_registry.h" #include "kvstore_account_observer.h" @@ -650,6 +652,14 @@ Status KvStoreDataService::AppExit(const AppId &appId, pid_t uid, uint32_t token // memory of parameter appId locates in a member of clientDeathObserverMap_ and will be freed after // clientDeathObserverMap_ erase, so we have to take a copy if we want to use this parameter after erase operation. AppId appIdTmp = appId; + + if (appId.appId == "com.ohos.medialibrary.MediaLibraryDataA") { + HapTokenInfo tokenInfo; + AccessTokenKit::GetHapTokenInfo(token, tokenInfo); + ZLOGI("not close bundle:%{public}s, tokenInfo.bundle:%{public}s, uid:%{public}d, token:%{public}u", + appId.appId.c_str(), tokenInfo.bundleName.c_str(), uid, token); + return Status::SUCCESS; + } std::lock_guard lg(clientDeathObserverMutex_); clientDeathObserverMap_.erase(token); diff --git a/services/distributeddataservice/app/test/BUILD.gn b/services/distributeddataservice/app/test/BUILD.gn index fc20044f2..298cda146 100644 --- a/services/distributeddataservice/app/test/BUILD.gn +++ b/services/distributeddataservice/app/test/BUILD.gn @@ -87,6 +87,7 @@ ohos_unittest("KvStoreImplLogicalIsolationTest") { configs = [ ":module_private_config" ] external_deps = [ + "access_token:libaccesstoken_sdk", "dataclassification:data_transit_mgr", "deviceauth_standard:deviceauth_sdk", "hiviewdfx_hilog_native:libhilog", @@ -152,6 +153,7 @@ ohos_unittest("KvStoreImplPhysicalIsolationTest") { configs = [ ":module_private_config" ] external_deps = [ + "access_token:libaccesstoken_sdk", "dataclassification:data_transit_mgr", "deviceauth_standard:deviceauth_sdk", "hiviewdfx_hilog_native:libhilog", @@ -217,6 +219,7 @@ ohos_unittest("KvStoreDataServiceTest") { configs = [ ":module_private_config" ] external_deps = [ + "access_token:libaccesstoken_sdk", "dataclassification:data_transit_mgr", "deviceauth_standard:deviceauth_sdk", "hiviewdfx_hilog_native:libhilog", @@ -284,6 +287,7 @@ ohos_unittest("KvStoreBackupTest") { configs = [ ":module_private_config" ] external_deps = [ + "access_token:libaccesstoken_sdk", "dataclassification:data_transit_mgr", "deviceauth_standard:deviceauth_sdk", "hiviewdfx_hilog_native:libhilog", @@ -325,6 +329,7 @@ ohos_unittest("KvStoreFlowCtrlManagerTest") { configs = [ ":module_private_config" ] external_deps = [ + "access_token:libaccesstoken_sdk", "dataclassification:data_transit_mgr", "deviceauth_standard:deviceauth_sdk", "hiviewdfx_hilog_native:libhilog", @@ -384,6 +389,7 @@ ohos_unittest("KvStoreSyncManagerTest") { configs = [ ":module_private_config" ] external_deps = [ + "access_token:libaccesstoken_sdk", "dataclassification:data_transit_mgr", "deviceauth_standard:deviceauth_sdk", "hiviewdfx_hilog_native:libhilog", @@ -466,6 +472,7 @@ ohos_unittest("KvStoreUninstallerTest") { external_deps = [ "ability_base:base", "ability_base:want", + "access_token:libaccesstoken_sdk", "dataclassification:data_transit_mgr", "deviceauth_standard:deviceauth_sdk", "hiviewdfx_hilog_native:libhilog", -- Gitee From e6b8c239cb85fb22c06e0a8644d8f577f85d8962 Mon Sep 17 00:00:00 2001 From: zuojiangjiang Date: Thu, 19 May 2022 11:40:57 +0800 Subject: [PATCH 2/2] fix error Signed-off-by: zuojiangjiang --- services/distributeddataservice/app/src/kvstore_data_service.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/distributeddataservice/app/src/kvstore_data_service.cpp b/services/distributeddataservice/app/src/kvstore_data_service.cpp index 5535df3b2..e9ef6ca75 100644 --- a/services/distributeddataservice/app/src/kvstore_data_service.cpp +++ b/services/distributeddataservice/app/src/kvstore_data_service.cpp @@ -63,6 +63,7 @@ namespace OHOS::DistributedKv { using json = nlohmann::json; using namespace std::chrono; using namespace OHOS::DistributedData; +using namespace Security::AccessToken; using KvStoreDelegateManager = DistributedDB::KvStoreDelegateManager; REGISTER_SYSTEM_ABILITY_BY_ID(KvStoreDataService, DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID, true); -- Gitee