diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a09bf5a..56950740 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ####Next Version * Pebble: Support launching of Watchapps though the AppManager Activity * Pebble: Fix firmware installation when all 8 app slots are in use (and probably firmware installation form recovery) +* Pebble: Fix error when reinstalling apps, useful for upgrading/downgrading * Pebble: Support CM 12.1 Music App * Mi Band: Make vibration count configurable for different kinds of Notifications * Support rebooting Mi Band/Pebble through the Debug Activity diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PebbleIoThread.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PebbleIoThread.java index feedc2ad..aa2932e6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PebbleIoThread.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PebbleIoThread.java @@ -318,13 +318,31 @@ public class PebbleIoThread extends GBDeviceIoThread { // right now on the Pebble we also receive this on a failed/successful installation ;/ switch (appMgmtRes.result) { case FAILURE: - LOG.info("failure removing app"); // TODO: report to AppManager - finishInstall(true); + if (mIsInstalling) { + if (mInstallState == PebbleAppInstallState.WAIT_SLOT) { + // get the free slot + writeInstallApp(mPebbleProtocol.encodeAppInfoReq()); + } else { + finishInstall(true); + } + } else { + LOG.info("failure removing app"); + } break; case SUCCESS: - finishInstall(false); - // refresh app list - write(mPebbleProtocol.encodeAppInfoReq()); + if (mIsInstalling) { + if (mInstallState == PebbleAppInstallState.WAIT_SLOT) { + // get the free slot + writeInstallApp(mPebbleProtocol.encodeAppInfoReq()); + } else { + finishInstall(false); + // refresh app list + write(mPebbleProtocol.encodeAppInfoReq()); + } + } else { + LOG.info("successfully removed app"); + write(mPebbleProtocol.encodeAppInfoReq()); + } break; default: break; @@ -397,7 +415,7 @@ public class PebbleIoThread extends GBDeviceIoThread { mInstallSlot = 0; mInstallState = PebbleAppInstallState.START_INSTALL; } else { - writeInstallApp(mPebbleProtocol.encodeAppInfoReq()); + writeInstallApp(mPebbleProtocol.encodeAppDelete(mPBWReader.getGBDeviceApp().getUUID())); mInstallState = PebbleAppInstallState.WAIT_SLOT; } }