From: luozheng <1732036298@qq.com> Date: Wed, 31 Dec 2025 07:01:17 +0000 (+0800) Subject: 1.解决电话界面内存泄漏 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F3006%2Fhead;p=mirrors%2FFD230.git 1.解决电话界面内存泄漏 2.解决蓝牙电话不能接听和挂断bug --- diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/include/MainCallingPresenter.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/include/MainCallingPresenter.h index 67d7e38f3..9883b057f 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/include/MainCallingPresenter.h +++ b/code/sdk/application/wearable/fd272/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/fd272/nativeapp/nativeui/makephone/src/CallingView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/src/CallingView.cpp index a55e4e38d..edd28acc0 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/src/CallingView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/src/CallingView.cpp @@ -386,7 +386,6 @@ void CallingView::text_updata_buf(const char *buf) const char*text_buf=label_number->GetText(); sprintf_s(new_buf,16,"%s%s",text_buf,buf); label_number->SetText(new_buf); - RootView::GetInstance()->Invalidate(); return; } diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp index 654e5d4e0..f97e9a3a3 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp @@ -65,19 +65,11 @@ 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::HonrsViewChange() { @@ -191,14 +183,12 @@ bool MainCallingPresenter::HintsHandupClick() bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) { -#ifdef SUPPORT_CAT1_SERVICE UNUSED(event); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",view.GetViewId()); if (!InitPointerValue()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::InitPointerValue error"); return false; } - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",view.GetViewId()); if (strcmp(view.GetViewId(), "microphoneChange") == 0) { if (changeImage == 0) { changeImage = 1; @@ -212,16 +202,7 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) return false; view_->GetScreenView()->GetImageMicrophone()->SetSrc(PNG_230_MICROPHONE_CLOSE_IMAGE_PATH); } - if(CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) - { - SetMicMutecat1(true); - } - else - { - SetMicMute(true); - } - - + SetMicMute(true); } else { changeImage = 0; if(CallerLogModel::GetInstance()->GetCallStatus()) @@ -234,59 +215,25 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) return false; view_->GetScreenView()->GetImageMicrophone()->SetSrc(PNG_230_MICROPHONE_OPEN_IMAGE_PATH); } - if(CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) - { - SetMicMutecat1(false); - } - else - { - SetMicMute(false); - } + SetMicMute(false); } return true; } else if (strcmp(view.GetViewId(), "displayHandUp") == 0 || strcmp(view.GetViewId(), "callingHandUp") == 0|| strcmp(view.GetViewId(), "dialingHandUp") == 0) { if(strcmp(view.GetViewId(), "callingHandUp") == 0 || strcmp(view.GetViewId(), "dialingHandUp") == 0) { - if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) - { - - { - sos_falg_clean(); - } - - //cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); - - cat1_call_hungup_timer(); - - - } - else - { - if (FinishCall() != 0) { + if (FinishCall() != 0) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::FinishCall() fail"); return false; - } } return true; } if (strcmp(view.GetViewId(), "displayHandUp") == 0) { - if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) - { - //cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); - cat1_call_hungup_timer(); - return true; - //#endif - - } - else - { - // 手表拒接呼入来电 - if (RejectIncomingCall() != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::RejectIncomingCall() fail"); - return false; - } + // 手表拒接呼入来电 + if (RejectIncomingCall() != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::RejectIncomingCall() fail"); + return false; } } if (FinishCall() != 0) { @@ -300,51 +247,21 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) HonrsViewChange(); } else if (strcmp(view.GetViewId(), "hintsHandup") == 0) { - - if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) - { - //cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); - cat1_call_hungup_timer(); - - return true; - //#endif - - }else - { - if (!HintsHandupClick()) - { - return false; - } - } - - - - + if (!HintsHandupClick()) + { + return false; + } } else if (strcmp(view.GetViewId(), "answer") == 0) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::phone calling"); - if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MakephoneNotify 11111111 "); - cat1_call_answer(); - return true; - - //#endif - } - else - { - // 界面的显示和隐藏 - SetMicMute(false); - - // 手表接听呼入来电 - if (AcceptIncomingCall() != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::AcceptIncomingCall() fail"); - return false; - } - return true; + // 界面的显示和隐藏 + SetMicMute(false); + // 手表接听呼入来电 + if (AcceptIncomingCall() != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::AcceptIncomingCall() fail"); + return false; } - - + return true; } else if ((strcmp(view.GetViewId(), "dial") == 0)) { @@ -443,7 +360,7 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) NativeAbility::GetInstance().EnterSlice(VIEW_BLUETOOTH_EARPHONE); } -#endif +// #endif return true; } diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/src/MainCallingView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/src/MainCallingView.cpp index 8f16e2eb5..3f1db60c0 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/src/MainCallingView.cpp +++ b/code/sdk/application/wearable/fd272/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()); } @@ -158,8 +157,7 @@ void MainCallingView::update_headset_state(uint8_t data) { if(callView) { - callView->update_headset_state(data); - RootView::GetInstance()->Invalidate(); + callView->update_headset_state(data); } } @@ -175,13 +173,13 @@ void MainCallingView::OnStart() return; } - RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MainCallingPresenter::GetInstance(); + 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);