Skip to content

fix(login): only expedite WorkManager requests on Android 12+ - #6620

Open
mahibi wants to merge 1 commit into
masterfrom
bugfix/noid/onlySetWorkersExpeditedForAndroid12+
Open

fix(login): only expedite WorkManager requests on Android 12+#6620
mahibi wants to merge 1 commit into
masterfrom
bugfix/noid/onlySetWorkersExpeditedForAndroid12+

Conversation

@mahibi

@mahibi mahibi commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

followup fix to #6506
quickfix before migrating to coroutine workers..

Expedited WorkRequests on API < 31 fall back to an implicit foreground service, which requires the Worker to override getForegroundInfo(). None of our Workers do, so any expedited request crashed with IllegalStateException on older Android versions. For CapabilitiesWorker during login, that crash meant its completion event was never posted, leaving the login spinner stuck forever.

Add setExpeditedIfSupported(), which only calls setExpedited() on API 31+ (where expedited work runs via JobScheduler and doesn't need getForegroundInfo()), and use it at all 21 call sites introduced by 39331e7.

Assisted-by: Claude Code:claude-sonnet-5


Stumbled about this issue when trying to set up an Android 9 device for #6621

馃弫 Checklist

  • 鉀戯笍 Tests (unit and/or integration) are included or not needed
  • 馃敄 Capability is checked or not needed
  • 馃敊 Backport requests are created or not needed: /backport to stable-xx.x
  • 馃搮 Milestone is set
  • 馃尭 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

馃 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Expedited WorkRequests on API < 31 fall back to an implicit foreground
service, which requires the Worker to override getForegroundInfo().
None of our Workers do, so any expedited request crashed with
IllegalStateException on older Android versions. For CapabilitiesWorker
during login, that crash meant its completion event was never posted,
leaving the login spinner stuck forever.

Add setExpeditedIfSupported(), which only calls setExpedited() on
API 31+ (where expedited work runs via JobScheduler and doesn't need
getForegroundInfo()), and use it at all 21 call sites introduced by
39331e7.

Assisted-by: Claude Code:claude-sonnet-5

Signed-off-by: Marcel Hibbe <[email protected]>
@mahibi mahibi added this to the 25.1.0 milestone Sep 2, 2026
@mahibi mahibi self-assigned this Sep 2, 2026
@mahibi mahibi added the 3. to review Waiting for reviews label Sep 2, 2026
@mahibi
mahibi requested a review from rapterjet2004 September 2, 2026 14:18
@mahibi

mahibi commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

/backport to stable-25.0.x

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/33641132405/artifacts/9853099210
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

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.

1 participant