diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java index 89ccd89d9..ab6ec40f3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java @@ -641,21 +641,28 @@ public class ImportExportOperation extends BaseOperation { public ImportKeyResult execute(ImportKeyringParcel input, CryptoInputParcel cryptoInput) { Proxy proxy = null; - if (cryptoInput.getParcelableProxy() == null) { - // if a proxy is not specified, we retrieve from preferences - Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(mContext).getProxyPrefs(); + if (!isOfflineImport(input)) { + if (cryptoInput.getParcelableProxy() == null) { + // if a proxy is not specified, we retrieve from preferences + Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(mContext).getProxyPrefs(); - if (proxyPrefs.torEnabled && !OrbotHelper.isOrbotInstalledAndRunning(mContext)) { - // is it okay to pass null for log? - return new ImportKeyResult(null, RequiredInputParcel.createRequiredOrbotEnable()); + if (proxyPrefs.torEnabled && !OrbotHelper.isOrbotInstalledAndRunning(mContext)) { + // is it okay to pass null for log? + return new ImportKeyResult(null, RequiredInputParcel.createRequiredOrbotEnable()); + } + } else { + proxy = cryptoInput.getParcelableProxy().getProxy(); } - } else { - proxy = cryptoInput.getParcelableProxy().getProxy(); } return importKeys(input.mKeyList, input.mKeyserver, proxy); } + // TODO: Verify if this is sufficient to determine offline import + private boolean isOfflineImport(ImportKeyringParcel importParcel) { + return importParcel.mKeyList == null; + } + public ImportKeyResult importKeys(ArrayList keyList, String keyServer, Proxy proxy) { ImportKeyResult result = null;