mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 04:46:51 +01:00
Made the firmware version extraction a bit more robust and added annotations to keep data classes after optimizations
This commit is contained in:
parent
348f459e3f
commit
0b021d72ab
@ -16,24 +16,30 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.pinetime;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
@Keep
|
||||
public class InfiniTimeDFUPackage {
|
||||
InfiniTimeDFUPackageManifest manifest;
|
||||
}
|
||||
|
||||
@Keep
|
||||
class InfiniTimeDFUPackageManifest {
|
||||
InfiniTimeDFUPackageApplication application;
|
||||
Float dfu_version;
|
||||
}
|
||||
|
||||
@Keep
|
||||
class InfiniTimeDFUPackageApplication {
|
||||
String bin_file;
|
||||
String dat_file;
|
||||
InfiniTimeDFUPackagePacketData init_packet_data;
|
||||
}
|
||||
|
||||
@Keep
|
||||
class InfiniTimeDFUPackagePacketData {
|
||||
BigInteger application_version;
|
||||
BigInteger device_revision;
|
||||
|
@ -16,6 +16,8 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.pinetime;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
@ -38,8 +40,6 @@ import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.UriHelper;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
public class PineTimeInstallHandler implements InstallHandler {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PineTimeInstallHandler.class);
|
||||
|
||||
@ -92,9 +92,15 @@ public class PineTimeInstallHandler implements InstallHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (metadata != null) {
|
||||
if (metadata != null &&
|
||||
metadata.manifest != null &&
|
||||
metadata.manifest.application != null &&
|
||||
metadata.manifest.application.bin_file != null) {
|
||||
valid = true;
|
||||
version = metadata.manifest.application.bin_file;
|
||||
} else {
|
||||
valid = false;
|
||||
LOG.error("Somehow metadata was found, but some data was missing");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user