Skip to content

fix(android): battery usage while the app is in the background#20882

Open
alexjba wants to merge 1 commit into
release/2.38.xfrom
fix/pause-more-work
Open

fix(android): battery usage while the app is in the background#20882
alexjba wants to merge 1 commit into
release/2.38.xfrom
fix/pause-more-work

Conversation

@alexjba
Copy link
Copy Markdown
Contributor

@alexjba alexjba commented May 15, 2026

What does the PR do

This commit bumps status-go to include status-im/status-go#7440. As a result the message sending is paused while in the background to stop the high frequency mvds loops that will prevent Android from going into sleep. To preserve message sending while the app is in the background/killed we'll have to wake messenger briefly on the OS intent. We'll resume messenger for 60 seconds - enough to push the message through and then it will be paused again unless the app goes back to foreground.

This results in less battery usage and less events piling up in the qt event loop while the app is in the background.

Closes: #20742

Affected areas

Actions within the push notifications on android. E.g. Reply, accept contact request

Quality checklist

Screencapture of the functionality

Impact on end user

The battery usage is reduced while status-go runs in the background.
Restoring the app will be faster after running in the background for a long time.

How to test

Login and kill the app.
Let it there for a few hours and compare the battery usage.

Receive contact request and message push notifications and respond from within the android notification.

Risk

Risk of breaking the push notifications actions.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Bumps status-go to a version that pauses MVDS message-sending loops while the app is backgrounded (to reduce Android battery drain) and adds Android-side glue so notification reply / contact-request actions can briefly wake the messaging service to push the user's reply through, then re-pause it.

Changes:

  • Add scheduleMessagingRepause() to StatusGoService with a 60s coalesced re-pause runnable on the main Handler, plus sInstance plumbing and cleanup in onCreate/onDestroy/applyUiVisibility.
  • In NotificationReplyReceiver, call ResumeService("messaging") before sending the chat / contact-request RPC and schedule a re-pause in the finally block.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
mobile/android/qt6/src/app/status/mobile/ipc/StatusGoService.java Adds singleton instance, main-thread handler, and a coalesced re-pause runnable for the "messaging" service used by background notification actions.
mobile/android/qt6/src/app/status/mobile/ipc/NotificationReplyReceiver.java Resumes "messaging" before background send, schedules re-pause in finally for both reply and contact-request paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@status-im-auto
Copy link
Copy Markdown
Member

status-im-auto commented May 15, 2026

Jenkins Builds

Click to see older builds (29)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 82a0bd3 1 2026-05-15 06:45:27 ~7 min tests/nim 📄log
✔️ 82a0bd3 1 2026-05-15 06:47:32 ~10 min android/arm64 🤖apk 📲
✔️ 82a0bd3 1 2026-05-15 06:49:20 ~11 min tests/ui 📄log
✔️ 82a0bd3 1 2026-05-15 06:50:34 ~13 min ios/aarch64 📱ipa 📲
✔️ 82a0bd3 1 2026-05-15 06:54:02 ~16 min macos/aarch64 🍎dmg
✔️ 82a0bd3 1 2026-05-15 06:55:12 ~17 min linux/x86_64 📦tgz
✔️ 82a0bd3 1 2026-05-15 07:01:59 ~24 min windows/x86_64 💿exe
✖️ 82a0bd3 11251 2026-05-15 07:32:33 ~37 min tests/e2e 📊rpt
✖️ 82a0bd3 3211 2026-05-15 07:45:30 ~43 min tests/e2e-windows 📊rpt
✔️ 53356d4 2 2026-05-15 09:51:55 ~8 min tests/nim 📄log
✔️ 53356d4 2 2026-05-15 09:53:09 ~10 min android/arm64 🤖apk 📲
53356d4 2 2026-05-15 09:53:58 ~10 min tests/ui 📄log
✔️ 53356d4 2 2026-05-15 09:56:22 ~13 min ios/aarch64 📱ipa 📲
✔️ 53356d4 2 2026-05-15 10:00:28 ~17 min linux/x86_64 📦tgz
✔️ 53356d4 2 2026-05-15 10:01:47 ~18 min macos/aarch64 🍎dmg
✔️ 53356d4 2 2026-05-15 10:08:55 ~25 min windows/x86_64 💿exe
✖️ 53356d4 11257 2026-05-15 10:24:18 ~23 min tests/e2e 📊rpt
✔️ 53356d4 3215 2026-05-15 10:29:13 ~20 min tests/e2e-windows 📊rpt
✖️ 53356d4 3231 2026-05-15 10:31:42 ~38 min tests/e2e-android 📦pkg
✔️ d559641 3 2026-05-18 06:10:42 ~8 min tests/nim 📄log
✔️ d559641 3 2026-05-18 06:12:41 ~10 min android/arm64 🤖apk 📲
✔️ d559641 3 2026-05-18 06:14:57 ~12 min tests/ui 📄log
✔️ d559641 3 2026-05-18 06:15:25 ~13 min ios/aarch64 📱ipa 📲
✔️ d559641 3 2026-05-18 06:18:32 ~16 min macos/aarch64 🍎dmg
✔️ d559641 3 2026-05-18 06:19:10 ~17 min linux/x86_64 📦tgz
✔️ d559641 3 2026-05-18 06:24:46 ~22 min windows/x86_64 💿exe
✔️ d559641 11275 2026-05-18 06:36:40 ~17 min tests/e2e 📊rpt
✔️ d559641 3230 2026-05-18 06:44:28 ~19 min tests/e2e-windows 📊rpt
✖️ d559641 3258 2026-05-18 07:27:18 ~1 hr 14 min tests/e2e-android 📦pkg
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 0fcfe0d 4 2026-05-18 12:02:51 ~13 min ios/aarch64 📱ipa 📲
✔️ 0fcfe0d 4 2026-05-18 12:05:40 ~16 min tests/nim 📄log
✔️ 0fcfe0d 4 2026-05-18 12:06:28 ~16 min macos/aarch64 🍎dmg
✔️ 0fcfe0d 4 2026-05-18 12:09:20 ~19 min tests/ui 📄log
✔️ 0fcfe0d 4 2026-05-18 12:11:25 ~21 min linux/x86_64 📦tgz
✔️ 0fcfe0d 4 2026-05-18 12:15:03 ~25 min windows/x86_64 💿exe
✔️ 0fcfe0d 3238 2026-05-18 12:51:33 ~36 min tests/e2e-windows 📊rpt
✔️ a7f2db1b 4 2026-05-18 12:03:34 ~14 min android/arm64 🤖apk 📲

@alexjba alexjba force-pushed the fix/pause-more-work branch from 82a0bd3 to 53356d4 Compare May 15, 2026 09:42
Copy link
Copy Markdown
Member

@caybro caybro left a comment

Choose a reason for hiding this comment

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

LGTM

@alexjba alexjba force-pushed the fix/pause-more-work branch from 53356d4 to d559641 Compare May 18, 2026 06:01
@sunleos
Copy link
Copy Markdown
Collaborator

sunleos commented May 18, 2026

@alexjba

Tested the battery usage by these two Status app versions:

  1. Status from this release build https://ci.infra.status.im/blue/organizations/jenkins/status-app%2Frelease/detail/release%2F2.38.x/34/artifacts/ - i.e. it is without these battery usage optimizations in this PR.

My phone device shows 4% battery usage since last fully charged for this build.

image
  1. Status PR (APK build 2 from this PR). My phone device shows 1% battery usage since last fully charged for this build.
image

If the data above is right (will try to monitor these two app versions to see if I spot anything different in terms of battery data usage), then this PR brings 3x improvements in terms of battery usage by the app.

This commit bumps status-go to include status-im/status-go#7440. As a result the message sending is paused while in the background to stop the high frequency mvds loops that will prevent Android from going into sleep.
To preserve message sending while the app is in the background/killed we'll have to wake messenger briefly on the OS intent. We'll resume messenger for 60 seconds - enough to push the message through and then it will be paused again unless the app goes back to foreground.

This results in less battery usage and less events piling up in the qt event loop while the app is in the background.
@alexjba alexjba force-pushed the fix/pause-more-work branch from d559641 to 0fcfe0d Compare May 18, 2026 11:49
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.

6 participants