From c4311e2f52e5870ccfd67d34fa7c364ecd160753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 4 Aug 2014 14:44:11 +0200 Subject: [PATCH] Remove support for IO_FILE, this is no longer used and was never a good practice, use IO_URI on Android! --- .../service/KeychainIntentService.java | 31 ++----------------- 1 file changed, 2 insertions(+), 29 deletions(-) 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 b45359a10..601f45fed 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -110,9 +110,8 @@ public class KeychainIntentService extends IntentService public static final String SOURCE = "source"; // possible targets: public static final int IO_BYTES = 1; - public static final int IO_FILE = 2; // This was misleadingly TARGET_URI before! - public static final int IO_URI = 3; - public static final int IO_URIS = 4; + public static final int IO_URI = 2; + public static final int IO_URIS = 3; public static final String SELECTED_URI = "selected_uri"; @@ -716,16 +715,6 @@ public class KeychainIntentService extends IntentService byte[] bytes = data.getByteArray(bytesName); return new InputData(new ByteArrayInputStream(bytes), bytes.length); - case IO_FILE: /* encrypting file */ - String inputFile = data.getString(ENCRYPT_INPUT_FILE); - - // check if storage is ready - if (!FileHelper.isStorageMounted(inputFile)) { - throw new PgpGeneralException(getString(R.string.error_external_storage_not_ready)); - } - - return new InputData(new FileInputStream(inputFile), new File(inputFile).length()); - case IO_URI: /* encrypting content uri */ Uri providerUri = data.getParcelable(ENCRYPT_INPUT_URI); @@ -749,18 +738,6 @@ public class KeychainIntentService extends IntentService case IO_BYTES: return new ByteArrayOutputStream(); - case IO_FILE: - String outputFile = data.getString(ENCRYPT_OUTPUT_FILE); - - // check if storage is ready - if (!FileHelper.isStorageMounted(outputFile)) { - throw new PgpGeneralException( - getString(R.string.error_external_storage_not_ready)); - } - - // OutputStream - return new FileOutputStream(outputFile); - case IO_URI: Uri providerUri = data.getParcelable(ENCRYPT_OUTPUT_URI); @@ -790,10 +767,6 @@ public class KeychainIntentService extends IntentService case IO_BYTES: byte output[] = ((ByteArrayOutputStream) outStream).toByteArray(); resultData.putByteArray(bytesName, output); - break; - case IO_FILE: - // nothing, file was written, just send okay and verification bundle - break; case IO_URI: case IO_URIS: