GSConnect / gnome-shell-extension-gsconnect

KDE Connect implementation for GNOME
GNU General Public License v2.0
3.21k stars 258 forks source link

No SMS history for Signal, Samsung Messages #320

Closed stratus-ss closed 1 year ago

stratus-ss commented 5 years ago

I have recently installed GS Connect on a fully up to date Arch Linux system. The Phone is an up to date Honor 6x (or as up to date as the manufacturer allows)

I can send SMS from the desktop but the history is lost. On the phone I only have one side of the conversation (the received SMS). In the application, I can see my contacts but if I send an sms from the desktop and then go to the main contact list in the messaging window the history is lost.

On the phone I use signal as my SMS app. Is this an expected limitation?

andyholmes commented 5 years ago

I have heard of similar problems, even with KDE Connect, although I don't know if it's because of the SMS app or not. Only the most recent version of the Android app (v1.10) has support for SMS history, but that is read from Android's SMS database and API.

Whether Signal uses that database, or it's own I don't know. I know there is a newer and older API for this and Signal may not support the newer API, possibly so it can support older phones. If you wanted to test, you can try using the stock app and send a few test messages.

This would be an upstream bug in the Android app (especially if the message is being "sent" properly), so the best thing to do is to open a bug in KDE Connect's bugzilla, including a link to this bug, and then add a link here to that one so both projects can track it. You might find that it's a problem with Signal and you could see if they have a bug tracker too, and file a bug there :)

It might be a bit of work and waiting, but that's the best way to get things moving.

andyholmes commented 5 years ago
uniquePWD commented 5 years ago

It would seem the only solution would be to apply to Signal for accept to their encrypted message storage.

JohannPopper commented 5 years ago

Hey, first of all thank you so much for this fantastic extension. I'm coming here from the old #318 issue that you marked as a duplicate of this one because the main issue I have is as described there -- no SMS GNOME notifications anymore, and persistent history never worked (I didn't even know it was an intended feature, if I understand the above issue correctly). That is, as soon as I close an ongoing SMS conversation window, the history is gone, and I thought this normal functionality. Perhaps my observations will be valuable for a fix to each of these problems, the missing SMS messages in the rewritten post-v12 GSConnect.

I recently installed the latest Solus (GNOME 3.28), Ubuntu and Fedora (GNOME 3.30), each on three separate PCs, and these issues were present on all three. I had GSCv12 installed on my personal laptop with Solus and it still works great. However, when I installed these distros on these other laptops, I decided to install the latest GSCv15 from GNOME Extensions.

This did not go smoothly at all.

As a side note, downloading from the GNOME Extensions site results in the following error for GSC versions 13-15 when I try to activate each in Tweaks: <GLib.FileError: Failed to open file /usr/local/share/glib-2.0/schemas/gschemas.compiled”: open() failed: No such file or directory>. Figured it was a permissions issue at first, but everything checked out....

Therefore, I downloaded v15 directly from Github and had no problem installing on all 3 machines, each seemed to work great, the new GSC UI is really well designed, except that after a while it became apparent that SMS messages conspicuously no longer sync at all with the desktops, which, sadly, is probably the number one feature of GSC tbh.

Each laptop owner uses Samsung phones, btw, and I guess Signal for messaging as this is apparently default on Samsung. So, I checked the release notes for the last few versions of GSC and found v13+ I believe is a rewrite and v12 was the last of the previous branch. So, I downgraded to GSCv12 from Github on each of the machines, and now SMS works perfectly again, albeit with the older interface.

So, ultimately, that's the extent of how much I've narrowed down the problem. It's certainly not an Android, GNOME, or KDE issue per se, as the only factor that reproduced the issue every time is the latest branch of GSC. Obviously, there's some kind of unrelated issue with the GNOME Extensions site versions I thought you should know about (packaging maybe?), but the actual problem here is SMS not pushing to desktop notifications in the latest GSC branch; it's a huge dealbreaker. Anyway, I hope this helps to narrow down the issue. Something SMS related changed during the rewrite after this past August. I hope it's just a minor oversight of some kind.

andyholmes commented 5 years ago

Firstly, there are four relevant "packets" involved here:

Long before upstream KDE Connect had two-way SMS conversations or history of any kind, GSConnect used to fake it. The way this was done was by (1) collecting SMS send (outgoing) and (2) using flaky tests to match SMS event and Notification packets (incoming) to each other, because they were essentially duplicates.

When these could be matched to each other and collected, it was then attempted to match the name and phone number (if we got them) to an open SMS window that first sent the SMS send packet. When the window closed, it was all gone and if it wasn't open when Android received the message (ie. at that exact time) all you got was the desktop notification. This was a terrible hack that frequently didn't work, especially for anyone who wasn't using North American phone numbers.

The sms plugin was first released for Android with version v1.10 and provides SMS messages packet which contain history of both incoming and outgoing messages. These packets provide confirmation of sent messages with information about the sender, receiver, time, direction, full history and everything else you need to make a proper messaging app. We can query this at any time.

SMS apps like Google Messages, AOSP Messages, Textra and others, use the standard documented message database. Others like Samsung (proprietary) and Signal (encrypted) do not, however there is no way for us to tell what SMS app is being used and KDE Connect Android will still report that the phone supports SMS messages, even though we will never receive them.

The "legacy" SMS send and SMS event packets are still sent (for now until they are removed), but there is no way for us to know that we should fall back to them, and doing so will result in every message being duplicated for well-behaved SMS apps. The consequence is that GSConnect's SMS window can send messages, but you will receive no confirmation that they have been sent and incoming messages will never be displayed there.

You will receive Notification packets which may have an entry you can use to reply with, depending on the app, but you must have the notification plugin enabled on both devices. Additionally, neither KDE Connect nor GSConnect has ever supported MMS messages and it's unlikely these will be supported anytime soon. I'm not sure if they are repliable or if they correctly send desktop notifications.

archmunky commented 5 years ago

If I'm readying this correctly, I should be seeing sms history if I'm using Google Messages? I do have a Samsung S8 phone but Google is set as my SMS default and I'm still not seeing chat history in GSconnect.

andyholmes commented 5 years ago

It's still a bit unclear what the extent of the problem is with Samsung phones. There are reports this also affects Contacts as well.

Can you check whether or not your messages are in ~/.cache/gsconnect/<device-id>/sms.json? If there are no messages in there, it's likely a problem on the Android side. That might not mean it's a problem with the app though, it may just be modifications made by Samsung apply to all SMS apps.

You can also double check by enabling debug logging and see if Android is even sending you a list of sms.messages packets.

coxackie commented 5 years ago

On Motorola G6 with Google Messages, the same problem appears - no sms history, no contacts. I use GSConnect v17. Arch Linux, Gnome 3.30.2.

gabor-me commented 5 years ago

I use Huawei P10 Lite. Same problem. No SMS history, no sync of contacts either.

archmunky commented 5 years ago

I don't have any sms.json file in .cache/gsconnect or any subfolder. Also running v17 in Linux Mint 19, Gnome 3.28.2

andyholmes commented 5 years ago

screenshot_20181114-043447

coxackie commented 5 years ago

I can confirm I am using KDE Connect Android v1.10+ and have given the Android app permissions to you SMS & Contacts. Enabling debug logging, I see the following two lines with sms.messages:

0x7fc37e67f5d8 B string <atom: length 23> kdeconnect.sms.messages 0x7fc37e6bc720 B string <fat inline: length 23> kdeconnect.sms.messages

In the terminal output I have:

g_object_unref: assertion 'G_IS_OBJECT (object)' failed g_object_unref: assertion 'G_IS_OBJECT (object)' failed g_object_unref: assertion 'G_IS_OBJECT (object)' failed g_object_unref: assertion 'G_IS_OBJECT (object)' failed g_object_unref: assertion 'G_IS_OBJECT (object)' failed g_object_unref: assertion 'G_IS_OBJECT (object)' failed g_variant_new_string: assertion 'string != NULL' failed AT-SPI: Error in GetItems, sender=(null), error=Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. WARNING: motorola: sshfs: Warning: Permanently added '[192.168.1.4]:1743' (RSA) to the list of known hosts. WARNING: motorola: sshfs: Password authentication Failed to fetch network locations: Timeout was reached g_object_unref: assertion 'G_IS_OBJECT (object)' failed g_object_unref: assertion 'G_IS_OBJECT (object)' failed g_object_unref: assertion 'G_IS_OBJECT (object)' failed g_object_unref: assertion 'G_IS_OBJECT (object)' failed g_object_unref: assertion 'G_IS_OBJECT (object)' failed

archmunky commented 5 years ago

One thing I did find: I didn't have sshfs installed; fixed.

I tested everything from scratch by removing the extension and cache, clearing data from KDE Connect on phone then giving it all permissions again. I then installed gsconnect and immediately started debugging to capture a full log including pairing, sending text, receiving, etc. Will summarize logs below sanitizing ids/user names/contact info/phone numbers/etc.

GJS - reported capabilities:

"incomingCapabilities": [
   "kdeconnect.sms.request_conversations",
   "kdeconnect.telephony.request_mute",
   "kdeconnect.telephony.request",
   "kdeconnect.mpris",
   "kdeconnect.notification",
   "kdeconnect.sms.request_conversation",
   "kdeconnect.findmyphone.request",
   "kdeconnect.ping",
   "kdeconnect.systemvolume",
   "kdeconnect.notification.reply",
   "kdeconnect.share.request",
   "kdeconnect.sftp.request",
   "kdeconnect.notification.request",
   "kdeconnect.mousepad.request",
   "kdeconnect.contacts.request_vcards_by_uid",
   "kdeconnect.sms.request",
   "kdeconnect.runcommand",
   "kdeconnect.battery.request",
   "kdeconnect.clipboard",
   "kdeconnect.contacts.request_all_uids_timestamps"
],
"outgoingCapabilities": [
   "kdeconnect.sms.messages",
   "kdeconnect.telephony",
   "kdeconnect.notification",
   "kdeconnect.contacts.response_uids_timestamps",
   "kdeconnect.findmyphone.request",
   "kdeconnect.ping",
   "kdeconnect.mousepad.keyboardstate",
   "kdeconnect.share.request",
   "kdeconnect.contacts.response_vcards",
   "kdeconnect.notification.request",
   "kdeconnect.mousepad.echo",
   "kdeconnect.mousepad.request",
   "kdeconnect.sftp",
   "kdeconnect.runcommand.request",
   "kdeconnect.mpris.request",
   "kdeconnect.systemvolume.request",
   "kdeconnect.battery",
   "kdeconnect.clipboard"
],

GJS - Requests for contacts/sms data

DEBUG: [core.js:send:450]: Samsung SM-G950U: {
  "id": ###,
  "type": "kdeconnect.contacts.request_all_uids_timestamps",
  "body": {}
}
DEBUG: [core.js:send:450]: Samsung SM-G950U: {
  "id": ###,
  "type": "kdeconnect.sms.request_conversations",
  "body": {}
}
DEBUG: [core.js:receive/<:404]: Samsung SM-G950U: {
  "id": ###,
  "type": "kdeconnect.contacts.response_uids_timestamps",
  "body": {
    "uids": [
        (contacts list)
    ],
    (contacts data)
  }
}
DEBUG: [core.js:send:450]: Samsung SM-G950U: {
  "id": ###,
  "type": "kdeconnect.contacts.request_vcards_by_uid",
  "body": {
    "uids": [
        (contacts list)
    ]
  }
}
DEBUG: [core.js:receive/<:404]: Samsung SM-G950U: {
  "id": ###,
  "type": "kdeconnect.contacts.response_vcards",
  "body": {
    (vcards list)
    "uids": [
      (contacts list)
    ]
  }
}
JS WARNING: [/home/###/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/contacts.js 201]: reference to undefined property "type"

It looks like the phone is responding to the _kdeconnect.contacts.request_all_uidstimestamps requests but I don't see any responses to the _kdeconnect.sms.requestconversations requests. There is a kdeconnect.telephony response when receiving a text later though.

GJS - Sent a text message using gsconnect chat form and received response via notification; does not appear in chat area

DEBUG: [core.js:send:450]: Samsung SM-G950U: {
  "id": ###,
  "type": "kdeconnect.sms.request",
  "body": {
    "sendSms": true,
    "phoneNumber": "###",
    "messageBody": "Sending, test from gsconnect"
  }
}
DEBUG: [core.js:receive/<:404]: Samsung SM-G950U: {
  "id": ###,
  "type": "kdeconnect.notification",
  "body": {
    "payloadHash": "###",
    "requestReplyId": "###",
    "id": "0|com.google.android.apps.messaging|0|com.google.android.apps.messaging:sms:192|10445",
    "appName": "Messages",
    "isClearable": true,
    "ticker": "Recipient: Received, responding",
    "title": "Recipient",
    "text": "Received, responding",
    "time": "1543769479285"
  },
  "payloadSize": 2698,
  "payloadTransferInfo": {
    "port": 1739
  }
}
DEBUG: [core.js:receive/<:404]: Samsung SM-G950U: {
  "id": ###,
  "type": "kdeconnect.telephony",
  "body": {
    "event": "sms",
    "messageBody": "Received, responding",
    "contactName": "Recipient",
    "phoneThumbnail": "",
    "phoneNumber": "###"
  }
}

Looking in the Gnome-Shell logs, I see a few errors but not sure if they are related to gsconnect:

Some code accessed the property 'ENABLED_EXTENSIONS_KEY' on the module 'extensionSystem'. That property was defined with 'let' or 'const' inside the module. This was previously supported, but is not correct according to the ES6 standard. Any symbols to be exported from a module must be defined with 'var'. The property access will work as previously for the time being, but please fix your code anyway.
JS WARNING: [resource:///org/gnome/shell/ui/keyboard.js 546]: reference to undefined property "_rect"
JS ERROR: Exception in callback for signal: position-changed: TypeError: this._rect is undefined
getCurrentRect@resource:///org/gnome/shell/ui/keyboard.js:546:22
wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22
_onFocusPositionChanged@resource:///org/gnome/shell/ui/keyboard.js:611:20
wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22
_emit@resource:///org/gnome/gjs/modules/signals.js:128:27
_setCurrentWindow/this._currentWindowPositionId<@resource:///org/gnome/shell/ui/keyboard.js:528:21

DEBUG: [extension.js:_onInterfaceAdded:321]: GSConnect: Adding Samsung SM-G950U
DEBUG: [notification.js:_closeGSConnectNotification/<:110]: Closing pair-request
Object .GSConnectShellIconButton (0x555fac1429b0), has been already finalized. Impossible to get any property from it.
== Stack trace for context 0x555fa956f340 ==
#0 0x555fa9a2b710 i   /home/###/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/gmenu.js:510 (0x7fef03addde0 @ 124)
#1 0x555fa9a2b650 i   self-hosted:922 (0x7fef3c0f12b8 @ 469)
Object Meta.Background (0x555fabd4bba0), has been already deallocated - impossible to access to it. This might be caused by the fact that the object has been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs

Journalctl shows a single warning for contacts:

Dec 02 11:49:33 mint01 gjs[3032]: JS WARNING: [/home/###/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/contacts.js 201]: reference to undefined property "type"
andyholmes commented 5 years ago

NOTE TO USERS

I have opened a bug report upstream with KDE Connect for users who are sure this is an issue with the Android app. Please be a good neighbour and do not add "me too" or "+1" comments to this report.

Report your phone model, Android OS version and the SMS app you are using. Attach any logs as files. The bug report is here:

https://bugs.kde.org/show_bug.cgi?id=401677


I don't see any responses to the kdeconnect.sms.request_conversations requests

If that's the case, then this would be an issue in the Android app. It's still unclear why Samsung phones in particular don't respect the native SMS database, but there's nothing I can do in GSConnect to fix this.

There is a kdeconnect.telephony response when receiving a text later though.

These are the legacy packets, due to be removed sometime in the future. Unfortunately these don't provide anything like a history and they're only sent once, the moment they appear.

It may be possible to add a "legacy mode" at some point, but this will require some work to implement, won't work the same, and will have to be enabled manually by users.

Dec 02 11:49:33 mint01 gjs[3032]: JS WARNING: [/home/###/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/contacts.js 201]: reference to undefined property "type"

This I can probably fix, although it shouldn't be causing major problems. Unfortunately my laptop has died, so it may be some time until I can work on this extension as much as before.

andyholmes commented 5 years ago

For users with devices that still don't support SMS history, there is an experimental legacy-mode available in v19 that must be enabled manually:

  # List device id's
  dconf read /org/gnome/shell/extensions/gsconnect/devices

  # Enable legacy mode
  dconf write /org/gnome/shell/extensions/gsconnect/device/<device-id>/plugin/sms/legacy true

This will force the legacy packets to send desktop notifications and comes with a very basic dialog for sending SMS messages.

didrocks commented 5 years ago

Hey! Having the same issue after udpating to today's version (last commit c182fdd84a411660c4b27432d2659473d4a83dbd). Switching to legacy mode, I can see the old "pick a contact" window. Then, picking one, composing the sms, I can't send it (clicking on Send or Ctrl + Enter doesn't do anything).

ferdnyc commented 5 years ago

Then, picking one, composing the sms, I can't send it (clicking on Send or Ctrl + Enter doesn't do anything).

I'm actually seeing that same issue myself, on Fedora 29 with legacy-SMS enabled in v19. (Er... maybe v19 plus a couple of my local changes, come to think of it). Journal message logged when the "Send" button is pressed:

Jan 09 13:54:14 gjs[15664]: JS ERROR: TypeError: this.sms.sendMessage is not a function
                                      vfunc_response@$XTN_PATH/service/ui/telephony.js:103:13
                                      @$XTN_PATH/service/daemon.js:778:2
andyholmes commented 5 years ago

Then, picking one, composing the sms, I can't send it (clicking on Send or Ctrl + Enter doesn't do anything)

Oops! Fixed in fc4c953 and added Ctrl+Enter shortcut as a sorry gift :P

ferdnyc commented 5 years ago

(Actually, fixed in 0876d88, for those of us patching at home — fc4c953 was the Ctrl+Enter gift.)

didrocks commented 5 years ago

This is indeed, working perfectly! Thanks a lot :)

andyholmes commented 5 years ago

I'm going to close this one up now, since it's clearly an upstream issue. I'll leave it pinned for now though, so people are aware.

Consider posting a logcat in the upstream bug report to help out the KDE Connect developers: https://bugs.kde.org/show_bug.cgi?id=401677

uniquePWD commented 5 years ago

Can we reopen this? I've just filed this over at Signal: https://community.signalusers.org/t/provide-api-so-kde-connect-gsconnect-can-access-sms-history/5644

andyholmes commented 5 years ago

This would still be an upstream issue. There's just nothing to be fixed on GSConnect's side and it would have to be fixed in Android.

alexandrupetrini commented 5 years ago

I would like to also report Nokia 5 with Android 8.1 vanilla. In general Nokia 3 and above have Android 8.1 vanilla so mixing these 2 brands might be total No No.

andyholmes commented 5 years ago

Hi, if you can please report this information upstream, preferrably with a logcat from Android. The bug has been reported for a number of phones and Android version, but still lacks the logs KDE Connect developers need to fix this in the Android app.

https://bugs.kde.org/show_bug.cgi?id=401677

maxerbox commented 4 years ago

Xiami Phones are fixed with the last commit: https://invent.kde.org/kde/kdeconnect-android/commit/4a0c53610f5b8f82162bda0a2ac81d789f00e64a I have tried a build and it's working

aaronSkar commented 4 years ago

This seems to be working now on my Samsung s9 with android 10. Software versions I am on listed below. I have commented this on the KDE site as well. These versions were all taken through normal updates from Manjaro, Gnome Extensions and Google App store. I'm not running any custom stuff on my phone or PC.

Samsung Galexy S9 Android 10 Samsung Messages 11.0.00.291 KDEConnect Android App 1.13.7

Gnome Version: 3.34.2 DISTRIB_ID=ManjaroLinux DISTRIB_RELEASE=19.0.0 DISTRIB_CODENAME=Kyria DISTRIB_DESCRIPTION="Manjaro Linux"

GSConnect 31 Legacy Message Support = Disabled

RicardoEPRodrigues commented 4 years ago

Hello, I'm using a Samsung S10e with a similar loadout of @aaronSkar, yet I'm unable to see the messages.

Samsung Galaxy S10e Android 10 Samsung Messages 11.0.00.307 KDEConnect Android App 1.13.7

Gnome Version: 3.34.2 DISTRIB_ID=Ubuntu DISTRIB_RELEASE=19.10 DISTRIB_CODENAME=eoan DISTRIB_DESCRIPTION="Pop!_OS 19.10"

GSConnect 31 Legacy Message Support = Disabled

I did find someone that explored this issue a bit further here: https://invent.kde.org/kde/kdeconnect-android/issues/2

ferdnyc commented 4 years ago

@aaronSkar

Samsung Galexy S9 Android 10

@RicardoEPRodrigues

Samsung Galaxy S10e Android 10

That's not really sufficient detail in these cases, as Android releases have build numbers, and each carrier has their own build of the system software. (Which is first customized by Samsung for each model they offer — two different "Android 9" devices aren't really running the same OS, exactly, even if they're from the same manufacturer.) The excessive details are all listed in Settings > About phone > Software information on the device.

For example, my Galaxy Note 8 (where SMS still, for the record, also does not work) is currently running Sprint's SAOMC_SM-N950U_OYN_SPR_PP_0020, a carrier-distributed package of Samsung's build number PPR1.180610.011.N950USQS7DTA5 of Android 9. (Using version 1.0 of the One UI, their latest successor to the Experience UX, which replaced TouchWiz before it.)

Screenshot_20200224-024021_Settings

ferdnyc commented 4 years ago

...And I should probably charge my battery.

RicardoEPRodrigues commented 4 years ago

So what information is relevant to detail here? All that you showed?

What can we do to help on this issue?

ferdnyc commented 4 years ago

So what information is relevant to detail here? All that you showed?

Honestly, we have no idea. Having more data points might help determine that, but it's not yet clear what the pattern is, or that there even is a pattern really.

What can we do to help on this issue?

Here? Nothing. It's a KDE Connect Android bug, and can only be solved there. When it is, GSConnect will also benefit from the fix.

bprfh commented 4 years ago

Just an FYI: I have a samsung S9 with the newest updates(In Europe) and I see all messages now. Using the default samsung sms manager.

dmeltzer commented 4 years ago

For those not directly following along in the companion bug, there was a commit in kdeconnect-android a few days ago that fixes a lot of these issues (maybe all of them?)

I don't think there is a released version of this yet, but keep an eye out the next time your kdeconnect android app updates and messages may work again.

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

ferdnyc commented 4 years ago

I guess this still hasn't been released, huh? Even as a beta tester 1.14.2 is the latest my phone finds, and that was released over three months ago now. (As @dmeltzer 's comment shows, the commit in question is only a month or so old.)

Oh well. I'm sure it'll find its way to us eventually. Probably accompanied by even more new features!

andyholmes commented 4 years ago

Oh well. I'm sure it'll find its way to us eventually. Probably accompanied by even more new features!

It should be eventua-soon-ly (a new word I invented for FOSS :wink:). KDE Connect is in their GSoC again and there's been some good work there so I decided to re-open. If all goes well we can hopefully rip out the legacy SMS code.

I'm working my way towards the UI, where we'll need to fix our a11y support that's especially bad in the Messaging UI. I think I'll have to put my foot down on fixing that before we add new features, otherwise it'll just be a nightmare later.

pczekalski commented 4 years ago

I acknowledge, the problem still persists with Samsung Galaxy Note 8, KDE Connect 1.14.2, all permissions given. OS is Ubuntu 20.04

ghost commented 4 years ago

I also acknowledge that the problem still persists with Samsung Galaxy S8 running LineageOS, KDE Connect 1.14.2 and OS x86_64 Linux 5.8.9-arch2-1.

andyholmes commented 4 years ago

Locking this thread for now.

This is an upstream issue that can't be fixed in GSConnect, and only exists to track the upstream bug.

andyholmes commented 1 year ago

Closing, since this is not a bug in GSConnect and it's 2023 now :)