From 41a0cdf06c93f6d75864f67aee60bab2576ad56f Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Wed, 31 Jul 2024 10:57:57 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=E5=85=B3=E6=9C=BA=E5=8A=A8?= =?utf8?q?=E7=94=BB=E8=A2=AB=E6=89=93=E6=96=AD=E5=AF=BC=E8=87=B4=E4=B8=8D?= =?utf8?q?=E8=83=BD=E5=85=B3=E6=9C=BA=E6=88=96=E8=80=85=E9=87=8D=E5=90=AF?= =?utf8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../include/RebootAndShutdownPresenter.h | 3 +- .../src/RebootAndShutdownModel.cpp | 70 ++++++++++++++----- .../src/RebootAndShutdownPresenter.cpp | 7 +- 3 files changed, 59 insertions(+), 21 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownPresenter.h index 9b3df5468..69347cef9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-18 14:26:31 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-30 10:25:25 + * @LastEditTime: 2024-07-31 10:43:04 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownPresenter.h */ @@ -29,6 +29,7 @@ namespace OHOS RebootAndShutdownPresenter(); virtual ~RebootAndShutdownPresenter(); static RebootAndShutdownPresenter *GetInstance(); + bool GetIsShutDownImageAnimator(void); void OnStart() override; void OnResume() override; diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp index 0d08dea36..f653658aa 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp @@ -2,11 +2,12 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-18 14:55:27 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-27 18:27:16 + * @LastEditTime: 2024-07-31 10:49:15 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp */ #include "rebootandshutdown/include/RebootAndShutdownModel.h" +#include "rebootandshutdown/include/RebootAndShutdownPresenter.h" #include "wearable_log.h" #include "ConfigModel.h" #include "NativeAbility.h" @@ -55,6 +56,13 @@ namespace OHOS static void HandlePowerKeyLongPress(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HandlePowerKeyLongPress"); + + RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance(); + if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator()) + { + return; + } + const power_display_svr_api_t *display_api = power_display_svr_get_api(); if (!display_api) { @@ -86,8 +94,14 @@ namespace OHOS static void HandlePowerKeyDoubleClick(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandlePowerKeyDoubleClick"); - // Handle PowerKey DoubleClick logic here + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HandlePowerKeyDoubleClick"); + + RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance(); + if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator()) + { + return; + } + const power_display_svr_api_t *display_api = power_display_svr_get_api(); if (!display_api) { @@ -117,7 +131,7 @@ namespace OHOS /*注册电源键的双击事件*/ bool RebootAndShutdownModel::RegisterPowerKeyDoubleClickEvent(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterPowerKeyDoubleClickEvent"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterPowerKeyDoubleClickEvent"); // Register PowerKey DoubleClick event here int32_t ret = uapi_button_register_event_cb(HandlePowerKeyDoubleClick, BUTTON_PWR_CLICKUP_2); if (ret != ERRCODE_SUCC) @@ -130,6 +144,14 @@ namespace OHOS static void HandFuncKeyOnPress(void) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::HandFuncKeyOnPress"); + + RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance(); + if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator()) + { + return; + } + const power_display_svr_api_t *display_api = power_display_svr_get_api(); if (!display_api) { @@ -137,21 +159,13 @@ namespace OHOS return; } display_api->turn_on_screen(); - // if (display_api->get_screen_state() == SCREEN_OFF) /*处于灭屏状态才亮屏*/ - // { - - // } - // else - // { - // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Screen is on not to turn_on_screen"); - // } return; } /*注册功能键的按下事件*/ bool RebootAndShutdownModel::RegisterFuncKeyPressEvent(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyPressEvent"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyPressEvent"); // Register FuncKey Press event here int32_t ret = uapi_button_register_event_cb(HandFuncKeyOnPress, BUTTON1_PRESS); if (ret != ERRCODE_SUCC) @@ -166,7 +180,13 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HandFuncKeyOnLongPress"); - if(true == ConfigModel::GetInstance()->GetisFirstTimeStart()) + RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance(); + if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator()) + { + return; + } + + if (true == ConfigModel::GetInstance()->GetisFirstTimeStart()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandFuncKeyOnLongPress: first time power on"); return; @@ -213,7 +233,13 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HandleFuncKeyOnClick"); - if(true == ConfigModel::GetInstance()->GetisFirstTimeStart()) + RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance(); + if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator()) + { + return; + } + + if (true == ConfigModel::GetInstance()->GetisFirstTimeStart()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandleFuncKeyOnClick: first time power on"); return; @@ -243,7 +269,7 @@ namespace OHOS /*注册功能键的单击事件*/ bool RebootAndShutdownModel::RegisterFuncKeyClickEvent(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyClickEvent"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyClickEvent"); int32_t ret = uapi_button_register_event_cb(HandleFuncKeyOnClick, BUTTON1_CLICKUP); if (ret != ERRCODE_SUCC) { @@ -255,9 +281,15 @@ namespace OHOS static void HandleFuncKeyDoubleClick(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandleFuncKeyDoubleClick"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HandleFuncKeyDoubleClick"); + + RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance(); + if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator()) + { + return; + } - if(true == ConfigModel::GetInstance()->GetisFirstTimeStart()) + if (true == ConfigModel::GetInstance()->GetisFirstTimeStart()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandleFuncKeyDoubleClick: first time power on"); return; @@ -283,7 +315,7 @@ namespace OHOS /*注册功能键双击事件*/ bool RebootAndShutdownModel::RegisterFuncKeyDoubleClickEvent(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyDoubleClickEvent"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyDoubleClickEvent"); int32_t ret = uapi_button_register_event_cb(HandleFuncKeyDoubleClick, BUTTON1_CLICKUP_2); if (ret != ERRCODE_SUCC) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp index 8bbf6e0a6..460f98e89 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 15:11:17 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-30 10:23:45 + * @LastEditTime: 2024-07-31 10:43:30 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/RebootAndShutdownPresenter.cpp */ #include "AppViewIDs.h" @@ -221,4 +221,9 @@ namespace OHOS } return true; } + + bool RebootAndShutdownPresenter::GetIsShutDownImageAnimator(void) + { + return isShutDownImageAnimatorStart; + } } \ No newline at end of file -- 2.17.1