From e469ecd4638facf352d439a7d610ec103e78dca8 Mon Sep 17 00:00:00 2001 From: Me7c7 Date: Fri, 13 Sep 2024 10:05:38 +0300 Subject: [PATCH] Huawei: Optional tag for watchface params Related to this crash on Huawei Watch GT: nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket$MissingTagException: Missing tag: 6 at nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiTLV.getBytes(HuaweiTLV.java:219) at nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiTLV.getString(HuaweiTLV.java:239) at nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.Watchface$WatchfaceParams$Response.parseTlv(Watchface.java:125) at nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.requests.Request.handleResponse(Request.java:243) at nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.ResponseManager.handleData(ResponseManager.java:131) at nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.HuaweiSupportProvider.onCharacteristicChanged(HuaweiSupportProvider.java:875) at nodomain.freeyourgadget.gadgetbridge.service.devices.huawei.HuaweiLESupport.onCharacteristicChanged(HuaweiLESupport.java:80) at nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEQueue$InternalGattCallback.onCharacteristicChanged(BtLEQueue.java:679) at android.bluetooth.BluetoothGattCallback.onCharacteristicChanged(BluetoothGattCallback.java:194) at android.bluetooth.BluetoothGatt$1$8.run(BluetoothGatt.java:581) at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:948) at android.bluetooth.BluetoothGatt.-$$Nest$mrunOrQueueCallback(Unknown Source:0) at android.bluetooth.BluetoothGatt$1.onNotify(BluetoothGatt.java:575) at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:329) at android.os.Binder.execTransactInternal(Binder.java:1299) at android.os.Binder.execTransact(Binder.java:1253) --- .../gadgetbridge/devices/huawei/packets/Watchface.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/Watchface.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/Watchface.java index c896007b5..674aa7bc0 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/Watchface.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/Watchface.java @@ -122,7 +122,8 @@ public class Watchface { this.params.height = this.tlv.getShort(0x03); this.params.supportFileType = this.tlv.getByte(0x04); this.params.sort = this.tlv.getByte(0x05); - this.params.otherWatchfaceVersions = this.tlv.getString(0x06); + if (this.tlv.contains(0x06)) + this.params.otherWatchfaceVersions = this.tlv.getString(0x06); } } }