mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 05:16:51 +01:00
Amazift Bip Lite: Allow relaxing firmware checks to allow flashing of the regular Bip firmware (for the brave)
Closes #1819
This commit is contained in:
parent
f04c9aed29
commit
1a57c4db68
@ -29,4 +29,5 @@ public class DeviceSettingsPreferenceConst {
|
|||||||
public static final String PREF_BUTTON_2_FUNCTION = "button_2_function";
|
public static final String PREF_BUTTON_2_FUNCTION = "button_2_function";
|
||||||
public static final String PREF_BUTTON_3_FUNCTION = "button_3_function";
|
public static final String PREF_BUTTON_3_FUNCTION = "button_3_function";
|
||||||
public static final String PREF_VIBRATION_STRENGH_PERCENTAGE = "vibration_strength";
|
public static final String PREF_VIBRATION_STRENGH_PERCENTAGE = "vibration_strength";
|
||||||
|
public static final String PREF_RELAX_FIRMWARE_CHECKS = "relax_firmware_checks";
|
||||||
}
|
}
|
@ -26,7 +26,9 @@ import androidx.annotation.NonNull;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||||
|
|
||||||
@ -63,4 +65,21 @@ public class AmazfitBipLiteCoordinator extends AmazfitBipCoordinator {
|
|||||||
public int getBondingStyle() {
|
public int getBondingStyle() {
|
||||||
return BONDING_STYLE_REQUIRE_KEY;
|
return BONDING_STYLE_REQUIRE_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
||||||
|
return new int[]{
|
||||||
|
R.xml.devicesettings_amazfitbip,
|
||||||
|
R.xml.devicesettings_timeformat,
|
||||||
|
R.xml.devicesettings_wearlocation,
|
||||||
|
R.xml.devicesettings_custom_emoji_font,
|
||||||
|
R.xml.devicesettings_liftwrist_display,
|
||||||
|
R.xml.devicesettings_disconnectnotification,
|
||||||
|
R.xml.devicesettings_sync_calendar,
|
||||||
|
R.xml.devicesettings_expose_hr_thirdparty,
|
||||||
|
R.xml.devicesettings_buttonactions_with_longpress,
|
||||||
|
R.xml.devicesettings_pairingkey,
|
||||||
|
R.xml.devicesettings_relax_firmware_checks,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,14 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareInfo;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareInfo;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.ArrayUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.ArrayUtils;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||||
|
|
||||||
public class AmazfitBipLiteFirmwareInfo extends HuamiFirmwareInfo {
|
public class AmazfitBipLiteFirmwareInfo extends HuamiFirmwareInfo {
|
||||||
|
|
||||||
@ -66,6 +69,15 @@ public class AmazfitBipLiteFirmwareInfo extends HuamiFirmwareInfo {
|
|||||||
if (searchString32BitAligned(bytes, "Amazfit Bip Lite")) {
|
if (searchString32BitAligned(bytes, "Amazfit Bip Lite")) {
|
||||||
return HuamiFirmwareType.FIRMWARE;
|
return HuamiFirmwareType.FIRMWARE;
|
||||||
}
|
}
|
||||||
|
GBDevice device = GBApplication.app().getDeviceManager().getSelectedDevice();
|
||||||
|
if (device != null) {
|
||||||
|
Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(device.getAddress()));
|
||||||
|
if (prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_RELAX_FIRMWARE_CHECKS, false)) {
|
||||||
|
if (searchString32BitAligned(bytes, "Amazfit Bip")) {
|
||||||
|
return HuamiFirmwareType.FIRMWARE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return HuamiFirmwareType.INVALID;
|
return HuamiFirmwareType.INVALID;
|
||||||
}
|
}
|
||||||
if (ArrayUtils.startsWith(bytes, WATCHFACE_HEADER)) {
|
if (ArrayUtils.startsWith(bytes, WATCHFACE_HEADER)) {
|
||||||
|
@ -186,6 +186,8 @@
|
|||||||
<string name="pref_summary_allow_high_mtu">Increases transfer speed, but might not work on some Android devices.</string>
|
<string name="pref_summary_allow_high_mtu">Increases transfer speed, but might not work on some Android devices.</string>
|
||||||
<string name="pref_summary_sync_calendar">Enables calendar alerts, even when disconnected</string>
|
<string name="pref_summary_sync_calendar">Enables calendar alerts, even when disconnected</string>
|
||||||
<string name="pref_title_sync_caldendar">Sync calendar events</string>
|
<string name="pref_title_sync_caldendar">Sync calendar events</string>
|
||||||
|
<string name="pref_summary_relax_firmware_checks">Relax firmware checks</string>
|
||||||
|
<string name="pref_title_relax_firmware_checks">Enable this if you want to flash a firmware not intended for you device (at your own risk)</string>
|
||||||
<string name="pref_title_vibration_strength">Vibration strength</string>
|
<string name="pref_title_vibration_strength">Vibration strength</string>
|
||||||
<string name="pref_display_add_device_fab">Connect new device button</string>
|
<string name="pref_display_add_device_fab">Connect new device button</string>
|
||||||
<string name="pref_display_add_device_fab_on">Always visible</string>
|
<string name="pref_display_add_device_fab_on">Always visible</string>
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="relax_firmware_checks"
|
||||||
|
android:summary="@string/pref_summary_relax_firmware_checks"
|
||||||
|
android:title="@string/pref_title_relax_firmware_checks" />
|
||||||
|
</androidx.preference.PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user