From 03d103af0722540c0f636c139fac33d3ffb28a34 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sun, 14 Sep 2014 00:55:50 +0200 Subject: [PATCH] pending results are a type of non-success --- .../org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java | 1 + .../keychain/service/KeychainIntentService.java | 4 ++-- .../keychain/service/results/DecryptVerifyResult.java | 5 +++-- .../keychain/service/results/SignEncryptResult.java | 6 +++--- .../sufficientlysecure/keychain/ui/DecryptFileFragment.java | 4 ++-- .../keychain/ui/DecryptMessageFragment.java | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java index 9f97ac4c9..a81fa1a5a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java @@ -1,6 +1,7 @@ /* * Copyright (C) 2012-2014 Dominik Schürmann * Copyright (C) 2010-2014 Thialfihar + * Copyright (C) 2014 Vincent Breitmoser * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index e09c71787..f012d9a79 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -364,7 +364,7 @@ public class KeychainIntentService extends IntentService implements Progressable outStream.close(); - resultData.putParcelable(RESULT_DECRYPT_VERIFY_RESULT, decryptVerifyResult); + resultData.putParcelable(DecryptVerifyResult.EXTRA_RESULT, decryptVerifyResult); /* Output */ @@ -411,7 +411,7 @@ public class KeychainIntentService extends IntentService implements Progressable DecryptVerifyResult decryptVerifyResult = builder.build().execute(); - resultData.putParcelable(RESULT_DECRYPT_VERIFY_RESULT, decryptVerifyResult); + resultData.putParcelable(DecryptVerifyResult.EXTRA_RESULT, decryptVerifyResult); /* Output */ OtherHelper.logDebugBundle(resultData, "resultData"); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/DecryptVerifyResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/DecryptVerifyResult.java index e7ac209bf..7339f1306 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/DecryptVerifyResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/DecryptVerifyResult.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 Dominik Schürmann + * Copyright (C) 2014 Vincent Breitmoser * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,8 +25,8 @@ import org.openintents.openpgp.OpenPgpSignatureResult; public class DecryptVerifyResult extends OperationResultParcel { - // the fourth bit indicates a "data pending" result! - public static final int RESULT_PENDING = 8; + // the fourth bit indicates a "data pending" result! (it's also a form of non-success) + public static final int RESULT_PENDING = RESULT_ERROR +8; // fifth to sixth bit in addition indicate specific type of pending public static final int RESULT_PENDING_ASYM_PASSPHRASE = RESULT_PENDING +16; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/SignEncryptResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/SignEncryptResult.java index 073eab354..100a7c675 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/SignEncryptResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/SignEncryptResult.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Dominik Schürmann + * Copyright (C) 2014 Vincent Breitmoser * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,8 +26,8 @@ import java.util.Date; public class SignEncryptResult extends OperationResultParcel { - // the fourth bit indicates a "data pending" result! - public static final int RESULT_PENDING = 8; + // the fourth bit indicates a "data pending" result! (it's also a form of non-success) + public static final int RESULT_PENDING = RESULT_ERROR +8; // fifth to sixth bit in addition indicate specific type of pending public static final int RESULT_PENDING_NFC = RESULT_PENDING +16; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFileFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFileFragment.java index 7d9b2b9b3..924c5bec2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFileFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFileFragment.java @@ -179,7 +179,7 @@ public class DecryptFileFragment extends DecryptFragment { Bundle returnData = message.getData(); DecryptVerifyResult result = - returnData.getParcelable(KeychainIntentService.RESULT_DECRYPT_VERIFY_RESULT); + returnData.getParcelable(DecryptVerifyResult.EXTRA_RESULT); switch (result.getResult()) { case DecryptVerifyResult.RESULT_PENDING_ASYM_PASSPHRASE: @@ -259,7 +259,7 @@ public class DecryptFileFragment extends DecryptFragment { Bundle returnData = message.getData(); DecryptVerifyResult result = - returnData.getParcelable(KeychainIntentService.RESULT_DECRYPT_VERIFY_RESULT); + returnData.getParcelable(DecryptVerifyResult.EXTRA_RESULT); if (result.isPending()) { switch (result.getResult()) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptMessageFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptMessageFragment.java index a7a630be1..66ed563d9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptMessageFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptMessageFragment.java @@ -144,7 +144,7 @@ public class DecryptMessageFragment extends DecryptFragment { Bundle returnData = message.getData(); DecryptVerifyResult result = - returnData.getParcelable(KeychainIntentService.RESULT_DECRYPT_VERIFY_RESULT); + returnData.getParcelable(DecryptVerifyResult.EXTRA_RESULT); if (result.isPending()) { switch (result.getResult()) {