add SignEncryptResult parcel (probably break stuff)

This commit is contained in:
Vincent Breitmoser
2014-09-14 00:33:19 +02:00
parent 6156600e42
commit f0e159a372
7 changed files with 319 additions and 232 deletions

View File

@@ -63,6 +63,7 @@ import org.sufficientlysecure.keychain.service.results.ConsolidateResult;
import org.sufficientlysecure.keychain.service.results.EditKeyResult;
import org.sufficientlysecure.keychain.service.results.ImportKeyResult;
import org.sufficientlysecure.keychain.service.results.SaveKeyringResult;
import org.sufficientlysecure.keychain.service.results.SignEncryptResult;
import org.sufficientlysecure.keychain.util.ParcelableFileCache;
import org.sufficientlysecure.keychain.util.InputData;
import org.sufficientlysecure.keychain.util.Log;
@@ -91,7 +92,7 @@ public class KeychainIntentService extends IntentService implements Progressable
public static final String EXTRA_DATA = "data";
/* possible actions */
public static final String ACTION_ENCRYPT_SIGN = Constants.INTENT_PREFIX + "ENCRYPT_SIGN";
public static final String ACTION_SIGN_ENCRYPT = Constants.INTENT_PREFIX + "SIGN_ENCRYPT";
public static final String ACTION_DECRYPT_VERIFY = Constants.INTENT_PREFIX + "DECRYPT_VERIFY";
@@ -247,7 +248,7 @@ public class KeychainIntentService extends IntentService implements Progressable
String action = intent.getAction();
// executeServiceMethod action from extra bundle
if (ACTION_ENCRYPT_SIGN.equals(action)) {
if (ACTION_SIGN_ENCRYPT.equals(action)) {
try {
/* Input */
int source = data.get(SOURCE) != null ? data.getInt(SOURCE) : data.getInt(TARGET);
@@ -309,7 +310,8 @@ public class KeychainIntentService extends IntentService implements Progressable
builder.setCleartextInput(true);
}
builder.build().execute();
SignEncryptResult result = builder.build().execute();
resultData.putParcelable(SignEncryptResult.EXTRA_RESULT, result);
outStream.close();
@@ -779,12 +781,6 @@ public class KeychainIntentService extends IntentService implements Progressable
if (e instanceof PgpGeneralMsgIdException) {
e = ((PgpGeneralMsgIdException) e).getContextualized(this);
message = e.getMessage();
} else if (e instanceof PgpSignEncrypt.KeyExtractionException) {
message = getString(R.string.error_could_not_extract_private_key);
} else if (e instanceof PgpSignEncrypt.NoPassphraseException) {
message = getString(R.string.error_no_signature_passphrase);
} else if (e instanceof PgpSignEncrypt.NoSigningKeyException) {
message = getString(R.string.error_no_signature_key);
} else {
message = e.getMessage();
}

View File

@@ -474,6 +474,30 @@ public class OperationResultParcel implements Parcelable {
MSG_DC_TRAIL_UNKNOWN (R.string.msg_dc_trail_unknown),
MSG_DC_UNLOCKING (R.string.msg_dc_unlocking),
// signencrypt
MSG_SE_ASYMMETRIC (R.string.msg_se_asymmetric),
MSG_SE_CLEARSIGN_ONLY (R.string.msg_se_clearsign_only),
MSG_SE_COMPRESSING (R.string.msg_se_compressing),
MSG_SE_ENCRYPTING (R.string.msg_se_encrypting),
MSG_SE_ERROR_BAD_PASSPHRASE (R.string.msg_se_error_bad_passphrase),
MSG_SE_ERROR_IO (R.string.msg_se_error_io),
MSG_SE_ERROR_SIGN_KEY(R.string.msg_se_error_sign_key),
MSG_SE_ERROR_KEY_SIGN (R.string.msg_se_error_key_sign),
MSG_SE_ERROR_NFC (R.string.msg_se_error_nfc),
MSG_SE_ERROR_NO_PASSPHRASE (R.string.msg_se_error_no_passphrase),
MSG_SE_ERROR_PGP (R.string.msg_se_error_pgp),
MSG_SE_ERROR_SIG (R.string.msg_se_error_sig),
MSG_SE_ERROR_UNLOCK (R.string.msg_se_error_unlock),
MSG_SE_KEY_OK (R.string.msg_se_key_ok),
MSG_SE_KEY_UNKNOWN (R.string.msg_se_key_unknown),
MSG_SE_KEY_WARN (R.string.msg_se_key_warn),
MSG_SE_OK (R.string.msg_se_ok),
MSG_SE_PENDING_NFC (R.string.msg_se_pending_nfc),
MSG_SE (R.string.msg_se),
MSG_SE_SIGNING (R.string.msg_se_signing),
MSG_SE_SIGCRYPTING (R.string.msg_se_sigcrypting),
MSG_SE_SYMMETRIC (R.string.msg_se_symmetric),
;
private final int mMsgId;
@@ -562,6 +586,13 @@ public class OperationResultParcel implements Parcelable {
return mParcels.isEmpty();
}
public LogEntryParcel getLast() {
if (mParcels.isEmpty()) {
return null;
}
return mParcels.get(mParcels.size() -1);
}
@Override
public Iterator<LogEntryParcel> iterator() {
return mParcels.iterator();