1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 05:16:51 +01:00

Pebble: Choose binaries from basalt/ inside .pbw files for Pebble Time

PBW installation is still unsupported on FW 3.x, these are just preparations
This commit is contained in:
Andreas Shimokawa 2015-08-11 12:47:23 +02:00
parent 5a8c9a9180
commit 151f5b8e12
3 changed files with 11 additions and 6 deletions

View File

@ -25,7 +25,7 @@ public class PBWInstallHandler implements InstallHandler {
public PBWInstallHandler(Uri uri, Context context) {
mContext = context;
mPBWReader = new PBWReader(uri, context);
mPBWReader = new PBWReader(uri, context, ""); // FIXME: we should know the platform here
mUri = uri;
}

View File

@ -51,7 +51,12 @@ public class PBWReader {
private boolean isValid = false;
private String hwRevision = null;
public PBWReader(Uri uri, Context context) {
public PBWReader(Uri uri, Context context, String platform) {
String platformDir = "";
if (!platform.equals("aplite")) {
platformDir = platform + "/";
}
this.uri = uri;
cr = context.getContentResolver();
@ -71,7 +76,7 @@ public class PBWReader {
try {
while ((ze = zis.getNextEntry()) != null) {
String fileName = ze.getName();
if (fileName.equals("manifest.json")) {
if (fileName.equals(platformDir + "manifest.json")) {
long bytes = ze.getSize();
if (bytes > 8192) // that should be too much
break;
@ -102,8 +107,8 @@ public class PBWReader {
int size = jo.getInt("size");
long crc = jo.getLong("crc");
byte type = entry.getValue();
pebbleInstallables.add(new PebbleInstallable(name, size, (int) crc, type));
LOG.info("found file to install: " + name);
pebbleInstallables.add(new PebbleInstallable(platformDir + name, size, (int) crc, type));
LOG.info("found file to install: " + platformDir + name);
isValid = true;
} catch (JSONException e) {
// not fatal

View File

@ -377,7 +377,7 @@ public class PebbleIoThread extends GBDeviceIoThread {
mIsInstalling = true;
mInstallURI = uri;
mPBWReader = new PBWReader(mInstallURI, getContext());
mPBWReader = new PBWReader(mInstallURI, getContext(), gbDevice.getHardwareVersion().equals("dvt") ? "basalt" : "aplite");
mPebbleInstallables = mPBWReader.getPebbleInstallables();
mCurrentInstallableIndex = 0;