seedvault-app / seedvault

A backup application for the Android Open Source Project.
1.19k stars 73 forks source link

Warn users when they run out of space #656

Closed grote closed 1 month ago

grote commented 1 month ago

This PR takes two approaches for warning the user about out of space situations:

  1. try to retrieve actual free space from backup location and warn the user before attempting a backup if this is very low. some hacks are used to get the free space from external storage SAF providers
  2. catch exceptions that include hints about out of storage situations and then warn the user as soon as such an exception happens. Note that SAF does not always expose those exceptions to the caller.

Related to #363 Fixes #555

t-m-w commented 1 month ago
  1. try to retrieve actual free space from backup location and warn the user before attempting a backup if this is very low. some hacks are used to get the free space from external storage SAF providers

Tested this portion with a flash drive, and it looks like it's working fine. Free space is also shown when selecting a backup location, and backup sizes are shown when restoring.

t-m-w commented 1 month ago
  1. catch exceptions that include hints about out of storage situations and then warn the user as soon as such an exception happens. Note that SAF does not always expose those exceptions to the caller.

Tested this by setting MIN_FREE_SPACE to -1 and recompiling. Seems to not notice an IOException for ENOSPC (caused by ErrnoException for ENOSPC) and waits a few minutes until timing out with a generic "Backup failed." Full log provided privately.

grote commented 1 month ago

Seems to not notice an IOException for ENOSPC

This helped me to identify additional out of space situations,we can now warn the user about. Pushed those as extra commits.