Tapping outside of the progress box during a forced, one-way sync cancels the transfer
Checked for duplicates?
- [x] This issue is not a duplicate
Does it also happen in the desktop version?
- [ ] This bug does not occur in the latest version of Anki Desktop
What are the steps to reproduce this bug?
Force a one way sync Sync While syncing, tap outside of the progress window A toast pops up saying "interrupted"
Expected behaviour
Sync should continue
Debug info
AnkiDroid Version = 2.24.0alpha2 (a0e65b9054ff4a4da5fa410a834cd0528518c0a6)
Backend Version = 0.1.63-anki25.09.2 (25.09.2 3890e12c9e48c028c3f12aa58cb64bd9f8895e30)
Android Version = 16 (SDK 36)
ProductFlavor = full
Device Info = Google | google | bluejay | bluejay | Pixel 6a | bluejay
Webview User Agent = Mozilla/5.0 (Linux; Android 16; Pixel 6a Build/BP4A.251205.006; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/143.0.7499.192 Mobile Safari/537.36
ACRA UUID = 11e92d1e-a435-4b2e-994c-40db851e1867
FSRS = 5.1.0 (Enabled: true)
Crash Reports Enabled = true
(Optional) Anything else you want to share?
It might just be my phone, but if the screen turns off during a one way sync, even for just a few seconds, it looses the network connection ("Error: A network error occurred. Error details: error sending request") and I have to start over. I only found this bug because I had to keep tapping the screen during a sync over a slow connection.
Research
- [x] I have checked the manual and the FAQ and could not find a solution to my issue
- [ ] (Optional) I have confirmed the issue is not resolved in the latest alpha release (instructions)
@david-allison I want to work on this. Please assign it to me.
I tried to reproduce this on my device, but couldn’t trigger it.
Device:
- Redmi K50i
- Android version: 14 UP1A.231005.007
- OS Version: 2.0.3.0.ULOINXM
- AnkiDroid: 2.24.0alpha2
This suggests the behavior may be device or Android 16–specific (possibly Pixel/gesture handling related).
Should be generally reproducible. Are you sure you're forcing a full sync?
I am able to reproduce the issue on my phone.
I was not doing full sync. Will do it using full sync now..
@doozan quick clarification on expected behaviour required:
For the intended UX, should we:
- keep outside touch cancellation enabled but show a confirmation dialog before actually cancelling the sync when touched outside, or
- only allow cancellation via the explicit Cancel button and ignore outside touches?
We should follow the behavior of the normal sync progress dialog, which I believe is "only allow cancellation via the explicit Cancel button and ignore outside touches"
Posting findings from the closed PR (#20104 ) :
Findings about dialog behavior implementation:
-
The progress dialog is created in
withProgressDialog()inside:AnkiDroid/src/main/java/com/ichi2/anki/CoroutineHelpers.kt -
This helper configures cancellation for all progress dialogs created through it.
-
It is also the place where
setCanceledOnTouchOutside(...)would be applied if we try to block outside-touch dismissal. -
Because this helper is shared across multiple features, calling
setCanceledOnTouchOutside(false)here would change behavior for all progress dialogs, not only sync.
So applying setCanceledOnTouchOutside(false) in withProgressDialog() would be too broad.
Any behavior change should be scoped to the sync dialog path only, not the shared helper.
Calling code (forced one-way / full sync path):
File: AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt
Lines ~231–252 (commit 25aeacf)
- For the sync case, cancellation is enabled intentionally via
onCancel = ::cancelSync, but outside-touch dismissal currently triggers the same cancellation path as an explicit cancel action, without confirmation.
deckPicker.withProgress(
extractProgress = fullDownloadProgress(TR.syncDownloadingFromAnkiweb()),
onCancel = ::cancelSync,
) {
withCol {
try {
createBackup(
BackupManager.getBackupDirectoryFromCollection(colDb),
force = true,
waitForCompletion = true,
)
close(downgrade = false, forFullSync = true)
fullUploadOrDownload(auth, upload = false, serverUsn = mediaUsn)
} finally {
reopen(afterFullSync = true)
}
}
deckPicker.refreshState()
if (mediaUsn != null) {
SyncMediaWorker.start(deckPicker, auth)
}
}
@doozan as of now when sync is on-going which of the following behavior do you intend to be shown :
- Disable outside touch for sync cancellation.
- Provide an explicit cancellation confirmation dialogue box on outside touch for sync cancellation.
We should follow the behavior of the normal sync progress dialog: "Disable outside touch for sync cancellation"