From 1e47e08bccbb29ec5629b2fc1840c56c5f71f835 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=83=A1=E4=BC=A0=E5=86=9B?= <1224667075@qq.com> Date: Sat, 21 Sep 2024 04:47:31 +0000 Subject: [PATCH] Merge #996 into sdk602patch0626 from refs/changes/996/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 修复同步实时运动数据存在的BUG * refs/changes/996/head: (4 commits squashed) - 修复同步实时运动数据存在的BUG - 蓝牙文件取消传输修改 - 电话bug综合修复 - 电话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/996 --- .../nativeui/callerlog/src/CallerLogModel.cpp | 51 ++----- .../makephone/include/MainCallingPresenter.h | 2 + .../makephone/src/MainCallingPresenter.cpp | 5 + .../makephone/src/MainCallingView.cpp | 6 + .../phoneservice/src/PhoneService.cpp | 10 +- .../service/ble_service/bleservice/bleEvent.c | 96 ++++++++++++- .../service/ble_service/bleservice/bleEvent.h | 6 +- .../msg_center/src/msg_center_customer.cpp | 35 ++--- .../src/notify/makephone_notification.cpp | 131 +++++++----------- .../msg_center/src/notify/transmitting.cpp | 44 ++++-- 10 files changed, 210 insertions(+), 176 deletions(-) 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 a48fbb3de..13cfe6eac 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp @@ -17,6 +17,10 @@ #include "notification_manager.h" #include "osal_timer.h" #include "cmsis_os2.h" +#include "custom_utils.h" +#include "ConfigModel.h" +#include "vibrator_service.h" +#include "custom_runtime.h" #ifdef __cplusplus extern "C" { @@ -301,17 +305,6 @@ static void IncomingHandle(void) } -static osTimerId_t Waiting_timer=NULL; - -static void RejectIncomingCall_Timer_CallBack(int data) -{ - if(RejectIncomingCall() != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error"); - return ; - } - osTimerDelete(Waiting_timer); - Waiting_timer = NULL; -} // 来电等待界面 static void WaitingOpreate() { @@ -325,30 +318,12 @@ static void WaitingOpreate() if(!CallerLogModel::GetInstance()->get_RejectIncomingCall_falg()) { - uint32_t tick; - osStatus_t retTimer; - if(Waiting_timer!=NULL) - { - if(RejectIncomingCall() != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error"); - return ; - } - osTimerDelete(Waiting_timer); - Waiting_timer = NULL; - return; - } - - Waiting_timer = osTimerNew((osTimerFunc_t)RejectIncomingCall_Timer_CallBack, osTimerOnce, NULL, NULL); - tick =3000;// osMs2Tick(1000); - retTimer = osTimerStart(Waiting_timer, tick); - if (retTimer != osOK && Waiting_timer != NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer); - osTimerDelete(Waiting_timer); - Waiting_timer = NULL; - return ; + if(RejectIncomingCall() != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error"); + return ; } CallerLogModel::GetInstance()->set_RejectIncomingCall_falg(1); - + CustomEventPublish(TOPIC_EVENT_HFP_HINT,NULL,0); } else { @@ -358,18 +333,8 @@ static void WaitingOpreate() } return; } - } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[WaitingOpreate] WaitingOpreate"); - CallerLogModel::GetInstance()->SetCallStatus(false); - CallerLogModel::GetInstance()->SetWaitingStatus(true); - // If the call is handling in the notification, the slice is not switched - if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { - NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID, - PRIORITY_ONE); - } else { - g_isWatchCallView = true; - } } static void WatchActiveHandle(const PhoneCallInfo *phoneCall) diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingPresenter.h index b2093b61d..ecae95120 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingPresenter.h @@ -17,6 +17,7 @@ namespace OHOS { class MainCallingView; class MainCallingPresenter : public Presenter, + public RootView::OnKeyActListener, public UIView::OnClickListener , public UIView::OnDragListener{ public: @@ -33,6 +34,7 @@ public: bool CallingViewDisplay(); bool InitPointerValue(); bool OnClick(UIView& view, const ClickEvent& event) override; + bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 bool OnDragEnd(UIView &view, const DragEvent &event) override; VolumeSettingView *GetvolumeSetting(); 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 089543701..574e098e1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp @@ -413,6 +413,11 @@ bool MainCallingPresenter::OnDragEnd(OHOS::UIView& view, const OHOS::DragEvent& return true; } +bool MainCallingPresenter::OnKeyAct(UIView &view, const KeyEvent &event) // 增加按键事件 +{ + return true; +} + VolumeSettingView *MainCallingPresenter::GetvolumeSetting() { return volumeSetting; diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp index d759215a7..feb2ef553 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp @@ -33,6 +33,7 @@ MainCallingView::~MainCallingView() delete waitingView; waitingView = nullptr; + g_pMainView = nullptr; } @@ -135,6 +136,9 @@ void MainCallingView::OnStart() if (InitPointerValue() == false) { return; } + + RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MainCallingPresenter::GetInstance(); + RootView::GetInstance()->SetOnKeyActListener(keyactListener); RootView::GetInstance()->Add(displayGroup); RootView::GetInstance()->Add(callingGroup); @@ -183,6 +187,8 @@ void MainCallingView::OnStop() WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingView::~OnStop"); View::OnStop(); RootView::GetInstance()->RemoveAll(); + RootView::GetInstance()->ClearOnKeyActListener(); + return; } } \ No newline at end of file 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 2b024baf7..197d537e1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -674,11 +674,11 @@ static void ScoDisconnectPro(void) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[ScoDisconnectPro] start CallState:%d", g_currCallState); - // if(OHOS::CallerLogModel::GetInstance()->GetCallSource() == OHOS::CallerLogModel::CallSourceCat1 - // && OHOS::NotificationManager::GetInstance()->GetWatchCallStatus()) - // { - // return; - // } + if(OHOS::CallerLogModel::GetInstance()->GetCallSource() == OHOS::CallerLogModel::CallSourceCat1 + && OHOS::NotificationManager::GetInstance()->GetWatchCallStatus()) + { + return; + } // if(OHOS::CallerLogModel::GetInstance()->GetCallDial() == OHOS::CallerLogModel::HFP_PHONE_DIAL) // { 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 4c527aded..a8b532301 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -460,7 +460,7 @@ void sendtraningdata(msg_get_train_data_info_t *data) printf("发送训练实时数据 %d %s\n", data_len, jsonString); ble_data_type type={0x01,0x0f,data_len,1,1}; - send_big_data(type,data,data_len); + send_big_data(type,jsonString,data_len); //send_big_data(0, jsonString, data_len, data_len, 1, 1, 0x0f, 1); cJSON_free(jsonString); @@ -2677,6 +2677,47 @@ void APP_send_schedule_Cmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *tota } } +bool bin_Check_sos(uint8_t *data,uint16_t len) +{ + return true; +} + +void APP_send_sos_Cmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,uint8_t crcvalue) +{ + uint32_t tmp = 1; + uint16_t tmp_data = 1; + uint8_t sendBuf[19]; + memset(sendBuf,0,19); + sendBuf[0] = 0x72; + sendBuf[1] = 0x02; + sendBuf[2] = 0x25; + memcpy(sendBuf+3,&tmp,4); + memcpy(sendBuf+7,&tmp,4); + memcpy(sendBuf+11,&tmp,4); + memcpy(sendBuf+15,&tmp_data,2); + + if(Check_CRC(data,len,crcvalue)) + { + + + if(bin_Check_sos(data,len)) + { + sendBuf[17] = 1; + } + else + { + sendBuf[17] = 2; + } + sendBuf[18] = Calculate_CRC(sendBuf,18); + sendBleData(sendBuf,19); + } + else + { + sendBuf[17] = 0; + sendBuf[18] = Calculate_CRC(sendBuf,18); + sendBleData(sendBuf,19); + } +} void GetGPSCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,uint8_t crcvalue) @@ -2976,6 +3017,9 @@ void type2AE4Data(ble_read_data *buffer_handle,uint8_t *buf_cmd,uint8_t *data,ui case SYN_APP_SCHEDULE_DATA_CMD: APP_send_schedule_Cmd(typeID,data,datalen,totalData,crcvalue); break; + case APP_SEND_SOS_DATA_CMD: + APP_send_sos_Cmd(typeID,data,datalen,totalData,crcvalue); + break; default: @@ -4646,7 +4690,11 @@ static void GetAiRecordCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *tota } } - +static void GetSOSDataCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totaldata,uint8_t crcvalue) +{ + ble_data_type type_={0x01,0x36,0,1,1}; + send_big_data(type_,NULL,0); +} //AI录音已经就绪 static void AiIsReadyCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totaldata,uint8_t crcvalue) { @@ -5290,6 +5338,10 @@ void type2AE3Data(ble_read_data *buffer_handle,uint8_t *cmd_buf ,uint8_t *data,u case APP_GET_AI_PCM_DATA_CMD: GetAiRecordCmd(cmd,data,datalen,totaldata,crcvalue); break; + case APP_GET_SOS_DATA_CMD: + GetSOSDataCmd(cmd,data,datalen,totaldata,crcvalue); + break; + case GET_SPECIF_TYPE_FILE_CMD://获取指定类型文件目录 case AI_IS_READ_DATA_CMD: case SYN_HEART_HISTORY_DATA_CMD://同步心率历史数据 @@ -7136,13 +7188,45 @@ errcode_t check_header(msg_header_t *header ) errcode_t cancel_recv_file(ble_read_data *buffer_handle) { - if(BR_TRANSFER_timer) { - timer_flie_flag=1; + timer_flie_flag=0; + osTimerStop(BR_TRANSFER_timer); + osTimerDelete(BR_TRANSFER_timer); + BR_TRANSFER_timer = NULL; } - ble_reply_cmd(FILE_RECV_REPLY_STAT_CMD,0);//接收失败 - + + if(timer_flie_type==1) + { + TRANSMIT_DATA=TRANS_OTA_FAIL; + } + else if (timer_flie_type==3) + { + TRANSMIT_DATA=TRANS_DIAL_FAIL; + } + else + { + TRANSMIT_DATA=TRANS_FREE; + } + + ble_read_timer_p->receive_file_flag = 0; + if (ble_read_timer_p->file_recv_stat.recv_file_stat != 2) //已经下载完毕的文件,没有必要cancel了。 + { + if (ble_read_timer_p->file_recv_stat.file!=NULL) + { + fclose(ble_read_timer_p->file_recv_stat.file); + ble_read_timer_p->file_recv_stat.file = NULL; + } + if (ble_read_timer_p->file_recv_stat.file_name != NULL) + { + free(ble_read_timer_p->file_recv_stat.file_name); + ble_read_timer_p->file_recv_stat.file_name=NULL; + } + ble_read_timer_p->file_recv_stat.recv_file_stat = -1; + ble_read_timer_p=NULL; + } + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + return ERRCODE_SUCC; } diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h index c6220ebea..f2e2caeef 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -96,10 +96,11 @@ void cameram_send_data(void); #define SYN_SLEEP_HISTORY_DATA_CMD 0x014B //同步睡眠历史数据 #define SYN_GET_MSG_CONFIG_CMD 0x0133 //获取消息开关 #define APP_GET_AI_PCM_DATA_CMD 0x0134 //APP获取录音文件 +#define APP_GET_SOS_DATA_CMD 0x0136 //APP获取SOS信息 #define AI_IS_READ_DATA_CMD 0x0505 //AI准备就绪 -#define SET_DMP_MODE_CMD 0x0135 -#define GET_DMP_MODE_CMD 0x0136 +#define SET_DMP_MODE_CMD 0x0137 +#define GET_DMP_MODE_CMD 0x0138 #define FIND_PHONE_CMD 0x0501 @@ -641,6 +642,7 @@ TYPE:02 #define SYN_BASIC_REAL_HEATR_CMD 0x024B //同步基础训练试试心率记录 #define APP_SEND_CHATGPT_KEY_CMD 0x0223 //APP发送chatGPT key #define SYN_APP_SCHEDULE_DATA_CMD 0x0224 //同步schedule信息 +#define APP_SEND_SOS_DATA_CMD 0x0225 //APP发送sos信息 #define SYN_TODAY_BASIC_TRAIN_TXT_CMD 0x024D //同步当天任意时间之后的基础训练记录 #define APP_SEND_AI_KEY_IS_AVAILABLE_CMD 0x0506 //查询AI是否可用,APP 回复 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 0e4f5118e..d457d074f 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 @@ -567,7 +567,7 @@ void MsgCenterNotifyHfpPhoneProc(const Topic topic, Request* req) } if ((topic == TOPIC_EVENT_HFP_FINISHED && GetCurrCallNum() == 0) || topic == TOPIC_EVENT_HFP_PHONE_ACTIVE || topic == TOPIC_EVENT_HFP_WATCH_TO_PHONE) { - NotificationManager::GetInstance()->StopNotify(); + //NotificationManager::GetInstance()->StopNotify(); if( CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSource::CallSourcePhone) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetWatchCallStatus false"); @@ -816,27 +816,12 @@ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req) // Prevent this from happening: // When the incoming call view is displayed, the calling number is not set in CallerLogModel. //uapi_hfp_disconnect(); - - if(uapi_dev_runtime_get_train_status()) - { - CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len); - cat1_call_hungup(); - free(call_data); - - return; - } - - if(NotificationManager::GetInstance()->GetWatchCallStatus() && - (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)) + if((NotificationManager::GetInstance()->GetWatchCallStatus() && + (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)) || uapi_dev_runtime_get_train_status()) { - std::string hfp_number= CallerLogModel::GetInstance()->GetPhoneNumber(); - - CallerLogModel::GetInstance()->tempSetoperateNumberCAT1(hfp_number.c_str(),hfp_number.length()); - - CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len); + CallerLogModel::GetInstance()->tempSetoperateNumberCAT1(call_data,req->len); cat1_phone_state_change_cb(OPERATE_WAITING); - free(call_data); return; @@ -881,8 +866,8 @@ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req) return; } SetMicMute(false); - // AlarmClockModel::GetInstance()->AlarmPlayerStop() - AlarmViewEventListener::GetInstance()->CancelAlarmRing(); + AlarmClockModel::GetInstance()->AlarmPlayerStop(); + //AlarmViewEventListener::GetInstance()->CancelAlarmRing(); NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE); CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); @@ -930,8 +915,8 @@ void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req) unused(topic); unused(req); // just stop the notify - // AlarmClockModel::GetInstance()->AlarmPlayerStop(); - AlarmViewEventListener::GetInstance()->CancelAlarmRing(); + AlarmClockModel::GetInstance()->AlarmPlayerStop(); + // AlarmViewEventListener::GetInstance()->CancelAlarmRing(); if(!NotificationManager::GetInstance()->GetWatchCallStatus()) { return; @@ -1462,8 +1447,8 @@ void MsgCenterNotifybleTransmit(const Topic topic, Request* req) { set_transmittingShow_falg(data[0]); - if(NotificationManager::GetInstance()->HasNotifyShowing()) - NotificationManager::GetInstance()->StopNotify(); + // if(NotificationManager::GetInstance()->HasNotifyShowing()) + // NotificationManager::GetInstance()->StopNotify(); NotificationManager::GetInstance()->ShowNotify(showtransmitNotify, (uint16_t)topic, true); } 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 aacbabaa4..13da94aad 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 @@ -287,10 +287,23 @@ void FreeSOSView(void) SOSView = nullptr; } } - +uint8_t CALL_INCOMING_HINT_timer_FALG=0; void hintdialtimerCallBack(int data) { - NotificationManager::GetInstance()->StopNotify(); + CALL_INCOMING_HINT_timer_FALG--; + if(CALL_INCOMING_HINT_timer_FALG) + { + if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) + { + ui_api_vibrate_once_func(); + } + } + if(CALL_INCOMING_HINT_timer_FALG==0) + { + NotificationManager::GetInstance()->StopNotify(); + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hintdialtimerCallBack ??????!"); + } @@ -364,9 +377,9 @@ UIViewGroup* CALL_INCOMING_HINT(void) uint32_t tick; osStatus_t retTimer; - + CALL_INCOMING_HINT_timer_FALG=3; CALL_INCOMING_HINT_timer = osTimerNew((osTimerFunc_t)hintdialtimerCallBack, osTimerPeriodic, NULL, NULL); - tick =2000;// osMs2Tick(1000); + tick =osMs2Tick(1000);// osMs2Tick(1000); retTimer = osTimerStart(CALL_INCOMING_HINT_timer, tick); if (retTimer != osOK && CALL_INCOMING_HINT_timer != NULL) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer); @@ -446,12 +459,23 @@ UIViewGroup* SOS_cant_dial(void) } CallLogInfo info; -void calllog_info_init() +void calllog_info_init(uint8_t type) { strcpy(info.name,"xxx"); info.nameLen=3; - int len=strlen(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); - memcpy_s(info.tel,20,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),len+1); + int len; + if(type==0) + { + len=strlen(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + memcpy_s(info.tel,20,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),len+1); + } + else + { + len=strlen(CallerLogModel::GetInstance()->GettempPhoneNumber().c_str()); + memcpy_s(info.tel,20,CallerLogModel::GetInstance()->GettempPhoneNumber().c_str(),len+1); + } + + uint32_t tmptime=0; uapi_get_timestampe_ss(&tmptime); info.creationTime = tmptime; @@ -503,74 +527,21 @@ static void IncomingHandle(void) } -static osTimerId_t Waiting_timer=NULL; - -static void RejectIncomingCall_Timer_CallBack(int data) -{ - if(RejectIncomingCall() != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error"); - return ; - } - cat1_call_hungup(); - osTimerDelete(Waiting_timer); - Waiting_timer = NULL; - CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone); - CallerLogModel::GetInstance()->SetCallStatus(true); - CallerLogModel::GetInstance()->SetWaitingStatus(false); - - std::string hfp_number= CallerLogModel::GetInstance()->GettempPhoneNumber(); - CallerLogModel::GetInstance()->SetoperateNumber(hfp_number.c_str(),hfp_number.length()); - - NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID, - PRIORITY_ONE); -} - static void WaitingOpreate() { - - if(NotificationManager::GetInstance()->GetWatchCallStatus()) + + if(!CallerLogModel::GetInstance()->get_RejectIncomingCall_falg()) { - if(!CallerLogModel::GetInstance()->get_RejectIncomingCall_falg()) - { - CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); - uint32_t tick; - osStatus_t retTimer; - if(Waiting_timer!=NULL) - { - cat1_call_hungup(); - osTimerDelete(Waiting_timer); - Waiting_timer = NULL; - return; - } - Waiting_timer = osTimerNew((osTimerFunc_t)RejectIncomingCall_Timer_CallBack, osTimerOnce, NULL, NULL); - tick =3000;// osMs2Tick(1000); - retTimer = osTimerStart(Waiting_timer, tick); - if (retTimer != osOK && Waiting_timer != NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer); - osTimerDelete(Waiting_timer); - Waiting_timer = NULL; - return ; - } - CallerLogModel::GetInstance()->set_RejectIncomingCall_falg(1); - - } - else - { - cat1_call_hungup(); - std::string hfp_number= CallerLogModel::GetInstance()->GettempPhoneNumber(); - CallerLogModel::GetInstance()->SetoperateNumber(hfp_number.c_str(),hfp_number.length()); - - return; - } - + cat1_call_hungup(); + CustomEventPublish(TOPIC_EVENT_HFP_HINT,NULL,0); + CallerLogModel::GetInstance()->set_RejectIncomingCall_falg(1); + return; + } + else + { + cat1_call_hungup(); + return; } - - CallerLogModel::GetInstance()->SetCallStatus(false); - CallerLogModel::GetInstance()->SetWaitingStatus(true); - - - NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID, - PRIORITY_ONE); } static void WatchActiveHandle() @@ -598,12 +569,10 @@ static void WatchFinishHandle(void) { if(CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone) { - + addcalllog(); } else if(uapi_dev_runtime_get_train_status()) { - calllog_info_init(); - call_stat=2; addcalllog(); } else @@ -630,7 +599,7 @@ void cat1_phone_state_change_cb(uint8_t state) DialingHandle(); call_stat=0; - calllog_info_init(); + calllog_info_init(0); break; case OPERATE_ALERTING: // 显示对方响铃 @@ -640,7 +609,7 @@ void cat1_phone_state_change_cb(uint8_t state) // 显示电话呼入 PhoneServiceScreenCtr(true); IncomingHandle(); - calllog_info_init(); + calllog_info_init(0); if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) { ui_api_vibrate_once_func(); @@ -649,11 +618,9 @@ void cat1_phone_state_change_cb(uint8_t state) break; case OPERATE_WAITING: // 震动一下,提示有新电话呼入 还未对齐 - calllog_info_init(); - call_stat=2; - addcalllog(); WaitingOpreate(); - + call_stat=2; + calllog_info_init(1); return; case OPERATE_WATCH_ACTIVE: // 手表接听,显示界面 @@ -1240,7 +1207,7 @@ UIViewGroup* CreatePhoneCallView(void) g_phoneView->SetDraggable(true); g_phoneView->SetTouchable(true); call_stat=2; - calllog_info_init(); + calllog_info_init(0); NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreePhoneCallView); return g_phoneView; } @@ -1385,7 +1352,7 @@ UIViewGroup* CreateCalldialView(void) StartCallTimer(CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY, (int32_t)NOTIFY_ONE_SECOND); call_stat=0; - calllog_info_init(); + calllog_info_init(0); NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeCalldialView); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp index b245d14da..1341d748d 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp @@ -191,11 +191,12 @@ namespace OHOS // Add to rootView UIViewGroup_transmitting->Add(Title); - updatasider = new UISlider(); + if (updatasider == nullptr) { + updatasider = new UISlider(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView new fail"); - return ; + } updatasider->SetSliderColor(Color::Gray(), Color::Silver()); @@ -234,11 +235,12 @@ namespace OHOS UIViewGroup_transmitting->Add(label_); //Add ImageView to App - transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) { + transmitting_img = new UIImageView(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); - return ; + } transmitting_img->SetPosition(117, 87, 230, 160); const char *imagesPath = TRANSMITTING_OTA_DOWN; @@ -249,6 +251,12 @@ namespace OHOS osStatus_t retTimer; Set_OTA_recv_value(); + if(transmitting_timer!=NULL) + { + osTimerStop(transmitting_timer); + osTimerDelete(transmitting_timer); + transmitting_timer = NULL; + } transmitting_timer = osTimerNew((osTimerFunc_t)OTATimerCallBack, osTimerPeriodic, NULL, NULL); tick =500;// osMs2Tick(1000); retTimer = osTimerStart(transmitting_timer, tick); @@ -301,11 +309,11 @@ namespace OHOS UIViewGroup_transmitting->Add(label_); //Add ImageView to App - transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) { + transmitting_img = new UIImageView(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); - return ; } transmitting_img->SetPosition(117, 87, 230, 160); const char *imagesPath = TRANSMITTING_OTA_DOWN; @@ -355,11 +363,12 @@ namespace OHOS //Add ImageView to App - transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) { + transmitting_img = new UIImageView(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); - return ; + } transmitting_img->SetPosition(117, 87, 230, 160); const char *imagesPath = TRANSMITTING_OTA_DOWN; @@ -462,11 +471,11 @@ namespace OHOS label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) { + transmitting_img = new UIImageView(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); - return ; } transmitting_img->SetPosition(193, 150,80, 80); const char *imagesPath = TRANSMITTING_SUCC_PATH; @@ -475,7 +484,12 @@ namespace OHOS uint32_t tick; osStatus_t retTimer; - + if(transmitting_timer!=NULL) + { + osTimerStop(transmitting_timer); + osTimerDelete(transmitting_timer); + transmitting_timer = NULL; + } transmitting_timer = osTimerNew((osTimerFunc_t)dialtimerCallBack, osTimerPeriodic, NULL, NULL); tick =2000;// osMs2Tick(1000); retTimer = osTimerStart(transmitting_timer, tick); @@ -530,11 +544,11 @@ namespace OHOS label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) { + transmitting_img = new UIImageView(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); - return ; } transmitting_img->SetPosition(193, 150,80, 80); const char *imagesPath = TRANSMITTING_FAIL_PATH; @@ -560,6 +574,10 @@ namespace OHOS UIViewGroup_transmitting->SetPosition(0, 0, 466, 466); //UIViewGroup_transmitting->SetStyle(STYLE_BACKGROUND_OPA, 0); } + else + { + UIViewGroup_transmitting->RemoveAll(); + } switch (Transmitting_falg) { -- 2.17.1