1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-02-17 21:06:48 +01:00

Huawei: Fix flood of PhoneInfo messages

PR #3858 resulted in a flood of PhoneInfo messages. This fixes that.
This commit is contained in:
Martin.JM 2024-07-02 13:32:29 +02:00
parent b6f9faff80
commit e7fb74a18f
2 changed files with 11 additions and 1 deletions

View File

@ -785,6 +785,7 @@ public class DeviceConfig {
} }
public static class Response extends HuaweiPacket { public static class Response extends HuaweiPacket {
public boolean isAck = false;
public byte[] info; public byte[] info;
public Response(ParamsProvider paramsProvider) { public Response(ParamsProvider paramsProvider) {
@ -795,7 +796,12 @@ public class DeviceConfig {
} }
@Override @Override
public void parseTlv() { public void parseTlv() throws MissingTagException {
if (this.tlv.get().size() == 1 && this.tlv.contains(0x7f) && this.tlv.getInteger(0x7f) == 0x186A0) {
this.isAck = true;
return;
}
info = new byte[this.tlv.length()]; info = new byte[this.tlv.length()];
int i = 0; int i = 0;
for (TLV tlv : this.tlv.get()) { for (TLV tlv : this.tlv.get()) {

View File

@ -382,6 +382,10 @@ public class AsynchronousResponse {
return; return;
} }
DeviceConfig.PhoneInfo.Response phoneInfoResp = (DeviceConfig.PhoneInfo.Response) response; DeviceConfig.PhoneInfo.Response phoneInfoResp = (DeviceConfig.PhoneInfo.Response) response;
if (phoneInfoResp.isAck) {
LOG.info("Not responding to ack for PhoneInfo");
return;
}
GetPhoneInfoRequest getPhoneInfoReq = new GetPhoneInfoRequest(this.support, phoneInfoResp.info); GetPhoneInfoRequest getPhoneInfoReq = new GetPhoneInfoRequest(this.support, phoneInfoResp.info);
try { try {
getPhoneInfoReq.doPerform(); getPhoneInfoReq.doPerform();