n9 删除蓝牙耳机相关代码 3274/target/2 3276/1 3276/head
authorluozheng <1732036298@qq.com>
Mon, 16 Mar 2026 03:47:08 +0000 (11:47 +0800)
committerluozheng <1732036298@qq.com>
Mon, 16 Mar 2026 03:47:08 +0000 (11:47 +0800)
13 files changed:
code/sdk/application/wearable/n9/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/bluetooth/src/BluetoothPresenter.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/classicbluetooth/include/ClassicBlueToothView.h
code/sdk/application/wearable/n9/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/main/include/ConnectedStatusView.h
code/sdk/application/wearable/n9/nativeapp/nativeui/main/include/PullUpDownView.h
code/sdk/application/wearable/n9/nativeapp/nativeui/main/src/ConnectedStatusView.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/main/src/PullUpDownView.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/player/src/MusicPlayerSourceView.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/player/src/PlayersView.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/settings/src/SettingModel.cpp

index 1e41788..af22c1a 100644 (file)
@@ -1307,10 +1307,9 @@ static void A2dpSrcConnectstateChanged(bd_addr_t *bdAddr, int connState)
         GraphicService::GetInstance()->PostGraphicEvent(std::bind(ACLConnectionSuss, *bdAddr));\r
 \r
         #ifdef SUPPORT_CAT1_HFP_AG_SERV\r
-        SendMsgToUIService(EARPHONE_CONNECTED_TO_UI, 0, nullptr, 0);\r
       \r
-         uapi_dev_runtime_set_earphone_connect_stat(1);\r
-         uapi_save_runtime_log(RUNTIME_LOG_BR_CONNECT_A2DP_HEADSET);\r
+        uapi_dev_runtime_set_earphone_connect_stat(1);\r
+        uapi_save_runtime_log(RUNTIME_LOG_BR_CONNECT_A2DP_HEADSET);\r
         if(headset_Is_connect() == false)\r
         do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);\r
 \r
@@ -1322,10 +1321,6 @@ static void A2dpSrcConnectstateChanged(bd_addr_t *bdAddr, int connState)
         PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_A2DP, AUDIO_DEVICE_DISCONNECTED);\r
         GraphicService::GetInstance()->PostGraphicEvent(std::bind(ACLConnectionFail, *bdAddr));\r
 \r
-        #ifdef SUPPORT_BLE_SERVICE\r
-        // SendMsgToUIService(EARPHONE_DISCONNECTED_TO_UI, 0, nullptr, 0);\r
-        #endif\r
-\r
         uapi_save_runtime_log(RUNTIME_LOG_BR_DISCONNECT_A2DP_HEADSET);\r
         /* 实验室测试耳机回连场景,用户根据需要调整策略 */\r
         bool ret = gap_br_set_bt_scan_mode(GAP_SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, 60); // start scan\r
index 8e56890..005261f 100644 (file)
@@ -19,7 +19,7 @@
 namespace OHOS\r
 {\r
 \r
-    REGIST_SLICE(VIEW_BLUETOOTH_EARPHONE, MainBluetoothView, BluetoothPresenter);\r
+    // REGIST_SLICE(VIEW_BLUETOOTH_EARPHONE, MainBluetoothView, BluetoothPresenter);\r
 \r
 static BluetoothPresenter *g_pBluetoothPresenter = nullptr;\r
 \r
index 2d878fd..0315425 100644 (file)
@@ -57,10 +57,8 @@ namespace OHOS
         bool SetUpBlueToothToggleButton(void);\r
         UIScrollView *BlueToothScrollView = nullptr;\r
         UILabelExt *Title = nullptr;\r
-        UILabelButtonExt *BlueToothEarPhoneButton = nullptr;       // 蓝牙耳机按钮\r
         UILabelButtonExt *TradionalBlueToothButton = nullptr;      // 传统蓝牙按钮\r
         UILabelButtonExt *BluetoothServiceOptionsButton = nullptr; // 蓝牙服务选项按钮\r
-        UILabelExt *BlueToothEarPhoneLabel = nullptr;       // 蓝牙耳机\r
         UILabelExt *TradionalBlueToothLabel = nullptr;      // 传统蓝牙\r
         UILabelExt *BluetoothServiceOptionsLabel = nullptr; // 蓝牙服务选项\r
         UILabelExt *AttentionLabel = nullptr;\r
index 60a8823..1b6b3ab 100644 (file)
@@ -72,7 +72,7 @@ namespace OHOS
 \r
         if (strcmp(view.GetViewId(), BLUETOOTHEARPHONEBUTTON) == 0)\r
         {\r
-            NativeAbility::GetInstance().EnterSlice(VIEW_BLUETOOTH_EARPHONE);\r
+            // NativeAbility::GetInstance().EnterSlice(VIEW_BLUETOOTH_EARPHONE);\r
         }\r
         else if (strcmp(view.GetViewId(), BLUETOOTHSERVICEOPTIONSBUTTON) == 0)\r
         {\r
index 0ecb248..05bbe89 100644 (file)
@@ -38,11 +38,6 @@ namespace OHOS
                     delete Title;\r
                     Title = nullptr;\r
                 }\r
-                if (BlueToothEarPhoneButton != nullptr)\r
-                {\r
-                    delete BlueToothEarPhoneButton;\r
-                    BlueToothEarPhoneButton = nullptr;\r
-                }\r
                 if (TradionalBlueToothButton != nullptr)\r
                 {\r
                     delete TradionalBlueToothButton;\r
@@ -53,11 +48,6 @@ namespace OHOS
                     delete BluetoothServiceOptionsButton;\r
                     BluetoothServiceOptionsButton = nullptr;\r
                 }\r
-                if (BlueToothEarPhoneLabel != nullptr)\r
-                {\r
-                    delete BlueToothEarPhoneLabel;\r
-                    BlueToothEarPhoneLabel = nullptr;\r
-                }\r
                 if (TradionalBlueToothLabel != nullptr)\r
                 {\r
                     delete TradionalBlueToothLabel;\r
@@ -155,18 +145,10 @@ namespace OHOS
             .height = 35,\r
             .fontSize = 30,\r
             .lineHeigh = 35,\r
-            .textId = STR_BLUETOOTH_HEADPHONES, /*蓝牙耳机*/\r
+            // .textId = STR_BLUETOOTH_HEADPHONES, /*蓝牙耳机*/\r
+            .textId = STR_TRADITIONAL_BLUETOOTH, /*传统蓝牙*/\r
             .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,\r
         };\r
-        BlueToothEarPhoneLabel = SetClassicBlueToothViewLabel(labelconfig);\r
-        if (nullptr == BlueToothEarPhoneLabel)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothView::BlueToothEarPhoneLabel is nullptr!");\r
-            return false;\r
-        }\r
-        /* -------------------------------------------------------------------------- */\r
-        labelconfig.top = 273;\r
-        labelconfig.textId = STR_TRADITIONAL_BLUETOOTH; /*传统蓝牙*/\r
         TradionalBlueToothLabel = SetClassicBlueToothViewLabel(labelconfig);\r
         if (nullptr == TradionalBlueToothLabel)\r
         {\r
@@ -174,7 +156,7 @@ namespace OHOS
             return false;\r
         }\r
         /* -------------------------------------------------------------------------- */\r
-        labelconfig.top = 393;\r
+        labelconfig.top = 273;\r
         labelconfig.textId = STR_BLUETOOTH_SERVICE_OPTIONS; /*蓝牙服务选项*/\r
         BluetoothServiceOptionsLabel = SetClassicBlueToothViewLabel(labelconfig);\r
         if (nullptr == BluetoothServiceOptionsLabel)\r
@@ -189,7 +171,12 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothView::AttentionLabel is nullptr!");\r
             return false;\r
         }\r
-        AttentionLabel->SetPosition(53, 499, 360, 180);  // 位置大小\r
+        int y = 0;\r
+        if (BluetoothServiceOptionsButton)\r
+        {\r
+            y = BluetoothServiceOptionsButton->GetY() + BluetoothServiceOptionsButton->GetHeight() + 39;\r
+        }\r
+        AttentionLabel->SetPosition(53, y, 360, 180);    // 位置大小\r
         AttentionLabel->SetStyle(STYLE_TEXT_FONT, 20);   // 字体大小\r
         AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 30); // 字体行高\r
         //.text = "注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用(该功能主要用于电话拨打/通知、音乐控制/传输等)",\r
@@ -208,18 +195,6 @@ namespace OHOS
     // 按钮初始化\r
     bool ClassicBlueToothView::SetUpBlueToothButton(void)\r
     {\r
-        BlueToothEarPhoneButton = new UILabelButtonExt();\r
-        if (BlueToothEarPhoneButton == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::BlueToothEarPhoneButton new  fail!");\r
-            return false;\r
-        }\r
-        BlueToothEarPhoneButton->SetPosition(43, 120, 380, 100);\r
-        BlueToothEarPhoneButton->SetViewId(BLUETOOTHEARPHONEBUTTON);\r
-        BlueToothEarPhoneButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
-        BlueToothEarPhoneButton->SetImagePosition(326, 37);\r
-        BlueToothEarPhoneButton->SetImageSrc(PNG_SETTING_NEXT_IMAGE, PNG_SETTING_NEXT_IMAGE);\r
-        BlueToothEarPhoneButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);\r
         /* -------------------------------------------------------------------------- */\r
         TradionalBlueToothButton = new UILabelButtonExt();\r
         if (TradionalBlueToothButton == nullptr)\r
@@ -227,7 +202,7 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::TradionalBlueToothButton new  fail!");\r
             return false;\r
         }\r
-        TradionalBlueToothButton->SetPosition(43, 240, 380, 100);\r
+        TradionalBlueToothButton->SetPosition(43, 120, 380, 100);\r
         TradionalBlueToothButton->SetViewId(TRADIONALBLUETOOTHBUTTON);\r
         TradionalBlueToothButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
         TradionalBlueToothButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 16);\r
@@ -239,14 +214,13 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::BluetoothServiceOptionsButton new  fail!");\r
             return false;\r
         }\r
-        BluetoothServiceOptionsButton->SetPosition(43, 360, 380, 100);\r
+        BluetoothServiceOptionsButton->SetPosition(43, 240, 380, 100);\r
         BluetoothServiceOptionsButton->SetViewId(BLUETOOTHSERVICEOPTIONSBUTTON);\r
         BluetoothServiceOptionsButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
         BluetoothServiceOptionsButton->SetImagePosition(326, 37);\r
         BluetoothServiceOptionsButton->SetImageSrc(PNG_SETTING_NEXT_IMAGE, PNG_SETTING_NEXT_IMAGE);\r
         BluetoothServiceOptionsButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);\r
         /* -------------------------------------------------------------------------- */\r
-        BlueToothEarPhoneButton->SetOnClickListener(presenter_);\r
         BluetoothServiceOptionsButton->SetOnClickListener(presenter_);\r
 \r
         return true;\r
@@ -258,10 +232,10 @@ namespace OHOS
         TradionalBlueToothToggleButton = new UIToggleButton();\r
         if (nullptr == TradionalBlueToothToggleButton)\r
         {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::BlueToothEarPhoneButton new  fail!");\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::TradionalBlueToothToggleButton new  fail!");\r
             return false;\r
         }\r
-        TradionalBlueToothToggleButton->SetPosition(298, 265, 100, 50);\r
+        TradionalBlueToothToggleButton->SetPosition(298, 145, 100, 50);\r
         TradionalBlueToothToggleButton->SetState(ConfigModel::GetInstance()->GetClassicBlueToothState());\r
         TradionalBlueToothToggleButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);\r
         TradionalBlueToothToggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);\r
@@ -299,10 +273,8 @@ namespace OHOS
             return;\r
         }\r
         BlueToothScrollView->Add(Title);\r
-        BlueToothScrollView->Add(BlueToothEarPhoneButton);\r
         BlueToothScrollView->Add(TradionalBlueToothButton);\r
         BlueToothScrollView->Add(BluetoothServiceOptionsButton);\r
-        BlueToothScrollView->Add(BlueToothEarPhoneLabel);\r
         BlueToothScrollView->Add(TradionalBlueToothLabel);\r
         BlueToothScrollView->Add(BluetoothServiceOptionsLabel);\r
         BlueToothScrollView->Add(AttentionLabel);\r
index cb0b68c..4fd9233 100644 (file)
@@ -18,7 +18,6 @@ namespace OHOS
     typedef enum : uint8_t
     {
         PHONECONNECTEDSTATUS_ID = 0,
-        EARPHONECONNECTESTATUS_ID,
         BLUETOOTHCONNECTEDSTATUS,
         MAX_CONNECTEDSTATUS_ID,
     } CONNECTEDSTATUS_ID;
@@ -33,7 +32,6 @@ namespace OHOS
         UIViewGroup *ConnectedStatusViewInit(void);
         UIButton *GetCloseButton();
         void UpdatePhoneConnectedStatus(int status);
-        void UpdateEarPhoneConnectedStatus(int status);
         void UpdateBlueToothConnectedStatus(int status);
 
         struct LabelConfig
@@ -87,7 +85,6 @@ namespace OHOS
         UIImageView *background[MAX_CONNECTEDSTATUS_ID]{nullptr};
 
         UIImageView *PhoneConnectedStatusImage{nullptr};     // 显示手机连接状态
-        UIImageView *EarPhoneConnectedStatusImage{nullptr};  // 显示耳机连接状态
         UIImageView *BluetoothConnectedStatusImage{nullptr}; // 显示蓝牙连接状态
         UILabelExt *ConnectedStatusLabel[MAX_CONNECTEDSTATUS_ID]{nullptr};
 
index a956666..6cb268d 100644 (file)
@@ -69,12 +69,9 @@ namespace OHOS
         /* ---------------------------------- 1.连接状态 ---------------------------------- */
     public:
         bool GetPhoneConnectedStatus(void);
-        bool GetEarPhoneConnectedStatus(void);
         bool GetBlueToothConnectedStatus(void);
         void UpdatePhoneStatus(int status);
-        void UpdateEarPhoneStatus(int status);
         void UpdateBlueToothStatus(int status);
-        void SetPhoneConnectedIsVisible(bool state);
 
     private:
         UIImageView *DropDownConnectedStatusImageViweInit(int16_t x, int16_t y, int16_t w, int16_t h);
index 9bc59a5..bdb765c 100644 (file)
@@ -11,7 +11,6 @@ namespace OHOS
 {
     static OHOS::ColorType connectedColor[MAX_CONNECTEDSTATUS_ID] = {
         Color::GetColorFromRGBA(0xff, 0x8f, 0x00, 0xff),
-        Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff),
         Color::GetColorFromRGBA(0x01, 0x76, 0xff, 0xff),
     };
     static OHOS::ColorType disconnectedColor = Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff);
@@ -60,9 +59,6 @@ namespace OHOS
             delete PhoneConnectedStatusImage;
             PhoneConnectedStatusImage = nullptr;
 
-            delete EarPhoneConnectedStatusImage;
-            EarPhoneConnectedStatusImage = nullptr;
-
             delete BluetoothConnectedStatusImage;
             BluetoothConnectedStatusImage = nullptr;
 
@@ -175,7 +171,7 @@ namespace OHOS
     bool ConnectedStatusView::initBackground(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::initBackground");
-        int background_position_x = 33;
+        int background_position_x = 97;
         for (int i = 0; i < MAX_CONNECTEDSTATUS_ID; i++)
         {
             background[i] = new UIImageView();
@@ -184,7 +180,7 @@ namespace OHOS
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "background[%d] new fail!!", i);
                 return false;
             }
-            background[i]->SetPosition(background_position_x + i * 140, 113, 120, 200);
+            background[i]->SetPosition(background_position_x + i * 152, 113, 120, 200);
             background[i]->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
             background[i]->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
             background[i]->SetStyle(STYLE_BORDER_RADIUS, 40);
@@ -205,7 +201,7 @@ namespace OHOS
         }
 
         StatusImageParams params = {
-            .x = 63,
+            .x = 127,
             .y = 135,
             .width = 60,
             .height = 60,
@@ -217,19 +213,7 @@ namespace OHOS
         group->Add(PhoneConnectedStatusImage);
 
         params = {
-            .x = 203,
-            .y = 135,
-            .width = 60,
-            .height = 60,
-            .connectedImage = DROPDOWN_EARPHONESCONNECTED,
-            .disconnectedImage = DROPDOWN_EARPHONESDISCONNECTED,
-            .isConnected = pullUpDownView->GetEarPhoneConnectedStatus(),
-        };
-        EarPhoneConnectedStatusImage = InitStatusImage(params);
-        group->Add(EarPhoneConnectedStatusImage);
-
-        params = {
-            .x = 343,
+            .x = 279,
             .y = 135,
             .width = 60,
             .height = 60,
@@ -242,16 +226,15 @@ namespace OHOS
 
         uint16_t deviceName[MAX_CONNECTEDSTATUS_ID] = {
             STR_PHONE,     // 手机
-            STR_HEADSET,   // 耳机
             STR_BLUETOOTH, // 蓝牙
         }; // 初始化设备名称数组
 
-        int PhoneAndEarAndBluetooth_position_x = 53;
-        int ConnectedStatusLabel_position_x = 59;
+        int PhoneAndEarAndBluetooth_position_x = 117;
+        int ConnectedStatusLabel_position_x = 123;
 
         for (int i = 0; i < MAX_CONNECTEDSTATUS_ID; i++)
         {
-            LabelConfig titleConfig = {PhoneAndEarAndBluetooth_position_x + i * 140, 220, 80, 35, 30, 35, deviceName[i]};
+            LabelConfig titleConfig = {PhoneAndEarAndBluetooth_position_x + i * 152, 220, 80, 35, 30, 35, deviceName[i]};
             PhoneAndEarAndBluetooth[i] = InitLabel(titleConfig);
             group->Add(PhoneAndEarAndBluetooth[i]);
 
@@ -261,7 +244,7 @@ namespace OHOS
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectedStatusLabel[%d] new fail!!", i);
                 return false;
             }
-            ConnectedStatusLabel[i]->SetPosition(ConnectedStatusLabel_position_x + i * 140, 258, 70, 27);
+            ConnectedStatusLabel[i]->SetPosition(ConnectedStatusLabel_position_x + i * 152, 258, 70, 27);
             ConnectedStatusLabel[i]->SetStyle(STYLE_TEXT_FONT, 23);
             ConnectedStatusLabel[i]->SetStyle(STYLE_LINE_HEIGHT, 27);
             ConnectedStatusLabel[i]->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
@@ -270,7 +253,6 @@ namespace OHOS
             group->Add(ConnectedStatusLabel[i]);
         }
         UpdatePhoneConnectedStatus(pullUpDownView->GetPhoneConnectedStatus());
-        UpdateEarPhoneConnectedStatus(pullUpDownView->GetEarPhoneConnectedStatus());
         UpdateBlueToothConnectedStatus(pullUpDownView->GetBlueToothConnectedStatus());
 
         return true;
@@ -345,26 +327,6 @@ namespace OHOS
         updateConnectionStatus(params);
     }
 
-    // 更新蓝牙耳机连接状态
-    void ConnectedStatusView::UpdateEarPhoneConnectedStatus(int status)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::UpdateEarPhoneConnectedStatus");
-
-        ConnectionStatusParams params = {
-            .statusImage = EarPhoneConnectedStatusImage,
-            .statusLabel = ConnectedStatusLabel[EARPHONECONNECTESTATUS_ID],
-            .status = status,
-            .connectedImage = DROPDOWN_EARPHONESCONNECTED,
-            .disconnectedImage = DROPDOWN_EARPHONESDISCONNECTED,
-            .connectedText = STR_CONNECTED,
-            .disconnectedText = STR_DISCONNECTED,
-            .connectedColor = connectedColor[EARPHONECONNECTESTATUS_ID],
-            .disconnectedColor = disconnectedColor,
-        };
-
-        updateConnectionStatus(params);
-    }
-
     // 更新蓝牙连接状态
     void ConnectedStatusView::UpdateBlueToothConnectedStatus(int status)
     {
index 9a39bcc..613594e 100644 (file)
@@ -37,9 +37,6 @@ namespace OHOS
     // 手机连接状态
     static constexpr const char *DROPDOWN_PHONECONNECTED_IMAGE = "/user/res/dropdown/phone_connect.bin";
     static constexpr const char *DROPDOWN_PHONEDISCONNECTED_IMAGE = "/user/res/dropdown/phone_disconnect.bin";
-    // 耳机连接状态
-    static constexpr const char *DROPDOWN_EARPHONESCONNECTED_IMAGE = "/user/res/dropdown/earphones_connect.bin";
-    static constexpr const char *DROPDOWN_EARPHONESDISCONNECTED_IMAGE = "/user/res/dropdown/earphones_disconnect.bin";
     // 蓝牙连接状态
     static constexpr const char *DROPDOWN_BLUETOOTHCONNECTED_IMAGE = "/user/res/dropdown/bluetooth_connect.bin";
     static constexpr const char *DROPDOWN_BLUETOOTHDISCONNECTED_IMAGE = "/user/res/dropdown/bluetooth_disconnect.bin";
@@ -122,72 +119,17 @@ namespace OHOS
     bool PullUpDownView::GetPhoneConnectedStatus(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::GetPhoneConnectedStatus");
-        // uint8_t ret = uapi_dev_runtime_get_ble_connect_stat();
-        // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "ble phone connect stat = %d", ret);
-        // if (ret == 1)
-        //     return true;
-        // else
-        // return false;
 
         return SettingModel::GetInstance().GetPhoneConnectStatus();
     }
-    // 获取蓝牙耳机连接状态
-    bool PullUpDownView::GetEarPhoneConnectedStatus(void)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::GetEarPhoneConnectedStatus");
-        // uint8_t ret = uapi_dev_runtime_get_earphone_connect_stat();
-        // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "earphone connect stat = %d", ret);
-        // if (ret == 1)
-        //     return true;
-        // else
-        // return false;
-
-        return SettingModel::GetInstance().GetEarPhoneConnectStatus();
-    }
     // 获取蓝牙连接状态
     bool PullUpDownView::GetBlueToothConnectedStatus(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::GetBlueToothConnectedStatus");
-        // uint8_t ret = uapi_dev_runtime_get_br_connect_stat();
-        // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "br connect stat = %d [0 no connect, 1 a2dp, 2 hfp, 3 both]", ret);
-        // if (ret != 0)
-        //     return true;
-        // else
-        // return false;
 
         return SettingModel::GetInstance().GetBlueToothConnectStatus();
     }
 
-    // 设置蓝牙连接状态是否显示
-    void PullUpDownView::SetPhoneConnectedIsVisible(bool state)
-    {
-        if (connectedStatusBackgroundButton && showPhoneConnectedStatus && showEarPhoneConnectedStatus && showBluetoothConnectedStatus)
-        {
-            if (!state)
-            {
-                connectedStatusBackgroundButton->SetPosition(153, 10, 160, 50);
-                int x = connectedStatusBackgroundButton->GetX();
-                int y = connectedStatusBackgroundButton->GetY();
-                showPhoneConnectedStatus->SetVisible(true);
-                showEarPhoneConnectedStatus->SetPosition(x + 68, y + 13);
-                showBluetoothConnectedStatus->SetPosition(x + 110, y + 13);
-            }
-            else
-            {
-                connectedStatusBackgroundButton->SetPosition(178, 10, 110, 50);
-                int x = connectedStatusBackgroundButton->GetX();
-                int y = connectedStatusBackgroundButton->GetY();
-                showPhoneConnectedStatus->SetVisible(false);
-                showEarPhoneConnectedStatus->SetPosition(x + 22, y + 13);
-                showBluetoothConnectedStatus->SetPosition(showEarPhoneConnectedStatus->GetX() + showEarPhoneConnectedStatus->GetWidth() + 18, y + 13);
-            }
-            connectedStatusBackgroundButton->Invalidate();
-            showPhoneConnectedStatus->Invalidate();
-            showEarPhoneConnectedStatus->Invalidate();
-            showBluetoothConnectedStatus->Invalidate();
-        }
-    }
-
     // 更新手机连接状态
     void PullUpDownView::UpdatePhoneStatus(int status)
     {
@@ -197,38 +139,17 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showPhoneConnectedStatus nullptr");
             return;
         }
-        // showPhoneConnectedStatus->SetSrc(status ? DROPDOWN_PHONECONNECTED_IMAGE : DROPDOWN_PHONEDISCONNECTED_IMAGE);
-        // showPhoneConnectedStatus->Invalidate();
 
         if (status)
         showPhoneConnectedStatus->SetSrc(DROPDOWN_PHONECONNECTED_IMAGE);
         else
         showPhoneConnectedStatus->SetSrc(DROPDOWN_PHONEDISCONNECTED_IMAGE);
 
-        SetPhoneConnectedIsVisible(status);
-
         if (GetConnectedStatusView() != nullptr)
             GetConnectedStatusView()->UpdatePhoneConnectedStatus(status);
 
         return;
     }
-    // 更新蓝牙耳机连接状态
-    void PullUpDownView::UpdateEarPhoneStatus(int status)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::UpdateEarPhoneStatus");
-        if (showEarPhoneConnectedStatus == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showEarPhoneConnectedStatus nullptr");
-            return;
-        }
-        showEarPhoneConnectedStatus->SetSrc(status ? DROPDOWN_EARPHONESCONNECTED_IMAGE : DROPDOWN_EARPHONESDISCONNECTED_IMAGE);
-        showEarPhoneConnectedStatus->Invalidate();
-
-        if (GetConnectedStatusView() != nullptr)
-            GetConnectedStatusView()->UpdateEarPhoneConnectedStatus(status);
-
-        return;
-    }
     // 更新蓝牙连接状态
     void PullUpDownView::UpdateBlueToothStatus(int status)
     {
@@ -273,7 +194,7 @@ namespace OHOS
                 return;
             }
         }
-        connectedStatusBackgroundButton->SetPosition(153, 10, 160, 50);
+        connectedStatusBackgroundButton->SetPosition(178, 10, 110, 50);
         connectedStatusBackgroundButton->SetViewId(CONNECTEDSTATUSBACKGROUNDBUTTON);
         connectedStatusBackgroundButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
         connectedStatusBackgroundButton->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
@@ -297,20 +218,10 @@ namespace OHOS
                 return;
             }
         }
-        /* -------------------------------- 显示耳机连接状态 -------------------------------- */
-        if (showEarPhoneConnectedStatus == nullptr)
-        {
-            showEarPhoneConnectedStatus = DropDownConnectedStatusImageViweInit(x + 68, y + 13, 24, 24);
-            if (showEarPhoneConnectedStatus == nullptr)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showEarPhoneConnectedStatus new fail");
-                return;
-            }
-        }
         /* -------------------------------- 显示蓝牙连接状态 -------------------------------- */
         if (showBluetoothConnectedStatus == nullptr)
         {
-            showBluetoothConnectedStatus = DropDownConnectedStatusImageViweInit(x + 110, y + 13, 24, 24);
+            showBluetoothConnectedStatus = DropDownConnectedStatusImageViweInit(x + 68, y + 13, 24, 24);
             if (showBluetoothConnectedStatus == nullptr)
             {
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showBluetoothConnectedStatus new fail");
@@ -319,12 +230,10 @@ namespace OHOS
         }
         /* -------------------------------------------------------------------------- */
         UpdatePhoneStatus(GetPhoneConnectedStatus());
-        UpdateEarPhoneStatus(GetEarPhoneConnectedStatus());
         UpdateBlueToothStatus(GetBlueToothConnectedStatus());
         /* -------------------------------------------------------------------------- */
         group[DROPDOWNVIEW]->Add(connectedStatusBackgroundButton);
         group[DROPDOWNVIEW]->Add(showPhoneConnectedStatus);
-        group[DROPDOWNVIEW]->Add(showEarPhoneConnectedStatus);
         group[DROPDOWNVIEW]->Add(showBluetoothConnectedStatus);
     }
 
@@ -340,11 +249,6 @@ namespace OHOS
             delete showPhoneConnectedStatus;
             showPhoneConnectedStatus = nullptr;
         }
-        if (showEarPhoneConnectedStatus != nullptr)
-        {
-            delete showEarPhoneConnectedStatus;
-            showEarPhoneConnectedStatus = nullptr;
-        }
         if (showBluetoothConnectedStatus != nullptr)
         {
             delete showBluetoothConnectedStatus;
index e0b0082..2189e8e 100644 (file)
@@ -431,7 +431,7 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event)
     }
     else if (strcmp(view.GetViewId(), "callingheadset") == 0)
     {
-       NativeAbility::GetInstance().EnterSlice(VIEW_BLUETOOTH_EARPHONE);
+    //    NativeAbility::GetInstance().EnterSlice(VIEW_BLUETOOTH_EARPHONE);
     }
 
 // #endif
index 65f47c1..f029437 100644 (file)
@@ -287,6 +287,7 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bluetoothHeadsetLableButton new fail!!");\r
             return false;\r
         }\r
+        bluetoothHeadsetLableButton->SetVisible(false);\r
 \r
         return true;\r
     }\r
@@ -346,6 +347,7 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bluetoothHeadsetLabel new fail!!");\r
             return false;\r
         }\r
+        bluetoothHeadsetLabel->SetVisible(false);\r
         /* ---------------------- bluetoothHeadsetConnectState ---------------------- */\r
         labelConfig.top = 413;\r
         labelConfig.fontSize = 23;\r
@@ -357,6 +359,7 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bluetoothHeadsetConnectState new fail!!");\r
             return false;\r
         }\r
+        bluetoothHeadsetConnectState->SetVisible(false);\r
         return true;\r
     }\r
 \r
@@ -409,6 +412,7 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneImage LoadPlayerImage fail");\r
             return false;\r
         }\r
+        bluetoothHeadsetImage->SetVisible(false);\r
         return true;\r
     }\r
 \r
@@ -467,8 +471,8 @@ namespace OHOS
             return nullptr;\r
         }\r
 \r
-        UpdateBluetoothHeadsetConnectLabel();\r
-        UpdateBluetoothHeadSetViewIsVisible();\r
+        // UpdateBluetoothHeadsetConnectLabel();\r
+        // UpdateBluetoothHeadSetViewIsVisible();\r
         /* ----------------------------------- Add ---------------------------------- */\r
 \r
         scrollView->Add(titleLabel);\r
index 842da11..f1f0893 100644 (file)
@@ -1023,10 +1023,10 @@ namespace OHOS
             MusicSourceLabelSetText(STR_WATCH_MUSIC); /*手表音乐*/\r
             SetMusicPlayerButtonIsTouchable(false);\r
         }\r
-        if (musicPlayerSourceView)\r
-        {\r
-            musicPlayerSourceView->UpdateBluetoothHeadSetViewIsVisible();\r
-        }\r
+        // if (musicPlayerSourceView)\r
+        // {\r
+        //     musicPlayerSourceView->UpdateBluetoothHeadSetViewIsVisible();\r
+        // }\r
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdatePlayerView over!!");\r
     }\r
 \r
index ecf6787..86cee90 100644 (file)
@@ -137,6 +137,8 @@ namespace OHOS
     // 更新耳机连接状态
     void SettingModel::UpdateEarPhoneConnectStatus(bool status)
     {
+        /*屏蔽蓝牙耳机*/
+        #if 0 
         earphoneConnectStatus = status;
         if (PullUpDownView::GetInstance() != nullptr)
         {
@@ -150,6 +152,7 @@ namespace OHOS
         {
             MusicPlayerSourceView::GetInstance()->UpdateBluetoothHeadsetConnectLabel();
         }
+        #endif
     }
 
     // 更新蓝牙连接状态