From 8fefd1b49eb21b1b7d96ef7e59e4e9f4ace48cb6 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sat, 12 Oct 2019 19:04:12 +0200 Subject: [PATCH] * Mi Band 4/Amazfit Bip Lite: Trim white spaces and new lines from auth key --- CHANGELOG.md | 1 + .../service/devices/huami/operations/InitOperation.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dab18820..3b6e831c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * Wrist location settings are now per-device for all supported devices * Work around broken layout in database management activity * Show toast in case no app is installed which can handle GPX files +* Mi Band 4/Amazfit Bip Lite: Trim white spaces and new lines from auth key #### Version 0.36.2 * Amazfit Bip: Untested support for Lite variant diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/InitOperation.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/InitOperation.java index b655a8527..974b72128 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/InitOperation.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/InitOperation.java @@ -94,7 +94,7 @@ public class InitOperation extends AbstractBTLEOperation { String authKey = sharedPrefs.getString("authkey", null); if (authKey != null && !authKey.isEmpty()) { - byte[] srcBytes = authKey.getBytes(); + byte[] srcBytes = authKey.trim().getBytes(); if (authKey.length() == 34 && authKey.substring(0, 2).equals("0x")) { srcBytes = GB.hexStringToByteArray(authKey.substring(2)); }