From 0d92a2419afaf68035ec7be0428d1690aed0eef4 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 8 Oct 2024 16:46:38 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E7=BB=91=E7=A1=AE=E8=AE=A4=E5=BC=B9?= =?utf8?q?=E7=AA=97=E6=B7=BB=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 --- .../src/ShutDownImageAnimatorView.cpp | 7 +++- .../src/notify/pairing_notification.cpp | 42 ++++++++++++++----- .../drivers/peripheral/utils/custom_utils.c | 2 +- 3 files changed, 39 insertions(+), 12 deletions(-) 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 7cf2bedb9..ca29a381e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp @@ -10,6 +10,7 @@ #include #include "uicomponents/UIComponents.h" #include "vibrator_service.h" +#include "bleEvent.h" namespace OHOS { @@ -61,6 +62,10 @@ namespace OHOS case 2: do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0); break; + case 3: + #ifdef SUPPORT_BLE_SERVICE + cleanUnbindInfor(1); + #endif default: break; } @@ -71,7 +76,7 @@ namespace OHOS return shutDownImageAnimatorView; } - // 0 关机 1 重启 2 恢复出厂 + // 0 关机 1 重启 2 恢复出厂 3解绑恢复出厂 void ShutDownImageAnimatorView::ShutDownImageAnimator_Start(int type) { OperationType = type; diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp index 0d2d95498..e6090d89d 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-22 10:04:36 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-29 14:36:41 + * @LastEditTime: 2024-10-08 16:33:30 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp */ #include "notification_manager.h" @@ -29,7 +29,7 @@ #include #include "../../../../../../drivers/peripheral/vibrator/service/vibrator_service.h" #include - +#include "rebootandshutdown/include/ShutDownImageAnimatorView.h" namespace OHOS { UIViewGroup *DeviceBindingView{nullptr}; @@ -76,6 +76,9 @@ namespace OHOS UIButton *DeviceUnbindingRequestButtonOK{nullptr}; // 设备解除绑定请求(与新设备连接)确认 UIButton *DeviceUnbindingRequestButtonCancel{nullptr}; // 设备解除绑定请求(与新设备连接)取消 + ShutDownImageAnimatorView *p_ShutDownImageAnimatorView{nullptr}; // 关机动画 + UIViewGroup *ShutDownImageAnimatorGroupView{nullptr}; + PairingViewEventListener::PairingViewEventListener() { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener::PairingViewEventListener"); @@ -145,11 +148,24 @@ namespace OHOS else if (&view == DeviceUnbindingRequestButtonOK) // 设备解除绑定请求(与新设备连接)确认 { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener:: DeviceUnbindingRequestButtonOK OnClick"); - // 关闭通知界面 -#ifdef SUPPORT_BLE_SERVICE - cleanUnbindInfor(1); -#endif - NotificationManager::GetInstance()->StopNotify(); + if (p_ShutDownImageAnimatorView == nullptr) + { + p_ShutDownImageAnimatorView = new ShutDownImageAnimatorView(); + if (p_ShutDownImageAnimatorView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "p_ShutDownImageAnimatorView new fail!!"); + return false; + } + ShutDownImageAnimatorGroupView = p_ShutDownImageAnimatorView->ShutDownAnimatorViewInit(); + if (ShutDownImageAnimatorGroupView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShutDownImageAnimatorGroupView new fail!!"); + return false; + } + DeviceUnbindingRequestGroupView->SetVisible(false); + RootView::GetInstance()->Add(ShutDownImageAnimatorGroupView); + } + ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(3); } else if (&view == DeviceUnbindingRequestButtonCancel) // 设备解除绑定请求(与新设备连接)取消 { @@ -358,7 +374,7 @@ namespace OHOS DeviceBindingView->Add(DeviceBindingScrollView); } - //震动一次 + // 震动一次 if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) { ui_api_vibrate_once_func(); @@ -366,7 +382,7 @@ namespace OHOS ScreenTurnOn(40 * 1000); // 亮屏操作 40秒关闭 - PairingViewEventListener::GetInstance().Pairing_StartTimer(); //开启一个40s后弹窗自动销毁定时器 + PairingViewEventListener::GetInstance().Pairing_StartTimer(); // 开启一个40s后弹窗自动销毁定时器 NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDeviceBindingView); return DeviceBindingView; @@ -529,7 +545,7 @@ namespace OHOS ScreenTurnOn(40 * 1000); // 亮屏操作 40秒关闭 - PairingViewEventListener::GetInstance().Pairing_StartTimer(); //开启一个40s后弹窗自动销毁定时器 + PairingViewEventListener::GetInstance().Pairing_StartTimer(); // 开启一个40s后弹窗自动销毁定时器 /* -------------------------------------------------------------------------- */ NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDeviceUnBindingView); @@ -868,6 +884,12 @@ namespace OHOS DeviceUnbindingRequestGroupView = nullptr; WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[FreeDeviceUnbindingRequestGroupView] success"); } + if (p_ShutDownImageAnimatorView != nullptr) + { + RootView::GetInstance()->Remove(ShutDownImageAnimatorGroupView); + delete p_ShutDownImageAnimatorView; + p_ShutDownImageAnimatorView; + } } /* -------------------------------------------------------------------------- */ diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 612385083..3eaa191fe 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -1091,7 +1091,7 @@ void ScreenAlwaysOnCtr(uint8_t turnOnFlag) const power_display_svr_api_t *display_api = power_display_svr_get_api(); if(turnOnFlag) { - // display_api->set_screen_set_keepon_timeout(0); + display_api->set_screen_set_keepon_timeout(0); if (display_api->get_screen_state() != SCREEN_ON) { -- 2.17.1