From cef40606e46d2ce181a68e16ce82edc2ae6c90af Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Wed, 18 Dec 2024 16:00:21 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=E9=97=B9=E9=92=9F=E5=BC=B9?= =?utf8?q?=E7=AA=97=E5=8F=96=E6=B6=88=E5=85=B6=E4=BB=96=E7=95=8C=E9=9D=A2?= =?utf8?q?=E7=9A=84=E9=95=BF=E4=BA=AE=E5=B1=8F=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../msg_center/include/notify/alarm_notification.h | 2 ++ .../include/notify/findwatch_notification.h | 6 ++++-- .../service/msg_center/src/msg_center_customer.cpp | 8 ++++++-- .../msg_center/src/notify/alarm_notification.cpp | 13 ++++++++++++- .../src/notify/findwatch_notification.cpp | 10 +++++----- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h index 48a98bdff..79f8828d2 100755 --- a/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h @@ -62,6 +62,8 @@ public: { return true; } + + static uint8_t pre_screen_status; }; }; // namespace OHOS diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h index 0aee89176..9fc0eeb8c 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-25 17:31:19 - * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-11-27 10:44:16 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-12-18 15:22:38 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h */ #ifndef FIND_WATCH_NOTIFICATION_H @@ -92,6 +92,8 @@ namespace OHOS void setVolumeVal(int val); + static uint8_t pre_screen_status; + private: FindWatchViewEventListener(); ~FindWatchViewEventListener(); diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 56ca0bf28..e5f5a34c2 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -557,7 +557,9 @@ void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req) #endif SaveEleModel::GetInstance()->SetChargeStatus(true); if(PullUpDownView::GetInstance()){ - PullUpDownView::GetInstance()->UpdateBatteryProcess(); + // PullUpDownView::GetInstance()->UpdateBatteryProcess(); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() )); } /* ---------------------------------- 充电弹窗 * ---------------------------------- */ @@ -593,7 +595,9 @@ void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req) #endif SaveEleModel::GetInstance()->SetChargeStatus(false); if(PullUpDownView::GetInstance()){ - PullUpDownView::GetInstance()->UpdateBatteryProcess(); + // PullUpDownView::GetInstance()->UpdateBatteryProcess(); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() )); } /* ---------------------------------- 充电弹窗 ---------------------------------- */ testCHANINGView *t=testCHANINGView::GetInstance(); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp index adc756196..954641f0b 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp @@ -87,6 +87,8 @@ namespace OHOS constexpr int16_t DELAY_LABEL_HEIGHT = 35; constexpr int16_t DELAY_LABEL_FONT = 25; + uint8_t AlarmViewEventListener::pre_screen_status = 0;//屏幕之前的状态 + void StopNotifyCallback() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "StopNotifyCallback"); @@ -505,6 +507,12 @@ namespace OHOS /* -------------------------------------------------------------------------- */ StartAlarmTimer(AlarmTimerType::NOTIFY_ALARM_RING, NOTIFY_ONE_SECOND); ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); + + AlarmViewEventListener::pre_screen_status = uapi_dev_runtime_get_screen_always_on_status();//获取闹钟弹窗之前是否是长亮屏状态 + if(!AlarmViewEventListener::pre_screen_status) + { + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); + } } NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeAlarmView); return g_alarmView; @@ -544,7 +552,10 @@ namespace OHOS RootView::GetInstance()->Remove(g_alarmView); delete g_alarmView; g_alarmView = nullptr; - ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); + if(!AlarmViewEventListener::pre_screen_status) //如果闹钟弹窗之前不是长亮屏状态,就取消闹钟弹窗设置的常亮屏 + { + ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); + } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FreeAlarmView over!!"); } } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp index 0072bb4fa..182215f4a 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-25 17:33:47 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-12-10 15:03:45 + * @LastEditTime: 2024-12-18 15:23:13 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp * @details:实现查找手表的功能一般需要手表和智能手机之间的配合,通常是通过手机上的应用(App)或其他设备发送指令给手表,触发手表的查找功能。 * 以下是基本的实现步骤: @@ -46,7 +46,7 @@ namespace OHOS { UIViewGroup *FindWatchGroupView{nullptr}; UIButton *FindWatchButton{nullptr}; - uint8_t pre_screen_status = 0;//屏幕之前的状态之前 + uint8_t FindWatchViewEventListener::pre_screen_status = 0;//屏幕之前的状态 FindWatchViewEventListener::FindWatchViewEventListener() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindWatchViewEventListener::FindWatchViewEventListener"); @@ -474,8 +474,8 @@ namespace OHOS FindWatchViewEventListener::GetInstance().FindWatch_StartTimer(700); FindWatchViewEventListener::GetInstance().SetScreenBrightness(); - pre_screen_status = uapi_dev_runtime_get_screen_always_on_status();//获取查找手表之前是否是长亮屏状态 - if(!pre_screen_status) + FindWatchViewEventListener::pre_screen_status = uapi_dev_runtime_get_screen_always_on_status();//获取查找手表之前是否是长亮屏状态 + if(!FindWatchViewEventListener::pre_screen_status) { ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } @@ -505,7 +505,7 @@ namespace OHOS FindWatchViewEventListener::GetInstance().FindWatchRingPlayStop(); FindWatchViewEventListener::GetInstance().ResumeScreenBrightness(); FindWatchViewEventListener::GetInstance().FindWatch_StopTimer(); - if(!pre_screen_status) //如果查找手表之前不是长亮屏状态,就取消查找手表设置的常亮屏 + if(!FindWatchViewEventListener::pre_screen_status) //如果查找手表之前不是长亮屏状态,就取消查找手表设置的常亮屏 { ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); } -- 2.17.1