电话bug综合修复 996/3
authorhcj <1224667075@qq.com>
Sat, 21 Sep 2024 02:26:29 +0000 (10:26 +0800)
committerhcj <1224667075@qq.com>
Sat, 21 Sep 2024 02:26:29 +0000 (10:26 +0800)
code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp
code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingPresenter.h
code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp
code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp

index a48fbb3..13cfe6e 100644 (file)
 #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)
index b2093b6..ecae951 100644 (file)
@@ -17,6 +17,7 @@
 namespace OHOS {
 class MainCallingView;
 class MainCallingPresenter : public Presenter<MainCallingView>,
+                             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();
index 0895437..574e098 100644 (file)
@@ -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;
index d759215..0ac5cdf 100644 (file)
@@ -135,6 +135,8 @@ 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);
index 2b024ba..197d537 100644 (file)
@@ -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)
     // {
index f0dfda2..d457d07 100644 (file)
@@ -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())
+        if((NotificationManager::GetInstance()->GetWatchCallStatus() &&
+        (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)) || 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))
-        {
-            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;
index aacbaba..13da94a 100755 (executable)
@@ -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);