mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-19 07:07:46 +01:00
Pebble: add hack to enable and maybe disable Health from the App Manager activity
This commit is contained in:
parent
b9cb89ab8b
commit
33cf76172b
@ -31,6 +31,7 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.adapter.GBDeviceAppAdapter;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.PebbleProtocol;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
|
||||
|
||||
@ -76,6 +77,7 @@ public class AppManagerActivity extends Activity {
|
||||
List<GBDeviceApp> systemApps = new ArrayList<>();
|
||||
systemApps.add(new GBDeviceApp(UUID.fromString("4dab81a6-d2fc-458a-992c-7a1f3b96a970"), "Sports (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||
systemApps.add(new GBDeviceApp(UUID.fromString("cf1e816a-9db0-4511-bbb8-f60c48ca8fac"), "Golf (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||
systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_PEBBLE_HEALTH, "Health (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||
|
||||
return systemApps;
|
||||
}
|
||||
@ -155,7 +157,7 @@ public class AppManagerActivity extends Activity {
|
||||
AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) menuInfo;
|
||||
selectedApp = appList.get(acmi.position);
|
||||
|
||||
if (!selectedApp.isInCache()) {
|
||||
if (!selectedApp.isInCache() && !PebbleProtocol.UUID_PEBBLE_HEALTH.equals(selectedApp.getUUID())) {
|
||||
menu.removeItem(R.id.appmanager_app_reinstall);
|
||||
}
|
||||
menu.setHeaderTitle(selectedApp.getName());
|
||||
@ -168,6 +170,11 @@ public class AppManagerActivity extends Activity {
|
||||
GBApplication.deviceService().onAppDelete(selectedApp.getUUID());
|
||||
return true;
|
||||
case R.id.appmanager_app_reinstall:
|
||||
if (PebbleProtocol.UUID_PEBBLE_HEALTH.equals(selectedApp.getUUID())) {
|
||||
GBApplication.deviceService().onInstallApp(Uri.parse("fake://health"));
|
||||
return true;
|
||||
}
|
||||
|
||||
File cachePath;
|
||||
try {
|
||||
cachePath = new File(FileUtils.getExternalFilesDir().getPath() + "/pbw-cache/" + selectedApp.getUUID() + ".pbw");
|
||||
|
@ -570,6 +570,11 @@ public class PebbleIoThread extends GBDeviceIoThread {
|
||||
return;
|
||||
}
|
||||
|
||||
if (uri.equals(Uri.parse("fake://health"))) {
|
||||
write(mPebbleProtocol.encodeActivateHealth(true));
|
||||
return;
|
||||
}
|
||||
|
||||
String hwRev = gbDevice.getHardwareVersion();
|
||||
String platformName;
|
||||
if (hwRev.startsWith("snowy")) {
|
||||
|
@ -343,11 +343,11 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
byte last_id = -1;
|
||||
private final ArrayList<UUID> tmpUUIDS = new ArrayList<>();
|
||||
|
||||
public static final UUID UUID_PEBBLE_HEALTH = UUID.fromString("36d8c6ed-4c83-4fa1-a9e2-8f12dc941f8c"); // FIXME: store somewhere else, this is also accessed by other code
|
||||
private static final UUID UUID_GBPEBBLE = UUID.fromString("61476764-7465-7262-6469-656775527a6c");
|
||||
private static final UUID UUID_MORPHEUZ = UUID.fromString("5be44f1d-d262-4ea6-aa30-ddbec1e3cab2");
|
||||
private static final UUID UUID_WHETHERNEAT = UUID.fromString("3684003b-a685-45f9-a713-abc6364ba051");
|
||||
private static final UUID UUID_MISFIT = UUID.fromString("0b73b76a-cd65-4dc2-9585-aaa213320858");
|
||||
private static final UUID UUID_PEBBLE_HEALTH = UUID.fromString("36d8c6ed-4c83-4fa1-a9e2-8f12dc941f8c");
|
||||
private static final UUID UUID_PEBBLE_TIMESTYLE = UUID.fromString("4368ffa4-f0fb-4823-90be-f754b076bdaa");
|
||||
private static final UUID UUID_PEBSTYLE = UUID.fromString("da05e84d-e2a2-4020-a2dc-9cdcf265fcdd");
|
||||
|
||||
@ -675,7 +675,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
return buf.array();
|
||||
}
|
||||
|
||||
private byte[] encodeBlobdbActivateHealth(boolean activate) {
|
||||
public byte[] encodeActivateHealth(boolean activate) {
|
||||
byte[] blob;
|
||||
byte command;
|
||||
if (activate) {
|
||||
@ -1092,6 +1092,9 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
@Override
|
||||
public byte[] encodeAppDelete(UUID uuid) {
|
||||
if (isFw3x) {
|
||||
if (UUID_PEBBLE_HEALTH.equals(uuid)) {
|
||||
return encodeActivateHealth(false);
|
||||
}
|
||||
return encodeBlobdb(uuid, BLOBDB_DELETE, BLOBDB_APP, null);
|
||||
} else {
|
||||
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_REMOVEAPP_2X);
|
||||
|
Loading…
Reference in New Issue
Block a user