From 9939584cd326a9fee876be408dea79af5a053652 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=83=A1=E4=BC=A0=E5=86=9B?= <1224667075@qq.com> Date: Thu, 8 Aug 2024 07:46:33 +0000 Subject: [PATCH] Merge #659 into sdk602patch0626 from refs/changes/659/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 胡传军 * refs/changes/659/head: (11 commits squashed) - 增加cat1 DTMF服务 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into 0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into 0626 - 修复通讯录错误添加BUG - 合并 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into 0626 - 修复数据同步出现0 bug - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into 0626 - 优化电话 - 合并 - 修复无法退出BUG Signed-off-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/659 --- .../nativeui/alarm/src/AlarmClockModel.cpp | 6 + .../callerlog/include/CallerLogModel.h | 19 +++- .../nativeui/callerlog/src/CallerLogModel.cpp | 28 +++-- .../nativeui/makephone/src/CallingView.cpp | 59 ++++++---- .../makephone/src/MainCallingPresenter.cpp | 107 ++++++++++++++---- .../phone/src/DialingMethodPresenter.cpp | 1 + .../service/ble_service/bleservice/bleEvent.c | 3 +- .../service/msg_center/CMakeLists.txt | 55 +++++---- .../include/notify/makephone_notification.h | 1 + .../msg_center/src/msg_center_customer.cpp | 80 ++++++++++--- .../src/notify/makephone_notification.cpp | 103 ++++++++++++++++- 11 files changed, 366 insertions(+), 96 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp index ea88e66f6..6601e9765 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp @@ -18,6 +18,7 @@ #include "PlayersModel.h" #include "PhoneService.h" #include "ui_service.h" +#include "notification_manager.h" #include "../../../../../../../drivers/peripheral/config/include/ConfigModel.h" #ifdef __cplusplus @@ -713,6 +714,11 @@ uint16 AlarmClockModel::GetSliceId() int AlarmClockModel::AlarmPlayerStat() { int32_t ret; + if(NotificationManager::GetInstance()->GetWatchCallStatus()) + { + + return 0; + } // 设置回调函数 if (playerCtr.get() == nullptr) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/callerlog/include/CallerLogModel.h b/code/sdk/application/wearable/fd230app/nativeui/callerlog/include/CallerLogModel.h index 74509a712..b85d61d3a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/callerlog/include/CallerLogModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/callerlog/include/CallerLogModel.h @@ -34,21 +34,26 @@ enum PhoneStatus { void g_callTimesclean(); void g_callTimesadd(); - +int get_g_callTimes(); bool MulitplePhoneTextReplaces(); bool FindCallListInfoAndSetPriorityNumber(); void PhoneScoStatausCallback(hfp_sco_connect_state_t state); void PhoneChangeStatusCallback(const PhoneCallInfo *phoneCall); void PhoneErrorCallback(PhoneServiceErrorType type, int volume); void UsingPhoneScoStatausCallback(hfp_sco_connect_state_t state); +void StatusReset(); void UsingPhoneChangeStatusCallback(const PhoneCallInfo *phoneCall); void UsingPhoneErrorCallback(PhoneServiceErrorType type); - +void CAT1_ChangeStatusScreendisplay(int lastStatus); namespace OHOS { class CallerLogModel { public: +typedef enum { + CallSourcePhone, + CallSourceCat1, + } CallSource; void InitPhoneService(); static CallerLogModel *GetInstance(void); @@ -80,6 +85,14 @@ public: bool GetNotifyFlag(void); void SetNotifyFlag(bool flag); bool IsMulitplePhoneStatus(void); +CallSource GetCallSource(void) + { + return callsrc; + } + void SetCallSource(CallSource source) + { + callsrc = source; + } private: CallerLogModel(); CallerLogModel(const CallerLogModel &); @@ -96,6 +109,8 @@ private: bool phoneStatus{false}; // 判断是拨打界面还是呼入界面 bool callStatus{false}; // 判断是否正在接听电话 bool notifyFlag{false}; // 判断是否来电呼入 由notify生成界面 + + CallSource callsrc{CallSourcePhone}; //电话来源 }; } #ifdef __cplusplus diff --git a/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp index 6e90c21b2..f7a558031 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp @@ -94,14 +94,14 @@ static void DisableCallingTimer() } /* 状态复位 */ -static void StatusReset() +void StatusReset() { CallerLogModel::GetInstance()->SetCallStatus(false); CallerLogModel::GetInstance()->SetWaitingStatus(false); DisableCallingTimer(); // If the call is handling in the notification, the slice is not switched if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_PHONE); } else { g_isWatchCallView = false; } @@ -454,30 +454,39 @@ static void WatchFinishHandle(void) g_phoneStatus = PHONE_SINGLE_STATUS; } +void CAT1_ChangeStatusScreendisplay(int lastStatus) +{ + // If the call is handling in the notification, the slice is not switched + if (lastStatus != OPERATE_PHONE_ACTIVE && (!CallerLogModel::GetInstance()->GetNotifyFlag())) { + NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID, + PRIORITY_ONE); + } +} + static void ChangeStatusScreendisplay(int lastStatus) { if (GetScoConnectState() != HFP_SCO_STATE_CONNECTED) { if (lastStatus == HFP_HF_CALL_STATE_ACTIVE) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ACTIVE"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ACTIVE"); StatusReset(); return; } else if (lastStatus == HFP_HF_CALL_STATE_INCOMING) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_INCOMING"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_INCOMING"); } else if (GetCurrCallNum() == 1 && (lastStatus == HFP_HF_CALL_STATE_DIALING || lastStatus == HFP_HF_CALL_STATE_ALERTING)) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ALERTING"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ALERTING"); } else if (GetCurrCallNum() > 1) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] GetCurrCallNum MULITE"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] GetCurrCallNum MULITE"); DisableCallingTimer(); return; } } if (!IsCompleteCallFlow()) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] is not complete call flow"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] is not complete call flow"); return; } if (MultiplePhonesViewDisplay()) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] MultiplePhonesViewDisplay"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] MultiplePhonesViewDisplay"); return; } // If the call is handling in the notification, the slice is not switched @@ -489,7 +498,7 @@ static void ChangeStatusScreendisplay(int lastStatus) void UsingPhoneChangeStatusCallback(const PhoneCallInfo *phoneCall) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[UsingPhoneChangeStatusCallback] operate:%d, callNUm:%d, call flow:%d", + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[UsingPhoneChangeStatusCallback] operate:%d, callNUm:%d, call flow:%d", phoneCall->operate, GetCurrCallNum(), IsCompleteCallFlow()); if (phoneCall->operate == OPERATE_WATCH_FINISH && GetCurrCallNum() == 0) { @@ -640,6 +649,7 @@ void PhoneChangeStatusCallback(const PhoneCallInfo *phoneCall) { (void)memset_s(&callInfo, sizeof(PhoneCallInfo), 0, sizeof(PhoneCallInfo)); (void)memcpy_s(&callInfo, sizeof(PhoneCallInfo), phoneCall, sizeof(PhoneCallInfo)); + WEARABLE_LOGE(HILOG_MODULE_AAFWK, "PhoneChangeStatusCallback"); GraphicService::GetInstance()->PostGraphicEvent(std::bind(UsingPhoneChangeStatusCallback, &callInfo)); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp index ac557a501..9fd3061e1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp @@ -9,6 +9,11 @@ #include "wearable_log.h" #include "UiConfig.h" #include "PhoneService.h" +#include "cat1_server.h" +#include "cat1_server_hal.h" +#include "custom_utils.h" +#include "phoneaddressmodel.h" +#include "bletest.h" namespace OHOS { static constexpr uint16 MATH_ZERO = 0; @@ -215,33 +220,33 @@ bool CallingView::InitUILabelDisplay() callerDisplay->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); group->Add(callerDisplay); - callDuration = new UILabel(); - if (callDuration == nullptr) { - return false; - } - callDuration->SetPosition(194, 38, - 79, 35); - callDuration->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - callDuration->SetAlign(TEXT_ALIGNMENT_CENTER); - callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str()); - callDuration->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - callDuration->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff)); - group->Add(callDuration); - - - // currentTimes = new UILabel(); - // if (currentTimes == nullptr) { + // callDuration = new UILabel(); + // if (callDuration == nullptr) { // return false; // } - // currentTimes->SetPosition(LABEL_CURREMTTIME_POSITION_X, LABEL_CURREMTTIME_POSITION_Y, - // VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT); - // currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - // currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER); - // currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); - // currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_TIME_FONT_SIZE); - // currentTimes->SetTextColor(Color::White()); - - // group->Add(currentTimes); + // callDuration->SetPosition(194, 38, + // 79, 35); + // callDuration->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + // callDuration->SetAlign(TEXT_ALIGNMENT_CENTER); + // callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str()); + // callDuration->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + // callDuration->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff)); + // group->Add(callDuration); + + + currentTimes = new UILabel(); + if (currentTimes == nullptr) { + return false; + } + currentTimes->SetPosition(194, 38, + 79, 35); + currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER); + currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); + currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + currentTimes->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff)); + + group->Add(currentTimes); return true; } @@ -262,7 +267,11 @@ void CallingView::showdial(bool flag) void CallingView::text_updata_buf(const char *buf) { + if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) + SendDtfmStrNumberToCat1(buf[0]); + else uapi_hfp_send_DTMF_CODE(buf[0]); + char new_buf[16]={0}; const char*text_buf=label_number->GetText(); sprintf_s(new_buf,16,"%s%s",text_buf,buf); diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp index ce7dcf12d..e3280e157 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp @@ -16,7 +16,12 @@ #include "MainCallingView.h" #include "PhoneService.h" #include "WaitingHintsView.h" - +#include "cat1_server.h" +#include "cat1_server_hal.h" +#include "custom_utils.h" +#include "phoneaddressmodel.h" +#include "bletest.h" +#include "NativeAbility.h" namespace OHOS { static MainCallingPresenter *g_pMainView = nullptr; static constexpr int32 NUM_10 = 10; @@ -184,7 +189,7 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) 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; @@ -198,35 +203,99 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) return true; } else if (strcmp(view.GetViewId(), "displayHandUp") == 0 || strcmp(view.GetViewId(), "callingHandUp") == 0|| strcmp(view.GetViewId(), "dialingHandUp") == 0) { - if (strcmp(view.GetViewId(), "displayHandUp") == 0) { - // 手表拒接呼入来电 - if (RejectIncomingCall() != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::RejectIncomingCall() fail"); + if(strcmp(view.GetViewId(), "callingHandUp") == 0 || strcmp(view.GetViewId(), "dialingHandUp") == 0) + { + if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) + { + + cat1_call_hungup(); + cat1_handle_call_disconnected(); + } + else + { + 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_call_hungup(); + return true; + //#endif + + } + else + { + // 手表拒接呼入来电 + if (RejectIncomingCall() != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::RejectIncomingCall() fail"); + return false; + } } } if (FinishCall() != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::FinishCall() fail"); - return false; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::FinishCall() fail"); + return false; } return true; + } else if (strcmp(view.GetViewId(), "volumeSwitch") == 0) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::honrs show"); HonrsViewChange(); - } else if (strcmp(view.GetViewId(), "hintsHandup") == 0) { - if (!HintsHandupClick()) { - return false; - } + } else if (strcmp(view.GetViewId(), "hintsHandup") == 0) + { + + if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) + { + cat1_call_hungup(); + cat1_handle_call_disconnected(); + return true; + //#endif + + }else + { + if (!HintsHandupClick()) + { + return false; + } + } + + + + } else if (strcmp(view.GetViewId(), "answer") == 0) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::phone calling"); - // 界面的显示和隐藏 - SetMicMute(false); - // 手表接听呼入来电 - if (AcceptIncomingCall() != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::AcceptIncomingCall() fail"); - return false; + if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MakephoneNotify 11111111 "); + //#ifdef SUPPORT_CAT1_SERVICE + + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] start"); + //incomedcall_event_sendmsg_toUI("ok"); + cat1_call_answer(); + return true; + + //#endif } - return true; + else + { + // 界面的显示和隐藏 + 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)) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodPresenter.cpp index 11b1e6e2d..985b61339 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodPresenter.cpp @@ -56,6 +56,7 @@ namespace OHOS void DialingMethodPresenter::OnStop(void) { Presenter::OnStop(); + set_address_number(NULL); } bool DialingMethodPresenter::OnClick(UIView &view, const ClickEvent &event) diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index 483861e97..3e185eeb0 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -913,7 +913,8 @@ void cleanUnbindInfor(uint8_t flag)//和旧手机解绑清除配对信息 printf("json remove fail\r\n"); } set_ble_falg(0); - uapi_reboot_device(); + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0);//恢复出厂 + //uapi_reboot_device(); } } static bool ctkd_flag_ble=false; diff --git a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt index 283224b1b..2f53eb5cd 100644 --- a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt @@ -6,28 +6,6 @@ set(PUBLIC_HEADER ) set(PRIVATE_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclockmanage/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclocktimerconfig/include - ${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 - ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/sleep/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/config/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/main/include/dial - ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/bloodoxygen/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/heartrate/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/saveele/include/ - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/main/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/player/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativelauncher/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/goal/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/heart_blood/health_service/ ${CMAKE_CURRENT_SOURCE_DIR}/../../ohos_deps ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits @@ -48,7 +26,39 @@ set(PRIVATE_HEADER ${ROOT_DIR}/include/middleware/services/bts/br ${ROOT_DIR}/include/middleware/services/bts/common ) +if("FD230" IN_LIST DEFINES) +set(PRIVATE_HEADER + ${PRIVATE_HEADER} + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/callerlog/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phone/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phoneservice/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/producttest/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/system/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/sleep/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/config/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/main/include/dial + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/bloodoxygen/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/heartrate/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/saveele/include/ + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativelauncher/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/goal/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/heart_blood/health_service/ +) +else() +set(PRIVATE_HEADER + ${PRIVATE_HEADER} + ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclockmanage/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclocktimerconfig/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/callerlog/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/phoneservice/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/main/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/player/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include +) +endif() if("JS_ENABLE" IN_LIST DEFINES) set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/msg_center.cpp @@ -111,6 +121,7 @@ set(PUBLIC_HEADER ) set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/callerlog/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclockmanage/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclocktimerconfig/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/makephone_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/makephone_notification.h index ade20be40..29010aaeb 100755 --- a/code/sdk/application/wearable/service/msg_center/include/notify/makephone_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/makephone_notification.h @@ -17,6 +17,7 @@ enum class CallTimerType { namespace OHOS { void addcalllog(void); +void cat1_phone_state_change_cb(uint8_t state); class VolumeSettingView; UIViewGroup* CreatePhoneCallView(void); diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index ff6278562..c57b2be5d 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -43,6 +43,7 @@ #include "custom_runtime.h" #include "custom_utils.h" #include "SleepModel.h" +#include "PlayersModel.h" #ifdef FD230 #include "DialModelCharge.h" #include "DialModelHeartRate.h" @@ -502,13 +503,16 @@ void MsgCenterNotifyHfpIncomingProc(const Topic topic, Request* req) if (ret != EOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!"); } else { - // Prevent this from happening: + // Prevent this from happening: // When the incoming call view is displayed, the calling number is not set in CallerLogModel. CallerLogModel::GetInstance()->SetoperateNumber(callData.number, callData.number_len); } NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); - CallerLogModel::GetInstance()->SetNotifyFlag(true); - if (GetCurrCallNum() == 1) { + CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone); + + if (GetCurrCallNum() > 1) { + CallerLogModel::GetInstance()->SetNotifyFlag(true); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetCurrCallNum %d",GetCurrCallNum()); NotificationManager::GetInstance()->ShowNotify(ShowPhoneCallNotify, static_cast(topic), true); } else { EnableWaitingView(); @@ -528,6 +532,8 @@ void MsgCenterNotifyHfpPhoneProc(const Topic topic, Request* req) NotificationManager::GetInstance()->SetWatchCallStatus(false); } } + CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone); + } void MsgCenterNotifyHfpWatchProc(const Topic topic, Request* req) @@ -537,14 +543,22 @@ void MsgCenterNotifyHfpWatchProc(const Topic topic, Request* req) NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); // default not mute SetMicMute(false); - if (CallerLogModel::GetInstance()->IsMulitplePhoneStatus()) { + if (CallerLogModel::GetInstance()->IsMulitplePhoneStatus()) + { NotificationManager::GetInstance()->ShowNotify(ShowMultiPhoneCallNotify, static_cast(topic), true); } else { - NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast(topic), true); + //NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast(topic), true); + //CallerLogModel::GetInstance()->SetCallStatus(true); + + // NotificationManager::GetInstance()->StopNotify(); + // NativeAbility::GetInstance().ChangeSlice(AppViewId::VIEW_INCOMING_CALL); } NotificationManager::GetInstance()->SetWatchCallStatus(true); + } + CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone); + } @@ -731,6 +745,14 @@ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req) } else { // Prevent this from happening: // When the incoming call view is displayed, the calling number is not set in CallerLogModel. + if( NotificationManager::GetInstance()->GetWatchCallStatus()) + { + cat1_call_hungup(); + return; + } + + int ret = PlayersModel::GetInstance()->PlayerStop(); + const power_display_svr_api_t *display_api = power_display_svr_get_api(); if (display_api->get_screen_state() != SCREEN_ON) { @@ -751,8 +773,11 @@ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req) free(call_data); NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); - CallerLogModel::GetInstance()->SetNotifyFlag(true); - NotificationManager::GetInstance()->ShowNotify(ShowPhoneCallNotify, (uint16_t)topic, true); + //CallerLogModel::GetInstance()->SetNotifyFlag(true); + //NotificationManager::GetInstance()->ShowNotify(ShowPhoneCallNotify, (uint16_t)topic, true); + cat1_phone_state_change_cb(OPERATE_INCOMING); + + NotificationManager::GetInstance()->SetWatchCallStatus(true); } void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req) { @@ -760,11 +785,20 @@ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req) unused(req); if (req == NULL) return ; + if(!NotificationManager::GetInstance()->GetWatchCallStatus()) + { + return; + } + SetMicMute(false); AlarmClockModel::GetInstance()->AlarmPlayerStop(); NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); - CallerLogModel::GetInstance()->SetNotifyFlag(true); - NotificationManager::GetInstance()->ShowNotify(CreateCallingView, (uint16_t)topic, true); + //CallerLogModel::GetInstance()->SetNotifyFlag(true); + + cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE); + //NotificationManager::GetInstance()->ShowNotify(CreateCallingView, (uint16_t)topic, true); CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); + NotificationManager::GetInstance()->SetWatchCallStatus(true); + } void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req) @@ -788,21 +822,25 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req) // display_api->set_screen_set_keepon_timeout(10); //AlarmClockModel::GetInstance()->AlarmPlayerStart(); + int ret = PlayersModel::GetInstance()->PlayerStop(); + + cat1_call_dial(call_data); CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len); CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); + + cat1_phone_state_change_cb(OPERATE_DIALING); + NotificationManager::GetInstance()->SetWatchCallStatus(true); // hfp_hf_calls_info_t call; // CallChangeIncomePro(&call); } free(call_data); - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); - CallerLogModel::GetInstance()->SetNotifyFlag(true); + //CallerLogModel::GetInstance()->SetNotifyFlag(true); #ifdef FD230 - NotificationManager::GetInstance()->ShowNotify(CalldialNotify, (uint16_t)topic, true); + //NotificationManager::GetInstance()->ShowNotify(CalldialNotify, (uint16_t)topic, true); #endif - } void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req) { @@ -810,10 +848,18 @@ void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req) unused(req); // just stop the notify AlarmClockModel::GetInstance()->AlarmPlayerStop(); - if (CallerLogModel::GetInstance()->GetNotifyFlag() == true) { - NotificationManager::GetInstance()->StopNotify(); - addcalllog(); + if(!NotificationManager::GetInstance()->GetWatchCallStatus()) + { + return; } + cat1_phone_state_change_cb(OPERATE_WATCH_FINISH); + + SetMicMute(false); + // if (CallerLogModel::GetInstance()->GetNotifyFlag() == true) { + // NotificationManager::GetInstance()->StopNotify(); + // addcalllog(); + // } + NotificationManager::GetInstance()->SetWatchCallStatus(false); } @@ -1270,6 +1316,7 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { {TOPIC_EVENT_ON_TIME, MsgCenterNotifyONtimeProc},//增加整点保存数据 {TOPIC_EVENT_STEPDATA_UPDATE, MsgCenterNotifystepProc}, {TOPIC_EVENT_NEXTDAY_UPDATE, MsgCenterNotifyNextDayProc}, + {TOPIC_EVENT_HFP_INCOMMING, MsgCenterNotifyHfpIncomingProc}, {TOPIC_EVENT_HFP_PHONE_ACTIVE, MsgCenterNotifyHfpPhoneProc}, {TOPIC_EVENT_HFP_FINISHED, MsgCenterNotifyHfpPhoneProc}, @@ -1305,6 +1352,7 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { {TOPIC_EVENT_CAT1_CALLCONNTED, MsgCenterNotifyCat1CallConnectedProc}, {TOPIC_EVENT_CAT1_CALLENDED, MsgCenterNotifyCat1CallEndedProc}, {TOPIC_EVENT_CAT1_CALLDIAL, MsgCenterNotifyCat1dialProc}, + {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, MsgCenterNotifyCat1SignalUpdateProc}, {TOPIC_EVENT_CAT1_POWER_ON, MsgCenterNotifyCat1PowerOnProc}, {TOPIC_EVENT_CAT1_POWER_OFF, MsgCenterNotifyCat1PowerOffProc}, 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 957308e9e..e68d10f39 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 @@ -26,6 +26,7 @@ #include "phoneaddressmodel.h" #include "components/ui_label_button.h" #include "bletest.h" +#include "NativeAbility.h" // #define NOTIFY_THREE_SECONDS 3000 // #define NOTIFY_ONE_SECOND 1000 // #define NOTIFY_THIRTY_SECONDS 30000 @@ -136,8 +137,6 @@ void calllog_info_init() info.creationTime = tmptime; info.callDurTime=0; info.telLen=len; - - } void addcalllog() @@ -157,6 +156,106 @@ void addcalllog() } +static int g_callOperate = OPERATE_NO_OPE; + + +static void DialingHandle(void) +{ + CallerLogModel::GetInstance()->SetDialingStatus("正在拨号"); + CallerLogModel::GetInstance()->SetMakePhoneStatus(true); + +} + +static void AlertingHandle(void) +{ + CallerLogModel::GetInstance()->SetDialingStatus("正在响铃"); + CallerLogModel::GetInstance()->SetMakePhoneStatus(true); +} + +static void IncomingHandle(void) +{ + CallerLogModel::GetInstance()->SetMakePhoneStatus(false); +} + +static void WaitingOpreate() +{ + + CallerLogModel::GetInstance()->SetCallStatus(false); + CallerLogModel::GetInstance()->SetWaitingStatus(true); + // If the call is handling in the notification, the slice is not switched + NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID, + PRIORITY_ONE); + +} + +static void WatchActiveHandle() +{ + CallerLogModel::GetInstance()->SetCallStatus(true); + CallerLogModel::GetInstance()->SetWaitingStatus(false); + +} + +static void PhoneActiveHandle(void) +{ + +} + +static void WatchFinishHandle(void) +{ + if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL || + CallerLogModel::GetInstance()->GetNotifyFlag()) + { + StatusReset(); + } +} + +void cat1_phone_state_change_cb(uint8_t state) +{ + g_callOperate = state; + + switch (g_callOperate) { + case OPERATE_DIALING: + // 显示正在呼出界面 + DialingHandle(); + call_stat=0; + calllog_info_init(); + break; + case OPERATE_ALERTING: + // 显示对方响铃 + AlertingHandle(); + break; + case OPERATE_INCOMING: + // 显示电话呼入 + IncomingHandle(); + calllog_info_init(); + call_stat=2; + break; + case OPERATE_WAITING: + // 震动一下,提示有新电话呼入 还未对齐 + WaitingOpreate(); + + return; + case OPERATE_WATCH_ACTIVE: + // 手表接听,显示界面 + if(call_stat==2) + call_stat=1; + WatchActiveHandle(); + break; + case OPERATE_PHONE_HOLD: + // 挂起状态,不做处理 + return; + case OPERATE_WATCH_FINISH: + WatchFinishHandle(); + addcalllog(); + return; + case OPERATE_WATCH_REJECT: + default: + break; + } + CAT1_ChangeStatusScreendisplay(g_callOperate); +} + + // PhoneCallInfo tmp; // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeFinishPro] start g_scoFlag = %d, g_currCallNum = %d", -- 2.17.1