Start consolidate activity

This commit is contained in:
Dominik Schürmann 2014-08-19 16:49:48 +02:00
parent 4f8ddad9d3
commit c42f6a04ed

View File

@ -21,6 +21,7 @@ import android.accounts.Account;
import android.accounts.AccountManager; import android.accounts.AccountManager;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Environment; import android.os.Environment;
@ -29,6 +30,7 @@ import org.spongycastle.jce.provider.BouncyCastleProvider;
import org.sufficientlysecure.keychain.helper.Preferences; import org.sufficientlysecure.keychain.helper.Preferences;
import org.sufficientlysecure.keychain.helper.TlsHelper; import org.sufficientlysecure.keychain.helper.TlsHelper;
import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider; import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider;
import org.sufficientlysecure.keychain.ui.ConsolidateDialogActivity;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.PRNGFixes; import org.sufficientlysecure.keychain.util.PRNGFixes;
@ -92,12 +94,17 @@ public class KeychainApplication extends Application {
TemporaryStorageProvider.cleanUp(this); TemporaryStorageProvider.cleanUp(this);
// restart consolidate process if it has been interruped before
if (prefs.getCachedConsolidate()) { if (prefs.getCachedConsolidate()) {
// do something which calls ProviderHelper.consolidateDatabaseStep2 with a progressable // do something which calls ProviderHelper.consolidateDatabaseStep2 with a progressable
Intent consolidateIntent = new Intent(this, ConsolidateDialogActivity.class);
consolidateIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(consolidateIntent);
} }
} }
public static void setupAccountAsNeeded(Context context) { public static void setupAccountAsNeeded(Context context) {
AccountManager manager = AccountManager.get(context); AccountManager manager = AccountManager.get(context);
Account[] accounts = manager.getAccountsByType(Constants.PACKAGE_NAME); Account[] accounts = manager.getAccountsByType(Constants.PACKAGE_NAME);