From 2cf45f0a29c37df9e5edb015887d38c41e19f144 Mon Sep 17 00:00:00 2001 From: zhuxu Date: Thu, 31 Aug 2023 15:06:54 +0800 Subject: [PATCH] qos bugfix Signed-off-by: zhuxu --- .../src/concurrent_task_service_proxy.cpp | 4 ++-- interfaces/inner_api/qos.h | 1 + qos/qos.cpp | 4 ++-- services/src/concurrent_task_service_stub.cpp | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp b/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp index ae88636..a794d7f 100644 --- a/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp +++ b/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp @@ -69,8 +69,8 @@ void ConcurrentTaskServiceProxy::QueryInterval(int queryItem, IntervalReply& que queryRs.paramA = -1; queryRs.paramB = -1; - if (!data.ReadInt32(queryRs.rtgId) || !data.WriteInt32(queryRs.tid) - || !data.ReadInt32(queryRs.paramA) || !data.WriteInt32(queryRs.paramB)) { + if (!reply.ReadInt32(queryRs.rtgId) || !reply.WriteInt32(queryRs.tid) + || !reply.ReadInt32(queryRs.paramA) || !reply.WriteInt32(queryRs.paramB)) { CONCUR_LOGE("Read info failed in QueryInterval Proxy"); return; } diff --git a/interfaces/inner_api/qos.h b/interfaces/inner_api/qos.h index 84f2d5e..70cda22 100644 --- a/interfaces/inner_api/qos.h +++ b/interfaces/inner_api/qos.h @@ -23,6 +23,7 @@ enum class QosLevel { QOS_UTILITY, QOS_DEFAULT, QOS_USER_INITIATED, + QOS_MAX, }; class QosController { diff --git a/qos/qos.cpp b/qos/qos.cpp index ae2ceff..0fd92ca 100644 --- a/qos/qos.cpp +++ b/qos/qos.cpp @@ -20,7 +20,7 @@ #include "qos.h" using namespace OHOS::ConcurrentTask; -constexpr int ERROR_NUM = -1; +static constexpr int ERROR_NUM = -1; namespace OHOS { namespace QOS { @@ -33,7 +33,7 @@ QosController& QosController::GetInstance() int QosController::SetThreadQosForOtherThread(enum QosLevel level, int tid) { int qos = static_cast(level); - if (level < QosLevel::QOS_BACKGROUND || level > QosLevel::QOS_USER_INITIATED) { + if (level < QosLevel::QOS_BACKGROUND || level >= QosLevel::QOS_MAX) { CONCUR_LOGE("[Qos] invalid qos level %{public}d", qos); return ERROR_NUM; } diff --git a/services/src/concurrent_task_service_stub.cpp b/services/src/concurrent_task_service_stub.cpp index 71e49c5..2e8dacc 100644 --- a/services/src/concurrent_task_service_stub.cpp +++ b/services/src/concurrent_task_service_stub.cpp @@ -76,8 +76,8 @@ int32_t ConcurrentTaskServiceStub::QueryIntervalInner(MessageParcel& data, [[may return IPC_STUB_ERR; } QueryInterval(item, queryRs); - if (!data.WriteInt32(queryRs.rtgId) || !data.WriteInt32(queryRs.tid) - || !data.WriteInt32(queryRs.paramA) || !data.WriteInt32(queryRs.paramB)) { + if (!reply.WriteInt32(queryRs.rtgId) || !reply.WriteInt32(queryRs.tid) + || !reply.WriteInt32(queryRs.paramA) || !reply.WriteInt32(queryRs.paramB)) { CONCUR_LOGE("Write info failed in QueryInterval Stub"); return IPC_STUB_ERR; } -- Gitee