mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Pebble: Support removing apps on FW 3.X (metadata)
This commit is contained in:
@@ -179,7 +179,8 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
static final short LENGTH_APPRUNSTATE = 17;
|
static final short LENGTH_APPRUNSTATE = 17;
|
||||||
static final short LENGTH_PING = 5;
|
static final short LENGTH_PING = 5;
|
||||||
static final short LENGTH_PHONEVERSION = 17;
|
static final short LENGTH_PHONEVERSION = 17;
|
||||||
static final short LENGTH_REMOVEAPP = 17;
|
static final short LENGTH_REMOVEAPP_2X = 17;
|
||||||
|
static final short LENGTH_REMOVEAPP_3X = 21;
|
||||||
static final short LENGTH_REFRESHAPP = 5;
|
static final short LENGTH_REFRESHAPP = 5;
|
||||||
static final short LENGTH_SETTIME = 5;
|
static final short LENGTH_SETTIME = 5;
|
||||||
static final short LENGTH_SYSTEMMESSAGE = 2;
|
static final short LENGTH_SYSTEMMESSAGE = 2;
|
||||||
@@ -597,14 +598,27 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] encodeAppDelete(UUID uuid) {
|
public byte[] encodeAppDelete(UUID uuid) {
|
||||||
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_REMOVEAPP);
|
ByteBuffer buf;
|
||||||
buf.order(ByteOrder.BIG_ENDIAN);
|
if (isFw3x) {
|
||||||
buf.putShort(LENGTH_REMOVEAPP);
|
buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_REMOVEAPP_3X);
|
||||||
buf.putShort(ENDPOINT_APPMANAGER);
|
buf.order(ByteOrder.BIG_ENDIAN);
|
||||||
buf.put(APPMANAGER_REMOVEAPP);
|
buf.putShort(LENGTH_REMOVEAPP_3X);
|
||||||
|
buf.putShort(ENDPOINT_BLOBDB);
|
||||||
|
buf.order(ByteOrder.LITTLE_ENDIAN);
|
||||||
|
buf.put(BLOBDB_DELETE);
|
||||||
|
buf.putShort((short) mRandom.nextInt()); // token
|
||||||
|
buf.put(BLOBDB_APP);
|
||||||
|
buf.put(LENGTH_UUID);
|
||||||
|
buf.order(ByteOrder.BIG_ENDIAN);
|
||||||
|
} else {
|
||||||
|
buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_REMOVEAPP_2X);
|
||||||
|
buf.order(ByteOrder.BIG_ENDIAN);
|
||||||
|
buf.putShort(LENGTH_REMOVEAPP_2X);
|
||||||
|
buf.putShort(ENDPOINT_APPMANAGER);
|
||||||
|
buf.put(APPMANAGER_REMOVEAPP);
|
||||||
|
}
|
||||||
buf.putLong(uuid.getMostSignificantBits());
|
buf.putLong(uuid.getMostSignificantBits());
|
||||||
buf.putLong(uuid.getLeastSignificantBits());
|
buf.putLong(uuid.getLeastSignificantBits());
|
||||||
|
|
||||||
return buf.array();
|
return buf.array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user