SamAmco / track-and-graph

An android app for tracking personal data and creating custom graphs
GNU General Public License v3.0
438 stars 40 forks source link

Restoring DB sometimes freezes the app #167

Open stheid opened 2 years ago

stheid commented 2 years ago

This issue is meant to collect the observations. Right now i have not really investigated the issue thoroughly and i am not 100% sure about the implications

SamAmco commented 2 years ago

The backup restore process is as follows. All app data is stored in a sql database file by Room. When you backup, we simply copy that file to a user defined location. Restoring is simply copying the selected file into the place of the sql database file. If the restored file uses an older schema than the current installation of the app then it will be upgraded automatically by Room using the migration code that ships with each database schema change. Originally I tried to implement some code that would restart the app when you restore a database so that Room would be forced to run its migrations and everything could be reloaded. I have found though that this code that should restart the app doesn't work very well so this may be the source of the freezing issue. The app should be restarted when the database file is changed ideally unless there is a way to force Room to reload (which i couldn't find when I was implementing this)

stheid commented 2 years ago

nevertheless, the app should at least inform the user that the restoration has finished. Right now there is know way to know whether the restore has succeded, is still on the way, or failed.

SamAmco commented 2 years ago

Yeah I'm all for improvements in this area.