解决开启4G后长按功能按键死机问题,230和n9修改
authorluozheng <1732036298@qq.com>
Mon, 29 Dec 2025 06:34:01 +0000 (14:34 +0800)
committerluozheng <1732036298@qq.com>
Mon, 29 Dec 2025 06:34:01 +0000 (14:34 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/MainCallingPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp
code/sdk/application/wearable/fd230/service/msg_center/src/notify/phone_crt.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/include/MainCallingPresenter.h
code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingView.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp
code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp

index 67d7e38..9883b05 100644 (file)
@@ -26,9 +26,7 @@ public:
     ~MainCallingPresenter() override;
 
     void OnStart() override;
-    void OnPause() override;
     void OnResume() override;
-    void OnStop() override;
     static MainCallingPresenter *GetInstance();
 
     void HonrsViewChange();
index 9a4ca9f..e0b0082 100644 (file)
@@ -65,18 +65,10 @@ 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::OnResume(void) {
+    RootView::GetInstance()->SetOnKeyActListener(this);
 }
 
 void MainCallingPresenter::HonrsViewChange()
index 8f16e2e..c92e6a7 100644 (file)
@@ -145,7 +145,6 @@ void MainCallingView::updataCallingname(void)
             if(displayView)
             displayView->updataCallingname();
 
-           RootView::GetInstance()->Invalidate();
 
             //callerDisplay->SetText(CallerLogModel::GetInstance()->Getphonename().c_str());
         }
@@ -159,7 +158,6 @@ void MainCallingView::update_headset_state(uint8_t data)
      if(callView)
      {
          callView->update_headset_state(data);
-        RootView::GetInstance()->Invalidate();
      }
         
 }
@@ -175,13 +173,12 @@ void MainCallingView::OnStart()
         return;
     }
     
-    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);
index 0ded82e..3a40585 100644 (file)
@@ -439,7 +439,6 @@ namespace OHOS
         if (HandleAlarmOrFindWatchNotify())
             return;
         GraphicService::GetInstance()->PostGraphicEvent(std::bind(SOSKeyLongPress));
-        SOSKeyLongPress();
     }
 
     /*注册功能键的长按事件*/
index ada010a..27a529f 100644 (file)
@@ -313,8 +313,11 @@ UIViewGroup* CALL_FAIL_HINT(void)
    
     if (FAILHintView == nullptr) {
         FAILHintView = new UIViewGroup();
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!");
-        
+        if(FAILHintView == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!");
+            return nullptr;
+        }
     }
     FAILHintView->SetPosition(0, 0);
     FAILHintView->SetWidth(Screen::GetInstance().GetWidth());
@@ -872,7 +875,8 @@ void phone_VibratorFunc(void)
         custom_VibratorFunc_int(0);
     }
 }
- 
+
+
   
 
 
index 67d7e38..9883b05 100644 (file)
@@ -26,9 +26,7 @@ public:
     ~MainCallingPresenter() override;
 
     void OnStart() override;
-    void OnPause() override;
     void OnResume() override;
-    void OnStop() override;
     static MainCallingPresenter *GetInstance();
 
     void HonrsViewChange();
index 9a4ca9f..e0b0082 100644 (file)
@@ -65,18 +65,10 @@ 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::OnResume(void) {
+    RootView::GetInstance()->SetOnKeyActListener(this);
 }
 
 void MainCallingPresenter::HonrsViewChange()
index 8f16e2e..c92e6a7 100644 (file)
@@ -145,7 +145,6 @@ void MainCallingView::updataCallingname(void)
             if(displayView)
             displayView->updataCallingname();
 
-           RootView::GetInstance()->Invalidate();
 
             //callerDisplay->SetText(CallerLogModel::GetInstance()->Getphonename().c_str());
         }
@@ -159,7 +158,6 @@ void MainCallingView::update_headset_state(uint8_t data)
      if(callView)
      {
          callView->update_headset_state(data);
-        RootView::GetInstance()->Invalidate();
      }
         
 }
@@ -175,13 +173,12 @@ void MainCallingView::OnStart()
         return;
     }
     
-    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);
index 4b3fe80..470796c 100644 (file)
@@ -445,7 +445,6 @@ namespace OHOS
         if (HandleAlarmOrFindWatchNotify())
             return;
         GraphicService::GetInstance()->PostGraphicEvent(std::bind(SOSKeyLongPress));
-        SOSKeyLongPress();
     }
 
     /*注册功能键的长按事件*/
index b562c35..27a529f 100644 (file)
@@ -313,8 +313,11 @@ UIViewGroup* CALL_FAIL_HINT(void)
    
     if (FAILHintView == nullptr) {
         FAILHintView = new UIViewGroup();
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!");
-        
+        if(FAILHintView == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!");
+            return nullptr;
+        }
     }
     FAILHintView->SetPosition(0, 0);
     FAILHintView->SetWidth(Screen::GetInstance().GetWidth());