Bug 464037

Summary: KdeConnect fails to send SMS message due to permission error but all permissions are allowed
Product: [Applications] kdeconnect Reporter: ddowie <lanobald>
Component: android-applicationAssignee: Albert Vaca Cintora <albertvaka>
Status: REPORTED ---    
Severity: normal CC: andrew.g.r.holmes
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description ddowie 2023-01-09 06:58:02 UTC
KdeConnect fails to send SMS message due to permission error (No permission to access APN settings)? 
All permissions are allowed for the KDEConnect app in the android. (Phone, SMS, Call logs, Contacts, Misic and audio...)

STEPS TO REPRODUCE
1. install KdeConnect on android 13 (samsug galaxy s21 ultra)
2. install GsConnect client on PC
3. send SMS from Gsconnect

OBSERVED RESULT
SMS message is not sent. Typed message content stays greyed out then dissapears.

EXPECTED RESULT
SMS message written on the pc should be sent through the KDEConnect app on the device(android)

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 22.04
(available in About System)
Gnome 42.5

ADDITIONAL INFORMATION
Log on the PC side shows that message was sent to device:

jan 06 08:43:40 org.gnome.Shell.Extensions.GSConnect[30554]: [/service/device.js:sendPacket:449]: SM-G998B: {
"id": 1672991020072,
"type": "kdeconnect.sms.request",
"body": {
"sendSms": true,
"phoneNumber": "+3xxxxxxxxx",
"messageBody": "test5"
}
}

On the device adb logcat shows exception:

01-08 16:42:35.620 27764 7001 W Sending message: Unable to determine correct outgoing address for sub ID -1. Using
01-08 16:42:35.636 27764 7001 E TelephonyHelper: Error encountered while trying to read APNs
01-08 16:42:35.636 27764 7001 E TelephonyHelper: java.lang.SecurityException: No permission to access APN settings
01-08 16:42:35.636 27764 7001 E TelephonyHelper: at android.os.Parcel.createExceptionOrNull(Parcel.java:3023)
....
...
.
..
....
01-08 16:42:35.637 27764 7001 V Sending message: Sending new SMS
01-08 16:42:35.768 27764 7001 E Sending message: Exception
01-08 16:42:35.768 27764 7001 E Sending message: 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.
01-08 16:42:35.768 27764 7001 E Sending message: 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.
.....
...