Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doubled notifications #4152

Closed
waclaw66 opened this issue Oct 3, 2021 · 15 comments
Closed

Doubled notifications #4152

waclaw66 opened this issue Oct 3, 2021 · 15 comments
Assignees
Labels
A-Notifications O-Occasional Affects or can be seen by some users regularly or most users rarely S-Tolerable Low/no impact on users T-Defect Something isn't working: bugs, crashes, hangs and other reported problems X-Won't-Fix This will not be worked on

Comments

@waclaw66
Copy link
Contributor

waclaw66 commented Oct 3, 2021

Steps to reproduce

Just receive a message.

capture.mp4

What happened?

What did you expect?

Single notification for a message.

What happened?

When single message is received two same notifications are shown for a little while in a row.
I tried to re-register pusher, create a new session, optimized init sync. Nothing helped.

Your phone model

Xiaomi Mi 9T

Operating system version

Android 11

Application version and app store

1.3.1

Homeserver

own

Have you submitted a rageshake?

Yes

@waclaw66 waclaw66 added the T-Defect Something isn't working: bugs, crashes, hangs and other reported problems label Oct 3, 2021
@ouchadam ouchadam self-assigned this Oct 4, 2021
@ouchadam
Copy link
Contributor

ouchadam commented Oct 4, 2021

Hi @waclaw66 thanks for raising this, unfortunately I don't have a android 11 MIUI device to test on and I'm not familiar with their notification UI changes, would you be able to provide some more information?

  • do you have the same issue when using a matrix.org account
  • has this issue recently started happening, if so was it tied to an application update/homeserver upgrade
  • do the messages stack as list with notification actions
  • "notifications are shown for a little while in a row." does this mean the duplicate notification disappears
MIUI 12.0.3/Android 10 Stock~ (Samsung One UI) Android 11
2021-10-04T13:01:44,528885888+01:00 2021-10-04T13:07:28,372840475+01:00

@waclaw66
Copy link
Contributor Author

waclaw66 commented Oct 4, 2021

@ouchadam:
some feedback...

  • yes it does also using matrix.org account
  • it happens a while, now I've tried version 1.2.2, it behaves the same
  • messages stack same as on your screenshot, but for two messages there is count (4)
  • yes, I see only single notification for a message, but it does a sound and counts twice
  • it works properly on Huawei device (Android 9) though
capture.mp4

@ouchadam
Copy link
Contributor

ouchadam commented Oct 4, 2021

the video really helps clarify, thanks!

It's interesting to see the final expanded notification is

test 1 
test 2

rather than

test 1
test 1
test 2 
test 2

I'll keep investigating and see if I can reproduce on my side and hopefully fix

@ouchadam
Copy link
Contributor

ouchadam commented Oct 4, 2021

one last thing to confirm, does the issue happen for both notification styles? Settings -> Notifications -> Notifications Shade -> android / MIUI

2021-10-04T20:29:03,743812769+01:00

when I select MIUI (Pocofone f1 MIUI 12.0.3.0) and turn off animations, I can see flashes of the summary group leaking through, there's also a few reports of the MIUI style having issues with other messaging apps (which I assume is a group summary issue)

@waclaw66
Copy link
Contributor Author

waclaw66 commented Oct 5, 2021

It looks the same for both notification styles. Although I have observed that sometimes (quite seldom) the second notification counts up to 3 only.

@waclaw66
Copy link
Contributor Author

waclaw66 commented Oct 7, 2021

As I discussed this issue with another affected users, the common cause is Wifi. When a message is received using wifi, notification is doubled, on the other hand using mobile data there is only single notification for a message. Strange.

@ouchadam
Copy link
Contributor

ouchadam commented Oct 7, 2021

Very interesting... the difference in network conditions also ties into my current race condition theory

My current thinking is that the way we update the android summary group notification (eg how gmail batches notifications under a single expandable notification) is updating out of sync to the individual message notifications, causing the group notification to display in the same place as the normal message, which in turn presents itself as 2 notifications for 1 message event (1 summary update, 1 message update).

We can see this happening in your video where the first message that is displayed is "$username: $message", this is a group summary and shouldn't be visible until there's multiple notifications to put in a group.

At the moment we create and display all the individual messages in a big loop, each iteration of the loop may take more or less time depending on fetching data, avatars, cancelling previous notifications etc then at the very end we update the group, however if we don't update the group fast enough sometimes wonky things can happen.

My plan is a big redesign of the notifications in order to create them all and then display them all in one go, hopefully eliminating the race conditions 🤞

There's also a lot of redundant cancelling -> showing which might be causing issues which will also be addressed in the redesign.

tl;dr still working on it!

@ouchadam
Copy link
Contributor

tentatively fixed in 1.3.7 (let's reopen if the issue still occurs, we may need to go back to the drawing board though 🤔)

@waclaw66
Copy link
Contributor Author

I think it is not completly resolved yet. I'm seeing it time to time even on my new Samsung device (S20 FE Android 11). There is shown (2) for a single notification.

@ouchadam
Copy link
Contributor

thanks for the update 👍 when this occurs, does the notification expand to show multiple notifications, or is it still the 1 notification but notified twice?

also, would you say the issue occurs less often after upgrading to 1.3.7+?

@ouchadam ouchadam reopened this Jan 20, 2022
@waclaw66
Copy link
Contributor Author

waclaw66 commented Jan 20, 2022

There is shown only single notification but with badge (2). It does much less than before 1.3.7.
I'm not sure if it's related, but sometimes a notification doesn't dissapear when I click on it. Element is opened on that message, but notification keeps showing, it has to be swiped to side manually.
Sometimes the badge (2) is not shown without interaction, but after a click to notification as you can see in the snap below

output.mp4

Nevertheless it seems the system thinks the notification is duplicated.

@ouchadam
Copy link
Contributor

you beat me to it, I've just been able to reproduce on my samsung as well

COLLAPSED EXPANDED
2022-01-20T12:21:47,356932116+00:00 2022-01-20T12:21:30,200597213+00:00

since I'm able to also reproduce it should be much easier to confirm a fix! will investigate

@ouchadam
Copy link
Contributor

unfortunately this appears to be a samsung specific issue (possibly other OEMs), they're including any updates to the notification in their counter

it's caused by the use of the conversations api and us updating existing messages, some times the messages are fetched in their final form but other times there could be edits, redactions or the server could give us more information about the message later on

for example, in screenshots above scenario I'm seeing the same message come through twice as we gain the sender information in separate updates

sender - adam
message - a

sender - adam (@ouchadam:matrix.org)
message - a

the second notification is created to notify silently (no sound/vibration etc) but the samsung counter doesn't respect this.

FWIW stock android doesn't include this counter

ANDROID 11 ANDROID 12
Screenshot_20220120_135907 Screenshot_20220120_135623

@ouchadam ouchadam added O-Occasional Affects or can be seen by some users regularly or most users rarely S-Tolerable Low/no impact on users labels Jan 20, 2022
@waclaw66
Copy link
Contributor Author

Thanks for the investigation. I think it's totaly torelable now, the only disturbance is the counter. It's much better that before 1.3.7. The issue can be closed.

@ouchadam
Copy link
Contributor

thanks for all the help! I'll close this ticket off as a won't fix but we can definitely reopen if we find more OEMs/roms with the same issue

If anyone is finding this really troublesome a workaround is to disable the "conversation grouping" notification settings, although it means losing the benefit of conversations

TOGGLE RESULT
2022-01-21T09:21:25,388677615+00:00 2022-01-21T09:23:54,169369329+00:00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Notifications O-Occasional Affects or can be seen by some users regularly or most users rarely S-Tolerable Low/no impact on users T-Defect Something isn't working: bugs, crashes, hangs and other reported problems X-Won't-Fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants