From a9fbb0afce0f9bb8624d25513c523b593cf2376c Mon Sep 17 00:00:00 2001 From: Caisking Date: Thu, 13 Nov 2025 18:11:25 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E8=A7=86=E9=A2=91=E8=A1=A8?= =?utf8?q?=E7=9B=98=E7=9A=84=E6=81=AF=E5=B1=8F=E5=8D=A1=E4=BD=8F=E7=9A=84?= =?utf8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/screennotify/src/ui_screennotify.cpp | 7 +++++++ .../nativeui/screennotify/src/ui_screennotify.cpp | 7 +++++++ .../nativeui/screennotify/src/ui_screennotify.cpp | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp index c75a42ce2..a58f0b111 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp @@ -157,12 +157,19 @@ void notify_screen_on_event(void) { callback(SCREEN_STATUS_ON); } ChangeToHomeView(); + if (GraphicService::GetInstance()->IsNativeRunning() && !OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) { + OHOS::NativeAbility::GetInstance().ResumeSlice(); // ensure that don't resume twice if switch to home + } } void notify_screen_off_event(void) { for (auto callback : g_callbacks) { callback(SCREEN_STATUS_OFF); } + if (GraphicService::GetInstance()->IsNativeRunning()) { + OHOS::NativeAbility::GetInstance().StopSliceTransition(); // make sure to end slice transition before turning screen off. + OHOS::NativeAbility::GetInstance().PauseSlice(); + } } void set_back_to_home_interval(uint32_t time_sec) { diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp index c75a42ce2..a58f0b111 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp @@ -157,12 +157,19 @@ void notify_screen_on_event(void) { callback(SCREEN_STATUS_ON); } ChangeToHomeView(); + if (GraphicService::GetInstance()->IsNativeRunning() && !OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) { + OHOS::NativeAbility::GetInstance().ResumeSlice(); // ensure that don't resume twice if switch to home + } } void notify_screen_off_event(void) { for (auto callback : g_callbacks) { callback(SCREEN_STATUS_OFF); } + if (GraphicService::GetInstance()->IsNativeRunning()) { + OHOS::NativeAbility::GetInstance().StopSliceTransition(); // make sure to end slice transition before turning screen off. + OHOS::NativeAbility::GetInstance().PauseSlice(); + } } void set_back_to_home_interval(uint32_t time_sec) { diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp index c75a42ce2..a58f0b111 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp @@ -157,12 +157,19 @@ void notify_screen_on_event(void) { callback(SCREEN_STATUS_ON); } ChangeToHomeView(); + if (GraphicService::GetInstance()->IsNativeRunning() && !OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) { + OHOS::NativeAbility::GetInstance().ResumeSlice(); // ensure that don't resume twice if switch to home + } } void notify_screen_off_event(void) { for (auto callback : g_callbacks) { callback(SCREEN_STATUS_OFF); } + if (GraphicService::GetInstance()->IsNativeRunning()) { + OHOS::NativeAbility::GetInstance().StopSliceTransition(); // make sure to end slice transition before turning screen off. + OHOS::NativeAbility::GetInstance().PauseSlice(); + } } void set_back_to_home_interval(uint32_t time_sec) { -- 2.17.1