1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-27 11:05:49 +01:00

Huami: Do not display firmware information and whitelist information when flashing watchfaces

Closes #1781
This commit is contained in:
Andreas Shimokawa 2020-04-08 11:05:47 +02:00
parent e5560fb182
commit 11d96e4641
4 changed files with 34 additions and 16 deletions

View File

@ -28,6 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWHelper;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareInfo;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
public abstract class HuamiFWHelper extends AbstractMiBandFWHelper {
protected HuamiFirmwareInfo firmwareInfo;
@ -110,6 +111,10 @@ public abstract class HuamiFWHelper extends AbstractMiBandFWHelper {
firmwareInfo.checkValid();
}
@Override
public HuamiFirmwareType getFirmwareType() {
return firmwareInfo.getFirmwareType();
}
public HuamiFirmwareInfo getFirmwareInfo() {
return firmwareInfo;
}

View File

@ -31,6 +31,7 @@ import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
import nodomain.freeyourgadget.gadgetbridge.util.UriHelper;
@ -122,4 +123,6 @@ public abstract class AbstractMiBandFWHelper {
protected abstract void determineFirmwareInfo(byte[] wholeFirmwareBytes);
public abstract void checkValid() throws IllegalArgumentException;
public abstract HuamiFirmwareType getFirmwareType();
}

View File

@ -30,6 +30,8 @@ import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType.WATCHFACE;
public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
private static final Logger LOG = LoggerFactory.getLogger(AbstractMiBandFWInstallHandler.class);
@ -58,7 +60,7 @@ public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
protected abstract AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException;
protected GenericItem createInstallItem(GBDevice device) {
private GenericItem createInstallItem(GBDevice device) {
return new GenericItem(mContext.getString(R.string.installhandler_firmware_name, mContext.getString(device.getType().getName()), helper.getFirmwareKind(), helper.getHumanFirmwareVersion()));
}
@ -98,6 +100,7 @@ public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
return;
}
StringBuilder builder = new StringBuilder();
if (helper.getFirmwareType() != WATCHFACE) {
if (helper.isSingleFirmware()) {
getFwUpgradeNotice();
builder.append(getFwUpgradeNotice());
@ -116,6 +119,7 @@ public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
fwItem.setDetails(mContext.getString(R.string.miband_fwinstaller_untested_version));
// TODO: set a UNKNOWN (question mark) button
}
}
installActivity.setInfoText(builder.toString());
installActivity.setInstallItem(fwItem);
installActivity.setInstallEnabled(true);

View File

@ -29,6 +29,7 @@ import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.AbstractMiFirmwareInfo;
/**
@ -122,6 +123,11 @@ public class MiBandFWHelper extends AbstractMiBandFWHelper {
firmwareInfo.checkValid();
}
@Override
public HuamiFirmwareType getFirmwareType() {
return null;
}
/**
* @param wholeFirmwareBytes
* @return