From: luozheng <1732036298@qq.com> Date: Mon, 29 Dec 2025 06:34:01 +0000 (+0800) Subject: 解决开启4G后长按功能按键死机问题,230和n9修改 X-Git-Url: http://git.snicker.com.cn/css/html/static/gitweb.css?a=commitdiff_plain;h=6869c1c8d016c9fb23c9c9eef378d0fa680d0d24;p=mirrors%2FFD230.git 解决开启4G后长按功能按键死机问题,230和n9修改 --- diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/MainCallingPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/MainCallingPresenter.h index 67d7e38f3..9883b057f 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/MainCallingPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/MainCallingPresenter.h @@ -26,9 +26,7 @@ public: ~MainCallingPresenter() override; void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static MainCallingPresenter *GetInstance(); void HonrsViewChange(); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp index 9a4ca9f3e..e0b0082d1 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp @@ -65,18 +65,10 @@ MainCallingPresenter *MainCallingPresenter::GetInstance() void MainCallingPresenter::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::OnStart"); - - } -void MainCallingPresenter::OnPause(void) {} - -void MainCallingPresenter::OnResume(void) {} - -void MainCallingPresenter::OnStop(void) -{ - RootView::GetInstance()->ClearOnKeyActListener(); - +void MainCallingPresenter::OnResume(void) { + RootView::GetInstance()->SetOnKeyActListener(this); } void MainCallingPresenter::HonrsViewChange() diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingView.cpp index 8f16e2eb5..c92e6a741 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingView.cpp @@ -145,7 +145,6 @@ void MainCallingView::updataCallingname(void) if(displayView) displayView->updataCallingname(); - RootView::GetInstance()->Invalidate(); //callerDisplay->SetText(CallerLogModel::GetInstance()->Getphonename().c_str()); } @@ -159,7 +158,6 @@ void MainCallingView::update_headset_state(uint8_t data) if(callView) { callView->update_headset_state(data); - RootView::GetInstance()->Invalidate(); } } @@ -175,13 +173,12 @@ void MainCallingView::OnStart() return; } - RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MainCallingPresenter::GetInstance(); - RootView::GetInstance()->SetOnKeyActListener(keyactListener); - RootView::GetInstance()->Add(displayGroup); - RootView::GetInstance()->Add(callingGroup); - RootView::GetInstance()->Add(screenGroup); - RootView::GetInstance()->Add(waitingGroup); + AddViewToRootContainer(displayGroup); + AddViewToRootContainer(callingGroup); + AddViewToRootContainer(screenGroup); + AddViewToRootContainer(waitingGroup); + waitingGroup->SetVisible(false); callingGroup->SetVisible(false); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp index 0ded82eb4..3a4058513 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp @@ -439,7 +439,6 @@ namespace OHOS if (HandleAlarmOrFindWatchNotify()) return; GraphicService::GetInstance()->PostGraphicEvent(std::bind(SOSKeyLongPress)); - SOSKeyLongPress(); } /*注册功能键的长按事件*/ diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/notify/phone_crt.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/phone_crt.cpp index ada010a06..27a529f34 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/src/notify/phone_crt.cpp +++ b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/phone_crt.cpp @@ -313,8 +313,11 @@ UIViewGroup* CALL_FAIL_HINT(void) if (FAILHintView == nullptr) { FAILHintView = new UIViewGroup(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!"); - + if(FAILHintView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!"); + return nullptr; + } } FAILHintView->SetPosition(0, 0); FAILHintView->SetWidth(Screen::GetInstance().GetWidth()); @@ -872,7 +875,8 @@ void phone_VibratorFunc(void) custom_VibratorFunc_int(0); } } - + + diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/include/MainCallingPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/include/MainCallingPresenter.h index 67d7e38f3..9883b057f 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/include/MainCallingPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/include/MainCallingPresenter.h @@ -26,9 +26,7 @@ public: ~MainCallingPresenter() override; void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static MainCallingPresenter *GetInstance(); void HonrsViewChange(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp index 9a4ca9f3e..e0b0082d1 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp @@ -65,18 +65,10 @@ MainCallingPresenter *MainCallingPresenter::GetInstance() void MainCallingPresenter::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::OnStart"); - - } -void MainCallingPresenter::OnPause(void) {} - -void MainCallingPresenter::OnResume(void) {} - -void MainCallingPresenter::OnStop(void) -{ - RootView::GetInstance()->ClearOnKeyActListener(); - +void MainCallingPresenter::OnResume(void) { + RootView::GetInstance()->SetOnKeyActListener(this); } void MainCallingPresenter::HonrsViewChange() diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingView.cpp index 8f16e2eb5..c92e6a741 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingView.cpp @@ -145,7 +145,6 @@ void MainCallingView::updataCallingname(void) if(displayView) displayView->updataCallingname(); - RootView::GetInstance()->Invalidate(); //callerDisplay->SetText(CallerLogModel::GetInstance()->Getphonename().c_str()); } @@ -159,7 +158,6 @@ void MainCallingView::update_headset_state(uint8_t data) if(callView) { callView->update_headset_state(data); - RootView::GetInstance()->Invalidate(); } } @@ -175,13 +173,12 @@ void MainCallingView::OnStart() return; } - RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MainCallingPresenter::GetInstance(); - RootView::GetInstance()->SetOnKeyActListener(keyactListener); - RootView::GetInstance()->Add(displayGroup); - RootView::GetInstance()->Add(callingGroup); - RootView::GetInstance()->Add(screenGroup); - RootView::GetInstance()->Add(waitingGroup); + AddViewToRootContainer(displayGroup); + AddViewToRootContainer(callingGroup); + AddViewToRootContainer(screenGroup); + AddViewToRootContainer(waitingGroup); + waitingGroup->SetVisible(false); callingGroup->SetVisible(false); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp index 4b3fe8097..470796cc5 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp @@ -445,7 +445,6 @@ namespace OHOS if (HandleAlarmOrFindWatchNotify()) return; GraphicService::GetInstance()->PostGraphicEvent(std::bind(SOSKeyLongPress)); - SOSKeyLongPress(); } /*注册功能键的长按事件*/ diff --git a/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp b/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp index b562c356a..27a529f34 100644 --- a/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp +++ b/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp @@ -313,8 +313,11 @@ UIViewGroup* CALL_FAIL_HINT(void) if (FAILHintView == nullptr) { FAILHintView = new UIViewGroup(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!"); - + if(FAILHintView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!"); + return nullptr; + } } FAILHintView->SetPosition(0, 0); FAILHintView->SetWidth(Screen::GetInstance().GetWidth());