Revert "Remove non-encrypted backuping"
This reverts commit 5b87b64855.
This commit is contained in:
@@ -18,6 +18,20 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.operations;
|
||||
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
@@ -49,17 +63,6 @@ import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.util.InputData;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* An operation class which implements high level backup
|
||||
@@ -73,7 +76,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
*/
|
||||
public class BackupOperation extends BaseOperation<BackupKeyringParcel> {
|
||||
|
||||
private static final String[] PROJECTION = new String[]{
|
||||
private static final String[] PROJECTION = new String[] {
|
||||
KeyRings.MASTER_KEY_ID,
|
||||
KeyRings.PUBKEY_DATA,
|
||||
KeyRings.PRIVKEY_DATA,
|
||||
@@ -112,10 +115,18 @@ public class BackupOperation extends BaseOperation<BackupKeyringParcel> {
|
||||
|
||||
try {
|
||||
|
||||
boolean nonEncryptedOutput = cryptoInput == null;
|
||||
|
||||
Uri plainUri = null;
|
||||
OutputStream plainOut;
|
||||
plainUri = TemporaryFileProvider.createFile(mContext);
|
||||
plainOut = mContext.getContentResolver().openOutputStream(plainUri);
|
||||
if (nonEncryptedOutput && backupInput.mOutputUri == null) {
|
||||
plainOut = outputStream;
|
||||
} else if (nonEncryptedOutput) {
|
||||
plainOut = mContext.getContentResolver().openOutputStream(backupInput.mOutputUri);
|
||||
} else {
|
||||
plainUri = TemporaryFileProvider.createFile(mContext);
|
||||
plainOut = mContext.getContentResolver().openOutputStream(plainUri);
|
||||
}
|
||||
|
||||
int exportedDataSize;
|
||||
|
||||
@@ -131,6 +142,12 @@ public class BackupOperation extends BaseOperation<BackupKeyringParcel> {
|
||||
// if there was an error, it will be in the log so we just have to return
|
||||
return new ExportResult(ExportResult.RESULT_ERROR, log);
|
||||
}
|
||||
|
||||
if (nonEncryptedOutput) {
|
||||
// log.add(LogType.MSG_EXPORT_NO_ENCRYPT, 1);
|
||||
log.add(LogType.MSG_BACKUP_SUCCESS, 1);
|
||||
return new ExportResult(ExportResult.RESULT_OK, log);
|
||||
}
|
||||
}
|
||||
|
||||
PgpSignEncryptOperation pseOp = new PgpSignEncryptOperation(mContext, mProviderHelper, mProgressable, mCancelled);
|
||||
|
||||
Reference in New Issue
Block a user