From 05fba99c38eaa61c47f1813bd99e857bcf70df90 Mon Sep 17 00:00:00 2001 From: edwardcaoyue Date: Sat, 27 Jan 2024 16:18:03 +0800 Subject: [PATCH] modify qos right Signed-off-by: edwardcaoyue --- services/src/concurrent_task_controller.cpp | 2 +- services/src/qos_interface.cpp | 2 +- test/unittest/phone/qos_interface_test.cpp | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/services/src/concurrent_task_controller.cpp b/services/src/concurrent_task_controller.cpp index 1da2c3a..9093ffe 100644 --- a/services/src/concurrent_task_controller.cpp +++ b/services/src/concurrent_task_controller.cpp @@ -533,7 +533,7 @@ void TaskController::FocusStatusProcess(int uid, int pid, int status) { int ret = -1; unsigned int rtgFlag = AF_RTG_ALL; - unsigned int qosFlag = AF_QOS_ALL; + unsigned int qosFlag = AF_QOS_DELEGATED; if (status == static_cast(MSG_GET_FOCUS)) { ret = AuthSwitch(pid, rtgFlag, qosFlag, static_cast(AuthStatus::AUTH_STATUS_FOCUS)); CONCUR_LOGI("pid %{public}d get focus. ret %{public}d", pid, ret); diff --git a/services/src/qos_interface.cpp b/services/src/qos_interface.cpp index 0e27a43..4b1b1aa 100644 --- a/services/src/qos_interface.cpp +++ b/services/src/qos_interface.cpp @@ -97,7 +97,7 @@ int AuthEnable(unsigned int pid, unsigned int uaFlag, unsigned int status) data.pid = pid; data.rtgUaFlag = uaFlag; - data.qosUaFlag = AF_QOS_ALL; + data.qosUaFlag = AF_QOS_DELEGATED; data.status = status; data.type = static_cast(AuthManipulateType::AUTH_ENABLE); diff --git a/test/unittest/phone/qos_interface_test.cpp b/test/unittest/phone/qos_interface_test.cpp index 4dfa1d3..defe1ee 100644 --- a/test/unittest/phone/qos_interface_test.cpp +++ b/test/unittest/phone/qos_interface_test.cpp @@ -26,7 +26,6 @@ using namespace testing; using namespace testing::ext; using namespace OHOS::FFRT_TEST; using namespace std; -constexpr unsigned int AF_QOS_ALL = 0x0003; class QosInterfaceTest : public testing::Test { public: @@ -272,6 +271,12 @@ HWTEST_F(QosInterfaceTest, QosPolicyTest, TestSize.Level1) ret = QosPolicySet(policyDatas); EXPECT_EQ(ret, -1); #if defined(ARM64_TEST) && ARM64_TEST + unsigned int pid = getpid(); + unsigned int rtgFlag = AF_RTG_ALL; + unsigned int qosFlag = AF_QOS_ALL; + unsigned int status = static_cast(AuthStatus::AUTH_STATUS_FOREGROUND); + ret = AuthSwitch(pid, rtgFlag, qosFlag, status); + EXPECT_EQ(ret, 0); ret = QosPolicySet(&g_defaultQosPolicy); EXPECT_EQ(ret, 0); #endif -- Gitee