From 183e12e9b3481c4df0c62c15f12eb45921772a49 Mon Sep 17 00:00:00 2001 From: edwardcaoyue Date: Fri, 18 Aug 2023 10:16:08 +0800 Subject: [PATCH 1/3] add param set Signed-off-by: edwardcaoyue --- etc/param/BUILD.gn | 35 +++++++++++++++++++++++++++++++++++ etc/param/ffrt.para | 18 ++++++++++++++++++ etc/param/ffrt.para.dac | 18 ++++++++++++++++++ services/BUILD.gn | 5 ++++- 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 etc/param/BUILD.gn create mode 100644 etc/param/ffrt.para create mode 100644 etc/param/ffrt.para.dac diff --git a/etc/param/BUILD.gn b/etc/param/BUILD.gn new file mode 100644 index 0000000..d4856ff --- /dev/null +++ b/etc/param/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") + +group("ffrt_etc") { + deps = [ + ":ffrt.para", + ":ffrt.para.dac", + ] +} + +ohos_prebuilt_etc("ffrt.para") { + source = "ffrt.para" + relative_install_dir = "param" + part_name = "qos_manager" + subsystem_name = "resourceschedule" +} + +ohos_prebuilt_etc("ffrt.para.dac") { + source = "ffrt.para.dac" + relative_install_dir = "param" + part_name = "qos_manager" + subsystem_name = "resourceschedule" +} diff --git a/etc/param/ffrt.para b/etc/param/ffrt.para new file mode 100644 index 0000000..dfc1ee8 --- /dev/null +++ b/etc/param/ffrt.para @@ -0,0 +1,18 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ffrt.interval.ui=false +ffrt.interval.renderthread=true +ffrt.interval.renderservice=false +ffrt.interval.slide=false +ffrt.interval.limit=false \ No newline at end of file diff --git a/etc/param/ffrt.para.dac b/etc/param/ffrt.para.dac new file mode 100644 index 0000000..54d66a1 --- /dev/null +++ b/etc/param/ffrt.para.dac @@ -0,0 +1,18 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ffrt.interval.ui = system:system:0664 +ffrt.interval.renderthread = system:system:0664 +ffrt.interval.renderservice = system:system:0664 +ffrt.interval.slide = system:system:0664 +ffrt.interval.limit = system:system:0664 diff --git a/services/BUILD.gn b/services/BUILD.gn index ac88952..d80dd77 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -40,7 +40,10 @@ ohos_shared_library("concurrentsvc") { "src/qos_manager.cpp", ] - deps = [ "//third_party/jsoncpp:jsoncpp" ] + deps = [ + "//third_party/jsoncpp:jsoncpp", + "../etc/param:ffrt_etc", + ] external_deps = [ "c_utils:utils", -- Gitee From 7690bd7ae21ba7b379db719fce104ac14cd2413f Mon Sep 17 00:00:00 2001 From: edwardcaoyue Date: Fri, 18 Aug 2023 14:15:48 +0800 Subject: [PATCH 2/3] new ipc header Signed-off-by: edwardcaoyue --- .../src/concurrent_task_service_proxy.cpp | 41 +++++------------- include/ipc_util.h | 43 +++++++++++++++++++ services/BUILD.gn | 2 +- services/src/concurrent_task_service_stub.cpp | 34 +++++---------- 4 files changed, 65 insertions(+), 55 deletions(-) create mode 100644 include/ipc_util.h 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 4ae78b9..dfbff5a 100644 --- a/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp +++ b/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp @@ -16,6 +16,7 @@ #include "concurrent_task_service_proxy.h" #include "concurrent_task_log.h" #include "concurrent_task_errors.h" +#include "ipc_util.h" namespace OHOS { namespace ConcurrentTask { @@ -25,18 +26,10 @@ void ConcurrentTaskServiceProxy::ReportData(uint32_t resType, int64_t value, con MessageParcel data; MessageParcel reply; MessageOption option = { MessageOption::TF_ASYNC }; - if (!data.WriteInterfaceToken(ConcurrentTaskServiceProxy::GetDescriptor())) { - return; - } - if (!data.WriteUint32(resType)) { - return; - } - if (!data.WriteInt64(value)) { - return; - } - if (!data.WriteString(payload.toStyledString())) { - return; - } + WRITE_PARCEL(data, InterfaceToken, ConcurrentTaskServiceProxy::GetDescriptor(), , ConcurrentTaskServiceProxy); + WRITE_PARCEL(data, Uint32, resType, , ConcurrentTaskServiceProxy); + WRITE_PARCEL(data, Int64, value, , ConcurrentTaskServiceProxy); + WRITE_PARCEL(data, String, payload.toStyledString(), , ConcurrentTaskServiceProxy); uint32_t code = static_cast(ConcurrentTaskInterfaceCode::REPORT_DATA); error = Remote()->SendRequest(code, data, reply, option); if (error != NO_ERROR) { @@ -56,12 +49,8 @@ void ConcurrentTaskServiceProxy::QueryInterval(int queryItem, IntervalReply& que queryRs.paramA = -1; queryRs.paramB = -1; queryRs.paramC = -1; - if (!data.WriteInterfaceToken(ConcurrentTaskServiceProxy::GetDescriptor())) { - return; - } - if (!data.WriteInt64(queryItem)) { - return; - } + WRITE_PARCEL(data, InterfaceToken, ConcurrentTaskServiceProxy::GetDescriptor(), , ConcurrentTaskServiceProxy); + WRITE_PARCEL(data, Int64, queryItem, , ConcurrentTaskServiceProxy); uint32_t code = static_cast(ConcurrentTaskInterfaceCode::QUERY_INTERVAL); error = Remote()->SendRequest(code, data, reply, option); @@ -69,18 +58,10 @@ void ConcurrentTaskServiceProxy::QueryInterval(int queryItem, IntervalReply& que CONCUR_LOGE("QueryInterval error: %{public}d", error); return; } - if (!reply.ReadInt32(queryRs.rtgId)) { - return; - } - if (!reply.ReadInt32(queryRs.paramA)) { - return; - } - if (!reply.ReadInt32(queryRs.paramB)) { - return; - } - if (!reply.ReadInt32(queryRs.paramC)) { - return; - } + READ_PARCEL(reply, Int32, queryRs.rtgId, , ConcurrentTaskServiceProxy); + READ_PARCEL(reply, Int32, queryRs.paramA, , ConcurrentTaskServiceProxy); + READ_PARCEL(reply, Int32, queryRs.paramB, , ConcurrentTaskServiceProxy); + READ_PARCEL(reply, Int32, queryRs.paramC, , ConcurrentTaskServiceProxy); return; } } // namespace ConcurrentTask diff --git a/include/ipc_util.h b/include/ipc_util.h new file mode 100644 index 0000000..4f22642 --- /dev/null +++ b/include/ipc_util.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CONCURRENT_TASK_COMMON_INCLUDE_IPC_UTIL_H +#define CONCURRENT_TASK_COMMON_INCLUDE_IPC_UTIL_H + +#include "concurrent_task_log.h" + +namespace OHOS { +namespace ConcurrentTask { + +#define READ_PARCEL(parcel, type, out, errReturn, className) \ + do { \ + if (!(parcel).Read##type(out)) { \ + CONCUR_LOGE(""#className"::%{public}s read"#out" failed", __func__); \ + return errReturn; \ + } \ + } while (0) \ + +#define WRITE_PARCEL(parcel, type, in, errReturn, className) \ + do { \ + if (!(parcel).Write##type(in)) { \ + CONCUR_LOGE(""#className"::%{public}s write"#in" failed", __func__); \ + return errReturn; \ + } \ + } while (0) + +} // namespace ConcurrentTask +} // namespace OHOS + +#endif // CONCURRENT_TASK_COMMON_INCLUDE_IPC_UTIL_H diff --git a/services/BUILD.gn b/services/BUILD.gn index d80dd77..3b7adca 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -41,8 +41,8 @@ ohos_shared_library("concurrentsvc") { ] deps = [ - "//third_party/jsoncpp:jsoncpp", "../etc/param:ffrt_etc", + "//third_party/jsoncpp:jsoncpp", ] external_deps = [ diff --git a/services/src/concurrent_task_service_stub.cpp b/services/src/concurrent_task_service_stub.cpp index 1cc9427..e9e255b 100644 --- a/services/src/concurrent_task_service_stub.cpp +++ b/services/src/concurrent_task_service_stub.cpp @@ -18,6 +18,7 @@ #include "concurrent_task_errors.h" #include "string_ex.h" #include "ipc_skeleton.h" +#include "ipc_util.h" namespace OHOS { namespace ConcurrentTask { @@ -46,19 +47,14 @@ int32_t ConcurrentTaskServiceStub::ReportDataInner(MessageParcel& data, [[maybe_ return ERR_CONCURRENT_TASK_PARCEL_ERROR; } uint32_t type = 0; - if (!data.ReadUint32(type)) { - return ERR_CONCURRENT_TASK_PARCEL_ERROR; - } + READ_PARCEL(data, Uint32, type, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); int64_t value = 0; - if (!data.ReadInt64(value)) { - return ERR_CONCURRENT_TASK_PARCEL_ERROR; - } + READ_PARCEL(data, Int64, value, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); std::string payload; - if (!data.ReadString(payload)) { - return ERR_CONCURRENT_TASK_PARCEL_ERROR; - } + READ_PARCEL(data, String, payload, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); + if (payload.empty()) { return ERR_OK; } @@ -72,27 +68,17 @@ int32_t ConcurrentTaskServiceStub::QueryIntervalInner(MessageParcel& data, [[may return ERR_CONCURRENT_TASK_PARCEL_ERROR; } int item; - if (!data.ReadInt32(item)) { - return ERR_CONCURRENT_TASK_PARCEL_ERROR; - } + READ_PARCEL(data, Int32, item, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); IntervalReply queryRs; queryRs.rtgId = -1; queryRs.paramA = -1; queryRs.paramB = -1; queryRs.paramC = -1; QueryInterval(item, queryRs); - if (!reply.WriteInt32(queryRs.rtgId)) { - return ERR_CONCURRENT_TASK_PARCEL_ERROR; - } - if (!reply.WriteInt32(queryRs.paramA)) { - return ERR_CONCURRENT_TASK_PARCEL_ERROR; - } - if (!reply.WriteInt32(queryRs.paramB)) { - return ERR_CONCURRENT_TASK_PARCEL_ERROR; - } - if (!reply.WriteInt32(queryRs.paramC)) { - return ERR_CONCURRENT_TASK_PARCEL_ERROR; - } + WRITE_PARCEL(reply, Int32, queryRs.rtgId, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); + WRITE_PARCEL(reply, Int32, queryRs.paramA, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); + WRITE_PARCEL(reply, Int32, queryRs.paramB, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); + WRITE_PARCEL(reply, Int32, queryRs.paramC, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); return ERR_OK; } -- Gitee From d6fc00f64894b74a018894be5a752256beab9572 Mon Sep 17 00:00:00 2001 From: edwardcaoyue Date: Sat, 19 Aug 2023 16:26:19 +0800 Subject: [PATCH 3/3] sync code Signed-off-by: edwardcaoyue --- bundle.json | 3 +- ...ncurrent_task_service_ipc_interface_code.h | 12 +-- .../include/concurrent_task_type.h | 2 +- .../src/concurrent_task_service_proxy.cpp | 42 +++++--- include/ipc_util.h | 43 --------- services/BUILD.gn | 6 ++ services/include/concurrent_task_controller.h | 8 +- services/include/qos_interface.h | 56 +++++++---- services/src/concurrent_task_controller.cpp | 95 +++++++++++++------ services/src/concurrent_task_service_stub.cpp | 28 +++--- services/src/qos_interface.cpp | 4 +- services/src/qos_manager.cpp | 29 ++++-- .../phone/concurrent_task_controller_test.cpp | 38 ++++---- test/unittest/phone/qos_interface_test.cpp | 2 +- 14 files changed, 207 insertions(+), 161 deletions(-) delete mode 100644 include/ipc_util.h diff --git a/bundle.json b/bundle.json index 62241f7..6f6da47 100644 --- a/bundle.json +++ b/bundle.json @@ -15,8 +15,6 @@ "syscap": [], "features": [], "adapted_system_type": [ - "mini", - "small", "standard" ], "rom": "2048KB", @@ -30,6 +28,7 @@ "frame_aware_sched", "hilog", "hitrace", + "init", "ipc", "safwk", "samgr" diff --git a/frameworks/concurrent_task_client/include/concurrent_task_service_ipc_interface_code.h b/frameworks/concurrent_task_client/include/concurrent_task_service_ipc_interface_code.h index 2ec5618..ace5b72 100644 --- a/frameworks/concurrent_task_client/include/concurrent_task_service_ipc_interface_code.h +++ b/frameworks/concurrent_task_client/include/concurrent_task_service_ipc_interface_code.h @@ -16,17 +16,13 @@ #ifndef CONCURRENT_TASK_SERVICES_IPC_INTERFACE_CODE_H #define CONCURRENT_TASK_SERVICES_IPC_INTERFACE_CODE_H -#include "iremote_broker.h" -#include "json/json.h" -#include "concurrent_task_type.h" - /* SAID:1912 */ namespace OHOS { namespace ConcurrentTask { - enum class ConcurrentTaskInterfaceCode { - REPORT_DATA = 1, - QUERY_INTERVAL = 2, - }; +enum class ConcurrentTaskInterfaceCode { + REPORT_DATA = 1, + QUERY_INTERVAL = 2, +}; } // namespace ConcurrentTask } // namespace OHOS diff --git a/frameworks/concurrent_task_client/include/concurrent_task_type.h b/frameworks/concurrent_task_client/include/concurrent_task_type.h index 70d5105..b95fbc8 100644 --- a/frameworks/concurrent_task_client/include/concurrent_task_type.h +++ b/frameworks/concurrent_task_client/include/concurrent_task_type.h @@ -49,9 +49,9 @@ enum QueryIntervalItem { struct IntervalReply { int rtgId; + int tid; int paramA; int paramB; - int paramC; }; } } 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 dfbff5a..ae88636 100644 --- a/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp +++ b/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp @@ -16,7 +16,6 @@ #include "concurrent_task_service_proxy.h" #include "concurrent_task_log.h" #include "concurrent_task_errors.h" -#include "ipc_util.h" namespace OHOS { namespace ConcurrentTask { @@ -26,10 +25,14 @@ void ConcurrentTaskServiceProxy::ReportData(uint32_t resType, int64_t value, con MessageParcel data; MessageParcel reply; MessageOption option = { MessageOption::TF_ASYNC }; - WRITE_PARCEL(data, InterfaceToken, ConcurrentTaskServiceProxy::GetDescriptor(), , ConcurrentTaskServiceProxy); - WRITE_PARCEL(data, Uint32, resType, , ConcurrentTaskServiceProxy); - WRITE_PARCEL(data, Int64, value, , ConcurrentTaskServiceProxy); - WRITE_PARCEL(data, String, payload.toStyledString(), , ConcurrentTaskServiceProxy); + if (!data.WriteInterfaceToken(ConcurrentTaskServiceProxy::GetDescriptor())) { + CONCUR_LOGE("Write interface token failed in ReportData Proxy"); + return; + } + if (!data.WriteUint32(resType) || !data.WriteInt64(value) || !data.WriteString(payload.toStyledString())) { + CONCUR_LOGE("Write info failed in ReportData Proxy"); + return; + } uint32_t code = static_cast(ConcurrentTaskInterfaceCode::REPORT_DATA); error = Remote()->SendRequest(code, data, reply, option); if (error != NO_ERROR) { @@ -45,12 +48,15 @@ void ConcurrentTaskServiceProxy::QueryInterval(int queryItem, IntervalReply& que MessageParcel data; MessageParcel reply; MessageOption option = { MessageOption::TF_SYNC }; - queryRs.rtgId = -1; - queryRs.paramA = -1; - queryRs.paramB = -1; - queryRs.paramC = -1; - WRITE_PARCEL(data, InterfaceToken, ConcurrentTaskServiceProxy::GetDescriptor(), , ConcurrentTaskServiceProxy); - WRITE_PARCEL(data, Int64, queryItem, , ConcurrentTaskServiceProxy); + + if (!data.WriteInterfaceToken(ConcurrentTaskServiceProxy::GetDescriptor())) { + CONCUR_LOGE("Write interface token failed in QueryInterval Proxy"); + return; + } + if (!data.WriteInt32(queryItem) || !data.WriteInt32(queryRs.tid)) { + CONCUR_LOGE("Write info failed in QueryInterval Proxy"); + return; + } uint32_t code = static_cast(ConcurrentTaskInterfaceCode::QUERY_INTERVAL); error = Remote()->SendRequest(code, data, reply, option); @@ -58,10 +64,16 @@ void ConcurrentTaskServiceProxy::QueryInterval(int queryItem, IntervalReply& que CONCUR_LOGE("QueryInterval error: %{public}d", error); return; } - READ_PARCEL(reply, Int32, queryRs.rtgId, , ConcurrentTaskServiceProxy); - READ_PARCEL(reply, Int32, queryRs.paramA, , ConcurrentTaskServiceProxy); - READ_PARCEL(reply, Int32, queryRs.paramB, , ConcurrentTaskServiceProxy); - READ_PARCEL(reply, Int32, queryRs.paramC, , ConcurrentTaskServiceProxy); + queryRs.rtgId = -1; + queryRs.tid = -1; + queryRs.paramA = -1; + queryRs.paramB = -1; + + if (!data.ReadInt32(queryRs.rtgId) || !data.WriteInt32(queryRs.tid) + || !data.ReadInt32(queryRs.paramA) || !data.WriteInt32(queryRs.paramB)) { + CONCUR_LOGE("Read info failed in QueryInterval Proxy"); + return; + } return; } } // namespace ConcurrentTask diff --git a/include/ipc_util.h b/include/ipc_util.h deleted file mode 100644 index 4f22642..0000000 --- a/include/ipc_util.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef CONCURRENT_TASK_COMMON_INCLUDE_IPC_UTIL_H -#define CONCURRENT_TASK_COMMON_INCLUDE_IPC_UTIL_H - -#include "concurrent_task_log.h" - -namespace OHOS { -namespace ConcurrentTask { - -#define READ_PARCEL(parcel, type, out, errReturn, className) \ - do { \ - if (!(parcel).Read##type(out)) { \ - CONCUR_LOGE(""#className"::%{public}s read"#out" failed", __func__); \ - return errReturn; \ - } \ - } while (0) \ - -#define WRITE_PARCEL(parcel, type, in, errReturn, className) \ - do { \ - if (!(parcel).Write##type(in)) { \ - CONCUR_LOGE(""#className"::%{public}s write"#in" failed", __func__); \ - return errReturn; \ - } \ - } while (0) - -} // namespace ConcurrentTask -} // namespace OHOS - -#endif // CONCURRENT_TASK_COMMON_INCLUDE_IPC_UTIL_H diff --git a/services/BUILD.gn b/services/BUILD.gn index 3b7adca..6244b98 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -16,6 +16,7 @@ import("//build/ohos.gni") config("concurrent_task_config") { visibility = [ ":*" ] cflags_cc = [ "-fexceptions" ] + cflags = [ "-fstack-protector-strong" ] include_dirs = [ "include", "../include", @@ -45,11 +46,16 @@ ohos_shared_library("concurrentsvc") { "//third_party/jsoncpp:jsoncpp", ] + if (defined(global_parts_info.resourceschedule_frame_aware_sched_override)) { + defines = [ "QOS_EXT_ENABLE" ] + } + external_deps = [ "c_utils:utils", "eventhandler:libeventhandler", "frame_aware_sched:rtg_interface", "hilog:libhilog", + "init:libbegetutil", "ipc:ipc_single", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/services/include/concurrent_task_controller.h b/services/include/concurrent_task_controller.h index 4c7ed16..739cee9 100644 --- a/services/include/concurrent_task_controller.h +++ b/services/include/concurrent_task_controller.h @@ -43,7 +43,7 @@ private: bool CheckUid(pid_t uid); void TypeMapInit(); void QosApplyInit(); - void SetHwcAuth(bool status); + void SetSystemAuth(int uid, bool status); void TryCreateRsGroup(); void QueryUi(pid_t uid, IntervalReply& queryRs); void QueryRender(pid_t uid, IntervalReply& queryRs); @@ -52,7 +52,7 @@ private: int GetRequestType(std::string strRequstType); void DealSystemRequest(int requestType, const Json::Value& payload); void DealAppRequest(int requestType, const Json::Value& payload, pid_t uid); - void NewForeground(int uid); + void NewForeground(int uid, const Json::Value& payload); void NewBackground(int uid); void NewAppStart(int uid); void AppKilled(int uid); @@ -65,12 +65,13 @@ private: QosManager qosManager_; std::vector authApps_; int renderServiceGrpId_ = -1; + int rsTid_ = -1; bool rtgEnabled_ = false; }; class ForegroundAppRecord { public: - explicit ForegroundAppRecord(int uid); + explicit ForegroundAppRecord(int uid, int uiTid); ~ForegroundAppRecord(); void AddKeyThread(int tid, int prio = PRIO_NORMAL); @@ -84,6 +85,7 @@ public: private: int uid_ = 0; int grpId_ = 0; + int uiTid_ = 0; std::unordered_set keyThreads_; }; } // namespace ConcurrentTask diff --git a/services/include/qos_interface.h b/services/include/qos_interface.h index 37528b2..199e283 100644 --- a/services/include/qos_interface.h +++ b/services/include/qos_interface.h @@ -23,8 +23,13 @@ extern "C" { /* * generic */ -#define SYSTEM_UID 1000 -#define ROOT_UID 0 +constexpr int SYSTEM_UID = 1000; +constexpr int ROOT_UID = 0; +constexpr int NR_QOS = 6; +constexpr unsigned int SET_RTG_ENABLE = 1; +constexpr unsigned int QOS_CTRL_IPC_MAGIC = 0xCC; +constexpr unsigned int AUTH_CTRL_IPC_MAGIC = 0xCD; +constexpr unsigned int RTG_SCHED_IPC_MAGIC = 0xAB; /* * auth_ctrl @@ -50,22 +55,19 @@ enum class AuthStatus { AUTH_STATUS_SYSTEM_SERVER = 2, AUTH_STATUS_FOREGROUND = 3, AUTH_STATUS_BACKGROUND = 4, +#ifdef QOS_EXT_ENABLE + AUTH_STATUS_FOCUS = 5, +#endif AUTH_STATUS_DEAD, }; -enum class QosClassLevel { - QOS_UNSPECIFIED = 0, - QOS_BACKGROUND = 1, - QOS_UTILITY = 2, - QOS_DEFAULT = 3, - QOS_USER_INITIATED = 4, - QOS_DEADLINE_REQUEST = 5, - QOS_USER_INTERACTIVE = 6, - QOS_MAX, +enum AuthCtrlCmdid { + BASIC_AUTH_CTRL = 1, + AUTH_CTRL_MAX_NR }; #define BASIC_AUTH_CTRL_OPERATION \ - _IOWR(0xCD, 1, struct AuthCtrlData) + _IOWR(AUTH_CTRL_IPC_MAGIC, BASIC_AUTH_CTRL, struct AuthCtrlData) /* * qos ctrl @@ -73,6 +75,9 @@ enum class QosClassLevel { enum class QosManipulateType { QOS_APPLY = 1, QOS_LEAVE, +#ifdef QOS_EXT_ENABLE + QOS_GET, +#endif QOS_MAX_NR, }; @@ -80,6 +85,12 @@ struct QosCtrlData { int pid; unsigned int type; unsigned int level; +#ifdef QOS_EXT_ENABLE + int qos; + int staticQos; + int dynamicQos; + bool tagSchedEnable = false; +#endif }; struct QosPolicyData { @@ -90,11 +101,14 @@ struct QosPolicyData { int rtSchedPriority; }; -enum class QosPolicyType { +enum QosPolicyType { QOS_POLICY_DEFAULT = 1, QOS_POLICY_SYSTEM_SERVER = 2, QOS_POLICY_FRONT = 3, QOS_POLICY_BACK = 4, +#ifdef QOS_EXT_ENABLE + QOS_POLICY_FOCUS = 5, +#endif QOS_POLICY_MAX_NR, }; @@ -111,13 +125,19 @@ enum class QosPolicyType { struct QosPolicyDatas { int policyType; unsigned int policyFlag; - struct QosPolicyData policys[static_cast(QosClassLevel::QOS_MAX)]; + struct QosPolicyData policys[NR_QOS + 1]; +}; + +enum QosCtrlCmdid { + QOS_CTRL = 1, + QOS_POLICY = 2, + QOS_CTRL_MAX_NR }; #define QOS_CTRL_BASIC_OPERATION \ - _IOWR(0xCC, 1, struct QosCtrlData) + _IOWR(QOS_CTRL_IPC_MAGIC, QOS_CTRL, struct QosCtrlData) #define QOS_CTRL_POLICY_OPERATION \ - _IOWR(0xCC, 2, struct QosPolicyDatas) + _IOWR(QOS_CTRL_IPC_MAGIC, QOS_POLICY, struct QosPolicyDatas) /* * RTG @@ -132,7 +152,7 @@ struct RtgEnableData { }; #define CMD_ID_SET_ENABLE \ - _IOWR(0xAB, 1, struct RtgEnableData) + _IOWR(RTG_SCHED_IPC_MAGIC, SET_RTG_ENABLE, struct RtgEnableData) /* * interface @@ -147,7 +167,7 @@ int QosApply(unsigned int level); int QosApplyForOther(unsigned int level, int tid); int QosLeave(void); int QosLeaveForOther(int tid); -int QosPolicy(struct QosPolicyDatas *policyDatas); +int QosPolicy(const struct QosPolicyDatas *policyDatas); #ifdef __cplusplus } diff --git a/services/src/concurrent_task_controller.cpp b/services/src/concurrent_task_controller.cpp index 492919a..5269e2e 100644 --- a/services/src/concurrent_task_controller.cpp +++ b/services/src/concurrent_task_controller.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#include #include #include #include @@ -20,12 +21,18 @@ #include "rtg_interface.h" #include "ipc_skeleton.h" #include "concurrent_task_log.h" +#include "parameters.h" #include "concurrent_task_controller.h" -constexpr int TARGET_UID = 3039; + +constexpr int RS_UID = 1003; using namespace OHOS::RME; namespace OHOS { namespace ConcurrentTask { +const std::string INTERVAL_DDL = "ffrt.interval.renderthread"; +constexpr int CURRENT_RATE = 90; +constexpr int PARAM_TYPE = 1; + TaskController& TaskController::GetInstance() { static TaskController instance; @@ -131,14 +138,23 @@ void TaskController::QueryRender(int uid, IntervalReply& queryRs) void TaskController::QueryRenderService(int uid, IntervalReply& queryRs) { - if (renderServiceGrpId_ > 0) { - CONCUR_LOGD("uid %{public}d query rs group %{public}d.", uid, renderServiceGrpId_); - queryRs.rtgId = renderServiceGrpId_; - return; + if (renderServiceGrpId_ <= 0) { + TryCreateRsGroup(); + CONCUR_LOGI("uid %{public}d query rs group failed and create %{public}d.", uid, renderServiceGrpId_); + if (renderServiceGrpId_ <= 0) { + CONCUR_LOGE("uid %{public}d create rs group failed", uid); + return; + } } - TryCreateRsGroup(); queryRs.rtgId = renderServiceGrpId_; - CONCUR_LOGE("uid %{public}d query rs group failed and create %{public}d.", uid, renderServiceGrpId_); + if (rsTid_ <= 0) { + rsTid_ = queryRs.tid; + int ret = AddThreadToRtg(rsTid_, renderServiceGrpId_, PRIO_RT); + if (ret < 0) { + CONCUR_LOGE("uid %{public}d tid %{public}d join rs group failed.", uid, rsTid_); + } + } + SetFrameRateAndPrioType(renderServiceGrpId_, CURRENT_RATE, PARAM_TYPE); } void TaskController::QueryHwc(int uid, IntervalReply& queryRs) @@ -161,25 +177,25 @@ void TaskController::QueryHwc(int uid, IntervalReply& queryRs) } } -void TaskController::SetHwcAuth(bool status) +void TaskController::SetSystemAuth(int uid, bool status) { int ret; if (status) { - ret = AuthEnable(TARGET_UID, AF_RTG_ALL, static_cast(AuthStatus::AUTH_STATUS_FOREGROUND)); + ret = AuthEnable(uid, AF_RTG_ALL, static_cast(AuthStatus::AUTH_STATUS_FOREGROUND)); } else { - ret = AuthDelete(TARGET_UID); + ret = AuthDelete(uid); } if (ret == 0) { - CONCUR_LOGI("set auth status(%{public}d) for %{public}d success", status, TARGET_UID); + CONCUR_LOGI("set auth status(%{public}d) for %{public}d success", status, uid); } else { - CONCUR_LOGE("set auth status(%{public}d) for %{public}d fail with ret %{public}d ", status, TARGET_UID, ret); + CONCUR_LOGE("set auth status(%{public}d) for %{public}d fail with ret %{public}d ", status, uid, ret); } } void TaskController::Init() { - SetHwcAuth(true); + SetSystemAuth(RS_UID, true); TypeMapInit(); qosManager_.Init(); TryCreateRsGroup(); @@ -187,7 +203,7 @@ void TaskController::Init() void TaskController::Release() { - SetHwcAuth(false); + SetSystemAuth(RS_UID, false); msgType_.clear(); if (renderServiceGrpId_ <= 0) { return; @@ -222,7 +238,9 @@ void TaskController::TryCreateRsGroup() } if (renderServiceGrpId_ <= 0) { CONCUR_LOGI("CreateRsRtgGroup failed! rtGrp:%{public}d", renderServiceGrpId_); + return; } + SetSystemAuth(RS_UID, true); } int TaskController::GetRequestType(std::string strRequstType) @@ -256,7 +274,7 @@ void TaskController::DealSystemRequest(int requestType, const Json::Value& paylo } switch (requestType) { case MSG_FOREGROUND: - NewForeground(appUid); + NewForeground(appUid, payload); break; case MSG_BACKGROUND: NewBackground(appUid); @@ -309,8 +327,21 @@ std::list::iterator TaskController::GetRecordOfUid(int uid) return foregroundApp_.end(); } -void TaskController::NewForeground(int uid) +void TaskController::NewForeground(int uid, const Json::Value& payload) { + int uiTid = 0; +#ifdef QOS_EXT_ENABLE + try { + uiTid = std::stoi(payload["pid"].asString()); + } catch (...) { + CONCUR_LOGE("Unexpected pid format uiTid is %{public}d", uiTid); + return; + } + if (uiTid < 0) { + CONCUR_LOGE("uiTid error: %{public}d", uiTid); + return; + } +#endif auto it = find(authApps_.begin(), authApps_.end(), uid); if (it == authApps_.end()) { CONCUR_LOGI("un-authed uid %{public}d", uid); @@ -319,7 +350,6 @@ void TaskController::NewForeground(int uid) unsigned int uidParam = static_cast(uid); unsigned int uaFlag = AF_RTG_ALL; unsigned int status = static_cast(AuthStatus::AUTH_STATUS_FOREGROUND); - int ret = AuthEnable(uidParam, uaFlag, status); if (ret == 0) { CONCUR_LOGI("auth_enable %{public}d success", uid); @@ -327,18 +357,24 @@ void TaskController::NewForeground(int uid) CONCUR_LOGE("auth_enable %{public}d fail with ret %{public}d", uid, ret); } bool found = false; + bool ddlEnabled = OHOS::system::GetBoolParameter(INTERVAL_DDL, false); for (auto iter = foregroundApp_.begin(); iter != foregroundApp_.end(); iter++) { if (iter->GetUid() == uid) { found = true; - CONCUR_LOGI("uid %{public}d is already in foreground.", uid); + if (ddlEnabled) { + iter->AddKeyThread(uiTid, PRIO_RT); + } iter->BeginScene(); } } CONCUR_LOGI("uid %{public}d change to foreground.", uid); if (!found) { - ForegroundAppRecord *tempRecord = new ForegroundAppRecord(uid); + ForegroundAppRecord *tempRecord = new ForegroundAppRecord(uid, uiTid); if (tempRecord->IsValid()) { foregroundApp_.push_back(*tempRecord); + if (ddlEnabled) { + tempRecord->AddKeyThread(uiTid, PRIO_RT); + } tempRecord->BeginScene(); } else { delete tempRecord; @@ -418,16 +454,14 @@ void TaskController::PrintInfo() } } -ForegroundAppRecord::ForegroundAppRecord(int uid) +ForegroundAppRecord::ForegroundAppRecord(int uid, int uiTid) { uid_ = uid; - grpId_ = CreateNewRtgGrp(PRIO_RT, MAX_KEY_THREADS); - if (grpId_ <= 0) { - CONCUR_LOGI("CreateNewRtgGroup with RT failed, try change to normal type."); - grpId_ = CreateNewRtgGrp(PRIO_NORMAL, MAX_KEY_THREADS); - } - if (grpId_ <= 0) { - CONCUR_LOGI("CreateNewRtgGroup failed! rtGrp:%{public}d, pid: %{public}d", grpId_, uid); + uiTid_ = uiTid; + if (OHOS::system::GetBoolParameter(INTERVAL_DDL, false)) { + grpId_ = CreateNewRtgGrp(PRIO_RT, MAX_KEY_THREADS); + } else { + grpId_ = -1; } } @@ -457,7 +491,7 @@ void ForegroundAppRecord::AddKeyThread(int tid, int prio) } else { int ret = AddThreadToRtg(tid, grpId_, rtgPrio); if (ret != 0) { - CONCUR_LOGI("Add key thread fail: Kernel err report."); + CONCUR_LOGI("Add key thread fail: Kernel err report. ret is %{public}d", ret); } else { CONCUR_LOGI("Add key thread %{public}d", tid); } @@ -478,8 +512,9 @@ bool ForegroundAppRecord::BeginScene() bool ForegroundAppRecord::EndScene() { + grpId_ = SearchRtgForTid(uiTid_); if (grpId_ <= 0) { - CONCUR_LOGI("Error end scene in uid %{public}d", uid_); + CONCUR_LOGI("Error end scene loss grpId_ in uid %{public}d", uid_); return false; } OHOS::RME::EndScene(grpId_); @@ -498,7 +533,7 @@ int ForegroundAppRecord::GetGrpId() bool ForegroundAppRecord::IsValid() { - if (uid_ > 0 && grpId_ > 0) { + if (uid_ > 0) { return true; } return false; diff --git a/services/src/concurrent_task_service_stub.cpp b/services/src/concurrent_task_service_stub.cpp index e9e255b..71e49c5 100644 --- a/services/src/concurrent_task_service_stub.cpp +++ b/services/src/concurrent_task_service_stub.cpp @@ -18,7 +18,6 @@ #include "concurrent_task_errors.h" #include "string_ex.h" #include "ipc_skeleton.h" -#include "ipc_util.h" namespace OHOS { namespace ConcurrentTask { @@ -46,15 +45,14 @@ int32_t ConcurrentTaskServiceStub::ReportDataInner(MessageParcel& data, [[maybe_ if (!IsValidToken(data)) { return ERR_CONCURRENT_TASK_PARCEL_ERROR; } - uint32_t type = 0; - READ_PARCEL(data, Uint32, type, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); + uint32_t type = 0; int64_t value = 0; - READ_PARCEL(data, Int64, value, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); - std::string payload; - READ_PARCEL(data, String, payload, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); - + if (!data.ReadUint32(type) || !data.ReadInt64(value) || !data.ReadString(payload)) { + CONCUR_LOGE("Read info failed in ReportData Stub"); + return IPC_STUB_ERR; + } if (payload.empty()) { return ERR_OK; } @@ -68,17 +66,21 @@ int32_t ConcurrentTaskServiceStub::QueryIntervalInner(MessageParcel& data, [[may return ERR_CONCURRENT_TASK_PARCEL_ERROR; } int item; - READ_PARCEL(data, Int32, item, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); IntervalReply queryRs; queryRs.rtgId = -1; + queryRs.tid = -1; queryRs.paramA = -1; queryRs.paramB = -1; - queryRs.paramC = -1; + if (!data.ReadInt32(item) || !data.ReadInt32(queryRs.tid)) { + CONCUR_LOGE("Read info failed in QueryInterval Stub"); + return IPC_STUB_ERR; + } QueryInterval(item, queryRs); - WRITE_PARCEL(reply, Int32, queryRs.rtgId, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); - WRITE_PARCEL(reply, Int32, queryRs.paramA, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); - WRITE_PARCEL(reply, Int32, queryRs.paramB, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); - WRITE_PARCEL(reply, Int32, queryRs.paramC, ERR_CONCURRENT_TASK_PARCEL_ERROR, ConcurrentTaskServiceStub); + if (!data.WriteInt32(queryRs.rtgId) || !data.WriteInt32(queryRs.tid) + || !data.WriteInt32(queryRs.paramA) || !data.WriteInt32(queryRs.paramB)) { + CONCUR_LOGE("Write info failed in QueryInterval Stub"); + return IPC_STUB_ERR; + } return ERR_OK; } diff --git a/services/src/qos_interface.cpp b/services/src/qos_interface.cpp index e5d2fb6..b16bbd9 100644 --- a/services/src/qos_interface.cpp +++ b/services/src/qos_interface.cpp @@ -66,7 +66,7 @@ static int TrivalOpenQosCtrlNode(void) int EnableRtg(bool flag) { struct RtgEnableData enableData; - char configStr[] = "load_freq_switch:1;sched_cycle:1;frame_max_util:750"; + char configStr[] = "load_freq_switch:1;sched_cycle:1;frame_max_util:1024"; int ret; enableData.enable = flag; @@ -303,7 +303,7 @@ int QosLeaveForOther(int tid) return ret; } -int QosPolicy(struct QosPolicyDatas *policyDatas) +int QosPolicy(const struct QosPolicyDatas *policyDatas) { int fd; int ret; diff --git a/services/src/qos_manager.cpp b/services/src/qos_manager.cpp index e9fe5ae..31db399 100644 --- a/services/src/qos_manager.cpp +++ b/services/src/qos_manager.cpp @@ -18,7 +18,7 @@ #include "concurrent_task_log.h" static struct QosPolicyDatas g_defaultQosPolicy = { - .policyType = static_cast(QosPolicyType::QOS_POLICY_DEFAULT), + .policyType = QOS_POLICY_DEFAULT, .policyFlag = QOS_FLAG_ALL, .policys = { {0, 0, 0, 1024, 0}, @@ -32,21 +32,27 @@ static struct QosPolicyDatas g_defaultQosPolicy = { }; static struct QosPolicyDatas g_foregroundQosPolicy = { - .policyType = static_cast(QosPolicyType::QOS_POLICY_FRONT), + .policyType = QOS_POLICY_FRONT, .policyFlag = QOS_FLAG_ALL, .policys = { {0, 0, 0, 1024, 0}, {10, 10, 0, 200, 0}, {5, 5, 0, 250, 0}, {0, 0, 0, 1024, 0}, - {-5, -5, 300, 1024, 0}, +#ifdef QOS_EXT_ENABLE + {-10, 0, 300, 1024, 0}, {-10, -10, 500, 1024, 0}, {-10, -10, 500, 1024, 2}, +#else + {0, 0, 0, 1024, 0}, + {0, 0, 0, 1024, 0}, + {0, 0, 0, 1024, 0}, +#endif } }; static struct QosPolicyDatas g_backgroundQosPolicy = { - .policyType = static_cast(QosPolicyType::QOS_POLICY_BACK), + .policyType = QOS_POLICY_BACK, .policyFlag = QOS_FLAG_ALL & ~QOS_FLAG_RT, .policys = { {0, 0, 0, 1024, 0}, @@ -54,22 +60,33 @@ static struct QosPolicyDatas g_backgroundQosPolicy = { {10, 10, 0, 200, 0}, {5, 5, 0, 250, 0}, {0, 0, 0, 300, 0}, +#ifdef QOS_EXT_ENABLE {-5, -5, 0, 350, 0}, {-5, -5, 0, 350, 3}, +#else + {0, 0, 0, 1024, 0}, + {0, 0, 0, 1024, 0}, +#endif } }; static struct QosPolicyDatas g_systemServerQosPolicy = { - .policyType = static_cast(QosPolicyType::QOS_POLICY_SYSTEM_SERVER), + .policyType = QOS_POLICY_SYSTEM_SERVER, .policyFlag = QOS_FLAG_ALL, .policys = { {0, 0, 0, 1024, 0}, {10, 10, 0, 200, 0}, {5, 5, 0, 250, 0}, {0, 0, 0, 1024, 0}, - {-5, -5, 300, 1024, 0}, +#ifdef QOS_EXT_ENABLE + {-10, 0, 300, 1024, 0}, {-10, -10, 500, 1024, 0}, {-10, -10, 500, 1024, 2}, +#else + {0, 0, 0, 1024, 0}, + {0, 0, 0, 1024, 0}, + {0, 0, 0, 1024, 0}, +#endif } }; diff --git a/test/unittest/phone/concurrent_task_controller_test.cpp b/test/unittest/phone/concurrent_task_controller_test.cpp index fda3403..46a85f6 100644 --- a/test/unittest/phone/concurrent_task_controller_test.cpp +++ b/test/unittest/phone/concurrent_task_controller_test.cpp @@ -107,11 +107,11 @@ HWTEST_F(ConcurrentTaskControllerTest, InitTest, TestSize.Level1) * @tc.desc: Test whether the PushTask interface are normal. * @tc.type: FUNC */ -HWTEST_F(ConcurrentTaskControllerTest, AuthHwcTest, TestSize.Level1) +HWTEST_F(ConcurrentTaskControllerTest, AuthSystemTest, TestSize.Level1) { - TaskController::GetInstance().SetHwcAuth(true); - TaskController::GetInstance().SetHwcAuth(false); - TaskController::GetInstance().SetHwcAuth(true); + TaskController::GetInstance().SetSystemAuth(3039, true); + TaskController::GetInstance().SetSystemAuth(3039, false); + TaskController::GetInstance().SetSystemAuth(3039, true); } /** @@ -201,22 +201,22 @@ HWTEST_F(ConcurrentTaskControllerTest, NewForegroundTest, TestSize.Level1) { TaskController fore; int uid = 0; - fore.NewForeground(uid); + fore.NewForeground(uid, 0); fore.NewBackground(uid); fore.NewAppStart(uid); - fore.NewForeground(uid); + fore.NewForeground(uid, 0); fore.NewBackground(uid); fore.AppKilled(uid); uid = 574; - fore.foregroundApp_.push_back(ForegroundAppRecord(574)); - fore.foregroundApp_.push_back(ForegroundAppRecord(1)); - fore.foregroundApp_.push_back(ForegroundAppRecord(3)); + fore.foregroundApp_.push_back(ForegroundAppRecord(574, 0)); + fore.foregroundApp_.push_back(ForegroundAppRecord(1, 0)); + fore.foregroundApp_.push_back(ForegroundAppRecord(3, 0)); auto iter = fore.foregroundApp_.begin(); EXPECT_EQ(iter->GetUid(), uid); - fore.NewForeground(uid); + fore.NewForeground(uid, 0); fore.NewBackground(uid); fore.NewAppStart(uid); - fore.NewForeground(uid); + fore.NewForeground(uid, 0); fore.NewBackground(uid); fore.AppKilled(uid); } @@ -229,9 +229,9 @@ HWTEST_F(ConcurrentTaskControllerTest, NewForegroundTest, TestSize.Level1) HWTEST_F(ConcurrentTaskControllerTest, PrintInfoTest, TestSize.Level1) { TaskController print; - print.foregroundApp_.push_back(ForegroundAppRecord(1)); - print.foregroundApp_.push_back(ForegroundAppRecord(3)); - print.foregroundApp_.push_back(ForegroundAppRecord(5)); + print.foregroundApp_.push_back(ForegroundAppRecord(1, 0)); + print.foregroundApp_.push_back(ForegroundAppRecord(3, 0)); + print.foregroundApp_.push_back(ForegroundAppRecord(5, 0)); auto iter = print.foregroundApp_.begin(); EXPECT_NE(iter, print.foregroundApp_.end()); print.PrintInfo(); @@ -251,7 +251,7 @@ HWTEST_F(ConcurrentTaskControllerTest, AddKeyThreadTest, TestSize.Level1) int tid4 = 48; int tid5 = 49; int prio = PRIO_NORMAL; - ForegroundAppRecord foregroundapprecord = ForegroundAppRecord(uid); + ForegroundAppRecord foregroundapprecord = ForegroundAppRecord(uid, 0); foregroundapprecord.AddKeyThread(tid, prio); foregroundapprecord.keyThreads_.insert(tid); foregroundapprecord.AddKeyThread(tid, prio); @@ -281,7 +281,7 @@ HWTEST_F(ConcurrentTaskControllerTest, AddKeyThreadTest, TestSize.Level1) HWTEST_F(ConcurrentTaskControllerTest, BeginSceneTest, TestSize.Level1) { int uid = 758; - ForegroundAppRecord foregroundapprecord = ForegroundAppRecord(uid); + ForegroundAppRecord foregroundapprecord = ForegroundAppRecord(uid, 0); foregroundapprecord.BeginScene(); foregroundapprecord.EndScene(); foregroundapprecord.grpId_ = -1; @@ -300,7 +300,7 @@ HWTEST_F(ConcurrentTaskControllerTest, BeginSceneTest, TestSize.Level1) HWTEST_F(ConcurrentTaskControllerTest, IsValidTest, TestSize.Level1) { int uid = 758; - ForegroundAppRecord foregroundapprecord = ForegroundAppRecord(uid); + ForegroundAppRecord foregroundapprecord = ForegroundAppRecord(uid, 0); EXPECT_EQ(foregroundapprecord.GetUid(), foregroundapprecord.uid_); EXPECT_EQ(foregroundapprecord.GetGrpId(), foregroundapprecord.grpId_); foregroundapprecord.uid_ = -1; @@ -311,7 +311,7 @@ HWTEST_F(ConcurrentTaskControllerTest, IsValidTest, TestSize.Level1) EXPECT_EQ(foregroundapprecord.IsValid(), false); foregroundapprecord.uid_ = 1; foregroundapprecord.grpId_ = -1; - EXPECT_EQ(foregroundapprecord.IsValid(), false); + EXPECT_EQ(foregroundapprecord.IsValid(), true); foregroundapprecord.uid_ = 1; foregroundapprecord.grpId_ = 1; EXPECT_EQ(foregroundapprecord.IsValid(), true); @@ -325,7 +325,7 @@ HWTEST_F(ConcurrentTaskControllerTest, IsValidTest, TestSize.Level1) HWTEST_F(ConcurrentTaskControllerTest, PrintKeyThreadsTest, TestSize.Level1) { int uid = 758; - ForegroundAppRecord foregroundapprecord = ForegroundAppRecord(uid); + ForegroundAppRecord foregroundapprecord = ForegroundAppRecord(uid, 0); foregroundapprecord.keyThreads_.insert(1); foregroundapprecord.keyThreads_.insert(3); foregroundapprecord.keyThreads_.insert(5); diff --git a/test/unittest/phone/qos_interface_test.cpp b/test/unittest/phone/qos_interface_test.cpp index 1a43acf..e5beabd 100644 --- a/test/unittest/phone/qos_interface_test.cpp +++ b/test/unittest/phone/qos_interface_test.cpp @@ -212,7 +212,7 @@ HWTEST_F(QosInterfaceTest, QosLeaveForOtherTest, TestSize.Level1) */ static struct QosPolicyDatas g_defaultQosPolicy = { - .policyType = static_cast(QosPolicyType::QOS_POLICY_DEFAULT), + .policyType = QOS_POLICY_DEFAULT, .policyFlag = QOS_FLAG_ALL, .policys = { {0, 0, 0, 1024, 0}, -- Gitee