From: luozheng <1732036298@qq.com> Date: Sun, 29 Sep 2024 10:38:52 +0000 (+0800) Subject: 解决,#878,手表,恢复出厂设置时,频繁点击按钮会持续震动bug X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=5debfccd2dd31f866e3aa97a18525416eca3d458;p=mirrors%2FFD230.git 解决,#878,手表,恢复出厂设置时,频繁点击按钮会持续震动bug 恢复出厂添加关机动画 --- 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) // 恢复出厂设置取消