mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Fix crash on PebbleKit intents where app UUID was sent as String
This commit is contained in:
committed by
Arjan Schrijver
parent
ba0e8c3d86
commit
15f404f2f9
+10
-2
@@ -75,7 +75,7 @@ class PebbleKitSupport {
|
||||
switch (action) {
|
||||
case PEBBLEKIT_ACTION_APP_START:
|
||||
case PEBBLEKIT_ACTION_APP_STOP:
|
||||
uuid = (UUID) intent.getSerializableExtra("uuid");
|
||||
uuid = parseUUIDFromIntent(intent);
|
||||
if (uuid != null) {
|
||||
if (action.equals(PEBBLEKIT_ACTION_APP_STOP) &&
|
||||
intent.getBooleanExtra(PEBBLEKIT_EXTRA_REOPEN_LAST_APP, false)) {
|
||||
@@ -87,7 +87,7 @@ class PebbleKitSupport {
|
||||
break;
|
||||
case PEBBLEKIT_ACTION_APP_SEND:
|
||||
int transaction_id = intent.getIntExtra("transaction_id", -1);
|
||||
uuid = (UUID) intent.getSerializableExtra("uuid");
|
||||
uuid = parseUUIDFromIntent(intent);
|
||||
String jsonString = intent.getStringExtra("msg_data");
|
||||
LOG.info("json string: " + jsonString);
|
||||
|
||||
@@ -136,6 +136,14 @@ class PebbleKitSupport {
|
||||
ContextCompat.registerReceiver(mContext, mPebbleKitReceiver, intentFilter, ContextCompat.RECEIVER_EXPORTED);
|
||||
}
|
||||
|
||||
private UUID parseUUIDFromIntent(Intent intent) {
|
||||
if (intent.getStringExtra("uuid") != null) {
|
||||
return UUID.fromString(intent.getStringExtra("uuid"));
|
||||
} else {
|
||||
return (UUID) intent.getSerializableExtra("uuid");
|
||||
}
|
||||
}
|
||||
|
||||
void sendAppMessageIntent(GBDeviceEventAppMessage appMessage) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(PEBBLEKIT_ACTION_APP_RECEIVE);
|
||||
|
||||
Reference in New Issue
Block a user