aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2015-08-24 02:37:26 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2015-08-24 02:37:26 +0200
commit1144ebb94cad7de9bee336206b3685641f70af16 (patch)
tree1a54cbc133bec36a21a19d5ba3932766bf01039a /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
parentdb5040a061bdf86122f4dfb9cfdac9258be1731d (diff)
downloadopen-keychain-1144ebb94cad7de9bee336206b3685641f70af16.tar.gz
open-keychain-1144ebb94cad7de9bee336206b3685641f70af16.tar.bz2
open-keychain-1144ebb94cad7de9bee336206b3685641f70af16.zip
API: Fix get sign key, related to OpenPgpKeyPreference bugs
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java42
1 files changed, 27 insertions, 15 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
index ea016c657..9e6681341 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
@@ -715,28 +715,40 @@ public class OpenPgpService extends RemoteService {
}
private Intent getSignKeyIdImpl(Intent data) {
- String preferredUserId = data.getStringExtra(OpenPgpApi.EXTRA_USER_ID);
+ // if data already contains EXTRA_SIGN_KEY_ID, it has been executed again
+ // after user interaction. Then, we just need to return the long again!
+ if (data.hasExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID)) {
+ long signKeyId = data.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID,
+ Constants.key.none);
- Intent intent = new Intent(getBaseContext(), SelectSignKeyIdActivity.class);
- String currentPkg = getCurrentCallingPackage();
- intent.setData(KeychainContract.ApiApps.buildByPackageNameUri(currentPkg));
- intent.putExtra(SelectSignKeyIdActivity.EXTRA_USER_ID, preferredUserId);
- intent.putExtra(SelectSignKeyIdActivity.EXTRA_DATA, data);
+ Intent result = new Intent();
+ result.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, signKeyId);
+ result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS);
+ return result;
+ } else {
+ String preferredUserId = data.getStringExtra(OpenPgpApi.EXTRA_USER_ID);
- PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0,
- intent,
- PendingIntent.FLAG_CANCEL_CURRENT);
+ Intent intent = new Intent(getBaseContext(), SelectSignKeyIdActivity.class);
+ String currentPkg = getCurrentCallingPackage();
+ intent.setData(KeychainContract.ApiApps.buildByPackageNameUri(currentPkg));
+ intent.putExtra(SelectSignKeyIdActivity.EXTRA_USER_ID, preferredUserId);
+ intent.putExtra(SelectSignKeyIdActivity.EXTRA_DATA, data);
- // return PendingIntent to be executed by client
- Intent result = new Intent();
- result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED);
- result.putExtra(OpenPgpApi.RESULT_INTENT, pi);
+ PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0,
+ intent,
+ PendingIntent.FLAG_CANCEL_CURRENT);
+
+ // return PendingIntent to be executed by client
+ Intent result = new Intent();
+ result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED);
+ result.putExtra(OpenPgpApi.RESULT_INTENT, pi);
- return result;
+ return result;
+ }
}
private Intent getKeyIdsImpl(Intent data) {
- // if data already contains key ids extra GET_KEY_IDS has been executed again
+ // if data already contains EXTRA_KEY_IDS, it has been executed again
// after user interaction. Then, we just need to return the array again!
if (data.hasExtra(OpenPgpApi.EXTRA_KEY_IDS)) {
long[] keyIdsArray = data.getLongArrayExtra(OpenPgpApi.EXTRA_KEY_IDS);