Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

Ensure proper mail account removal

dev-12 requested to merge 3657-a15-mailapp-bugfix into main

Description

Resolves a bug where apps like the mail client failed to receive account removal events while stopped, leading to stale data.

Technical details

Mail applications rely on account-related events (e.g., account removal) to keep their internal state synchronized with the system. Previously, the Account Manager used a custom broadcast to send account lifecycle events. This custom broadcast included the Intent.FLAG_INCLUDE_STOPPED_PACKAGES flag, ensuring that applications would receive these events even when they were in a stopped state.

A later change removed this custom broadcast, and the mail app was updated to listen for standard system events instead. However, these standard broadcasts do not include the FLAG_INCLUDE_STOPPED_PACKAGES flag. As a result, if the mail app is in a stopped state when an account is removed via system settings, it does not receive the event. This causes a desynchronized state where the app continues to display data for an account that no longer exists.

This fix reintroduces explicit broadcasts for account lifecycle events, including the necessary flag to ensure delivery to stopped packages.

Tests

manual:

  1. add an sso account from settings and turn on mail sync
  2. open mail app and verify you see your email from newly added account
  3. force-stop the mail app
  4. remove the sso account from settings
  5. verify the account is remove from mail app as well

(in build without this patch account will not be removed if the app is not running 'at-least in background')

Issues

see mail#3657

10 commandments of code review

👪 ❤️ https://gitlab.e.foundation/groups/e/-/wikis/contribute/development-processes/code-review-guidelines

Summary by CodeRabbit

  • New Features

    • Account removal now triggers protected app-wide notifications so linked services and sync processes can react and clean up.
  • Chores

    • Added and declared a signature-level permission to secure broadcasts for account event notifications, ensuring only authorized receivers get these messages.
Edited by CodeRabbitAI

Merge request reports

Loading