添加关机状态的runtime
authorluozheng <1732036298@qq.com>
Wed, 30 Oct 2024 10:09:07 +0000 (18:09 +0800)
committerluozheng <1732036298@qq.com>
Wed, 30 Oct 2024 10:09:07 +0000 (18:09 +0800)
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp
code/sdk/drivers/peripheral/utils/custom_runtime.c
code/sdk/drivers/peripheral/utils/custom_runtime.h

index 18ff179..4eaadf6 100644 (file)
@@ -13,6 +13,7 @@
 #include "bleEvent.h"
 #include "AppViewIDs.h"
 #include "NativeAbility.h"
+#include <custom_runtime.h>
 namespace OHOS
 {
 
@@ -66,9 +67,9 @@ namespace OHOS
             do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0);
             break;
         case 3:
-            #ifdef SUPPORT_BLE_SERVICE
+#ifdef SUPPORT_BLE_SERVICE
             cleanUnbindInfor(1);
-            #endif
+#endif
         default:
             break;
         }
@@ -82,14 +83,17 @@ namespace OHOS
     //  0 关机 1 重启 2 恢复出厂 3解绑恢复出厂
     void ShutDownImageAnimatorView::ShutDownImageAnimator_Start(int type)
     {
-        OperationType = type;
-        shutDownImageAnimatorView->Start();
-        isShutDownImageAnimatorStart = true;
-        ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 关机动画已经开始了不能息屏
+        OperationType = type; // 保存操作类型:0 关机 1 重启 2 恢复出厂 3解绑恢复出厂
         
-        uapi_take_to_wake(0);//关闭抬腕亮屏,和息屏
+        shutDownImageAnimatorView->Start(); // 开始播放关机动画
+
+        uapi_dev_runtime_set_shutting_down_status(1);//设置关机状态runtime值
+
+        ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 关机动画已经开始了不能息屏
+
+        uapi_take_to_wake(0); // 关闭抬腕亮屏,和息屏
 
-        NativeAbility::GetInstance().SetCurSlicePriority(0); //设置Slice优先级为最高,防止弹窗出现
+        NativeAbility::GetInstance().SetCurSlicePriority(0); // 设置Slice优先级为最高,防止弹窗出现
 
         // 关机增加震动
         ui_api_vibrate_once_func();
@@ -98,6 +102,15 @@ namespace OHOS
     // 获取开机动画是否已经开始
     bool ShutDownImageAnimatorView::GetShutDownImageAnimatorIsStart(void)
     {
+        if (uapi_dev_runtime_get_shutting_down_status() == 1)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "正在进行关机动画");
+            isShutDownImageAnimatorStart = true;
+        }
+        else
+        {
+            isShutDownImageAnimatorStart = false;
+        }
         return isShutDownImageAnimatorStart;
     }
 
index d2315e4..970d29f 100644 (file)
@@ -101,6 +101,7 @@ typedef struct
     uint8_t factory_test_status;//产测模式状态
     uint8_t screen_always_on_status;//屏幕是否常亮状态
     uint8_t wear_status;
+    uint8_t shutting_down_status;//是否处于关机状态
 } runtime_status_t;
 
 
@@ -431,6 +432,16 @@ uint8_t uapi_dev_runtime_get_respiratory_training_status(void)
     return g_runtime.respiratory_training_status;
 }
 
+//设置关机状态
+void uapi_dev_runtime_set_shutting_down_status(uint8_t status)
+{
+    g_runtime.shutting_down_status = status;
+}
+uint8_t uapi_dev_runtime_get_shutting_down_status(void)
+{
+    return g_runtime.shutting_down_status;
+}
+
 //设置是否常亮状态
 void uapi_dev_runtime_set_screen_always_on_status(uint8_t status)
 {
index 00ae3b7..26bd585 100644 (file)
@@ -178,6 +178,10 @@ 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);
+
+//关机状态
+void uapi_dev_runtime_set_shutting_down_status(uint8_t status);
+uint8_t uapi_dev_runtime_get_shutting_down_status(void);
 /***************************************cat1 runtime 变量设置获取函数**************************************************/