1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-28 01:24:05 +02: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 boolean isAck = false;
public byte[] info;
public Response(ParamsProvider paramsProvider) {
@ -795,7 +796,12 @@ public class DeviceConfig {
}
@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()];
int i = 0;
for (TLV tlv : this.tlv.get()) {

View File

@ -382,6 +382,10 @@ public class AsynchronousResponse {
return;
}
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);
try {
getPhoneInfoReq.doPerform();