Skip to content

feat: use low power mode when the app is in the background#20202

Draft
alexjba wants to merge 8 commits intofeat/local-notificationsfrom
feat/reduce-app-work
Draft

feat: use low power mode when the app is in the background#20202
alexjba wants to merge 8 commits intofeat/local-notificationsfrom
feat/reduce-app-work

Conversation

@alexjba
Copy link
Copy Markdown
Contributor

@alexjba alexjba commented Mar 16, 2026

What does the PR do

status-im/status-go#7373 introduced a new low power mode where the status-go work can be paused/resumed using the appStateChanged method.

This PR implements the java layer and calls the appStateChanged whenever the app goes to background, gets killed, starts or resumes.

Affected areas

Android start/stop/background and foreground states.

Quality checklist

Impact on end user

The user should see better battery life when the app is running in the background.

How to test

Get a relative power usage for the phone with the usual apps running.
Open the app, login and kill the app.
Observe the power usage for some time and compare with the baseline established before.

Risk

Medium

@status-im-auto
Copy link
Copy Markdown
Member

status-im-auto commented Mar 16, 2026

Jenkins Builds

Click to see older builds (61)
Commit #️⃣ Finished (UTC) Duration Platform Result
20d0f5b 1 2026-03-16 17:28:39 ~10 min macos/aarch64-nwaku 📄log
✔️ 20d0f5b 1 2026-03-16 17:29:26 ~11 min android/arm64 🤖apk 📲
✔️ 20d0f5b 1 2026-03-16 17:29:49 ~11 min tests/nim 📄log
✔️ 20d0f5b 1 2026-03-16 17:30:54 ~12 min ios/aarch64 📱ipa 📲
20d0f5b 1 2026-03-16 17:33:37 ~15 min macos/aarch64 📄log
✔️ 20d0f5b 1 2026-03-16 17:34:28 ~15 min tests/ui 📄log
✔️ 20d0f5b 1 2026-03-16 17:34:46 ~16 min linux/x86_64 📦tgz
✔️ 20d0f5b 1 2026-03-16 17:38:26 ~19 min linux/x86_64-nwaku 📦tgz
✖️ 20d0f5b 1743 2026-03-16 17:39:18 ~9 min tests/e2e-android 📦pkg
✔️ 20d0f5b 1 2026-03-16 17:42:27 ~23 min windows/x86_64 💿exe
✔️ 20d0f5b 10265 2026-03-16 17:55:37 ~20 min tests/e2e 📊rpt
✖️ 20d0f5b 2358 2026-03-16 18:00:17 ~17 min tests/e2e-windows 📊rpt
✔️ 20d0f5b 2 2026-03-17 08:14:04 ~13 min macos/aarch64 🍎dmg
4eec65e 2 2026-03-19 09:00:20 ~9 min macos/aarch64-nwaku 📄log
4eec65e 2 2026-03-19 09:00:46 ~10 min ios/aarch64 📄log
4eec65e 3 2026-03-19 09:07:08 ~16 min macos/aarch64 📄log
4eec65e 2 2026-03-19 09:10:42 ~20 min windows/x86_64 📄log
✔️ 4eec65e 2 2026-03-19 09:23:13 ~33 min android/arm64 🤖apk 📲
4eec65e 2 2026-03-19 09:26:38 ~36 min linux/x86_64 📄log
✔️ 4eec65e 2 2026-03-19 09:28:03 ~37 min tests/nim 📄log
✖️ 4eec65e 1848 2026-03-19 09:28:53 ~5 min tests/e2e-android 📦pkg
4eec65e 2 2026-03-19 09:29:54 ~39 min linux/x86_64-nwaku 📄log
✔️ 4eec65e 2 2026-03-19 09:32:40 ~42 min tests/ui 📄log
f55f3bb 1 2026-03-19 10:43:08 ~11 min unknown 📄log
f55f3bb 3 2026-03-19 10:46:04 ~14 min macos/aarch64-nwaku 📄log
✔️ f55f3bb 3 2026-03-19 10:46:45 ~14 min ios/aarch64 📱ipa 📲
✔️ f55f3bb 3 2026-03-19 10:49:40 ~17 min android/arm64 🤖apk 📲
✔️ f55f3bb 4 2026-03-19 10:51:01 ~19 min macos/aarch64 🍎dmg
✔️ f55f3bb 3 2026-03-19 10:52:13 ~20 min tests/nim 📄log
✔️ f55f3bb 3 2026-03-19 10:56:19 ~24 min tests/ui 📄log
✔️ f55f3bb 3 2026-03-19 10:59:43 ~27 min linux/x86_64 📦tgz
✔️ f55f3bb 3 2026-03-19 11:04:07 ~32 min linux/x86_64-nwaku 📦tgz
✔️ f55f3bb 3 2026-03-19 11:04:51 ~32 min windows/x86_64 💿exe
✖️ f55f3bb 1852 2026-03-19 11:38:41 ~48 min tests/e2e-android 📦pkg
✔️ f55f3bb 10339 2026-03-19 11:38:41 ~38 min tests/e2e 📊rpt
✖️ f55f3bb 2433 2026-03-19 11:53:58 ~48 min tests/e2e-windows 📊rpt
✔️ ffd77e9 4 2026-03-19 14:39:51 ~23 min ios/aarch64 📱ipa 📲
✔️ ffd77e9 4 2026-03-19 14:42:53 ~26 min windows/x86_64 💿exe
✔️ ffd77e9 5 2026-03-19 14:45:26 ~28 min macos/aarch64 🍎dmg
✔️ ffd77e9 4 2026-03-19 14:46:52 ~30 min macos/aarch64-nwaku 🍎dmg
✔️ ffd77e9 4 2026-03-19 14:47:16 ~30 min android/arm64 🤖apk 📲
✔️ ffd77e9 4 2026-03-19 14:54:14 ~37 min tests/nim 📄log
✔️ ffd77e9 4 2026-03-19 14:55:47 ~39 min tests/ui 📄log
✔️ ffd77e9 4 2026-03-19 14:57:16 ~40 min linux/x86_64 📦tgz
ffd77e9 2 2026-03-19 14:58:26 ~41 min unknown 📄log
✔️ ffd77e9 4 2026-03-19 15:00:02 ~43 min linux/x86_64-nwaku 📦tgz
✔️ ffd77e9 2446 2026-03-19 15:15:54 ~32 min tests/e2e-windows 📊rpt
✔️ ffd77e9 10358 2026-03-19 15:35:38 ~38 min tests/e2e 📊rpt
✖️ ffd77e9 1865 2026-03-19 15:43:31 ~56 min tests/e2e-android 📦pkg
bb34d7d 5 2026-03-20 16:03:56 ~13 min macos/aarch64-nwaku 📄log
✔️ bb34d7d 5 2026-03-20 16:05:49 ~15 min ios/aarch64 📱ipa 📲
✔️ bb34d7d 6 2026-03-20 16:06:41 ~16 min android/arm64 🤖apk 📲
✔️ bb34d7d 5 2026-03-20 16:08:11 ~17 min tests/nim 📄log
✔️ bb34d7d 6 2026-03-20 16:10:12 ~19 min macos/aarch64 🍎dmg
✔️ bb34d7d 5 2026-03-20 16:12:42 ~22 min tests/ui 📄log
✔️ bb34d7d 5 2026-03-20 16:13:52 ~23 min linux/x86_64 📦tgz
✔️ bb34d7d 5 2026-03-20 16:16:04 ~25 min linux/x86_64-nwaku 📦tgz
✔️ bb34d7d 5 2026-03-20 16:17:55 ~27 min windows/x86_64 💿exe
✔️ bb34d7d 10392 2026-03-20 16:32:51 ~18 min tests/e2e 📊rpt
✔️ bb34d7d 4 2026-03-20 16:45:23 ~54 min unknown 📦pkg 📲
✖️ bb34d7d 1907 2026-03-20 17:41:53 ~1 hr 35 min tests/e2e-android 📦pkg
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 762ab83 6 2026-03-24 11:04:21 ~8 min tests/nim 📄log
✔️ 762ab83 7 2026-03-24 11:06:12 ~10 min android/arm64 🤖apk 📲
✔️ 762ab83 6 2026-03-24 11:08:51 ~13 min tests/ui 📄log
✔️ 762ab83 6 2026-03-24 11:13:21 ~17 min linux/x86_64 📦tgz
✔️ 762ab83 6 2026-03-24 11:22:52 ~27 min windows/x86_64 💿exe
✔️ 762ab83 6 2026-03-24 11:26:47 ~31 min ios/aarch64 📱ipa 📲
✔️ 762ab83 10426 2026-03-24 11:32:34 ~19 min tests/e2e 📊rpt
✔️ 762ab83 2510 2026-03-24 11:39:52 ~16 min tests/e2e-windows 📊rpt
✔️ 762ab83 5 2026-03-24 11:58:40 ~1 hr 3 min unknown 📦pkg 📲
✖️ 762ab83 1959 2026-03-24 12:23:21 ~1 hr 17 min tests/e2e-android 📦pkg

@caybro
Copy link
Copy Markdown
Member

caybro commented Mar 17, 2026

Baseline: installed at 11am with 95%
End result: 11 pm left with 37% (a bit lower than usual but still ok)

@noeliaSD
Copy link
Copy Markdown
Contributor

noeliaSD commented Mar 17, 2026

Baseline: Installed at 14.00 with 100%
End result: still 100% after 7h --> No usage, just left the phone with the app killed and no other apps running
Other metric: 95% after 12h more with the app in background

@jrainville
Copy link
Copy Markdown
Member

jrainville commented Mar 17, 2026

Baseline: installed at 10h40am at 81%
End result: 16% at 10pm
I did use my phone a lot, including video watching.

Here is the break down:
Screenshot_20260317_215628_Device care
Screenshot_20260317_215634_Device care
Screenshot_20260317_215700_Device care
Screenshot_20260317_215703_Device care

As you can see, Status PR only used 3% and was kept alive in the background the whole time

@micieslak
Copy link
Copy Markdown
Member

Baseline: Installed at 18.20 with 100%
End result: TBD

@friofry
Copy link
Copy Markdown
Contributor

friofry commented Mar 17, 2026

Baseline: Installed at 22:45 UTC (17 Mar) with 100%
End result: 9:34 UTC (19 Mar) with 85%

I noticed that when I open the app immediately after minimizing it, either:

  • the screen goes black for 3–5 seconds before the UI appears
  • or it stays black for more than 20 seconds until I touch the screen

@jrainville
Copy link
Copy Markdown
Member

As for the UX of it, it seems like all messages were gotten in the BG, as they were all there as soon as I opened back.

The only thing to improve would be the app loading speed. It can be done in a other issue/PR.
It will also help with the login speed.
My PR on community loading state will also help because it will show a loading instead of the black screen.
For me it took about 15 secs on this screen:
Screenshot_20260317_220319_Status PR

@alexjba alexjba force-pushed the feat/local-notifications branch from 8083a3b to 2547977 Compare March 19, 2026 10:28
@alexjba alexjba force-pushed the feat/reduce-app-work branch from 4eec65e to f55f3bb Compare March 19, 2026 10:31
@alexjba
Copy link
Copy Markdown
Contributor Author

alexjba commented Mar 19, 2026

The long splash screen and the blank screen should probably be tackled in a different PR.
I've looked into the long splash screen and it's basically how long it needs to load all the nim modules and data. What we could do as a quick patch would be to lower the splash screen to the time it needs to load the libs and then to move the user to our loading screen we see on login. The real fix though would be to work on app start-up time after login.

We have another issue for the blank screen found by @friofry. #19010

@alexjba alexjba force-pushed the feat/local-notifications branch from 2547977 to a3fb90c Compare March 19, 2026 14:14
@alexjba alexjba force-pushed the feat/reduce-app-work branch from f55f3bb to ffd77e9 Compare March 19, 2026 14:16
@alexjba alexjba requested a review from Copilot March 19, 2026 14:31
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

Implements Android Java-layer support for status-go’s low power mode by reporting UI foreground/background state changes to the backend and making those calls non-blocking to avoid ANRs.

Changes:

  • Add async UI-visibility reporting with replay-on-reconnect behavior in StatusGoServiceClient.
  • Add service-side lifecycle scheduling to call into status-go (AppStateChange) on UI visibility changes.
  • Bump vendor/status-go submodule to a commit that includes the new lifecycle capability.

Reviewed changes

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

File Description
vendor/status-go Updates status-go submodule to version that supports lifecycle pause/resume.
mobile/android/qt6/src/app/status/mobile/ipc/StatusGoServiceClient.java Adds async setUiVisible, replay on reconnect, and safer bind/unbind flow.
mobile/android/qt6/src/app/status/mobile/ipc/StatusGoService.java Adds coalesced background execution for backend lifecycle updates on visibility changes.

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

You can also share your feedback on Copilot code review. Take the survey.

@alexjba alexjba force-pushed the feat/local-notifications branch 2 times, most recently from 5d18b86 to b1382af Compare March 20, 2026 11:01
alexjba added 6 commits March 20, 2026 14:45
- normalize notification id
- parse the status-go json for errors
- hook setUIVisible(false) on android app crash
- make sure setUIVisible doesn't block the main thread
- properly identify group chat notifications
@alexjba alexjba force-pushed the feat/local-notifications branch from b1382af to 06925c7 Compare March 20, 2026 12:46
@alexjba alexjba force-pushed the feat/reduce-app-work branch from bb34d7d to 762ab83 Compare March 24, 2026 10:55
@alexjba alexjba force-pushed the feat/local-notifications branch from 06925c7 to af270a6 Compare March 24, 2026 10:57
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.

8 participants