fix: remove app from recents if in an invalid state#20415
Merged
BrayanDSO merged 2 commits intoankidroid:mainfrom Mar 12, 2026
Merged
fix: remove app from recents if in an invalid state#20415BrayanDSO merged 2 commits intoankidroid:mainfrom
BrayanDSO merged 2 commits intoankidroid:mainfrom
Conversation
After manual testing, the app no longer appears in Recents. I suspect this fixes: "android backup in progress, please try again" `Process.killProcess()` is a hard kill. I suspect some Android internals keep a reference to the process (users are reporting AnkiDroid being broken in the task list when the backup toast shows) If the app is in an invalid state within Android, it is feasible that Application.onCreate() is skipped, perpetually causing the "android backup in progress, please try again" toast. `finishAndRemoveTask` should stop this from occurring. Fixes 19050 - seen on a Samsung A35
lukstbit
approved these changes
Mar 7, 2026
BrayanDSO
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose / Description
I suspect this fixes the app being in an invalid state, causing "android backup in progress, please try again" to appear until the device is restarted.
Process.killProcess()is a hard kill.I suspect some Android internals keep a reference to the process (users are reporting AnkiDroid being broken in the task list when the backup toast shows)
If the app is in an invalid state within Android, it is feasible that
Application.onCreate()is skipped, perpetually causing the "android backup in progress, please try again" toast.Fixes
Approach
Use
finishAndRemoveTask: https://developer.android.com/reference/android/app/Activity#finishAndRemoveTask()How Has This Been Tested?
After manual testing, the app no longer appears in Recents.
Learning (optional, can help others)
Seen on many devices, including a Samsung A35
Checklist