From 886575481e66502090cec0907b553560e3b56e9c Mon Sep 17 00:00:00 2001 From: liuchungang Date: Fri, 6 Sep 2024 15:08:11 +0800 Subject: [PATCH] ddl scene sched remove video Signed-off-by: liuchungang --- services/include/concurrent_task_controller.h | 6 +-- services/src/concurrent_task_controller.cpp | 50 +------------------ .../concurrent_fuzzer/concurrent_fuzzer.cpp | 2 +- .../phone/concurrent_task_controller_test.cpp | 4 +- 4 files changed, 6 insertions(+), 56 deletions(-) diff --git a/services/include/concurrent_task_controller.h b/services/include/concurrent_task_controller.h index faf4421..2b5ecee 100644 --- a/services/include/concurrent_task_controller.h +++ b/services/include/concurrent_task_controller.h @@ -64,15 +64,13 @@ private: void DealSystemRequest(int requestType, const Json::Value& payload); void NewForeground(int uid, int pid); void NewBackground(int uid, int pid); - void NewAppStart(int uid, int pid, const std::string& bundleName, int appType); + void NewAppStart(int uid, int pid, const std::string& bundleName); void AppKilled(int uid, int pid); void ContinuousTaskProcess(int uid, int pid, int status); void FocusStatusProcess(int uid, int pid, int status); void InteractionSceneProcess(int status); void DeadlinePerfMode(); void DeadlinePowerMode(); - bool IsVideoApp(int pid); - int ParseAppType(const Json::Value& payload); int AuthSystemProcess(int pid); bool ConfigReaderInit(); bool ModifySystemRate(const Json::Value& payload); @@ -114,12 +112,10 @@ private: int authedRSPid_ = 0; bool ddlSceneSchedSwitch_ = false; bool ddlPowerModeEnable_ = false; - bool isVideoApp_ = false; std::atomic curGamePid_ = -1; int executorNum_ = 0; std::map appBundleName; std::unique_ptr configReader_ = nullptr; - std::unordered_map appTypeCache_; const std::string RENDER_SERVICE_PROCESS_NAME = "render_service"; const std::string RESOURCE_SCHEDULE_PROCESS_NAME = "resource_schedule_service"; diff --git a/services/src/concurrent_task_controller.cpp b/services/src/concurrent_task_controller.cpp index 11d3f19..95b41b6 100644 --- a/services/src/concurrent_task_controller.cpp +++ b/services/src/concurrent_task_controller.cpp @@ -44,9 +44,6 @@ namespace { constexpr int RTG_TYPE_MAX = 3; constexpr int RS_UID = 1003; constexpr int EXECUTOR_LIMIT_NUM = 3; - constexpr int APP_TYPE_VIDEO = 10067; - constexpr int APP_TYPE_VIDEO_CLIP = 10026; - constexpr int APP_TYPE_INVALID = -1; } #define CMD_ID_SET_RTG \ @@ -361,7 +358,6 @@ bool TaskController::ConfigReaderInit() void TaskController::Release() { msgType_.clear(); - appTypeCache_.clear(); if (renderServiceMainGrpId_ > 0) { DestroyRtgGrp(renderServiceMainGrpId_); renderServiceMainGrpId_ = -1; @@ -475,7 +471,7 @@ void TaskController::DealSystemRequest(int requestType, const Json::Value& paylo NewBackground(uid, pid); break; case MSG_APP_START: - NewAppStart(uid, pid, bundleName, ParseAppType(payload)); + NewAppStart(uid, pid, bundleName); break; case MSG_APP_KILLED: AppKilled(uid, pid); @@ -589,7 +585,7 @@ void TaskController::NewBackground(int uid, int pid) } } -void TaskController::NewAppStart(int uid, int pid, const std::string& bundleName, int appType) +void TaskController::NewAppStart(int uid, int pid, const std::string& bundleName) { CONCUR_LOGI("pid %{public}d start.", pid); unsigned int pidParam = static_cast(pid); @@ -606,9 +602,6 @@ void TaskController::NewAppStart(int uid, int pid, const std::string& bundleName std::lock_guard lock(appInfoLock_); authApps_.push_back(pid); appBundleName[pid] = bundleName; - if (ddlSceneSchedSwitch_ && appType != APP_TYPE_INVALID) { - appTypeCache_[bundleName] = appType; - } } void TaskController::AppKilled(int uid, int pid) @@ -672,18 +665,9 @@ void TaskController::FocusStatusProcess(int uid, int pid, int status) 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); - if (ddlSceneSchedSwitch_) { - if (IsVideoApp(pid)) { - isVideoApp_ = true; - CONCUR_LOGD("video app bundleName %{public}s get focus", appBundleName[pid].c_str()); - } else { - isVideoApp_ = false; - } - } } else if (status == static_cast(MSG_LOSE_FOCUS)) { ret = AuthSwitch(pid, rtgFlag, qosFlag, static_cast(AuthStatus::AUTH_STATUS_FOREGROUND)); CONCUR_LOGI("pid %{public}d lose focus. ret %{public}d", pid, ret); - isVideoApp_ = false; } else { CONCUR_LOGE("Invalid focus status %{public}d", status); } @@ -696,9 +680,6 @@ void TaskController::InteractionSceneProcess(int status) if (status == MSG_ENTER_INTERACTION_SCENE) { DeadlinePerfMode(); } else if (status == MSG_EXIT_INTERACTION_SCENE) { - if (isVideoApp_) { - return; - } DeadlinePowerMode(); } } @@ -988,33 +969,6 @@ int TaskController::CreateNewRtgGrp(int prioType, int rtNum) return ret; } -int TaskController::ParseAppType(const Json::Value& payload) -{ - int appType = APP_TYPE_INVALID; - if (payload.isMember("appType") && payload["appType"].isString()) { - try { - appType = stoi(payload["appType"].asString()); - } catch (...) { - CONCUR_LOGE("Unexpected apptype format"); - return APP_TYPE_INVALID; - } - } - return appType; -} - -bool TaskController::IsVideoApp(int pid) -{ - if (!ddlSceneSchedSwitch_ || appBundleName.find(pid) == appBundleName.end()) { - return false; - } - std::string bundleName = appBundleName[pid]; - if (appTypeCache_.find(bundleName) != appTypeCache_.end()) { - return appTypeCache_[bundleName] == APP_TYPE_VIDEO || - appTypeCache_[bundleName]== APP_TYPE_VIDEO_CLIP; - } - return false; -} - ForegroundAppRecord::ForegroundAppRecord(int pid, int uiTid, bool createGrp) { pid_ = pid; diff --git a/test/fuzztest/concurrent_fuzzer/concurrent_fuzzer.cpp b/test/fuzztest/concurrent_fuzzer/concurrent_fuzzer.cpp index 75d4c25..fa8066f 100644 --- a/test/fuzztest/concurrent_fuzzer/concurrent_fuzzer.cpp +++ b/test/fuzztest/concurrent_fuzzer/concurrent_fuzzer.cpp @@ -816,7 +816,7 @@ bool FuzzTaskControllerNewAppStart(const uint8_t* data, size_t size) int pid = GetData(); int uid = GetData(); std::string bundleName = std::to_string(GetData()); - TaskController::GetInstance().NewAppStart(uid, pid, bundleName, -1); + TaskController::GetInstance().NewAppStart(uid, pid, bundleName); } return true; } diff --git a/test/unittest/phone/concurrent_task_controller_test.cpp b/test/unittest/phone/concurrent_task_controller_test.cpp index 19cc245..be2df45 100644 --- a/test/unittest/phone/concurrent_task_controller_test.cpp +++ b/test/unittest/phone/concurrent_task_controller_test.cpp @@ -236,7 +236,7 @@ HWTEST_F(ConcurrentTaskControllerTest, NewForegroundTest, TestSize.Level1) int tid = gettid(); fore.NewForeground(uid, tid); fore.NewBackground(uid, tid); - fore.NewAppStart(uid, tid, "", -1); + fore.NewAppStart(uid, tid, ""); fore.NewForeground(uid, tid); fore.NewBackground(uid, tid); fore.ContinuousTaskProcess(uid, tid, static_cast(MSG_CONTINUOUS_TASK_START)); @@ -251,7 +251,7 @@ HWTEST_F(ConcurrentTaskControllerTest, NewForegroundTest, TestSize.Level1) EXPECT_EQ(iter->GetPid(), tid); fore.NewForeground(uid, tid); fore.NewBackground(uid, tid); - fore.NewAppStart(uid, tid, "", -1); + fore.NewAppStart(uid, tid, ""); fore.NewForeground(uid, tid); fore.NewBackground(uid, tid); fore.ContinuousTaskProcess(uid, tid, static_cast(MSG_CONTINUOUS_TASK_END)); -- Gitee