diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2016-02-22 15:21:40 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2016-02-22 15:21:40 +0100 |
commit | 0784a0b4301b9bd15a80d135bdece19f44bc4258 (patch) | |
tree | a4a3a5af9e8df27556fccb8259f7a75c627a2696 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java | |
parent | c9018e1844293eb2c47f642c5940531a3496dce5 (diff) | |
parent | f54f12c48c71d728f5a0cff7a750b34a345da5cf (diff) | |
download | open-keychain-0784a0b4301b9bd15a80d135bdece19f44bc4258.tar.gz open-keychain-0784a0b4301b9bd15a80d135bdece19f44bc4258.tar.bz2 open-keychain-0784a0b4301b9bd15a80d135bdece19f44bc4258.zip |
Merge pull request #1722 from open-keychain/api-seperation
Better seperation of remote activities
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java index 772dfe070..78d82d436 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java @@ -35,7 +35,6 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey; import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing; import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.ProviderHelper; -import org.sufficientlysecure.keychain.remote.CryptoInputParcelCacheService; import org.sufficientlysecure.keychain.service.PassphraseCacheService; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; import org.sufficientlysecure.keychain.service.input.RequiredInputParcel; @@ -61,9 +60,6 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenNfcActivity public static final String EXTRA_REQUIRED_INPUT = "required_input"; public static final String EXTRA_CRYPTO_INPUT = "crypto_input"; - // passthrough for OpenPgpService - public static final String EXTRA_SERVICE_INTENT = "data"; - public static final String RESULT_CRYPTO_INPUT = "result_data"; public ViewAnimator vAnimator; @@ -72,7 +68,6 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenNfcActivity public NfcGuideView nfcGuideView; private RequiredInputParcel mRequiredInput; - private Intent mServiceIntent; private static final byte[] BLANK_FINGERPRINT = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -136,7 +131,6 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenNfcActivity Bundle data = intent.getExtras(); mRequiredInput = data.getParcelable(EXTRA_REQUIRED_INPUT); - mServiceIntent = data.getParcelable(EXTRA_SERVICE_INTENT); obtainPassphraseIfRequired(); } @@ -273,18 +267,8 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenNfcActivity } @Override - protected void onNfcPostExecute() { - if (mServiceIntent != null) { - // if we're triggered by OpenPgpService - // save updated cryptoInputParcel in cache - CryptoInputParcelCacheService.addCryptoInputParcel(this, mServiceIntent, mInputParcel); - setResult(RESULT_OK, mServiceIntent); - } else { - Intent result = new Intent(); - // send back the CryptoInputParcel we received - result.putExtra(RESULT_CRYPTO_INPUT, mInputParcel); - setResult(RESULT_OK, result); - } + protected final void onNfcPostExecute() { + handleResult(mInputParcel); // show finish vAnimator.setDisplayedChild(2); @@ -315,6 +299,17 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenNfcActivity }.execute(); } + /** + * Defines how the result of this activity is returned. + * Is overwritten in RemoteSecurityTokenOperationActivity + */ + protected void handleResult(CryptoInputParcel inputParcel) { + Intent result = new Intent(); + // send back the CryptoInputParcel we received + result.putExtra(RESULT_CRYPTO_INPUT, inputParcel); + setResult(RESULT_OK, result); + } + @Override protected void onNfcError(String error) { pauseTagHandling(); |