From: hcj <1224667075@qq.com> Date: Fri, 2 Aug 2024 07:52:54 +0000 (+0800) Subject: 增加通话记录回拨,修复通话记录不刷新BUG X-Git-Tag: release_V1.2.70_20241020_135402~713^2~1 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=88f98fd2f65f1d33d8990b503b9e8164b54a0e18;p=mirrors%2FFD230.git 增加通话记录回拨,修复通话记录不刷新BUG --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhonePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhonePresenter.cpp index 5e1affc07..fe02bfd88 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhonePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhonePresenter.cpp @@ -13,7 +13,7 @@ #include #include "iostream" #include "UiConfig.h" - +#include "phone/include/phoneaddressmodel.h" namespace OHOS { @@ -71,6 +71,13 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s OnClick", curViewId.c_str()); NativeAbility::GetInstance().EnterSlice(VIEW_PHONEDIR); } + else + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s OnClick", curViewId.c_str()); + set_address_number((char *)view.GetViewId()); + NativeAbility::GetInstance().EnterSlice(VIEW_DIALING_METHOD); + } + return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp index 614bdb7a8..79d978411 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp @@ -43,7 +43,7 @@ namespace OHOS } button->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h); button->SetViewId(buttonconfig.ViewId); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "----------%s ---",buttonconfig.ViewId); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "----------%s ---",buttonconfig.ViewId); button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); if(clickListener!=NULL) button->SetOnClickListener(clickListener); @@ -279,9 +279,18 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",(info + i - 1)->tel); char buf[20]={0}; + sprintf_s(buf,20,"%s",(const char*)(info + i - 1)->tel); - buttonconfig.str=buf; - button_calllog[i]=SetTheButton_ext(buttonconfig,NULL); + char name[30]={0}; + if(get_phone_addrss_name(name,buf)) + { + buttonconfig.str=name; + }else + { + buttonconfig.str=buf; + } + buttonconfig.ViewId=(const char*)(info + i - 1)->tel; + button_calllog[i]=SetTheButton_ext(buttonconfig,ButtonOnclickListen); if(button_calllog[i]==nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::button_calllog new fail!"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h index 08c14fec4..bbd3f1614 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h @@ -256,6 +256,8 @@ uint32 GetCallCodec(void); // 添加通话进通话记录文件 void AddToCallLog(CallLogInfo *info); +void AddToCallLog_CAT1(CallLogInfo *callInfo); + int uapi_hfp_disconnect(void); int uapi_hfp_connect(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp index b2c9675f9..1d7837629 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -848,7 +848,23 @@ END: info = nullptr; return ret; } +void AddToCallLog_CAT1(CallLogInfo *callInfo) +{ + if (callInfo == nullptr) { + return; + } + int fileSize = GetCallLogFileSize(); + int num = fileSize / sizeof(CallLogInfo); + if (num >= CALL_LOG_MAX_NUM) { + int ret = RemoveFirstCallLog(); + if (ret == OHOS_FAILURE) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddToCallLogPro] RemoveFirstCallLog error"); + return; + } + } + AddToCallLog(callInfo); +} // 添加通话记录 static void AddToCallLogPro(PhoneCallInfo *callInfo) { @@ -902,6 +918,8 @@ static void AddToCallLogPro(PhoneCallInfo *callInfo) AddToCallLog(&info); } + + // 获取通话记录 int GetCallLog(CallLogInfo **info, int *num) { diff --git a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt index bbd759b58..549591261 100644 --- a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt @@ -11,6 +11,7 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/callerlog/include ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phone/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phoneservice/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/phoneservice/include ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/producttest/include ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/system/include @@ -119,6 +120,7 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phone/include ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/config/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/callerlog/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phoneservice/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/phoneservice/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/main/include ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/main/include/dial diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp index 6f770759b..810812f42 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp @@ -139,7 +139,7 @@ void addcalllog() info.status=CALL_MISSED; if(call_stat<=2) { - AddToCallLog(&info); + AddToCallLog_CAT1(&info); call_stat=3; }