Skip to content

fix: back on the Home screen sends the wallet to the background - #1618

Merged
HashEngineering merged 2 commits into
feat/kotlin-sdk-phase-1from
fix/home-back-to-background
Oct 13, 2026
Merged

HashEngineering merged 2 commits into
feat/kotlin-sdk-phase-1from
fix/home-back-to-background

Conversation

@HashEngineering

@HashEngineering HashEngineering commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Pressing back on the Home screen closed the wallet by destroying MainActivity. Reopening it then rebuilt the main screen from scratch, which was slower and lost scroll position and screen state.

The cause: LockScreenActivity registers a back handler that calls handleBackNavigation(). MainActivity's override first tries goBack(), which pops only the activity's own fragment back stack. The bottom-nav tabs live on the nav host's back stack, so on Home that activity-level stack is empty. The call then falls through to finish().

What was done?

  • On Home, MainActivity.handleBackNavigation() now calls moveTaskToBack(true). This matches the system default for a root activity since Android 12: the wallet goes to the background and reopens instantly. Auto-logout still applies on resume.
  • If MainActivity isn't the task root (for example, it was opened inside another app's task from a dash: link), it still finishes as before. Otherwise that other app would be sent to the background.
  • The rest of back navigation is unchanged: back still closes the lock screen, pops sub-screens, and returns to Home from the other tabs.

How Has This Been Tested?

  • :wallet:assemble_testNet3Debug builds.
  • Not yet tried on a device or emulator.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Pressing Back from the app’s main screen now sends the app to the background instead of closing its task.

Back on Home fell through to LockScreenActivity.handleBackNavigation,
which finish()es MainActivity: the tabs live on the nav host's back
stack, so the activity's own stack is empty there. Reopening then
rebuilt the main screen from scratch. Move the task to the background
instead, matching the Android 12+ default for a root activity. When
MainActivity isn't the task root (opened inside another app's task),
keep finishing, so that app isn't backgrounded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: dashpay/dash-wallet/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c8026c97-2694-4e39-8e31-e6b66296ef9b

📥 Commits

Reviewing files that changed from the base of the PR and between ebb9c20 and 452722c.


📒 Files selected for processing (3)
  • wallet/src/de/schildbach/wallet/ui/main/HomeBackAction.kt
  • wallet/src/de/schildbach/wallet/ui/main/MainActivity.kt
  • wallet/test/de/schildbach/wallet/ui/main/HomeBackActionTest.kt

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: dashpay/dash-wallet/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4c5e31b9-58c6-41ba-93ce-fca73242ac5e

📥 Commits

Reviewing files that changed from the base of the PR and between ff1d9a4 and ebb9c20.


📒 Files selected for processing (1)
  • wallet/src/de/schildbach/wallet/ui/main/MainActivity.kt

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.



📝 Walkthrough
📝 Walkthrough

Walkthrough

Back navigation now backgrounds the task when MainActivity is the task root. When it is not the root, the existing superclass back-navigation behavior remains.

Changes

Back Navigation

Layer / File(s) Summary
Root task back behavior
wallet/src/de/schildbach/wallet/ui/main/MainActivity.kt
When the activity is the task root and the user cannot navigate back within the app or is not on the lock screen, back navigation calls moveTaskToBack(true). Otherwise, the superclass handler remains in use.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~7 minutes

Change: Bug fix

Suggested reviewers: bfoss765


Merge Risk: ⚪ Minimal · up to ebb9c

Back navigation remains within the wallet when a destination can be popped; at the task root, Home back backgrounds the task as intended. No actionable merge-blocking risk is established.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: Home-screen back navigation sends the wallet task to the background.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ Final review complete — no blockers (commit 452722c) · triage: low

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Final validation — Phase 1 + Phase 2

The change correctly backgrounds a root MainActivity while preserving finish behavior for non-root launches; no blocking defect was confirmed. The new navigation branch lacks regression coverage, so one non-blocking test suggestion remains. Validation was static only; the supplied exact-head CI snapshot reports successful check and build jobs.

🟡 1 suggestion(s)

Review provenance

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: low by gpt-6.1-sol (effort low) — The diff makes a small, contained change to MainActivity.handleBackNavigation(), backgrounding root tasks while preserving the existing lock-screen, back-stack, and non-root behavior.
  • Phase 1 reviewers: glm-5.3-flash — general (completed, effort high); agent phase1-reviewer
  • Phase 1 model: glm-5.3-flash — zai quota: 5h 99% left, weekly 86% left; passed over gemini-3.8-flash-high (antigravity below 15% reserve: weekly 14% left, 5h 100% left)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort medium); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `wallet/src/de/schildbach/wallet/ui/main/MainActivity.kt`:
- [SUGGESTION] wallet/src/de/schildbach/wallet/ui/main/MainActivity.kt:474-487: New isTaskRoot/moveTaskToBack back-navigation branch has no test
  This branch implements the PR's central behavior, but no test exercises either outcome. A regression could silently restore Home's destructive finish behavior or background another app's task on a non-root launch. Add focused activity tests with the lock screen hidden and the activity fragment back stack empty: assert that the root path requests task backgrounding without finishing, and that the non-root path finishes without requesting task backgrounding. The existing LockScreenActivityCreateGateTest provides a starting point for bypassing Hilt injection, but its early-exit setup does not initialize the unlocked UI needed to reach this branch. Dispatcher-level navigation checks can additionally protect the unchanged handling of sub-screens and tabs.

Extract the decision into homeBackAction() (lock screen → ignore,
fragment back stack → pop, Home as task root → move task to back,
Home in another app's task → finish) and unit-test each case, so a
regression to finish() on Home, or backgrounding another app's task,
is caught.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-review — Final validation — Phase 1 + Phase 2

Independently reviewed the complete PR diff at 452722c and traced the surrounding back-navigation, task-launch, and auto-logout behavior; no actionable in-scope issues were found. The extracted decision function and its four branch tests address the prior coverage suggestion while preserving lock-screen interception and fragment-stack handling. This was a static review: the supplied CI snapshot reports check success and build in progress; tests were not run locally, and Android task movement remains unverified on a device.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: low by gpt-6.1-sol (effort low) — The diff makes a small, contained change to back-navigation decisions with straightforward branch tests and does not alter a critical surface.
  • Phase 1 reviewers: glm-5.3-flash — general (completed, effort high); agent phase1-reviewer
  • Phase 1 model: glm-5.3-flash — zai quota: 5h 94% left, weekly 99% left; passed over gemini-3.8-flash-high (antigravity below 15% reserve: weekly 14% left, 5h 100% left)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort medium); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort medium); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@HashEngineering
HashEngineering merged commit f23c813 into feat/kotlin-sdk-phase-1 Oct 13, 2026
3 checks passed
HashEngineering added a commit that referenced this pull request Oct 15, 2026
…sdk-phase-1-v11.9.1

Brings in #1613, #1597 (Kotlin SDK v42int30), #1603, #1612, #1617, #1618 and #1615.

- WalletTransactionMetadataProviderGiftCardTest: kept both imports
  (TransactionRecordsDao from this branch, SdkTxMetadataSource from #1603).
- WalletTransactionMetadataProviderSdkStoreTest (new in #1603): passes the
  transactionRecordsDao this branch added to the provider's constructor.
- forgetTransaction() also refuses a transaction the SDK store holds. Since
  #1603 an SDK-only transaction has real metadata, and the dashj wallet not
  holding it no longer proves the payment was never sent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HashEngineering added a commit that referenced this pull request Oct 15, 2026
Back on More (or any other bottom-nav tab) left the app: LockScreenActivity's
activity-scoped back callback is re-added on every start, so once the
activity has been stopped it outranks the nav host's callback and every
back press reached MainActivity.handleBackNavigation(), which only looked
at the activity's own fragment stack (empty) and sent the wallet to the
background (finished it before #1618).

handleBackNavigation() now pops the nav back stack while it has a previous
entry — a tab goes back to Home, a sub-screen to its parent. On Home, back
is consumed: the wallet is neither closed nor backgrounded. Opened inside
another app's task (dash: link) it still finishes, so the user is not
stranded.

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

2 participants