From 1a7333215942a7cd6c3f88b034fd1a0f2c5fd621 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 26 Nov 2024 22:07:59 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=E9=87=8D=E5=90=AF=E5=90=8E?= =?utf8?q?=E4=B8=8A=E4=B8=8B=E6=BB=91=E5=8A=A8=E6=AD=BB=E6=9C=BA=E9=97=AE?= =?utf8?q?=E9=A2=98=EF=BC=9A=E5=8C=85=E6=8B=ACuI=E5=92=8C=E8=93=9D?= =?utf8?q?=E7=89=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../brandy/brandy_standard/thread_pri_init.c | 10 +++++----- .../nativeui/main/src/MainPresenterSample.cpp | 20 +++++++++---------- .../nativeui/main/src/MainViewSample.cpp | 2 +- .../main/src/dial/DialArcLabelView.cpp | 3 ++- .../nativeui/main/src/dial/DialLabelView.cpp | 3 ++- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c index 73e862a29..52f463281 100755 --- a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c +++ b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c @@ -447,10 +447,7 @@ static void thread_main(const void *unused) uapi_vibrator_service_init(); #endif -#ifdef SUPPORT_AT_OHOSFWK - ohos_startup(); -#endif - + #ifdef CONFIG_SYSTEM_VIEW SEGGER_SYSVIEW_Conf(); @@ -525,7 +522,10 @@ uapi_pm_remove_sleep_veto(PM_ID_DEBUG); #ifdef SUPPORT_A5133_SERVICE uapi_a5133_service_init(); #endif - +#ifdef SUPPORT_AT_OHOSFWK + ohos_startup(); +#endif + startup_post_init(); set_startup_finish_flag(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp index f194ae602..08772acea 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp @@ -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"); } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp index 2c0ef1787..a2dad7c33 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp @@ -613,7 +613,7 @@ namespace OHOS } //主界面->上拉界面 else if(mainSwipeGroup->GetCurrentPageId(0) == mainClockView->GetViewIndex() && - mainSwipeGroup->GetCurrentPageId(1) == 1) + mainSwipeGroup->GetCurrentPageId(1) == 2) { return DROPDOWN; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialArcLabelView.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialArcLabelView.cpp index dbfa000f3..40868a628 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialArcLabelView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialArcLabelView.cpp @@ -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; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialLabelView.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialLabelView.cpp index d69040315..f72621458 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialLabelView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialLabelView.cpp @@ -75,7 +75,8 @@ namespace OHOS text_ = nullptr; return false; } - text_[textLen] = '\0'; + // text_[textLen] = '\0'; + text_[textLen-1] = '\0'; return true; } -- 2.17.1