1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-24 17:45:50 +01:00

Pebble: Fix error when reinstalling apps, useful for upgrading/downgrading

Fixes #65
This commit is contained in:
Andreas Shimokawa 2015-06-08 22:38:16 +02:00
parent 4f8a7ea64d
commit efac912929
2 changed files with 25 additions and 6 deletions

View File

@ -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

View File

@ -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
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:
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;
}
}