Skip to content

Fix #8894 bug, crashing while listening to notifications#9140

Open
progician wants to merge 1 commit into
element-hq:developfrom
progician:bug/8894-catch-sync-crash
Open

Fix #8894 bug, crashing while listening to notifications#9140
progician wants to merge 1 commit into
element-hq:developfrom
progician:bug/8894-catch-sync-crash

Conversation

@progician
Copy link
Copy Markdown

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Captures exceptions and logs them coming from the foreground notification listener service.

Motivation and context

The foreground notification listener service eventually times out, as Android 12+ does not allow applications running in the foreground indefinitely. The service than gets interrupted and runs into an exception, which never gets properly caught and so it ends up with the application crashing.

While this change doesn't fix the underlying issue, that the foreground notification listener service cannot run any longer, at least it doesn't crash the application.

I do wonder, however, if the whole foreground notification listener is not really viable in this form.

Tests

  1. Start the app
  2. Set the Settings > Notifications > Background Sync Mode to Optimised for real time
  3. Wait:
#!/system/bin/sh
adb shell input KEYCODE_HOME && \
sleep 5400

Tested devices

  • Physical
  • Emulator
  • OS version(s): 16

Checklist

…vice

The foreground notification listener service eventually times out, as
Android 12+ does not allow applications running in the foreground
indefinitely. The service than gets interrupted and runs into an
exception, which never gets properly caught and so it ends up with the
application crashing.

While this change doesn't fix the underlying issue, that the foreground
notification listener service cannot run any longer, at least it doesn't
crash the application.

I do wonder, however, if the whole foreground notification listener is
not really viable in this form.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@progician progician changed the title Fix Fix #8894 bug, crashing while listening to notifications Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants