From 5debfccd2dd31f866e3aa97a18525416eca3d458 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Sun, 29 Sep 2024 18:38:52 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=EF=BC=8C#878=EF=BC=8C?= =?utf8?q?=E6=89=8B=E8=A1=A8=EF=BC=8C=E6=81=A2=E5=A4=8D=E5=87=BA=E5=8E=82?= =?utf8?q?=E8=AE=BE=E7=BD=AE=E6=97=B6=EF=BC=8C=E9=A2=91=E7=B9=81=E7=82=B9?= =?utf8?q?=E5=87=BB=E6=8C=89=E9=92=AE=E4=BC=9A=E6=8C=81=E7=BB=AD=E9=9C=87?= =?utf8?q?=E5=8A=A8bug=20=E6=81=A2=E5=A4=8D=E5=87=BA=E5=8E=82=E6=B7=BB?= =?utf8?q?=E5=8A=A0=E5=85=B3=E6=9C=BA=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../include/ShutDownImageAnimatorView.h | 6 ++--- .../src/RebootAndShutdownPresenter.cpp | 8 +++--- .../src/ShutDownImageAnimatorView.cpp | 26 ++++++++++++------- .../nativeui/system/src/SystemPresenter.cpp | 8 +++--- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h index 89cc1e561..653ffb8c5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-20 11:05:46 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-28 20:21:31 + * @LastEditTime: 2024-09-29 18:03:03 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h */ @@ -30,7 +30,7 @@ namespace OHOS static ShutDownImageAnimatorView *GetInstance(); UIViewGroup *ShutDownAnimatorViewInit(void); UIImageAnimatorView *GeShutDownImageAnimatorView(void); - void ShutDownImageAnimator_Start(bool state); + void ShutDownImageAnimator_Start(int type); bool GetShutDownImageAnimatorIsStart(void); private: @@ -42,7 +42,7 @@ namespace OHOS UIImageAnimatorView *shutDownImageAnimatorView{nullptr}; // 关机动画 ImageAnimatorInfo ShutDownImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息 const char **ShutDownPathsArray{nullptr}; // 关机图片路径数组 - bool isShutDownOperation; + int OperationType; bool isShutDownImageAnimatorStart{false}; }; } 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 90d00fad0..362a82631 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-09-19 14:21:00 + * @LastEditTime: 2024-09-29 18:14:14 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/RebootAndShutdownPresenter.cpp */ #include "AppViewIDs.h" @@ -83,7 +83,9 @@ namespace OHOS else if (strcmp(view.GetViewId(), FACTORY_RESET_BUTTON_CHECK_ON) == 0) // 恢复出厂设置确认 { ui_api_vibrate_once_func(); //恢复出厂增加震动 - do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0); + view_->ChangeView(FACTORYRESET, SHUTDOWNANIMATOR); + ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(2); + isShutDownImageAnimatorStart = true; return true; } else if (strcmp(view.GetViewId(), FACTORY_RESET_BUTTON_CHECK_OFF) == 0) // 恢复出厂设置取消 @@ -100,7 +102,7 @@ namespace OHOS start_shutdown_or_reboot(); shutdown_reboot_prejobs(); - ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(true); + ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(0); isShutDownImageAnimatorStart = true; } else if (&view == view_->GetButtonCancel()) // 关机取消 diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp index 60db0d238..7cf2bedb9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp @@ -50,13 +50,19 @@ namespace OHOS { UNUSED(view); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownPresenter::OnAnimatorStop"); - if (isShutDownOperation == true) + switch (OperationType) { + case 0: uapi_poweroff_device(); // 关机 - } - else - { + break; + case 1: uapi_reboot_device(); // 重启 + break; + case 2: + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0); + break; + default: + break; } } @@ -65,15 +71,15 @@ namespace OHOS return shutDownImageAnimatorView; } - // true 关机 false 重启 - void ShutDownImageAnimatorView::ShutDownImageAnimator_Start(bool state) + // 0 关机 1 重启 2 恢复出厂 + void ShutDownImageAnimatorView::ShutDownImageAnimator_Start(int type) { - isShutDownOperation = state; + OperationType = type; shutDownImageAnimatorView->Start(); isShutDownImageAnimatorStart = true; - ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON);//关机动画已经开始了不能息屏 + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 关机动画已经开始了不能息屏 - //关机增加震动 + // 关机增加震动 ui_api_vibrate_once_func(); } @@ -86,7 +92,7 @@ namespace OHOS bool ShutDownImageAnimatorView::ShowUpShutDownAnimatorView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ShutDownImageAnimatorView::ShowUpShutDownAnimatorView"); - ShutDownPathsArray = CreateImagePathsArray(ShutDownPaths, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + ShutDownPathsArray = CreateImagePathsArray(ShutDownPaths, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (shutDownImageAnimatorView == nullptr) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp index 8daedb063..25111ea9e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp @@ -199,7 +199,7 @@ namespace OHOS start_shutdown_or_reboot(); shutdown_reboot_prejobs(); - ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(false); + ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(1); isShutDownImageAnimatorStart = true; return true; } @@ -214,7 +214,7 @@ namespace OHOS start_shutdown_or_reboot(); shutdown_reboot_prejobs(); - ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(true); + ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(0); isShutDownImageAnimatorStart = true; return true; } @@ -226,7 +226,9 @@ namespace OHOS else if (strcmp(view.GetViewId(), FACTORYRESET_CHECKON) == 0) // 恢复出厂设置确认 { ui_api_vibrate_once_func(); //恢复出厂增加震动 - do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0); + p_SystemView->ChangeView(FACTORYRESETVIEW, SHUTDOWNANIMATIONVIEW); + ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(2); + isShutDownImageAnimatorStart = true; return true; } else if (strcmp(view.GetViewId(), FACTORYRESET_CHECKOFF) == 0) // 恢复出厂设置取消 -- 2.17.1