From 2a5c779a4379771a6b9648e3d7da89cc31fa627f Mon Sep 17 00:00:00 2001 From: Axi_Beft Date: Fri, 30 May 2025 00:01:01 +0800 Subject: [PATCH] data_share add is_emulator Signed-off-by: Axi_Beft --- .../distributeddataservice/service/data_share/BUILD.gn | 3 +++ .../service/data_share/data_share_service_stub.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/services/distributeddataservice/service/data_share/BUILD.gn b/services/distributeddataservice/service/data_share/BUILD.gn index 087ff05e1..b687c8bdc 100644 --- a/services/distributeddataservice/service/data_share/BUILD.gn +++ b/services/distributeddataservice/service/data_share/BUILD.gn @@ -33,6 +33,9 @@ config("module_public_config") { "../crypto/include", "../permission/include", ] + if (is_emulator) { + defines = [ "IS_EMULATOR" ] + } } group("build_module") { deps = [ ":data_share_service" ] diff --git a/services/distributeddataservice/service/data_share/data_share_service_stub.cpp b/services/distributeddataservice/service/data_share/data_share_service_stub.cpp index 170de1bcb..f9ef5f7dc 100644 --- a/services/distributeddataservice/service/data_share/data_share_service_stub.cpp +++ b/services/distributeddataservice/service/data_share/data_share_service_stub.cpp @@ -36,12 +36,16 @@ class DataShareServiceStub::QosManager { public: QosManager() { +#ifndef IS_EMULATOR // set thread qos QOS_USER_INTERACTIVE QOS::SetThreadQos(QOS::QosLevel::QOS_USER_INTERACTIVE); +#endif } ~QosManager() { +#ifndef IS_EMULATOR QOS::ResetThreadQos(); +#endif } }; @@ -351,9 +355,6 @@ int DataShareServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Me { // set thread qos DataShareServiceStub::QosManager qos; - // check thread qos - QOS::QosLevel curLevel; - int qosRet = QOS::GetThreadQos(curLevel); int tryTimes = TRY_TIMES; while (!isReady_.load() && tryTimes > 0) { @@ -373,8 +374,7 @@ int DataShareServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Me code = code - DATA_SHARE_CMD_SYSTEM_CODE; } if (code != DATA_SHARE_SERVICE_CMD_QUERY && code != DATA_SHARE_SERVICE_CMD_GET_SILENT_PROXY_STATUS) { - ZLOGI("code:%{public}u, callingPid:%{public}d, qosRet:%{public}d, curLevel:%{public}d", - code, callingPid, qosRet, curLevel); + ZLOGI("code:%{public}u, callingPid:%{public}d", code, callingPid); } if (!CheckInterfaceToken(data)) { DataShareThreadLocal::CleanFromSystemApp(); -- Gitee