mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 14:32:54 +01:00
Zepp OS: Prevent AGPS file upload under low MTU
This commit is contained in:
parent
f6ff357a6b
commit
d56a42a424
@ -65,9 +65,11 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventAppInfo;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventAppInfo;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.capabilities.loyaltycards.LoyaltyCard;
|
import nodomain.freeyourgadget.gadgetbridge.capabilities.loyaltycards.LoyaltyCard;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventDisplayMessage;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventFindPhone;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventFindPhone;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventScreenshot;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventScreenshot;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences;
|
||||||
@ -585,6 +587,19 @@ public abstract class Huami2021Support extends HuamiSupport implements ZeppOsFil
|
|||||||
try {
|
try {
|
||||||
if (getCoordinator().sendAgpsAsFileTransfer()) {
|
if (getCoordinator().sendAgpsAsFileTransfer()) {
|
||||||
LOG.info("Sending AGPS as file transfer");
|
LOG.info("Sending AGPS as file transfer");
|
||||||
|
|
||||||
|
if (getMTU() == 23) {
|
||||||
|
// AGPS updates without high MTU are too slow and eventually get stuck,
|
||||||
|
// so let's fail right away and inform the user
|
||||||
|
LOG.warn("MTU of {} is too low for AGPS file transfer", getMTU());
|
||||||
|
handleGBDeviceEvent(new GBDeviceEventDisplayMessage(
|
||||||
|
getContext().getString(R.string.updatefirmwareoperation_failed_low_mtu, getMTU()),
|
||||||
|
Toast.LENGTH_LONG,
|
||||||
|
GB.WARN
|
||||||
|
));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
new ZeppOsAgpsUpdateOperation(
|
new ZeppOsAgpsUpdateOperation(
|
||||||
this,
|
this,
|
||||||
agpsHandler.getFile(),
|
agpsHandler.getFile(),
|
||||||
|
@ -831,6 +831,7 @@
|
|||||||
<string name="gpx_route_upload_failed">Gpx route upload failed</string>
|
<string name="gpx_route_upload_failed">Gpx route upload failed</string>
|
||||||
<string name="gpx_route_upload_complete">Gpx route upload complete</string>
|
<string name="gpx_route_upload_complete">Gpx route upload complete</string>
|
||||||
<string name="gpx_route_upload_in_progress">Uploading gpx route</string>
|
<string name="gpx_route_upload_in_progress">Uploading gpx route</string>
|
||||||
|
<string name="updatefirmwareoperation_failed_low_mtu">Current MTU of %1$d is too low, please enable high MTU in the device settings.</string>
|
||||||
<string name="chart_steps">Steps</string>
|
<string name="chart_steps">Steps</string>
|
||||||
<string name="calories">Calories</string>
|
<string name="calories">Calories</string>
|
||||||
<string name="distance">Distance</string>
|
<string name="distance">Distance</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user