consolidate: working implementation, lacking ui
This commit is contained in:
@@ -52,6 +52,7 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralMsgIdException;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.service.OperationResults.ConsolidateResult;
|
||||
import org.sufficientlysecure.keychain.service.OperationResults.EditKeyResult;
|
||||
import org.sufficientlysecure.keychain.service.OperationResults.ImportKeyResult;
|
||||
import org.sufficientlysecure.keychain.service.OperationResults.SaveKeyringResult;
|
||||
@@ -103,6 +104,8 @@ public class KeychainIntentService extends IntentService
|
||||
|
||||
public static final String ACTION_CERTIFY_KEYRING = Constants.INTENT_PREFIX + "SIGN_KEYRING";
|
||||
|
||||
public static final String ACTION_CONSOLIDATE = Constants.INTENT_PREFIX + "CONSOLIDATE";
|
||||
|
||||
/* keys for data bundle */
|
||||
|
||||
// encrypt, decrypt, import export
|
||||
@@ -142,6 +145,7 @@ public class KeychainIntentService extends IntentService
|
||||
|
||||
// import key
|
||||
public static final String IMPORT_KEY_LIST = "import_key_list";
|
||||
public static final String IMPORT_KEY_FILE = "import_key_file";
|
||||
|
||||
// export key
|
||||
public static final String EXPORT_OUTPUT_STREAM = "export_output_stream";
|
||||
@@ -179,6 +183,8 @@ public class KeychainIntentService extends IntentService
|
||||
|
||||
public static final String RESULT_IMPORT = "result";
|
||||
|
||||
public static final String RESULT_CONSOLIDATE = "consolidate_result";
|
||||
|
||||
Messenger mMessenger;
|
||||
|
||||
private boolean mIsCanceled;
|
||||
@@ -662,7 +668,16 @@ public class KeychainIntentService extends IntentService
|
||||
} catch (Exception e) {
|
||||
sendErrorToHandler(e);
|
||||
}
|
||||
|
||||
} 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void sendErrorToHandler(Exception e) {
|
||||
|
||||
@@ -388,6 +388,15 @@ public class OperationResultParcel implements Parcelable {
|
||||
MSG_MF_UID_ERROR_EMPTY (R.string.msg_mf_uid_error_empty),
|
||||
MSG_MF_UNLOCK_ERROR (R.string.msg_mf_unlock_error),
|
||||
MSG_MF_UNLOCK (R.string.msg_mf_unlock),
|
||||
|
||||
// consolidate
|
||||
MSG_CON (R.string.msg_con),
|
||||
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),
|
||||
MSG_CON_REIMPORT_SECRET (R.plurals.msg_con_reimport_secret),
|
||||
MSG_CON_REIMPORT_PUBLIC (R.plurals.msg_con_reimport_public),
|
||||
MSG_CON_SUCCESS (R.string.msg_con_success),
|
||||
;
|
||||
|
||||
private final int mMsgId;
|
||||
|
||||
@@ -272,4 +272,12 @@ public abstract class OperationResults {
|
||||
};
|
||||
}
|
||||
|
||||
public static class ConsolidateResult extends OperationResultParcel {
|
||||
|
||||
public ConsolidateResult(int result, OperationLog log) {
|
||||
super(result, log);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user