修复视频表盘的息屏卡住的问题
authorCaisking <Casiking@zhihuishixun.com>
Thu, 13 Nov 2025 10:11:25 +0000 (18:11 +0800)
committerCaisking <Casiking@zhihuishixun.com>
Thu, 13 Nov 2025 10:11:25 +0000 (18:11 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp

index c75a42c..a58f0b1 100644 (file)
@@ -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) {
index c75a42c..a58f0b1 100644 (file)
@@ -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) {
index c75a42c..a58f0b1 100644 (file)
@@ -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) {