Skip to content

Restart to install screen when last app is uninstalled#3777

Draft
avazirna wants to merge 1 commit into
fix-flaky-instrumentation-testsfrom
fix-restart-target-on-last-app-uninstall
Draft

Restart to install screen when last app is uninstalled#3777
avazirna wants to merge 1 commit into
fix-flaky-instrumentation-testsfrom
fix-restart-target-on-last-app-uninstall

Conversation

@avazirna

Copy link
Copy Markdown
Contributor

Summary

When uninstalling an app from the App Manager, CommCare always restarted to AppManagerActivity. If the uninstalled app was the last installed app, that left the user on an empty app-manager screen.

This change picks the restart target based on whether any installed app records remain after uninstall:

  • 0 apps leftDispatchActivity (routes to the install/setup screen)
  • 1+ apps leftAppManagerActivity (unchanged behavior)

Notes

  • The count comes from MultipleAppsUtil.appRecordArray(), read after AppLifecycleUtils.uninstall(...), which removes the ApplicationRecord from global storage before returning on success.
  • If uninstall(...) aborts mid-way (e.g. a file/db can't be deleted), the record remains in storage, so the count stays >= 1 and we safely route to AppManagerActivity.

Note

Base is fix-flaky-instrumentation-tests (stacked PR) — this branch was split off from it. Rebase onto master once the base branch merges.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@avazirna avazirna marked this pull request as draft June 29, 2026 12:52
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.

1 participant