From 2b3592f35408b107e5f6d9c2792351bee6c82791 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Fri, 16 Dec 2016 23:47:59 +0100 Subject: [PATCH] Pebble: allow sending data to the pebble during installation on FW >= 3.0 It seems to be no problem to recieve notifications etc during app installation with non legacy firmwares :) --- .../service/devices/pebble/PebbleIoThread.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java index 45035477..8bbc5b57 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java @@ -486,10 +486,11 @@ class PebbleIoThread extends GBDeviceIoThread { if (bytes == null) { return; } - // block writes if app installation in in progress - if (mIsConnected && (!mIsInstalling || mInstallState == PebbleAppInstallState.WAIT_SLOT)) { - write_real(bytes); + // on FW < 3.0 block writes if app installation in in progress + if (!mIsConnected || (mPebbleProtocol.mFwMajor < 3 && mIsInstalling && mInstallState != PebbleAppInstallState.WAIT_SLOT)) { + return; } + write_real(bytes); } // FIXME: parts are supporsed to be generic code @@ -500,7 +501,7 @@ class PebbleIoThread extends GBDeviceIoThread { LOG.info("syncing time"); write(mPebbleProtocol.encodeSetTime()); } - write(mPebbleProtocol.encodeEnableAppLogs(prefs.getBoolean("pebble_enable_applogs",false))); + write(mPebbleProtocol.encodeEnableAppLogs(prefs.getBoolean("pebble_enable_applogs", false))); write(mPebbleProtocol.encodeReportDataLogSessions()); gbDevice.setState(GBDevice.State.INITIALIZED); return false; @@ -603,10 +604,6 @@ class PebbleIoThread extends GBDeviceIoThread { } void installApp(Uri uri, int appId) { - if (mIsInstalling) { - return; - } - if (uri.equals(Uri.parse("fake://health"))) { write(mPebbleProtocol.encodeActivateHealth(true)); write(mPebbleProtocol.encodeSetSaneDistanceUnit(true)); @@ -617,6 +614,10 @@ class PebbleIoThread extends GBDeviceIoThread { return; } + if (mIsInstalling) { + return; + } + String platformName = PebbleUtils.getPlatformName(gbDevice.getModel()); try {