From ffc6bd5a73604510d8d7681c5164ee01016df95b Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 19 Aug 2018 00:51:04 +0200 Subject: [PATCH] Mi Band 3: Also fix diplay of SMS and EMAIL We have to send a fake app source that is never displayed to make the text appear... :P --- .../devices/huami/amazfitbip/AmazfitBipSupport.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipSupport.java index dda8d2cfb..58d9270d3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipSupport.java @@ -110,9 +110,10 @@ public class AmazfitBipSupport extends HuamiSupport { int maxLength = 230; if (characteristicChunked != null) { int prefixlength = 2; - int suffixlength = 0; - byte[] appSuffix = null; + // We also need a (fake) source name for Mi Band 3 for SMS/EMAIL, else the message is not displayed + byte[] appSuffix = "\0 \0".getBytes(); + int suffixlength = appSuffix.length; if (alertCategory == AlertCategory.CustomHuami) { String appName; @@ -127,7 +128,7 @@ public class AmazfitBipSupport extends HuamiSupport { if (ai != null) { appName = "\0" + pm.getApplicationLabel(ai) + "\0"; } else { - appName = "\0" + "unknown app" + "\0"; + appName = "\0" + "UNKNOWN" + "\0"; } appSuffix = appName.getBytes(); suffixlength = appSuffix.length; @@ -145,9 +146,7 @@ public class AmazfitBipSupport extends HuamiSupport { } System.arraycopy(rawmessage, 0, command, prefixlength, length); - if (appSuffix != null) { - System.arraycopy(appSuffix, 0, command, prefixlength + length, appSuffix.length); - } + System.arraycopy(appSuffix, 0, command, prefixlength + length, appSuffix.length); writeToChunked(builder, 0, command); } else {