consolidate: split into two steps, can pick up at second step if anything fails

This commit is contained in:
Vincent Breitmoser
2014-08-19 15:45:42 +02:00
parent 8d668d170c
commit c725239a69
7 changed files with 112 additions and 26 deletions

View File

@@ -490,10 +490,7 @@ public class KeychainIntentService extends IntentService
PgpImportExport pgpImportExport = new PgpImportExport(this, this);
ImportKeyResult result = pgpImportExport.importKeyRings(entries);
Bundle resultData = new Bundle();
resultData.putParcelable(RESULT_IMPORT, result);
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, resultData);
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, result);
} catch (Exception e) {
sendErrorToHandler(e);
}
@@ -670,12 +667,8 @@ public class KeychainIntentService extends IntentService
}
} else if (ACTION_CONSOLIDATE.equals(action)) {
ConsolidateResult result = new ProviderHelper(this).consolidateDatabase(this);
Bundle resultData = new Bundle();
resultData.putParcelable(RESULT_CONSOLIDATE, result);
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, resultData);
ConsolidateResult result = new ProviderHelper(this).consolidateDatabaseStep1(this);
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, result);
}
}

View File

@@ -391,6 +391,7 @@ public class OperationResultParcel implements Parcelable {
// consolidate
MSG_CON (R.string.msg_con),
MSG_CON_ERROR_BAD_STATE (R.string.msg_con_error_bad_state),
MSG_CON_SAVE_SECRET (R.string.msg_con_save_secret),
MSG_CON_SAVE_PUBLIC (R.string.msg_con_save_public),
MSG_CON_DB_CLEAR (R.string.msg_con_db_clear),