use of com.fsck.k9.K9 in project k-9 by k9mail.
the class DatabaseUpgradeService method upgradeDatabases.
/**
* Upgrade the accounts' databases.
*/
private void upgradeDatabases() {
Preferences preferences = Preferences.getPreferences(this);
List<Account> accounts = preferences.getAccounts();
mProgressEnd = accounts.size();
mProgress = 0;
for (Account account : accounts) {
mAccountUuid = account.getUuid();
sendProgressBroadcast(mAccountUuid, mProgress, mProgressEnd);
try {
// Account.getLocalStore() is blocking and will upgrade the database if necessary
account.getLocalStore();
} catch (UnavailableStorageException e) {
Timber.e("Database unavailable");
} catch (Exception e) {
Timber.e(e, "Error while upgrading database");
}
mProgress++;
}
K9.setDatabasesUpToDate(true);
sendUpgradeCompleteBroadcast();
}
Aggregations