aboutsummaryrefslogtreecommitdiffstats
path: root/org_apg/src/org/thialfihar/android/apg/service
diff options
context:
space:
mode:
authorDominik <dominik@dominikschuermann.de>2012-06-18 19:29:23 +0300
committerDominik <dominik@dominikschuermann.de>2012-06-18 19:29:23 +0300
commite4489bc78d7540042fd9626eb0d03231e2bd9d0b (patch)
treede538c6923d9a025a4f83c67f1c6266fb70922c7 /org_apg/src/org/thialfihar/android/apg/service
parentcbfbb9430049fa1e888802aa1c771074e6570a5d (diff)
downloadopen-keychain-e4489bc78d7540042fd9626eb0d03231e2bd9d0b.tar.gz
open-keychain-e4489bc78d7540042fd9626eb0d03231e2bd9d0b.tar.bz2
open-keychain-e4489bc78d7540042fd9626eb0d03231e2bd9d0b.zip
file dialog reworked, file encryption should work again
Diffstat (limited to 'org_apg/src/org/thialfihar/android/apg/service')
-rw-r--r--org_apg/src/org/thialfihar/android/apg/service/ApgService.java35
1 files changed, 15 insertions, 20 deletions
diff --git a/org_apg/src/org/thialfihar/android/apg/service/ApgService.java b/org_apg/src/org/thialfihar/android/apg/service/ApgService.java
index 65b7432f7..f1ac46256 100644
--- a/org_apg/src/org/thialfihar/android/apg/service/ApgService.java
+++ b/org_apg/src/org/thialfihar/android/apg/service/ApgService.java
@@ -92,8 +92,8 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
public static final String GENERATE_SIGNATURE = "generate_signature";
public static final String SIGN_ONLY = "sign_only";
public static final String BYTES = "bytes";
- public static final String FILE_URI = "file_uri";
- public static final String OUTPUT_FILENAME = "output_filename";
+ public static final String INPUT_FILE = "input_file";
+ public static final String OUTPUT_FILE = "output_file";
public static final String PROVIDER_URI = "provider_uri";
// possible ints for EXTRA_ACTION
@@ -303,8 +303,8 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
long secretKeyId = data.getLong(SECRET_KEY_ID);
String passphrase = data.getString(PASSPHRASE);
- Uri fileUri = Uri.parse(data.getString(FILE_URI));
- String outputFilename = data.getString(OUTPUT_FILENAME);
+ String inputFile = data.getString(INPUT_FILE);
+ String outputFile = data.getString(OUTPUT_FILE);
boolean useAsciiArmour = data.getBoolean(USE_ASCII_AMOR);
long encryptionKeyIds[] = data.getLongArray(ENCRYPTION_KEYS_IDS);
@@ -316,26 +316,22 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
// InputStream
long inLength = -1;
FileInputStream inStream = null;
- if (fileUri.getScheme().equals("file")) {
- // get the rest after "file://"
- String path = Uri.decode(fileUri.toString().substring(7));
- if (path.startsWith(Environment.getExternalStorageDirectory().getAbsolutePath())) {
- if (!Environment.getExternalStorageState()
- .equals(Environment.MEDIA_MOUNTED)) {
- sendErrorToHandler(new GeneralException(
- getString(R.string.error_externalStorageNotReady)));
- return;
- }
+ if (inputFile.startsWith(Environment.getExternalStorageDirectory()
+ .getAbsolutePath())) {
+ if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+ sendErrorToHandler(new GeneralException(
+ getString(R.string.error_externalStorageNotReady)));
+ return;
}
- inStream = new FileInputStream(path);
- File file = new File(path);
- inLength = file.length();
}
+ inStream = new FileInputStream(inputFile);
+ File file = new File(inputFile);
+ inLength = file.length();
InputData inputData = new InputData(inStream, inLength);
// OutputStream
- if (outputFilename.startsWith(Environment.getExternalStorageDirectory()
+ if (outputFile.startsWith(Environment.getExternalStorageDirectory()
.getAbsolutePath())) {
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
sendErrorToHandler(new GeneralException(
@@ -343,7 +339,7 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
return;
}
}
- FileOutputStream outStream = new FileOutputStream(outputFilename);
+ FileOutputStream outStream = new FileOutputStream(outputFile);
// Operation
if (generateSignature) {
@@ -410,7 +406,6 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
FileOutputStream outStream = openFileOutput(streamFilename, Context.MODE_PRIVATE);
// Operation
-
if (generateSignature) {
Apg.generateSignature(this, inputData, outStream, useAsciiArmour, true,
secretKeyId, Apg.getCachedPassPhrase(secretKeyId), Preferences