session-foundation / session-android

A private messenger for Android.
https://getsession.org
GNU General Public License v3.0
32 stars 3 forks source link

[BUG] Session Messenger Slow mode notifications not working in GrapheneOS #35

Open cryptolokimax opened 3 months ago

cryptolokimax commented 3 months ago

Code of conduct

Self-training on how to write a bug report

Is there an existing issue for this?

Current Behavior

[PUBLISHED ON BEHALF OF Ragneid]

I am experiencing issues with slow mode notifications on my GrapheneOS device. When I send messages from other Android phone (not using GrapheneOS), notifications are rarely displayed on the GrapheneOS device and I always need to unlock my phone to see them. Additionally, other times there are significant delays in receiving these notifications, sometimes up to one hour or even more.

In contrast, when I send messages from my GrapheneOS device to another Android phone (also set to Slow Mode), the notifications arrive instantly without needing to unlock the phone. Session.log.122f28104704.txt

Expected Behavior

Notifications should be received promptly and displayed even when the phone is locked or when using other apps.

Steps To Reproduce

  1. Enable Slow Mode notifications.
  2. Set battery usage for Session to unrestricted.
  3. Send a message from a non-GrapheneOS Android device to your GrapheneOS device.
  4. Observe notification behavior while the phone is locked and unlocked.

Android Version

Android 14 (GrapheneOS 2024071600)

Session Version

1.18.6

Anything else?

Not sure if it has something to do but it seems that the app becomes inactive when 'Lock Session' is enabled. The app only remains active while in use, and once I switch to another app or lock the phone, it stops running in the background. Even with 'unrestricted battery' settings, this behavior persists. When 'Lock Session' is disabled, the app does not appear in the 'Active Apps' list, indicating it is not running in the background at all.

This issue seems specific to the app is not running in the background so no notification might be handled on GrapheneOS.

I must also say that I use Threema and Molly (Signal hardened fork) regularly also with unrestricted battery usage and these apps are always running in the background and notifications arrive immediately (I'm not using FCM nor Google Play Services, just in-app push notifications).

Thanks a lot. Really appreciated your support.

bemusementpark commented 3 months ago

Hey, thanks for the logs!

This is an area we were looking at recently, and it does appear that ApplicationContext#onStop stops polling for DMs and GroupV2 messages. This is somewhat intentional, as it drains the device to make requests for new messages. However there are APIs available that we should be able to use to poll for new messages without keeping the device awake

Communities you are subscribed to (if any) should keep polling in the background.

Actually I'm surprised you were receiving messages in the background with fast mode off. It could be informative to know a little more about that device:

  1. Was Session in the background/foreground?
  2. Was the device in standby or open to some app or home screen?
  3. OS of device
  4. version of Session on that device
  5. type of message that notifications were seen for. (DM, group or community)

If this issue is important to you please give it a πŸ‘ as I have done above! πŸŽ‰

ragne1d commented 3 months ago

Thank you for your prompt response to this matter.

To further investigate the issue, I conducted a test using an alternative Android device that is not running GrapheneOS. This device operates with Android 12 and Session 1.18.6, which matches the version of Session on my GrapheneOS device. When sending messages from the GrapheneOS device to the other Android device, I experienced no issues in receiving notifications promptly (with a delay of approximately two seconds) being the device locked so I guess the app is running in the background there. This was true for direct messages, group chats, and all other types of communication.

However, when attempting to send messages from the Android device to my GrapheneOS device, I encountered the following anomalies. In some instances, the notification would only arrive after unlocking my phone and opening Session, as the app does not run in the background on this platform. On other occasions, I received the message notification with a delay of around one hour or more, which seems inconsistent given that the Session app is not active in GrapheneOS being the phone locked.

I hope you have enough information to proceed investigating the issue. Otherwise, please let me know :)

ragne1d commented 3 months ago

Hey, do you have any news about this issue? Thanks a lot.

bemusementpark commented 3 months ago

It's probably up to the community to let it be known if this is important. So vote with πŸ‘ and/or suggest a better method.

ragne1d commented 3 months ago

Already voted weeks ago but no more replies. I don't think I'm the only one using GrapheneOS and Session with Slow mode notification enabled btw. I guess it's not the top prio issue to be resolved but I guess it's kinda important too since it's actually anoying. I mean, I believe is basic to have the notification service working properly if you offer Slow mode too.

There are also many people within the Session community who thinks that basic stuffs should be fixed before implementing new features. I do agree with that.

Thanks.

ThomasSession commented 3 months ago

@ragne1d We have current plans to rework how we run the Slow Mode entirely. Sorry for the inconvenience it's causing.

ragne1d commented 3 months ago

@ragne1d We have current plans to rework how we run the Slow Mode entirely. Sorry for the inconvenience it's causing.

Thanks for the information. It's really good to hear. Do you have any ETA? :)