解决重启后上下滑动死机问题:包括uI和蓝牙 1466/1 1466/head
authorluozheng <1732036298@qq.com>
Tue, 26 Nov 2024 14:07:59 +0000 (22:07 +0800)
committerluozheng <1732036298@qq.com>
Tue, 26 Nov 2024 14:07:59 +0000 (22:07 +0800)
code/sdk/application/brandy/brandy_standard/thread_pri_init.c
code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialArcLabelView.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialLabelView.cpp

index 73e862a..52f4632 100755 (executable)
@@ -447,10 +447,7 @@ static void thread_main(const void *unused)
     uapi_vibrator_service_init();\r
 #endif\r
 \r
-#ifdef SUPPORT_AT_OHOSFWK\r
-    ohos_startup();\r
-#endif\r
-    \r
+\r
 \r
 #ifdef CONFIG_SYSTEM_VIEW\r
     SEGGER_SYSVIEW_Conf();\r
@@ -525,7 +522,10 @@ uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
 #ifdef SUPPORT_A5133_SERVICE\r
     uapi_a5133_service_init();\r
 #endif\r
-\r
+#ifdef SUPPORT_AT_OHOSFWK\r
+    ohos_startup();\r
+#endif\r
+    \r
     startup_post_init();\r
 \r
     set_startup_finish_flag();\r
index f194ae6..08772ac 100644 (file)
@@ -635,7 +635,7 @@ namespace OHOS
     }
     /* -------------------------------------------------------------------------- */
     // 声明定时器变量
-    static osTimerId_t g_timer = NULL;
+    static osTimerId_t g_timer = nullptr;
     static uint8_t UPDATETIME = 20; // 20秒
     uint8_t MainPresenterSample::g_PullUpDownTimes = UPDATETIME;
 
@@ -679,16 +679,16 @@ namespace OHOS
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainPresenterSample::PullUpDown_StartTimer");
         /* -------------------------- 1.检查定时器是否已经存在,如果存在则返回 ------------------------- */
-        if (g_timer != NULL)
+        if (g_timer != nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPresenterSample::PullUpDown_StartTimer Timer already exists!!");
             return;
         }
 
         /* --------------------------------- 2.创建定时器 -------------------------------- */
-        g_timer = osTimerNew((osTimerFunc_t)PullUpDown_TimerCallback, osTimerPeriodic, NULL, NULL);
+        g_timer = osTimerNew((osTimerFunc_t)PullUpDown_TimerCallback, osTimerPeriodic, nullptr, nullptr);
         // 检查定时器创建是否成功
-        if (g_timer == NULL)
+        if (g_timer == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPresenterSample::PullUpDown_StartTimer Timer create failed!!");
             return;
@@ -698,15 +698,15 @@ namespace OHOS
         int tick = osMs2Tick(interval);
         /* --------------------------------- 4.启动定时器 -------------------------------- */
         osStatus_t ret = osTimerStart(g_timer, tick);
-        /* -------------------- 5.检查定时器启动是否成功,如果启动失败,删除定时器并置为 NULL -------------------- */
+        /* -------------------- 5.检查定时器启动是否成功,如果启动失败,删除定时器并置为 nullptr -------------------- */
         if (ret != osOK)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[PullUpDown_StartTimer] osTimerDelete failed, ret = %lx!!", ret);
-            if (g_timer != NULL)
+            if (g_timer != nullptr)
             {
                 ret = osTimerDelete(g_timer);
             }
-            g_timer = NULL;
+            g_timer = nullptr;
             return;
         }
         return;
@@ -719,16 +719,16 @@ namespace OHOS
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainPresenterSample::PullUpDown_StopTimer");
         // 检查定时器是否存在
-        if (g_timer != NULL)
+        if (g_timer != nullptr)
         {
             osTimerStop(g_timer);
-            // 删除定时器并置为 NULL
+            // 删除定时器并置为 nullptr
             osStatus_t ret = osTimerDelete(g_timer);
             if (ret != osOK)
             {
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "osTimerDelete failed, ret = %lx!!", ret);
             }
-            g_timer = NULL;
+            g_timer = nullptr;
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "g_timer stop success");
         }
     }
index 2c0ef17..a2dad7c 100644 (file)
@@ -613,7 +613,7 @@ namespace OHOS
         }
         //主界面->上拉界面
         else if(mainSwipeGroup->GetCurrentPageId(0) == mainClockView->GetViewIndex() &&
-            mainSwipeGroup->GetCurrentPageId(1) == 1)
+            mainSwipeGroup->GetCurrentPageId(1) == 2)
         {
             return DROPDOWN;
         }
index dbfa000..40868a6 100644 (file)
@@ -65,7 +65,8 @@ bool DialArcLabelView::SetTextWithWildcard(const char* text)
         text_ = nullptr;
         return false;
     }
-    text_[textLen] = '\0';
+    // text_[textLen] = '\0';
+    text_[textLen-1] = '\0';
     return true;
 }
 
index d690403..f726214 100644 (file)
@@ -75,7 +75,8 @@ namespace OHOS
             text_ = nullptr;
             return false;
         }
-        text_[textLen] = '\0';
+        // text_[textLen] = '\0';
+        text_[textLen-1] = '\0';
         return true;
     }