From ad7d0271018c7e94b2ebe5daccdcafb7f540a4b1 Mon Sep 17 00:00:00 2001 From: liuhui Date: Tue, 3 Dec 2024 19:38:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8C=89=E7=94=B5=E6=BA=90?= =?UTF-8?q?=E9=94=AE=E6=8F=90=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuhui <396604715@qq.com> --- .../socperf_plugin/include/socperf_plugin.h | 1 + .../plugins/socperf_plugin/src/socperf_plugin.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/ressched/plugins/socperf_plugin/include/socperf_plugin.h b/ressched/plugins/socperf_plugin/include/socperf_plugin.h index 7bdeecb9..cc54fe69 100644 --- a/ressched/plugins/socperf_plugin/include/socperf_plugin.h +++ b/ressched/plugins/socperf_plugin/include/socperf_plugin.h @@ -61,6 +61,7 @@ private: void HandleWindowFocus(const std::shared_ptr& data); void HandleEventClick(const std::shared_ptr& data); void HandleEventKey(const std::shared_ptr& data); + void HandlePowerEventKey(const std::shared_ptr& data); void HandleLoadPage(const std::shared_ptr& data); void HandlePopPage(const std::shared_ptr& data); void HandleEventSlide(const std::shared_ptr& data); diff --git a/ressched/plugins/socperf_plugin/src/socperf_plugin.cpp b/ressched/plugins/socperf_plugin/src/socperf_plugin.cpp index 731fecbd..bf856125 100644 --- a/ressched/plugins/socperf_plugin/src/socperf_plugin.cpp +++ b/ressched/plugins/socperf_plugin/src/socperf_plugin.cpp @@ -85,6 +85,7 @@ namespace { const int32_t PERF_REQUEST_CMD_ID_REMOTE_UNLOCK = 10041; const int32_t PERF_REQUEST_CMD_ID_ACCOUNT_ACTIVATING = 10043; const int32_t PERF_REQUEST_CMD_ID_EVENT_KEY_DOWN = 10044; + const int32_t PERF_REQUEST_CMD_ID_POWER_KEY = 10045; const int32_t PERF_REQUEST_CMD_ID_LOAD_URL = 10070; const int32_t PERF_REQUEST_CMD_ID_MOUSEWHEEL = 10071; const int32_t PERF_REQUEST_CMD_ID_WEB_DRAG_RESIZE = 10073; @@ -226,6 +227,8 @@ void SocPerfPlugin::AddEventToFunctionMap() [this](const std::shared_ptr& data) { HandleGameBoost(data); })); functionMap.insert(std::make_pair(RES_TYPE_KEY_EVENT, [this](const std::shared_ptr& data) { HandleEventKey(data); })); + functionMap.insert(std::make_pair(RES_TYPE_MMI_INPUT_POWER_KEY, + [this](const std::shared_ptr& data) { HandlePowerEventKey(data); })); functionMap.insert(std::make_pair(RES_TYPE_APP_INSTALL_UNINSTALL, [this](const std::shared_ptr& data) { HandleUninstallEvent(data); })); if (RES_TYPE_SCENE_BOARD_ID != 0) { @@ -272,6 +275,7 @@ void SocPerfPlugin::InitResTypes() RES_TYPE_SCREEN_STATUS, RES_TYPE_APP_GAME_BOOST_EVENT, RES_TYPE_APP_INSTALL_UNINSTALL, + RES_TYPE_MMI_INPUT_POWER_KEY, }; if (RES_TYPE_SCENE_BOARD_ID != 0) { resTypes.insert(RES_TYPE_SCENE_BOARD_ID); @@ -451,6 +455,16 @@ void SocPerfPlugin::HandleEventKey(const std::shared_ptr& data) } } +void SocPerfPlugin::HandlePowerEventKey(const std::shared_ptr& data) +{ + if (data == nullptr) { + SOC_PERF_LOGD("SocPerfPlugin: socperf->POWER_KEY null data"); + return; + } + SOC_PERF_LOGD("SocPerfPlugin:socperf->POWER_KEY: %{public}lld", (long long)data->value); + OHOS::SOCPERF::SocPerfClient::GetInstance().PerfRequest(PERF_REQUEST_CMD_ID_POWER_KEY, "powerkey"); +} + bool SocPerfPlugin::HandleGameBoost(const std::shared_ptr& data) { if (socperfGameBoostSwitch_ || data == nullptr) { -- Gitee