1.增加常亮屏runtime,解决长亮屏界面被弹窗取消常亮屏 1192/2
authorluozheng <1732036298@qq.com>
Tue, 15 Oct 2024 07:55:57 +0000 (15:55 +0800)
committerluozheng <1732036298@qq.com>
Tue, 15 Oct 2024 07:55:57 +0000 (15:55 +0800)
2.#697,解决,手表开机和关机时增加震动(需求)

code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp
code/sdk/drivers/peripheral/utils/custom_runtime.c
code/sdk/drivers/peripheral/utils/custom_runtime.h
code/sdk/drivers/peripheral/utils/custom_utils.c

index 1677ffc..f6ac1c7 100644 (file)
@@ -300,6 +300,7 @@ extern "C" uint8_t uapi_dev_runtime_get_lock_status(void);
 #endif
 #include "bleEvent.h"
 #include "../../../../../../drivers/peripheral/config/include/ConfigModelC.h"
+#include "vibrator_service.h"
 
 namespace OHOS
 {
@@ -566,6 +567,9 @@ namespace OHOS
                     OHOS::MainModel::GetInstance().setDialState(OHOS::DialState::LOCK, true);  
                 }  
             }
+
+            // 开机增加震动 页面启动震动一次
+            ui_api_vibrate_once_func();
         }
         // 注册开机时间  
         SystemLogData systemlog;  
index af8badf..1da2833 100644 (file)
@@ -56,6 +56,7 @@
 #include "ui_serviceC.h"
 
 #include "languagecode/include/LanguageSwitchModel.h"
+#include "custom_runtime.h"
 
 extern "C" errcode_t uapi_pm_add_sleep_veto(pm_id_t veto_id);
 extern "C" errcode_t uapi_pm_remove_sleep_veto(pm_id_t veto_id);
@@ -204,6 +205,11 @@ extern "C"
         {
             return;
         }
+        if(uapi_dev_runtime_get_screen_always_on_status() == 1)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ScreenTurnOff] screen is always on not can turn off");
+            return;
+        }
 #if defined(SUPPORT_POWER_MANAGER)
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScreenTurnOff] timeout auto");
         set_back_to_home_interval(g_interval);
index 50c0685..4a8c231 100644 (file)
@@ -99,6 +99,7 @@ typedef struct
     uint8_t respiratory_training_status; //呼吸训练开始状态
     uint8_t heartrate_detect_status;//主动检测心率状态
     uint8_t factory_test_status;//产测模式状态
+    uint8_t screen_always_on_status;//屏幕是否常亮状态
 
 } runtime_status_t;
 
@@ -430,6 +431,15 @@ uint8_t uapi_dev_runtime_get_respiratory_training_status(void)
     return g_runtime.respiratory_training_status;
 }
 
+//设置是否常亮状态
+void uapi_dev_runtime_set_screen_always_on_status(uint8_t status)
+{
+    g_runtime.screen_always_on_status = status;
+}
+uint8_t uapi_dev_runtime_get_screen_always_on_status(void)
+{
+    return g_runtime.screen_always_on_status;
+}
 // sleep mode flag
 void uapi_sleep_mode_flag_set(uint8_t flag)
 {
index ef2b6cb..39ef464 100644 (file)
@@ -174,6 +174,10 @@ uint8_t uapi_dev_runtime_get_motion_recognition_status(void);
 //呼吸训练
 void uapi_dev_runtime_set_respiratory_training_status(uint8_t status);
 uint8_t uapi_dev_runtime_get_respiratory_training_status(void);
+
+//设置屏幕是否常亮
+void uapi_dev_runtime_set_screen_always_on_status(uint8_t status);
+uint8_t uapi_dev_runtime_get_screen_always_on_status(void);
 /***************************************cat1 runtime 变量设置获取函数**************************************************/
 
 
index bc0e0f7..d0f2fdf 100644 (file)
@@ -1101,12 +1101,18 @@ void ScreenAlwaysOnCtr(uint8_t turnOnFlag)
         {
             display_api->turn_on_screen();
         }
+
+        uapi_dev_runtime_set_screen_always_on_status(1);
+
         //当设置的值是-1 的时候,设置屏幕常亮
         display_api->set_screen_set_keepon_timeout(-1);
         s_screen_always_on = true;
     }
     else
     {
+
+        uapi_dev_runtime_set_screen_always_on_status(0);
+
         display_api->set_screen_set_keepon_timeout(0);
         s_screen_always_on = false;
     }