Skip to content

Conversation

@vitorhugods
Copy link
Member

@vitorhugods vitorhugods commented Dec 18, 2025

BugWPB-20795 [Android] During a long initial sync, app only syncs in the foreground.


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

If a user puts the app in the background whilst doing Slow Sync after logging in, Sync doesn't continue.

Causes

Android OS will say "Stop it, please - Or deal with the consequences".

Solutions

Take advantage of the new :work module within Kalium, which exposes Initial Sync works.

  1. Whenever a Initial Sync work starts for any user
  2. Launch a Expedited worker, which will
  3. Monitor until all user accounts are with Work.InitialSync complete.

Modularisation

I thought of going ahead and making this monitor + worker in a module.
This required some extra modularisation, like moving Notification, DI and Media stuff to :core, so I did the lifting there too.

Dependencies

Needs releases with:

Testing

Test Coverage

  • I have added automated test to this contribution

How to Test

Login in the app, or use the debug settings to "Force sync" :)

A Setting up Wire... notification will appear if the WorkManager decides a ForegroundService is needed (Android 11 or older).

image

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@vitorhugods vitorhugods force-pushed the sync/chore/add-background-work-monitoring branch 3 times, most recently from 52647af to b1c51c2 Compare December 22, 2025 09:27
@vitorhugods vitorhugods force-pushed the sync/chore/add-background-work-monitoring branch from b1c51c2 to 108fbfe Compare December 22, 2025 11:55
@sonarqubecloud
Copy link

@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

❌ Patch coverage is 11.76471% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.14%. Comparing base (fa4b380) to head (108fbfe).

Files with missing lines Patch % Lines
...re/android/notification/CallNotificationManager.kt 0.00% 4 Missing ⚠️
...android/notification/MessageNotificationManager.kt 0.00% 2 Missing ⚠️
...otlin/com/wire/android/ui/WireActivityViewModel.kt 50.00% 2 Missing ⚠️
.../com/wire/android/workmanager/WireWorkerFactory.kt 0.00% 2 Missing ⚠️
...ire/android/services/PlayingAudioMessageService.kt 0.00% 1 Missing ⚠️
...id/workmanager/worker/AssetUploadObserverWorker.kt 0.00% 1 Missing ⚠️
...kmanager/worker/DeleteConversationLocallyWorker.kt 0.00% 1 Missing ⚠️
...roid/workmanager/worker/NotificationFetchWorker.kt 0.00% 1 Missing ⚠️
...rkmanager/worker/PersistentWebsocketCheckWorker.kt 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (11.76%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4490      +/-   ##
===========================================
+ Coverage    48.76%   49.14%   +0.38%     
===========================================
  Files          563      560       -3     
  Lines        19466    19310     -156     
  Branches      3247     3234      -13     
===========================================
- Hits          9492     9490       -2     
+ Misses        8978     8824     -154     
  Partials       996      996              
Files with missing lines Coverage Δ
...nager/WireForegroundNotificationDetailsProvider.kt 0.00% <ø> (ø)
...ire/android/services/PlayingAudioMessageService.kt 0.00% <0.00%> (ø)
...id/workmanager/worker/AssetUploadObserverWorker.kt 0.00% <0.00%> (ø)
...kmanager/worker/DeleteConversationLocallyWorker.kt 1.96% <0.00%> (ø)
...roid/workmanager/worker/NotificationFetchWorker.kt 0.00% <0.00%> (ø)
...rkmanager/worker/PersistentWebsocketCheckWorker.kt 29.41% <0.00%> (ø)
...android/notification/MessageNotificationManager.kt 0.00% <0.00%> (ø)
...otlin/com/wire/android/ui/WireActivityViewModel.kt 75.00% <50.00%> (+0.16%) ⬆️
.../com/wire/android/workmanager/WireWorkerFactory.kt 0.00% <0.00%> (ø)
...re/android/notification/CallNotificationManager.kt 39.24% <0.00%> (ø)

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa4b380...108fbfe. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vitorhugods vitorhugods requested review from Garzas, MohamadJaara, sbakhtiarov and yamilmedina and removed request for sbakhtiarov December 22, 2025 12:20
Copy link
Contributor

@yamilmedina yamilmedina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 🚀 ! Finally some DI module. Left a comment for the koverage since otherwise any tests won't run on the pipeline (like the case we had with :cells) 😅

// features
implementation(project(":features:cells"))
implementation(project(":features:sketch"))
implementation(projects.features.sync)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add this to the kover section 👀

i.e.
kover(project((projects.features.sync))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add this new module to the config for crowdin.yml 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants