Bug 464392 - Since SDK 31 bump, it is not possible to send SMS using KDE Connect
Summary: Since SDK 31 bump, it is not possible to send SMS using KDE Connect
Status: RESOLVED FIXED
Alias: None
Product: kdeconnect
Classification: Applications
Component: android-application (show other bugs)
Version: unspecified
Platform: Other Linux
: HI major
Target Milestone: ---
Assignee: Simon Redman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-16 22:17 UTC by Simon Redman
Modified: 2023-01-23 22:02 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Redman 2023-01-16 22:17:32 UTC
SUMMARY
Since SDK 31 (https://invent.kde.org/network/kdeconnect-android/-/commit/6fbd923c60538c2cc6da22246f5b523ef3160256), it is not possible to send SMS.

STEPS TO REPRODUCE
1. Use latest KDE Connect release (early January, 2023)
2. Send SMS using KDE Connect

OBSERVED RESULT

> V/Sending message: Sending new SMS
> E/Sending message: Exception
>     java.lang.IllegalArgumentException: org.kde.kdeconnect_tp: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
>     Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
>         at android.app.PendingIntent.checkFlags(PendingIntent.java:382)
>         at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:673)
>         at android.app.PendingIntent.getBroadcast(PendingIntent.java:660)
>         at com.klinker.android.send_message.Transaction.sendSmsMessage(Transaction.java:267)
>         at com.klinker.android.send_message.Transaction.sendNewMessage(Transaction.java:158)
>         at com.klinker.android.send_message.Transaction.sendNewMessage(Transaction.java:172)
>         at org.kde.kdeconnect.Plugins.SMSPlugin.SmsMmsUtils.sendMessage(SmsMmsUtils.java:188)
>         at org.kde.kdeconnect.Plugins.SMSPlugin.SMSPlugin.onPacketReceived(SMSPlugin.java:414)
>         at org.kde.kdeconnect.Device.onPacketReceived(Device.java:570)
>         <snipped for brevity>

EXPECTED RESULT

SMS sends

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.26.4
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7

ADDITIONAL INFORMATION
Initially reported by another user in https://bugs.kde.org/show_bug.cgi?id=425638
Comment 1 Simon Redman 2023-01-21 02:14:53 UTC
I have created this PR against the com.klinker.android library, which contains the offending code: https://github.com/klinker41/android-smsmms/pull/193

I have tested this change locally: Next step, figure out how to package and ship KDE Connect with that fix.
Comment 2 Simon Redman 2023-01-23 22:02:06 UTC
Git commit bcf080f6eb93b12194208e4114b52767f5b0acb0 by Simon Redman.
Committed on 23/01/2023 at 22:02.
Pushed by sredman into branch 'master'.

[SMS Plugin] Change android-smsmms to in-house build until upstream supports SDK31

## Summary

Android apps which target SDK 31+ require specifying the mutability of any PENDING_INTENT. This is not supported in the upstream android-smsmms library: https://github.com/klinker41/android-smsmms/pull/193

Until the above PR is merged, we need a solution. I have pulled the code into https://invent.kde.org/sredman/android-smsmms and published the package in the Maven repository in gitlab.

## Test Plan

### Before:
Attempting to send an SMS or MMS message using kdeconnect-sms results in no message being sent, and an error being logged:

> V/Sending message: Sending new SMS
> E/Sending message: Exception
>     java.lang.IllegalArgumentException: org.kde.kdeconnect_tp: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
>     Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
>         at android.app.PendingIntent.checkFlags(PendingIntent.java:382)
>         at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:673)
>         at android.app.PendingIntent.getBroadcast(PendingIntent.java:660)
>         at com.klinker.android.send_message.Transaction.sendSmsMessage(Transaction.java:267)
>         at com.klinker.android.send_message.Transaction.sendNewMessage(Transaction.java:158)
>         at com.klinker.android.send_message.Transaction.sendNewMessage(Transaction.java:172)
>         at org.kde.kdeconnect.Plugins.SMSPlugin.SmsMmsUtils.sendMessage(SmsMmsUtils.java:188)
>         at org.kde.kdeconnect.Plugins.SMSPlugin.SMSPlugin.onPacketReceived(SMSPlugin.java:414)
>         at org.kde.kdeconnect.Device.onPacketReceived(Device.java:570)
>         <snipped for brevity>

### After:
SMS and MMS sends normally.

M  +8    -2    build.gradle
M  +6    -0    settings.gradle

https://invent.kde.org/network/kdeconnect-android/commit/bcf080f6eb93b12194208e4114b52767f5b0acb0