1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-01 14:32:54 +01:00

Huami: Display explicit error if there is not enough free space

This commit is contained in:
José Rebelo 2023-08-26 12:14:23 +01:00
parent e36bd2eae7
commit 55d0697c44
2 changed files with 10 additions and 1 deletions

View File

@ -54,6 +54,8 @@ public class UpdateFirmwareOperation2020 extends UpdateFirmwareOperation {
public static final byte COMMAND_COMPLETE_TRANSFER = (byte) 0xd5; public static final byte COMMAND_COMPLETE_TRANSFER = (byte) 0xd5;
public static final byte COMMAND_FINALIZE_UPDATE = (byte) 0xd6; public static final byte COMMAND_FINALIZE_UPDATE = (byte) 0xd6;
public static final byte REPLY_ERROR_FREE_SPACE = (byte) 0x47;
protected int mChunkLength = -1; protected int mChunkLength = -1;
@Override @Override
@ -133,7 +135,13 @@ public class UpdateFirmwareOperation2020 extends UpdateFirmwareOperation {
LOG.error("Unexpected notification during firmware update: "); LOG.error("Unexpected notification during firmware update: ");
operationFailed(); operationFailed();
getSupport().logMessageContent(value); getSupport().logMessageContent(value);
displayMessage(getContext(), getContext().getString(R.string.updatefirmwareoperation_metadata_updateproblem), Toast.LENGTH_LONG, GB.ERROR); int errorMessage = R.string.updatefirmwareoperation_metadata_updateproblem;
// Display a more specific error message for known errors
if (value[0] == HuamiService.RESPONSE && value[1] == COMMAND_START_TRANSFER && value[2] == REPLY_ERROR_FREE_SPACE) {
// Not enough free space on the device
errorMessage = R.string.updatefirmwareoperation_updateproblem_free_space;
}
displayMessage(getContext(), getContext().getString(errorMessage), Toast.LENGTH_LONG, GB.ERROR);
done(); done();
} }
} }

View File

@ -824,6 +824,7 @@
<string name="pbwinstallhandler_app_item">%1$s (%2$s)</string> <string name="pbwinstallhandler_app_item">%1$s (%2$s)</string>
<string name="updatefirmwareoperation_updateproblem_do_not_reboot">Problem with the firmware transfer. DO NOT REBOOT your Mi Band!</string> <string name="updatefirmwareoperation_updateproblem_do_not_reboot">Problem with the firmware transfer. DO NOT REBOOT your Mi Band!</string>
<string name="updatefirmwareoperation_metadata_updateproblem">Problem with the firmware metadata transfer</string> <string name="updatefirmwareoperation_metadata_updateproblem">Problem with the firmware metadata transfer</string>
<string name="updatefirmwareoperation_updateproblem_free_space">The device does not have enough free space</string>
<string name="updatefirmwareoperation_update_complete">Firmware installation complete</string> <string name="updatefirmwareoperation_update_complete">Firmware installation complete</string>
<string name="updatefirmwareoperation_update_complete_rebooting">Firmware installation complete, rebooting device…</string> <string name="updatefirmwareoperation_update_complete_rebooting">Firmware installation complete, rebooting device…</string>
<string name="updatefirmwareoperation_write_failed">Firmware flashing failed</string> <string name="updatefirmwareoperation_write_failed">Firmware flashing failed</string>