Pebble: determine pbw type early for correct display in pbw-cache on firmware 3.x
This commit is contained in:
parent
3123f30e5a
commit
62c196eb1d
|
@ -120,11 +120,17 @@ public class PBWReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String appName = null;
|
||||||
|
String appCreator = null;
|
||||||
|
String appVersion = null;
|
||||||
|
UUID appUUID = null;
|
||||||
|
|
||||||
ZipInputStream zis = new ZipInputStream(fin);
|
ZipInputStream zis = new ZipInputStream(fin);
|
||||||
ZipEntry ze;
|
ZipEntry ze;
|
||||||
pebbleInstallables = new ArrayList<>();
|
pebbleInstallables = new ArrayList<>();
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while ((ze = zis.getNextEntry()) != null) {
|
while ((ze = zis.getNextEntry()) != null) {
|
||||||
String fileName = ze.getName();
|
String fileName = ze.getName();
|
||||||
|
@ -186,15 +192,10 @@ public class PBWReader {
|
||||||
String jsonString = baos.toString();
|
String jsonString = baos.toString();
|
||||||
try {
|
try {
|
||||||
JSONObject json = new JSONObject(jsonString);
|
JSONObject json = new JSONObject(jsonString);
|
||||||
String appName = json.getString("shortName");
|
appName = json.getString("shortName");
|
||||||
String appCreator = json.getString("companyName");
|
appCreator = json.getString("companyName");
|
||||||
String appVersion = json.getString("versionLabel");
|
appVersion = json.getString("versionLabel");
|
||||||
UUID uuid = UUID.fromString(json.getString("uuid"));
|
appUUID = UUID.fromString(json.getString("uuid"));
|
||||||
if (appName != null && appCreator != null && appVersion != null) {
|
|
||||||
// FIXME: dont assume WATCHFACE
|
|
||||||
app = new GBDeviceApp(uuid, appName, appCreator, appVersion, GBDeviceApp.Type.WATCHFACE);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -223,6 +224,16 @@ public class PBWReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zis.close();
|
zis.close();
|
||||||
|
if (appUUID != null && appName != null && appCreator != null && appVersion != null) {
|
||||||
|
GBDeviceApp.Type appType = GBDeviceApp.Type.APP_GENERIC;
|
||||||
|
|
||||||
|
if ((mFlags & 16) == 16) {
|
||||||
|
appType = GBDeviceApp.Type.APP_ACTIVITYTRACKER;
|
||||||
|
} else if ((mFlags & 1) == 1) {
|
||||||
|
appType = GBDeviceApp.Type.WATCHFACE;
|
||||||
|
}
|
||||||
|
app = new GBDeviceApp(appUUID, appName, appCreator, appVersion, appType);
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue