优化重点弹窗页面按键退出逻辑 3099/2 3099/head 3107/target/1
authorluozheng <1732036298@qq.com>
Fri, 16 Jan 2026 10:21:32 +0000 (18:21 +0800)
committerluozheng <1732036298@qq.com>
Fri, 16 Jan 2026 10:21:32 +0000 (18:21 +0800)
code/sdk/application/wearable/fd272/service/msg_center/src/notify/charge_notification.cpp

index b33c2d8..aa8edc0 100644 (file)
@@ -663,7 +663,14 @@ namespace OHOS
 
     bool lowppowrViewEventListener::OnKeyAct(UIView &view, const KeyEvent &event)
     {
-        NotificationManager::GetInstance()->StopNotify();
+        unsigned short keyID = event.GetKeyId();
+        unsigned short keyState = event.GetState();
+
+        // 如果是power键,且是亮屏状态,按键释放就返回上一级
+        if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0)
+        {
+            NotificationManager::GetInstance()->StopNotify();
+        }
         return true;
     }