From f15f60542dccb07e133f4aecd599c03ab8295f29 Mon Sep 17 00:00:00 2001 From: "Martin.JM" Date: Tue, 6 Aug 2024 12:04:05 +0200 Subject: [PATCH] Huawei: Fix for Huawei Band 9 Linked to #3784. --- .../gadgetbridge/devices/huawei/HuaweiLECoordinator.java | 5 ++++- .../service/devices/huawei/HuaweiSupportProvider.java | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiLECoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiLECoordinator.java index cd641c16a..2ee890f11 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiLECoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiLECoordinator.java @@ -81,7 +81,10 @@ public abstract class HuaweiLECoordinator extends AbstractBLEDeviceCoordinator i @Override public int[] getSupportedDeviceSpecificAuthenticationSettings() { - return new int[]{R.xml.devicesettings_huawei_account}; + return new int[]{ + R.xml.devicesettings_huawei_account, + R.xml.devicesettings_miband6_new_protocol + }; } @Override diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java index 3418b1117..8ac7891ee 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiSupportProvider.java @@ -529,7 +529,8 @@ public class HuaweiSupportProvider { if (isBLE()) { leBuilder = createLeTransactionBuilder("Initializing"); leBuilder.setCallback(leSupport); - leBuilder.notify(leSupport.getCharacteristic(HuaweiConstants.UUID_CHARACTERISTIC_HUAWEI_READ), true); + if (!GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean("force_new_protocol", false)) + leBuilder.notify(leSupport.getCharacteristic(HuaweiConstants.UUID_CHARACTERISTIC_HUAWEI_READ), true); leBuilder.add(new nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateAction(gbDevice, GBDevice.State.INITIALIZING, context)); } else { brBuilder = createBrTransactionBuilder("Initializing");