From 4ed5514691f8cb6d7323f9d57378ffafe7c7b3cf Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sun, 25 Oct 2015 18:21:34 +0100 Subject: linked: fix crash on <= lollipop --- .../sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java index 5cf0e6e08..5566c725b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java @@ -24,6 +24,7 @@ import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Build; +import android.os.Build.VERSION_CODES; import android.support.v4.content.CursorLoader; import android.util.Log; import android.view.LayoutInflater; @@ -228,9 +229,11 @@ public class LinkedIdsAdapter extends UserAttributesAdapter { } public void seekAttention() { - ObjectAnimator anim = SubtleAttentionSeeker.tintText(vComment, 1000); - anim.setStartDelay(200); - anim.start(); + if (Build.VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { + ObjectAnimator anim = SubtleAttentionSeeker.tintText(vComment, 1000); + anim.setStartDelay(200); + anim.start(); + } } } -- cgit v1.2.3 From cae76455d4543e8a073e01eb31b8e4bedab96503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sun, 25 Oct 2015 22:53:43 +0100 Subject: https everywhere --- Graphics/twitter_header.png | Bin 0 -> 166262 bytes OpenKeychain/src/main/res/raw/help_about.md | 8 ++++---- README.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 Graphics/twitter_header.png diff --git a/Graphics/twitter_header.png b/Graphics/twitter_header.png new file mode 100644 index 000000000..498a3c093 Binary files /dev/null and b/Graphics/twitter_header.png differ diff --git a/OpenKeychain/src/main/res/raw/help_about.md b/OpenKeychain/src/main/res/raw/help_about.md index 45d326daa..c5e8ebccf 100644 --- a/OpenKeychain/src/main/res/raw/help_about.md +++ b/OpenKeychain/src/main/res/raw/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) is an OpenPGP implementation for Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. License: GPLv3+ @@ -61,11 +61,11 @@ License: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT License) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 License) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/README.md b/README.md index e06366571..3144b4b77 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # OpenKeychain (for Android) OpenKeychain is an OpenPGP implementation for Android. -For a more detailed description and installation instructions go to http://www.openkeychain.org . +For a more detailed description and installation instructions go to https://www.openkeychain.org . ### Branches * The development of OpenKeychain happens in the "master" branch. -- cgit v1.2.3 From 6a04866ae61e6b5cb383e45bdbe29a649e60013f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 26 Oct 2015 12:29:05 +0100 Subject: Commit Github tokens --- OpenKeychain/build.gradle | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 73bad1dd8..3312df784 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -161,18 +161,9 @@ android { resValue "string", "account_type", "org.sufficientlysecure.keychain.account" resValue "string", "provider_content_authority", "org.sufficientlysecure.keychain.provider" - // Github API ID and secret are read from gradle.properties (not in git!) - // must use double escaping in gradle.properties! For example: - // githubClientId="\\"7a011b66275f244d3f21\\"" - // githubClientSecret="\\"eaced8a6655719d8c6848396de97b3f5d7a89fec\\"" - if (project.hasProperty('githubClientId') && - project.hasProperty('githubClientSecret')) { - - println "Found github oauth properties" - - buildConfigField "String", "GITHUB_CLIENT_ID", githubClientId - buildConfigField "String", "GITHUB_CLIENT_SECRET", githubClientSecret - } + // Github API + buildConfigField "String", "GITHUB_CLIENT_ID", "\"c942cd81844d94e7e41b\"" + buildConfigField "String", "GITHUB_CLIENT_SECRET", "\"f1dd17e70a0614abbd9310b00a310e23c6c8edff\"" } debug { @@ -186,9 +177,9 @@ android { resValue "string", "account_type", "org.sufficientlysecure.keychain.debug.account" resValue "string", "provider_content_authority", "org.sufficientlysecure.keychain.debug.provider" - // Github API for debug build only - buildConfigField "String", "GITHUB_CLIENT_ID", "\"7a011b66275f244d3f21\"" - buildConfigField "String", "GITHUB_CLIENT_SECRET", "\"eaced8a6655719d8c6848396de97b3f5d7a89fec\"" + // Github API + buildConfigField "String", "GITHUB_CLIENT_ID", "\"c942cd81844d94e7e41b\"" + buildConfigField "String", "GITHUB_CLIENT_SECRET", "\"f1dd17e70a0614abbd9310b00a310e23c6c8edff\"" // Enable code coverage (Jacoco) testCoverageEnabled true -- cgit v1.2.3 From cab52c401301596cf0ad2646e8172912a5623366 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Mon, 26 Oct 2015 12:52:39 +0100 Subject: fix FileHelper class for pre-lollipop devices --- .../keychain/util/FileHelper.java | 47 ++----------- .../keychain/util/FileHelperLollipop.java | 82 ++++++++++++++++++++++ 2 files changed, 86 insertions(+), 43 deletions(-) create mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelperLollipop.java diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java index 236913be7..c4d84a2d4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java @@ -272,57 +272,18 @@ public class FileHelper { return true; } - /** - * Tests whether a file is readable by others - */ - @TargetApi(VERSION_CODES.LOLLIPOP) - public static boolean S_IROTH(int mode) { - return (mode & S_IROTH) == S_IROTH; - } - /** * A replacement for ContentResolver.openInputStream() that does not allow the usage of * "file" Uris that point to private files owned by the application only. * - * This is not allowed: - * am start -a android.intent.action.SEND -t text/plain -n - * "org.sufficientlysecure.keychain.debug/org.sufficientlysecure.keychain.ui.EncryptFilesActivity" --eu - * android.intent.extra.STREAM - * file:///data/data/org.sufficientlysecure.keychain.debug/databases/openkeychain.db - * - * @throws FileNotFoundException + * @see FileHelperLollipop */ - @TargetApi(VERSION_CODES.LOLLIPOP) public static InputStream openInputStreamSafe(ContentResolver resolver, Uri uri) - throws FileNotFoundException { + throws FileNotFoundException { // Not supported on Android < 5 - if (Build.VERSION.SDK_INT < VERSION_CODES.LOLLIPOP) { - return resolver.openInputStream(uri); - } - - String scheme = uri.getScheme(); - if (ContentResolver.SCHEME_FILE.equals(scheme)) { - ParcelFileDescriptor pfd = ParcelFileDescriptor.open( - new File(uri.getPath()), ParcelFileDescriptor.parseMode("r")); - - try { - final StructStat st = Os.fstat(pfd.getFileDescriptor()); - if (!S_IROTH(st.st_mode)) { - Log.e(Constants.TAG, "File is not readable by others, aborting!"); - throw new FileNotFoundException("Unable to create stream"); - } - } catch (ErrnoException e) { - Log.e(Constants.TAG, "fstat() failed: " + e); - throw new FileNotFoundException("fstat() failed"); - } - - AssetFileDescriptor fd = new AssetFileDescriptor(pfd, 0, -1); - try { - return fd.createInputStream(); - } catch (IOException e) { - throw new FileNotFoundException("Unable to create stream"); - } + if (Build.VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { + return FileHelperLollipop.openInputStreamSafe(resolver, uri); } else { return resolver.openInputStream(uri); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelperLollipop.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelperLollipop.java new file mode 100644 index 000000000..f89d679bc --- /dev/null +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelperLollipop.java @@ -0,0 +1,82 @@ +package org.sufficientlysecure.keychain.util; + + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; + +import android.annotation.TargetApi; +import android.content.ContentResolver; +import android.content.res.AssetFileDescriptor; +import android.net.Uri; +import android.os.Build; +import android.os.Build.VERSION_CODES; +import android.os.ParcelFileDescriptor; +import android.system.ErrnoException; +import android.system.Os; +import android.system.StructStat; + +import org.sufficientlysecure.keychain.Constants; + +import static android.system.OsConstants.S_IROTH; + + +/** FileHelper methods which use Lollipop-exclusive API. + * Some of the methods and static fields used here cause VerifyErrors because + * they do not exist in pre-lollipop API, so they must be kept in a + * lollipop-only class. All methods here should only be called by FileHelper, + * and consequently have package visibility. + */ +@TargetApi(VERSION_CODES.LOLLIPOP) +class FileHelperLollipop { + /** + * Tests whether a file is readable by others + */ + private static boolean S_IROTH(int mode) { + return (mode & S_IROTH) == S_IROTH; + } + + /** + * A replacement for ContentResolver.openInputStream() that does not allow the usage of + * "file" Uris that point to private files owned by the application only. + * + * This is not allowed: + * am start -a android.intent.action.SEND -t text/plain -n + * "org.sufficientlysecure.keychain.debug/org.sufficientlysecure.keychain.ui.EncryptFilesActivity" --eu + * android.intent.extra.STREAM + * file:///data/data/org.sufficientlysecure.keychain.debug/databases/openkeychain.db + * + * @throws FileNotFoundException + */ + static InputStream openInputStreamSafe(ContentResolver resolver, Uri uri) + throws FileNotFoundException { + + String scheme = uri.getScheme(); + if (ContentResolver.SCHEME_FILE.equals(scheme)) { + ParcelFileDescriptor pfd = ParcelFileDescriptor.open( + new File(uri.getPath()), ParcelFileDescriptor.parseMode("r")); + + try { + final StructStat st = Os.fstat(pfd.getFileDescriptor()); + if (!S_IROTH(st.st_mode)) { + Log.e(Constants.TAG, "File is not readable by others, aborting!"); + throw new FileNotFoundException("Unable to create stream"); + } + } catch (ErrnoException e) { + Log.e(Constants.TAG, "fstat() failed: " + e); + throw new FileNotFoundException("fstat() failed"); + } + + AssetFileDescriptor fd = new AssetFileDescriptor(pfd, 0, -1); + try { + return fd.createInputStream(); + } catch (IOException e) { + throw new FileNotFoundException("Unable to create stream"); + } + } else { + return resolver.openInputStream(uri); + } + + } +} -- cgit v1.2.3 From 10407d34de7a0aa466470dd402ee10be6249d800 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Mon, 26 Oct 2015 14:40:40 +0100 Subject: decrypt: restart operation if interrupted by fragment recreation --- .../keychain/ui/DecryptListFragment.java | 27 ++++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java index 22ef52f6d..0abe833c6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java @@ -40,6 +40,7 @@ import android.os.AsyncTask; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.Parcelable; +import android.support.annotation.NonNull; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; @@ -97,7 +98,6 @@ public class DecryptListFragment public static final String ARG_CAN_DELETE = "can_delete"; private static final int REQUEST_CODE_OUTPUT = 0x00007007; - public static final String ARG_CURRENT_URI = "current_uri"; private ArrayList mInputUris; private HashMap mInputDataResults; @@ -113,7 +113,7 @@ public class DecryptListFragment /** * Creates new instance of this fragment */ - public static DecryptListFragment newInstance(ArrayList uris, boolean canDelete) { + public static DecryptListFragment newInstance(@NonNull ArrayList uris, boolean canDelete) { DecryptListFragment frag = new DecryptListFragment(); Bundle args = new Bundle(); @@ -170,9 +170,12 @@ public class DecryptListFragment outState.putParcelable(ARG_RESULTS, new ParcelableHashMap<>(results)); outState.putParcelable(ARG_OUTPUT_URIS, new ParcelableHashMap<>(mInputDataResults)); outState.putParcelableArrayList(ARG_CANCELLED_URIS, mCancelledInputUris); - outState.putParcelable(ARG_CURRENT_URI, mCurrentInputUri); outState.putBoolean(ARG_CAN_DELETE, mCanDelete); + // this does not save mCurrentInputUri - if anything is being + // processed at fragment recreation time, the operation in + // progress will be lost! + } @Override @@ -184,20 +187,19 @@ public class DecryptListFragment ArrayList inputUris = getArguments().getParcelableArrayList(ARG_INPUT_URIS); ArrayList cancelledUris = args.getParcelableArrayList(ARG_CANCELLED_URIS); ParcelableHashMap results = args.getParcelable(ARG_RESULTS); - Uri currentInputUri = args.getParcelable(ARG_CURRENT_URI); mCanDelete = args.getBoolean(ARG_CAN_DELETE, false); - displayInputUris(inputUris, currentInputUri, cancelledUris, + displayInputUris(inputUris, cancelledUris, results != null ? results.getMap() : null ); } - private void displayInputUris(ArrayList inputUris, Uri currentInputUri, - ArrayList cancelledUris, HashMap results) { + private void displayInputUris(ArrayList inputUris, ArrayList cancelledUris, + HashMap results) { mInputUris = inputUris; - mCurrentInputUri = currentInputUri; + mCurrentInputUri = null; mInputDataResults = results != null ? results : new HashMap(inputUris.size()); mCancelledInputUris = cancelledUris != null ? cancelledUris : new ArrayList(); @@ -206,10 +208,6 @@ public class DecryptListFragment for (final Uri uri : inputUris) { mAdapter.add(uri); - if (uri.equals(mCurrentInputUri)) { - continue; - } - if (mCancelledInputUris.contains(uri)) { mAdapter.setCancelled(uri, new OnClickListener() { @Override @@ -227,9 +225,8 @@ public class DecryptListFragment } } - if (mCurrentInputUri == null) { - cryptoOperation(); - } + // check if there are any pending input uris + cryptoOperation(); } @Override -- cgit v1.2.3 From c55ca09a0658e3602a1f349f2d1b58a54c7f95b4 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Mon, 26 Oct 2015 15:28:53 +0100 Subject: import: move uri resolution into AsyncTask, prevent NetworkOnMainThreadException --- .../keychain/ui/ImportKeysListFragment.java | 42 ++++-------------- .../keychain/ui/adapter/ImportKeysListLoader.java | 51 +++++++++++++++------- 2 files changed, 44 insertions(+), 49 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java index 864283b0a..7aed3176c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java @@ -17,6 +17,11 @@ package org.sufficientlysecure.keychain.ui; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + import android.app.Activity; import android.net.Uri; import android.os.Bundle; @@ -40,22 +45,12 @@ import org.sufficientlysecure.keychain.ui.adapter.AsyncTaskResultWrapper; import org.sufficientlysecure.keychain.ui.adapter.ImportKeysAdapter; import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListCloudLoader; import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListLoader; -import org.sufficientlysecure.keychain.util.FileHelper; -import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.ParcelableFileCache.IteratorWithSize; import org.sufficientlysecure.keychain.util.ParcelableProxy; import org.sufficientlysecure.keychain.util.Preferences; import org.sufficientlysecure.keychain.util.orbot.OrbotHelper; -import java.io.ByteArrayInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - public class ImportKeysListFragment extends ListFragment implements LoaderManager.LoaderCallbacks>> { @@ -180,8 +175,8 @@ public class ImportKeysListFragment extends ListFragment implements } static public class BytesLoaderState extends LoaderState { - byte[] mKeyBytes; - Uri mDataUri; + public byte[] mKeyBytes; + public Uri mDataUri; BytesLoaderState(byte[] keyBytes, Uri dataUri) { mKeyBytes = keyBytes; @@ -305,9 +300,7 @@ public class ImportKeysListFragment extends ListFragment implements onCreateLoader(int id, Bundle args) { switch (id) { case LOADER_ID_BYTES: { - BytesLoaderState ls = (BytesLoaderState) mLoaderState; - InputData inputData = getInputData(ls.mKeyBytes, ls.mDataUri); - return new ImportKeysListLoader(mActivity, inputData); + return new ImportKeysListLoader(mActivity, (BytesLoaderState) mLoaderState); } case LOADER_ID_CLOUD: { CloudLoaderState ls = (CloudLoaderState) mLoaderState; @@ -432,23 +425,4 @@ public class ImportKeysListFragment extends ListFragment implements } } - private InputData getInputData(byte[] importBytes, Uri dataUri) { - InputData inputData = null; - if (importBytes != null) { - inputData = new InputData(new ByteArrayInputStream(importBytes), importBytes.length); - } else if (dataUri != null) { - try { - InputStream inputStream = getActivity().getContentResolver().openInputStream(dataUri); - long length = FileHelper.getFileSize(getActivity(), dataUri, -1); - - inputData = new InputData(inputStream, length); - } catch (FileNotFoundException e) { - Log.e(Constants.TAG, "FileNotFoundException!", e); - return null; - } - } - - return inputData; - } - } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java index 139512ba9..038ebd5dd 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java @@ -17,6 +17,14 @@ package org.sufficientlysecure.keychain.ui.adapter; + +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; + import android.content.Context; import android.support.v4.content.AsyncTaskLoader; import android.support.v4.util.LongSparseArray; @@ -28,28 +36,26 @@ import org.sufficientlysecure.keychain.operations.results.GetKeyResult; import org.sufficientlysecure.keychain.operations.results.OperationResult; import org.sufficientlysecure.keychain.pgp.UncachedKeyRing; import org.sufficientlysecure.keychain.pgp.UncachedKeyRing.IteratorWithIOThrow; +import org.sufficientlysecure.keychain.ui.ImportKeysListFragment.BytesLoaderState; +import org.sufficientlysecure.keychain.util.FileHelper; import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.PositionAwareInputStream; -import java.io.BufferedInputStream; -import java.io.IOException; -import java.util.ArrayList; - public class ImportKeysListLoader extends AsyncTaskLoader>> { final Context mContext; - final InputData mInputData; + final BytesLoaderState mLoaderState; ArrayList mData = new ArrayList<>(); LongSparseArray mParcelableRings = new LongSparseArray<>(); AsyncTaskResultWrapper> mEntryListWrapper; - public ImportKeysListLoader(Context context, InputData inputData) { + public ImportKeysListLoader(Context context, BytesLoaderState inputData) { super(context); this.mContext = context; - this.mInputData = inputData; + this.mLoaderState = inputData; } @Override @@ -62,12 +68,13 @@ public class ImportKeysListLoader GetKeyResult getKeyResult = new GetKeyResult(GetKeyResult.RESULT_OK, null); mEntryListWrapper = new AsyncTaskResultWrapper<>(mData, getKeyResult); - if (mInputData == null) { + if (mLoaderState == null) { Log.e(Constants.TAG, "Input data is null!"); return mEntryListWrapper; } - generateListOfKeyrings(mInputData); + InputData inputData = getInputData(getContext(), mLoaderState); + generateListOfKeyrings(inputData); return mEntryListWrapper; } @@ -99,12 +106,7 @@ public class ImportKeysListLoader return mParcelableRings; } - /** - * Reads all PGPKeyRing objects from input - * - * @param inputData - * @return - */ + /** Reads all PGPKeyRing objects from the bytes of an InputData object. */ private void generateListOfKeyrings(InputData inputData) { PositionAwareInputStream progressIn = new PositionAwareInputStream( inputData.getInputStream()); @@ -132,4 +134,23 @@ public class ImportKeysListLoader } } + private static InputData getInputData(Context context, BytesLoaderState loaderState) { + InputData inputData = null; + if (loaderState.mKeyBytes != null) { + inputData = new InputData(new ByteArrayInputStream(loaderState.mKeyBytes), loaderState.mKeyBytes.length); + } else if (loaderState.mDataUri != null) { + try { + InputStream inputStream = context.getContentResolver().openInputStream(loaderState.mDataUri); + long length = FileHelper.getFileSize(context, loaderState.mDataUri, -1); + + inputData = new InputData(inputStream, length); + } catch (FileNotFoundException e) { + Log.e(Constants.TAG, "FileNotFoundException!", e); + return null; + } + } + + return inputData; + } + } -- cgit v1.2.3 From 65c402fbe0399609f43d250d3221d70542fcf4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 26 Oct 2015 19:09:30 +0100 Subject: Pull from transifex --- OpenKeychain/src/main/res/raw-cs/help_about.md | 8 +- OpenKeychain/src/main/res/raw-de/help_about.md | 8 +- OpenKeychain/src/main/res/raw-es/help_about.md | 8 +- OpenKeychain/src/main/res/raw-eu/help_about.md | 8 +- OpenKeychain/src/main/res/raw-fa/help_about.md | 8 +- OpenKeychain/src/main/res/raw-fi/help_about.md | 8 +- OpenKeychain/src/main/res/raw-fr/help_about.md | 8 +- OpenKeychain/src/main/res/raw-it/help_about.md | 8 +- OpenKeychain/src/main/res/raw-ja/help_about.md | 8 +- OpenKeychain/src/main/res/raw-ja/help_changelog.md | 16 +-- OpenKeychain/src/main/res/raw-nl/help_about.md | 8 +- OpenKeychain/src/main/res/raw-pl/help_about.md | 8 +- OpenKeychain/src/main/res/raw-ru/help_about.md | 8 +- OpenKeychain/src/main/res/raw-sl/help_about.md | 8 +- OpenKeychain/src/main/res/raw-sr/help_about.md | 8 +- OpenKeychain/src/main/res/raw-sv/help_about.md | 8 +- OpenKeychain/src/main/res/raw-tr/help_about.md | 8 +- OpenKeychain/src/main/res/raw-uk/help_about.md | 8 +- OpenKeychain/src/main/res/raw-zh-rTW/help_about.md | 8 +- OpenKeychain/src/main/res/raw-zh/help_about.md | 8 +- OpenKeychain/src/main/res/values-cs/strings.xml | 1 - OpenKeychain/src/main/res/values-de/strings.xml | 5 - OpenKeychain/src/main/res/values-es/strings.xml | 5 - OpenKeychain/src/main/res/values-eu/strings.xml | 5 - OpenKeychain/src/main/res/values-fr/strings.xml | 5 - OpenKeychain/src/main/res/values-it/strings.xml | 2 - OpenKeychain/src/main/res/values-ja/strings.xml | 131 ++++++++++++++++++++- OpenKeychain/src/main/res/values-nl/strings.xml | 5 - OpenKeychain/src/main/res/values-ru/strings.xml | 36 ++++++ OpenKeychain/src/main/res/values-sl/strings.xml | 1 - OpenKeychain/src/main/res/values-sr/strings.xml | 5 - OpenKeychain/src/main/res/values-sv/strings.xml | 1 - .../src/main/res/values-zh-rTW/strings.xml | 5 - 33 files changed, 248 insertions(+), 127 deletions(-) diff --git a/OpenKeychain/src/main/res/raw-cs/help_about.md b/OpenKeychain/src/main/res/raw-cs/help_about.md index 06bed0021..3538e68cc 100644 --- a/OpenKeychain/src/main/res/raw-cs/help_about.md +++ b/OpenKeychain/src/main/res/raw-cs/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) is an OpenPGP implementation for Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. License: GPLv3+ @@ -61,11 +61,11 @@ License: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT License) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 License) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/OpenKeychain/src/main/res/raw-de/help_about.md b/OpenKeychain/src/main/res/raw-de/help_about.md index 3d5bedbfa..64af3c07f 100644 --- a/OpenKeychain/src/main/res/raw-de/help_about.md +++ b/OpenKeychain/src/main/res/raw-de/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) ist eine OpenPGP-Implementierung für Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. Lizenz: GPLv3+ @@ -61,11 +61,11 @@ Lizenz: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache-Lizenz v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache-Lizenz v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache-Lizenz v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache-Lizenz v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache-Lizenz v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT-Lizenz) * [Snackbar](https://github.com/nispok/snackbar) (MIT-Lizenz) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11-Lizenz) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache-Lizenz v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache-Lizenz v2) * [ZXing](https://github.com/zxing/zxing) (Apache-Lizenz v2) diff --git a/OpenKeychain/src/main/res/raw-es/help_about.md b/OpenKeychain/src/main/res/raw-es/help_about.md index 194adfd3a..27dc7a59a 100644 --- a/OpenKeychain/src/main/res/raw-es/help_about.md +++ b/OpenKeychain/src/main/res/raw-es/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTA: ¡Ponga cada frase en su propia línea, Transifex pone cada línea en su propio campo de traducción!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) es una implementación de OpenPGP para Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. Licencia: GPLv3+ @@ -61,11 +61,11 @@ Licencia: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Licencia Apache v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Licencia Apache v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Licencia Apache v2) - * [OkHttp](http://square.github.io/okhttp/) (Licencia Apache v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Licencia Apache v2) * [Librería SafeSlinger Exchange](https://github.com/SafeSlingerProject/exchange-android) (Licencia MIT) * [Snackbar](https://github.com/nispok/snackbar) (Licencia MIT) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (Licencia MIT X11) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Licencia Apache v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Licencia Apache v2) * [ZXing](https://github.com/zxing/zxing) (Licencia Apache v2) diff --git a/OpenKeychain/src/main/res/raw-eu/help_about.md b/OpenKeychain/src/main/res/raw-eu/help_about.md index 74890c2d7..f5c54b18c 100644 --- a/OpenKeychain/src/main/res/raw-eu/help_about.md +++ b/OpenKeychain/src/main/res/raw-eu/help_about.md @@ -1,8 +1,8 @@ [//]: # (OHARRA: Meseez jarri esaldi bakoitza bere lerroan, Transifex-ek lerroak bere itzulpen eremuan jartzen ditu!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) Android-rako OpenPGP egokitzapen bat da. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. Baimena: GPLv3+ @@ -61,11 +61,11 @@ Baimena: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache Baimena v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache Baimena v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache Baimena v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache Baimena v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Diseinua) (Apache Baimena 2 bertsioa) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT Baimena) * [Snackbar](https://github.com/nispok/snackbar) (MIT Baimena) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 Baimena) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache Baimena v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache Baimena v2) * [ZXing](https://github.com/zxing/zxing) (Apache Baimena v2) diff --git a/OpenKeychain/src/main/res/raw-fa/help_about.md b/OpenKeychain/src/main/res/raw-fa/help_about.md index daecd5cbf..c1f4df2f2 100644 --- a/OpenKeychain/src/main/res/raw-fa/help_about.md +++ b/OpenKeychain/src/main/res/raw-fa/help_about.md @@ -1,8 +1,8 @@ [//]: # (تذکر: هر جمله در همان خط!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) یک نسخه از OpenPGP برای اندروید است. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. مجوز: GPLv3+ @@ -61,11 +61,11 @@ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT License) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 License) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/OpenKeychain/src/main/res/raw-fi/help_about.md b/OpenKeychain/src/main/res/raw-fi/help_about.md index 06bed0021..3538e68cc 100644 --- a/OpenKeychain/src/main/res/raw-fi/help_about.md +++ b/OpenKeychain/src/main/res/raw-fi/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) is an OpenPGP implementation for Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. License: GPLv3+ @@ -61,11 +61,11 @@ License: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT License) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 License) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/OpenKeychain/src/main/res/raw-fr/help_about.md b/OpenKeychain/src/main/res/raw-fr/help_about.md index 5994ae4df..ec9a107ba 100644 --- a/OpenKeychain/src/main/res/raw-fr/help_about.md +++ b/OpenKeychain/src/main/res/raw-fr/help_about.md @@ -1,8 +1,8 @@ [//] : # (NOTE : veuillez mettre chaque phrase dans sa propre ligne. Transifex met chaque ligne dans son propre champ de traduction !) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) est une mise en œuvre d'OpenPGP pour Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. Licence : GPLv3+ @@ -61,11 +61,11 @@ Licence : GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Licence Apache v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Licence Apache v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Licence Apache v2) - * [OkHttp](http://square.github.io/okhttp/) (licence Apache v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Conception matérielle) (Licence Apache v2) * [Bibliothèque d'échange SafeSlinger](https://github.com/SafeSlingerProject/exchange-android) (Licence MIT) * [Snackbar](https://github.com/nispok/snackbar) (Licence MIT) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (Licence MIT X11) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Licence Apache v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Licence Apache v2) * [ZXing](https://github.com/zxing/zxing) (Licence Apache v2) diff --git a/OpenKeychain/src/main/res/raw-it/help_about.md b/OpenKeychain/src/main/res/raw-it/help_about.md index f1802ddb1..62a7a2687 100644 --- a/OpenKeychain/src/main/res/raw-it/help_about.md +++ b/OpenKeychain/src/main/res/raw-it/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTA: Si prega di mettere ogni frase in una propria linea, Transifex mette ogni riga nel proprio campo di traduzione!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) e un impelementazione OpenPGP per Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. Licenza: GPLv3+ @@ -61,11 +61,11 @@ Licenza: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Design materiale) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT License) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 License) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/OpenKeychain/src/main/res/raw-ja/help_about.md b/OpenKeychain/src/main/res/raw-ja/help_about.md index 17e3e17e3..5748aa299 100644 --- a/OpenKeychain/src/main/res/raw-ja/help_about.md +++ b/OpenKeychain/src/main/res/raw-ja/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) は Android における OpenPGP 実装です。 +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. ライセンス: GPLv3以降 @@ -61,11 +61,11 @@ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT License) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 License) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/OpenKeychain/src/main/res/raw-ja/help_changelog.md b/OpenKeychain/src/main/res/raw-ja/help_changelog.md index 933100227..69efc6715 100644 --- a/OpenKeychain/src/main/res/raw-ja/help_changelog.md +++ b/OpenKeychain/src/main/res/raw-ja/help_changelog.md @@ -2,14 +2,14 @@ ## 3.6 - * Encrypted backups - * Security fixes based on external security audit - * YubiKey NEO key creation wizard - * Basic internal MIME support - * Automatic key synchronization - * Experimental feature: link keys to Github, Twitter accounts - * Experimental feature: key confirmation via phrases - * Experimental feature: dark theme + * 暗号化したバックアップ + * 外部セキュリティ監査によるセキュリティ修正 + * YubiKey NEO 鍵生成ウィザード + * 基本的な内部 MIME のサポート + * 自動鍵同期 + * 試験的機能: Github, Twitter アカウントと鍵のリンク + * 試験的機能: 語句による鍵検証 + * 試験的機能: ダークテーマ * API: Version 9 ## 3.5 diff --git a/OpenKeychain/src/main/res/raw-nl/help_about.md b/OpenKeychain/src/main/res/raw-nl/help_about.md index 5c0bc3327..2c88bed8f 100644 --- a/OpenKeychain/src/main/res/raw-nl/help_about.md +++ b/OpenKeychain/src/main/res/raw-nl/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) is een OpenPGP implementatie voor Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. Licentie: GPLv3+ @@ -61,11 +61,11 @@ Licentie: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache licentie v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache licentie v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache licentie v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache licentie v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache licentie v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT licentie) * [Snackbar](https://github.com/nispok/snackbar) (MIT licentie) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 licentie) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache licentie v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache licentie v2) * [ZXing](https://github.com/zxing/zxing) (Apache licentie v2) diff --git a/OpenKeychain/src/main/res/raw-pl/help_about.md b/OpenKeychain/src/main/res/raw-pl/help_about.md index 7262dfefd..28e0b04c5 100644 --- a/OpenKeychain/src/main/res/raw-pl/help_about.md +++ b/OpenKeychain/src/main/res/raw-pl/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) jest implementacją OpenPGP dla Androida. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. Licencja: GPLv3+ @@ -61,11 +61,11 @@ Licencja: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT License) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 License) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/OpenKeychain/src/main/res/raw-ru/help_about.md b/OpenKeychain/src/main/res/raw-ru/help_about.md index ddb17fc09..6e7e3e832 100644 --- a/OpenKeychain/src/main/res/raw-ru/help_about.md +++ b/OpenKeychain/src/main/res/raw-ru/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) это OpenPGP имплементация для ОС Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. Лицензия: GPLv3+ @@ -61,11 +61,11 @@ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT License) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 License) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/OpenKeychain/src/main/res/raw-sl/help_about.md b/OpenKeychain/src/main/res/raw-sl/help_about.md index 3fe72beef..eae093b37 100644 --- a/OpenKeychain/src/main/res/raw-sl/help_about.md +++ b/OpenKeychain/src/main/res/raw-sl/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) je implementacija OpenPGP za Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. Licenca: GPLv3+ @@ -61,11 +61,11 @@ Licenca: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Licenca Apache v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Licenca Apache v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (Licenca MIT) * [Snackbar](https://github.com/nispok/snackbar) (Licenca MIT) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (Licenca MIT X11) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Licenca Apache v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Licenca Apache v2) * [ZXing](https://github.com/zxing/zxing) (Licenca Apache v2) diff --git a/OpenKeychain/src/main/res/raw-sr/help_about.md b/OpenKeychain/src/main/res/raw-sr/help_about.md index 5bfbbc6ff..d88344739 100644 --- a/OpenKeychain/src/main/res/raw-sr/help_about.md +++ b/OpenKeychain/src/main/res/raw-sr/help_about.md @@ -1,8 +1,8 @@ [//]: # -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[Отворени кључарник (OpenKeychain)](http://www.openkeychain.org) је ОпенПГП имплементација за Андроид. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. Лиценца: ГПЛв3+ @@ -61,11 +61,11 @@ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Апачи лиценца в2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Апачи лиценца в2) * [MiniDNS](https://github.com/rtreffer/minidns) (Апачи лиценца в2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Материјал дизајн) (Апачи лиценца в2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (МИТ лиценца) * [Snackbar](https://github.com/nispok/snackbar) (МИТ лиценца) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (МИТ Икс11 лиценца) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Апачи лиценца в2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Апачи лиценца в2) * [ZXing](https://github.com/zxing/zxing) (Апачи лиценца в2) diff --git a/OpenKeychain/src/main/res/raw-sv/help_about.md b/OpenKeychain/src/main/res/raw-sv/help_about.md index 0fd4713bb..22aae17a1 100644 --- a/OpenKeychain/src/main/res/raw-sv/help_about.md +++ b/OpenKeychain/src/main/res/raw-sv/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTERING: Var vänlig och sätt varje mening på sin egen rad, Transifex sätter varje rad i sitt eget fält för översättningar!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) är en OpenPGP-implementation till Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. Licens: GPLv3+ @@ -61,11 +61,11 @@ Licens: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger's bibliotek för utbyte](https://github.com/SafeSlingerProject/exchange-android) (MIT-licens) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11-licens) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/OpenKeychain/src/main/res/raw-tr/help_about.md b/OpenKeychain/src/main/res/raw-tr/help_about.md index 06bed0021..3538e68cc 100644 --- a/OpenKeychain/src/main/res/raw-tr/help_about.md +++ b/OpenKeychain/src/main/res/raw-tr/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) is an OpenPGP implementation for Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. License: GPLv3+ @@ -61,11 +61,11 @@ License: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT License) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 License) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/OpenKeychain/src/main/res/raw-uk/help_about.md b/OpenKeychain/src/main/res/raw-uk/help_about.md index 06bed0021..3538e68cc 100644 --- a/OpenKeychain/src/main/res/raw-uk/help_about.md +++ b/OpenKeychain/src/main/res/raw-uk/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) is an OpenPGP implementation for Android. +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. License: GPLv3+ @@ -61,11 +61,11 @@ License: GPLv3+ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT License) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 License) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/OpenKeychain/src/main/res/raw-zh-rTW/help_about.md b/OpenKeychain/src/main/res/raw-zh-rTW/help_about.md index ed32e0d5d..527539f12 100644 --- a/OpenKeychain/src/main/res/raw-zh-rTW/help_about.md +++ b/OpenKeychain/src/main/res/raw-zh-rTW/help_about.md @@ -1,8 +1,8 @@ [//]: # (NOTE: Please put every sentence in its own line, Transifex puts every line in its own translation field!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org)是一個Android的OpenPGP應用。 +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. 授權:GPLv3+ @@ -61,11 +61,11 @@ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache License v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache License v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache License v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache License v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT License) * [Snackbar](https://github.com/nispok/snackbar) (MIT License) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 License) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache License v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache License v2) * [ZXing](https://github.com/zxing/zxing) (Apache License v2) diff --git a/OpenKeychain/src/main/res/raw-zh/help_about.md b/OpenKeychain/src/main/res/raw-zh/help_about.md index d8bc20016..1600f19ce 100644 --- a/OpenKeychain/src/main/res/raw-zh/help_about.md +++ b/OpenKeychain/src/main/res/raw-zh/help_about.md @@ -1,8 +1,8 @@ [//]: # (注意: 请把每个句子放在其本行中, Transifex把每一行放在它自己的位置!) -[http://www.openkeychain.org](http://www.openkeychain.org) +[https://www.openkeychain.org](https://www.openkeychain.org) -[OpenKeychain](http://www.openkeychain.org) 是安卓上的一个 OpenPGP 协议实现。 +[OpenKeychain](https://www.openkeychain.org) is an OpenPGP implementation for Android. 许可协议:GPLv3+ @@ -61,11 +61,11 @@ * [Markdown4J](https://github.com/jdcasey/markdown4j) (Apache 许可证 v2) * [MaterialDrawer](https://github.com/mikepenz/MaterialDrawer) (Apache 许可证 v2) * [MiniDNS](https://github.com/rtreffer/minidns) (Apache 许可证 v2) - * [OkHttp](http://square.github.io/okhttp/) (Apache License v2) + * [OkHttp](https://square.github.io/okhttp/) (Apache License v2) * [PagerSlidingTabStrip](https://github.com/jpardogo/PagerSlidingTabStrip) (Material Design) (Apache 许可证 v2) * [SafeSlinger Exchange library](https://github.com/SafeSlingerProject/exchange-android) (MIT 许可证) * [Snackbar](https://github.com/nispok/snackbar) (MIT 许可证) - * [SpongyCastle](http://rtyley.github.com/spongycastle/) (MIT X11 许可证) + * [SpongyCastle](https://rtyley.github.io/spongycastle/) (MIT X11 License) * [StickyListHeaders](https://github.com/emilsjolander/StickyListHeaders) (Apache 许可证 v2) * [TokenAutoComplete](https://github.com/splitwise/TokenAutoComplete) (Apache 许可证 v2) * [ZXing](https://github.com/zxing/zxing) (Apache 许可证 v2) diff --git a/OpenKeychain/src/main/res/values-cs/strings.xml b/OpenKeychain/src/main/res/values-cs/strings.xml index 04cfacd7c..ed9879ffb 100644 --- a/OpenKeychain/src/main/res/values-cs/strings.xml +++ b/OpenKeychain/src/main/res/values-cs/strings.xml @@ -404,7 +404,6 @@ Vyhledat Keybase.io nabízí “důkazy” které tvrdí, že vlastníkem tohoto klíče je: - Poznámka: Keybase.io důkazy jsou experimentální fíčura OpenKeychainu. Doporučujeme vám navíc potvrdit je pomocí naskenování QR kódu nebo si vyměnit klíče pomocí NFC. Příspěvek tweet diff --git a/OpenKeychain/src/main/res/values-de/strings.xml b/OpenKeychain/src/main/res/values-de/strings.xml index 9b4f06127..42c7cb790 100644 --- a/OpenKeychain/src/main/res/values-de/strings.xml +++ b/OpenKeychain/src/main/res/values-de/strings.xml @@ -189,20 +189,16 @@ HTTP SOCKS - Tor wird nicht verwendet Orbot installieren, um Tor zu nutzen? Installieren Du musst Orbot installiert und aktiviert haben, um Netzwerverkehr hindurchleiten zu können. Möchtest du es installieren? Abbrechen - Tor nicht verwendet Orbot starten? - Orbot scheint nicht zu laufen. Möchtest du es starten und mit Tor verbinden? Orbot starten Orbot starten Abbrechen - Tor nicht verwendet ]]> ]]> @@ -593,7 +589,6 @@ Es gibt keinen Nachweis aus dem Internet zur Vertrauenswürdigkeit dieses Schlüssels. Suche beginnen Keybase.io bietet \"Nachweise\" die bestätigen, dass der Schlüsselinhaber: - Hinweis: Keybase.io-Nachweise sind ein experimentelles Feature von OpenKeychain. Wir rufen dazu auf, zusätzlich zur Bestätigung, QR-Codes zu nutzen oder Schlüssel via NFC auszutauschen. Auf Twitter schreibt, als %s Auf GitHub bekannt ist, als %s diff --git a/OpenKeychain/src/main/res/values-es/strings.xml b/OpenKeychain/src/main/res/values-es/strings.xml index 5a2611507..706c0d226 100644 --- a/OpenKeychain/src/main/res/values-es/strings.xml +++ b/OpenKeychain/src/main/res/values-es/strings.xml @@ -189,20 +189,16 @@ HTTP SOCKS - No usar Tor ¿Instalar Orbot para usar Tor? Instalar Tiene que tener Orbot instalado y activado para proxyficar el tráfico a través de él. ¿Desea instalarlo? Cancelar - No usar Tor ¿Iniciar Orbot? - Orbot no parece estar corriendo. ¿Desea iniciarlo y conectar a Tor? Iniciar Orbot Iniciar Orbot Cancelar - No usar Tor ]]> ]]> @@ -593,7 +589,6 @@ No hay comprobante desde Internet de la confiabilidad de esta clave. Iniciar búsqueda Keybase.io ofrece \"comprobantes\" que sostienen que el propietario de esta clave: - Nota: Los comprobantes de Keybase.io son una característica experimental de OpenKeychain. Le animamos a que escanee los códigos QR o intercambie claves vía NFC además de confirmarlas. Publica en Twitter como %s Es conocido en GitHub como %s diff --git a/OpenKeychain/src/main/res/values-eu/strings.xml b/OpenKeychain/src/main/res/values-eu/strings.xml index 8378dfcad..b81f7364f 100644 --- a/OpenKeychain/src/main/res/values-eu/strings.xml +++ b/OpenKeychain/src/main/res/values-eu/strings.xml @@ -186,20 +186,16 @@ HTTP SOCKS - Ez erabili Tor Ezarri Orbot edo erabili Tor? Ezarri Orbot ezarrita eta proxy trafiko igaropena gaituta eduki behar duzu. Nahi duzu ezartzea? Ezeztatu - Ez erabili Tor Abiarazi Orbot? - Ez dirudi Orbot ekinean dagoenik. Nahi duzu abiaraztea eta Tor-era elkartzea? Abiarazi Orbot Abiarazi Orbot Ezeztatu - Ez erabili Tor ]]> ]]> @@ -587,7 +583,6 @@ Hasi bilaketa Keybase.io \"probak\" eskaintzen ditu giltza honen jabea baieztatzeko: - Oharra: Keybase.io egiaztapenak OpenKeychain-en ezaugarri esperimental bat da. QR kodeak eskaneatzea edo giltzak NFC bidez aldatzea gomendatzen dizugu hauek baieztatu ahal izateko. Argitaratu Twitter-en honela %s GitHub-en %s bezala ezagutzen da diff --git a/OpenKeychain/src/main/res/values-fr/strings.xml b/OpenKeychain/src/main/res/values-fr/strings.xml index dc29b3212..489774276 100644 --- a/OpenKeychain/src/main/res/values-fr/strings.xml +++ b/OpenKeychain/src/main/res/values-fr/strings.xml @@ -189,20 +189,16 @@ HTTP SOCKS - Ne pas utiliser Tor Installer Orbot pour utiliser Tor ? Installer Orbot doit être installé et doit relayer le trafic. Voulez-vous l\'installer maintenant ? Annuler - Ne pas utiliser Tor Démarrer Orbot ? - Orbot ne semble pas tourner. Voulez-vous le démarrer et vous connecter à Tor ? Démarrer Orbot Démarrer Orbot Annuler - Ne pas utiliser Tor ]]> ]]> @@ -593,7 +589,6 @@ Aucune preuve en provenance de l\'Internet sur la fiabilité de cette clef. Lancer la recherche Keybase.io offre des « preuves » affirmant que le propriétaire de cette clef : - Note : les preuves de keybase.io sont une fonction expérimentales d\'OpenKeychain. Nous vous encourageons à lire des codes QR ou à échanger des clefs via NFC en plus de les confirmer. Publie sur Twitter en tant que %s Est connu sur GitHub en tant que %s diff --git a/OpenKeychain/src/main/res/values-it/strings.xml b/OpenKeychain/src/main/res/values-it/strings.xml index 4c5f48373..1b8d2729a 100644 --- a/OpenKeychain/src/main/res/values-it/strings.xml +++ b/OpenKeychain/src/main/res/values-it/strings.xml @@ -158,13 +158,11 @@ HTTP SOCKS - Non usare Tor Installa Orbot per usare Tor? Installa Orbot deve essere installato e attivato per fare attraversare il traffico dei dati tramite proxy. Vuoi installare Orbot? Annulla - Non usare Tor Attivare Orbot? Attivare Orbot diff --git a/OpenKeychain/src/main/res/values-ja/strings.xml b/OpenKeychain/src/main/res/values-ja/strings.xml index 2adf862e3..db7f8ee98 100644 --- a/OpenKeychain/src/main/res/values-ja/strings.xml +++ b/OpenKeychain/src/main/res/values-ja/strings.xml @@ -25,6 +25,7 @@ 鍵のバックアップ 鍵が見当りません 鍵サーバへアップロード + バックアップ鍵 鍵の確認 鍵の概要 ヘルプ @@ -56,6 +57,7 @@ 鍵サーバ 指紋 + 語句 暗号化 復号 / 検証 現在の期限 @@ -76,11 +78,14 @@ 戻る なし 指紋一致 + 語句の一致 暗号化/署名とテキストをシェア 暗号化/署名とテキストをコピー 検証した鍵を見る 鍵の生成 ファイルの追加 + 共有 + ...で開く 復号化したテキストのコピー クリップボードから読み取り 入力ファイルの選択 @@ -91,9 +96,11 @@ 追加 デフォルトとして保存 保存しました! + 一致せず 設定 ヘルプ + バックアップ鍵 鍵の削除 自分の鍵の管理 検索 @@ -105,6 +112,8 @@ 全部のキーをアップデートする 拡張情報 指紋による確認 + 語句による検証 + 共有ログ 追加 テキスト @@ -113,6 +122,7 @@ ファイル: パスワードなし パスワード + PIN アンロック... 再度パスワードを入力 パスワード表示 @@ -155,6 +165,9 @@ 圧縮を有効 暗号化するファイル名 受信者を隠す + テスト接続 + 安全な鍵サーバのみ + URL 鍵サーバの削除 テーマ OpenPGP鍵サーバ @@ -171,6 +184,8 @@ 鍵の自動アップデート 注意 これらの機能はまだ完成していないか、ユーザーエクスペリエンス/セキュリティ研究の結果ではありません。そのため、このセキュリティに依存したり、遭遇した問題を報告しないでください! + 語句検証 + 16進指紋の変りに語句で鍵を検証 リンクしたユーザID Twitter、GitHub、Webサイト、またはDNSに鍵をリンク (keybase.ioに似ていますが、分散型) Keybase.io 検証 @@ -195,10 +210,10 @@ インストール Orbotをインストールして、それを介したプロキシトラフィックを有効にする必要があります。インストールしますか? キャンセル - Torを使わない + Torを使わないあ Orbotを始めますか? - Orbot は動作しても表れません。スタートしてTorに接続しますか? + Orbot は動作していないようです。起動して Tor に接続しますか? Orbotを始める Orbotを始める キャンセル @@ -247,6 +262,8 @@ 互換性のないファイルマネージャがインストールされています。 パスワードが一致しません。 パスワードを入れてください。 + パスワードの入力 + バックアップコードの入力 \'%s\' にパスワードを入れてください \'%s\' にPINを入力してください \'%s\' の Yubikey にアクセスするためのPINを入力してください @@ -269,6 +286,7 @@ 鍵のフルバックアップが行われます。保存先のファイルを指定してください。\n警告: ファイルが存在する場合、上書きされます! あなたの鍵を含めて、すべての鍵のフルバックアップが行われます。保存先のファイルを指定してください。\n警告: ファイルが存在する場合、上書きされます! 選択したすべての鍵を本当に削除してよいですか? + 削除後はこの鍵で暗号化されたメッセージ/ファイルが読めなくなります、またその鍵で行われたすべての鍵確認を失います! 鍵 \'%s\' を削除しますか? 秘密鍵もエクスポートします あなたは既知のAndroidのバグに遭遇しました。もし鍵とあなたの連絡先をリンクさせたいならOpenKeychainを再インストールしてください。 @@ -388,6 +406,7 @@ 鍵の削除中... 統合: キャッシュへ保存… 統合: 再インポート中… + 接続の検証中... Orbotを始める... 名前、Email...で検索 @@ -584,7 +603,6 @@ この鍵の信頼性についてのインターネットでの検証がありません。 検索開始 Keybase.ioはこのキーのオーナーだと言う証拠を提供している: - 注意:Keybase.ioのオーナー証拠は実験的な機会です。キーを確認することに加えて、QRコードや、NFCでキーを交換するのもお勧めする。 Twitterへ以下のIDで投稿 %s Githubでは %s で知られています @@ -658,10 +676,14 @@ 追加のEメールアドレスがこの鍵に紐付きそしてセキュアな通信に使うことができます。 メールアドレスがすでに追加されている メールアドレスのフォーマットが無効です + 6桁の数字でPINを選んでください。 + 管理者PINを書き留めて、安全な場所に保管してください (PINを3回間違ったときに必要になります)。 PIN 管理者PIN 再度PINを入力 PINが正しくありません! + PINは最低数字6字長は必要です! + 000000、123456、のような似た組み合わせではない、安全なPINを選んでください。 破棄: 鍵はもう使われません! 期限切れ: この連絡先は鍵の妥当性を拡張する必要があります! @@ -673,8 +695,10 @@ 鍵サーバを追加 鍵サーバの編集 + 接続が検証されました! 鍵サーバを検証なしで追加した。 無効なURLです! + 信頼された鍵サーバではありません (ピンニング証明書は利用できません)! 鍵サーバへの接続に失敗しました。URLとインターネット接続をチェックしてください。 %s を削除 最後の鍵サーバは削除できません。少なくとも一つは必要です! @@ -685,6 +709,7 @@ ナビゲーションドロワーを開く ナビゲーションドロワーを閉める 自分の鍵 + バックアップ/リストア テキストを入力 @@ -710,6 +735,8 @@ データベースエラーにより操作が失敗しました 内部エラーにより操作が失敗しました 公開鍵の鍵輪 %s をインポート + インポートした鍵の鍵指紋が予期したものと一致しません! + 指紋チェックOK 鍵輪データのエンコード中 鍵の解析中 データベース操作の準備 @@ -865,6 +892,7 @@ ユーザID \'%s\' の正常な自己署名が見付かりませんでした、鍵輪から除去しました 無効なユーザID \'%s\' を破棄中 重複したユーザID \'%s\' を削除中。IDを二つもっています。この結果は署名を失っているためかもしれません! + ユーザーID \'%s\' を削除しています。100以上のユーザーIDがインポートされません! ユーザIDをUTF-8として検証できませんでした! JPEG型のユーザー属性の処理中 不明な型のユーザー属性の処理中 @@ -896,6 +924,7 @@ 鍵輪は最低でも1つのユーザIDの生成が必要です! 主鍵は検証フラグが必須です! 鍵の生成時に期限を\'過去\'とすることはできません。これはプログラムエラーで、バグレポートでファイルを送ってください! + 鍵サイズは2048かそれ以上が必須です! 鍵サイズが不明です! これはプログラムエラーで、バグレポートでファイルの提出をお願いします! 楕円暗号が不明です! これはプログラムエラーで、バグレポートでファイルの提出をお願いします! PGP内部エラー! @@ -1014,6 +1043,7 @@ 受け入れた鍵で暗号化されていないデータです、スキップします... 鍵 %s で非対称の暗号化されたデータのブロックを検出 文字セットヘッダを発見: \'%s\' + バックアップバージョンヘッダを発見: \'%s\' 固定データを処理中 圧縮データの展開中 ファイル名: %s @@ -1036,6 +1066,7 @@ 入力データストリームのオープンエラー! ストリーム中に暗号化されたデータが見付からなかった! ストリーム中に既知の秘密鍵で暗号化されたデータが見付からなかった! + 署名データを見失いました! 操作中にPGP例外に当たりました! 完全性チェックOK! メタデータだけが要求され、暗号化をスキップしました @@ -1051,12 +1082,16 @@ 追跡で遭遇、対称暗号化されたデータ 追跡で未知のタイプのデータに遭遇 秘密鍵のロック解除 + 安全でない暗号化鍵が使用されました! 鍵が古くなっているか、攻撃のために発生することがあります。 安全でない暗号化アルゴリズムが使用されています! アプリケーションが古くなっているか、攻撃のために発生することがあります。 安全でないハッシュアルゴリズムが使用されています! アプリケーションが古くなっているか、攻撃のために発生することがあります。 修正検出コード (MDC) パケットが欠落しています! 暗号化アプリケーションは古くなっているか、暗号強度低下攻撃がある場合に発生することがあります。 安全でない鍵: RSA/DSA/エルガマルのビット長が短すぎるか、ECC曲線/アルゴリズムが安全でないと考えられます! アプリケーションが古くなっているか、攻撃のために発生することがあります。 署名の確認開始 + 署名済み固定データに署名リストがありません! + メッセージが正しい鍵で署名されていません! + 署名データの検証中 署名済み固定データにペイロードがありません ファイル名: %s MIME種別: %s @@ -1127,6 +1162,8 @@ 鍵輪のデコードエラー 鍵の展開ができません! (ネットワークの問題?) + 鍵サーバから展開できません: %s + 鍵サーバから秘密鍵をインポートできません! keybase.ioから回収: %s 鍵サーバからの回収: %s 鍵の展開に成功 @@ -1137,6 +1174,20 @@ I/Oエラーによりインポート操作が失敗しました! インポート操作に成功、ただしエラーあり! インポート操作に成功! + + %d の鍵とバックアップ + + すべての鍵とバックアップ + 公開鍵 %s のバックアップを作成中 + 公開鍵 %s をアップロード中 + 秘密鍵 %s のバックアップを作成中 + URIオープン時にエラー! + データベースエラー! + 入出力エラー! + 鍵データの事前処理のエラー! + サーバに鍵をアップロード中にエラー! インターネット接続を確認してください + バックアップ操作に成功 + 鍵サーバへアップロードに成功 削除するものがありません! 秘密鍵は個別にしか削除できません! @@ -1175,6 +1226,28 @@ IOエラー! フォーマットエラー! リソースが見つかりません! + 入力データの処理中 + OpenPGPデータの処理を試みています + 分離署名に遭遇しました + 以前の、未署名のデータをクリアしました! + 分離署名の処理中 + 署名データの処理中 + ネストされた署名データをスキップしています! + 署名された部分の後、末尾のデータをスキップしています! + サポートしない種別の分離署名! + 入力データの読み込み時にエラー! + OpenPGPデータの処理中にエラー! + MIMEデータとして解析できません + ファイル名: \'%s\' + 拡張子からMIME種別を推測しています + コンテンツ長: %s + MIMEデータ構造の解析中 + \"解析完了 + MIME構造が見つかりません + MIME部分の処理中 + コンテンツ種別: %s + データの処理に成功 + MIME解析をスキップしています アカウント保存 ダウンロードに成功しました! ファイル/クリップボードにて正しい鍵が見付かりません! @@ -1195,6 +1268,9 @@ %s 復号化した検証ポストが指定した値と一致しない + MIME構造の解析中 + MIME解析に失敗 + MIME解析に成功! タッチしてパスワードをクリア。 @@ -1220,6 +1296,7 @@ すべての鍵とあなた所有の鍵 すべての鍵 バックアップ + リストア 検証者 証明の詳細 @@ -1229,6 +1306,8 @@ あなたの検証された自己証明とあなたの鍵で生成された証明がここに表示されます ユーザID インポートした鍵には\"アイデンティティ\": 名前とメールアドレス を含みます。正確に期待したものと一致しているか認定されているものを選択します。 + 鍵指紋を、文字対文字で、相手の端末に表示しているものと比較 + これらの語句を、相手の端末に表示しているものと比較 破棄の理由 種別 鍵が見当りません! @@ -1249,6 +1328,7 @@ クリップボードへの複数ファイルの暗号化はサポートされていません。 バイナリファイルの署名のみの操作はサポートされません、最低1つは暗号化鍵を選択してください。 テキストの入力を暗号化! + ログの準備中に内部エラー! 鍵: 鍵交換の開始は、右側の参加者の番号を選択し、その後、\"交換開始\"ボタンを推します。\n\n2つ以上の質問で交換にいる右の参加者とその指紋が正しいかを確認してください。 交換開始 @@ -1293,7 +1373,12 @@ YubiKeyがマッチ、鍵に紐付けることができる YubiKeyがマッチ、鍵に部分的に紐付いている あなたのデバイスの背面にYubiKeyを固定してください。 + このYubiKeyは既に鍵を含んでいます。クラウドを使用して鍵をインポートしたり、YubiKeyをリセットすることができます。 インポート + リセット + 鍵のインポート + YubiKeyをリセット + YubiKeyをリセットすると、その上のキーを完全に破壊します。その後は、この鍵で暗号化されたメッセージ/ファイルを復号化することができなくなります! 違う鍵がYubiKeyに格納されています! NFCエラー: %s @@ -1310,7 +1395,9 @@ YubiKeyがチェーン中の最後のコマンドを待っています。 YubiKeyが不正な%sバイトを報告。 YubiKeyを取り出すのが早すぎました。操作が完了するまでYubiKeyを戻してしてください。 + タグは ISO-DEP (ISO 14443-4) をサポートしていません 再実行 + PINが正しくありません! 一時ファイルの生成でエラーしました。 オリジナルのファイルを削除します ファイル名を暗号化した @@ -1322,9 +1409,13 @@ 鍵の読み込みエラー! (エラー、空のログ) 復号化のための入力が読めない! + データの読み込みに失敗しました。これはAndroidメールクライアントのバグです! (Issue #290) + 不完全なデータを受信しました。 K-9 メールで、\'完全なメッセージをダウンロード\' を押してみてください! 不明なファイル名 (クリックして開きます) テキスト(クリックして表示) + 鍵のバックアップ (クリックしてインポート) 署名/暗号化した内容を表示 + 署名/暗号化した内容を共有 OpenKeychainで閲覧 データの処理でエラー! 暗号化データ @@ -1370,6 +1461,7 @@ %d 以上の不明なユーザID種別があります + \'リンクしたユーザID\' は、あなたのPGP鍵をWeb上のリソースに接続します。 種別を選択してください: このファイルは、長いID %2$s のOpenPGP鍵の所有権を請求しています。\n\n検証のトークン:\n%1$s このGistは私のOpenPGP鍵でリンクされたIDを確認し、このGitHubアカウントにリンクします。\n\n検証のトークン:\n%1$s @@ -1388,6 +1480,7 @@ リンクしたユーザID 検証 リトライ + 最後のステップを再試行 確認 閲覧 検証中… @@ -1395,4 +1488,36 @@ 確認中… %d 以上の不明なユーザID種別 リンクしたユーザIDを作成 + この操作は、鍵をあなたのGitHubアカウントにリンクします。\nボタンを押すと続行します。 + GitHubで認証… + Gistを投稿… + 鍵のアップデート… + Githubアカウントへリンク + 認証に失敗! + 接続タイムアウト! + ネットワークエラー! + 通信エラー: %s + GitHub認証 + OpenKeychain API テスト + 上書 + バックアップは、バックアップコードで保護されます。先に進む前に、それを書き留めてください! + バックアップコードを入力してください: + コードを受け付けました! + はい、書き留めました! + 入力したバックアップコードが正しくありません!\n正しく書き留めましたか? + バックアップを共有 + バックアップを保存 + バックアップの保存中にエラー! + バックアップを保存しました + バックアップは既に存在します! + OpenKeychainディレクトリに保存しました + チェックに戻る + テキストが長すぎてすべて表示できません! + 長すぎたため、共有テキストをカットしました! + ログを共有しますか? + 開発者がOpenKeychainのバグを見つけるためにログは非常に参考になりますが、更新された鍵に関するデータなど、潜在的な機密情報が含まれることがあります。この情報を共有しても大丈夫であることを確認してください。 + 共有 + キャンセル + データ種別が正しくありません。テキストを期待しました! + 共有データにテキストはありません! diff --git a/OpenKeychain/src/main/res/values-nl/strings.xml b/OpenKeychain/src/main/res/values-nl/strings.xml index 5e5ab2a09..cf870718e 100644 --- a/OpenKeychain/src/main/res/values-nl/strings.xml +++ b/OpenKeychain/src/main/res/values-nl/strings.xml @@ -158,20 +158,16 @@ HTTP SOCKS - Gebruik Tor niet Orbot installeren om Tor te gebruiken? Installeren Orbot moet geïnstalleerd en ingesteld zijn om verkeer erdoor te proxyen. Wil je het installeren? Annuleren? - Gebruik Tor niet Orbot starten? - Orbot wordt niet uitgevoerd. Wil je het opstarten en verbinden met Tor? Orbot starten Orbot starten Annuleren - Gebruik Tor niet 1 sleutel %d sleutels @@ -513,7 +509,6 @@ Zoeken starten Keybase.io geeft “bewijzen” die stellen dat de eigenaar van deze sleutel: - Let op: Keybase.io-bewijzen zijn een experimentele functie van OpenKeychain. We moedigen je aan QR-codes te scannen of sleutels uit te wisselen via NFC bovenop het bevestigen ervan. Helaas kan dit bewijs niet geverifieerd worden. Niet-herkend probleem met de bewijschecker diff --git a/OpenKeychain/src/main/res/values-ru/strings.xml b/OpenKeychain/src/main/res/values-ru/strings.xml index 7dc1f09c5..8db2e64ae 100644 --- a/OpenKeychain/src/main/res/values-ru/strings.xml +++ b/OpenKeychain/src/main/res/values-ru/strings.xml @@ -9,6 +9,7 @@ Расшифровать Добавить подключ Изменить ключ + Создать связанный идентификатор Настройки Приложения Серверы OpenPGP @@ -24,6 +25,7 @@ Резервные ключи Ключ не найден Загрузить на сервер ключей + Резервировать ключ Сертифицировать ключ Сведения о ключе Помощь @@ -36,12 +38,15 @@ Идентификаторы YubiKey Связанные контакты + Доказательства Keybase.io Должны ли Вы доверять этому ключу? Подтвердить верификацию Доп. ключи Поиск ключа + Сервер ключей, keybase.io Пароли и PIN-коды Сетевая анонимность + Tor, настройки прокси Интерфейс Синхронизация Автоматическое обновление ключей, @@ -51,6 +56,7 @@ Ключ Сервер ключей Отпечаток ключа + Фразы Зашифровать Расшифровка / Подтверждение Текущий срок годности @@ -71,11 +77,14 @@ Назад Нет Отпечатки совпадают + Совпадающие фразы Зашифровать/подписать и поделиться текстом Зашифровать/подписать и скопировать текст Просмотр ключа Создать ключ Добавить файл(ы) + Опубликовать + Открыть с помощью... Копировать расшифрованный текст Прочитать из буфера Выберите входной файл @@ -86,9 +95,11 @@ Добавить Сохранить по умолчанию Сохранено! + Нет совпадений Настройки Помощь + Резервировать ключ Удалить ключ Управление ключами Поиск @@ -100,6 +111,8 @@ Обновить все ключи Дополнительные сведения Подтвердить через отпечаток + Подтвердить фразами + Опубликовать отчёт Добавить Текст @@ -125,6 +138,7 @@ ХЭШ-алгоритм Зашифровать с паролем Запомнить время + Запомнить пароли для подключей Сжатие текста Сжатие файла Выберите серверы OpenPGP @@ -139,6 +153,7 @@ Имя Комментарий Email + Синхронизация с Интернет Отпечаток Срок годности Серверы ключей @@ -148,14 +163,30 @@ Использовать сжатие Шифровать имена файлов Скрыть получателей + Тест соединения + Только доверенные сервера ключей Удалить сервер ключей Тема Серверы OpenPGP Искать ключи на выбранных серверах OpenPGP (протокол HKP) keybase.io Искать ключи на Keybase.io + Автоматически обновлять ключи + Ключи старше недели обновляются с предпочтительного сервера ключей + Ключи не обновляются автоматически + Связать ключи с контактами + Связывать ключи с контактами основываясь на именах и адресах электронной почты. Это происходит полностью в автономном режиме на вашем устройстве. + Новые ключи не будут связаны с контактами + Автоматически обновлять ключи Предупреждение + Эти новые возможности ещё не закончены и/или пока только изучаются. Проще говоря, не стоит полагаться на их безопасность. Пожалуйста, не сообщайте о связанных с ними проблемах! + Фраза подтверждения + Подтвердить ключи с помощью фраз, вместо шестнадцатеричных отпечатков + Связанные идентификаторы + Привязать ключи к Twitter, GitHub, веб-сайту или DNS (по аналогии с keybase.io но децентрализованно) + Keybase.io подтверждение + Опрашивать keybase.io для подтверждения ключей и показывать это каждый раз при отображении ключей Использовать Tor Требуется установка Orbot @@ -209,6 +240,7 @@ 4 часа 8 часов всегда + Выбрать ключ DSA ElGamal RSA @@ -229,6 +261,7 @@ Нет совместимого менеджера файлов. Пароли не совпадают. Пожалуйста, введите пароль. + Введите пароль Введите пароль для \'%s\' Введите PIN для \'%s\' @@ -513,6 +546,7 @@ Добавьте хотя бы один идентификатор! Добавьте хотя бы один доп. ключ! + Синхронизация с Интернет Это обязательне поле Пароли не совпадают Вы указали следующие данные: @@ -914,9 +948,11 @@ Ошибка NFC: %s Пожалуйста, выберите тип: + Связанные идентификаторы Завершить Твиттер Повторить Подтвердить Ошибка + Опубликовать diff --git a/OpenKeychain/src/main/res/values-sl/strings.xml b/OpenKeychain/src/main/res/values-sl/strings.xml index 587cb364a..cceff9221 100644 --- a/OpenKeychain/src/main/res/values-sl/strings.xml +++ b/OpenKeychain/src/main/res/values-sl/strings.xml @@ -445,7 +445,6 @@ Začni iskanje Keybase.io ponuja \"dokazilo\", da je lastnik tega kluča: - Pozor: Dokazila Keybase.io v aplikaciji OpenKeychain so eksperimantalne narave. Za večjo zanesljivost priporočamo, da dodatno skenirate kode QR ali izmenjate ključe preko NFC. Dokazila se žal ne da preveriti. Neznan problem pri pregledovalniku dokazil diff --git a/OpenKeychain/src/main/res/values-sr/strings.xml b/OpenKeychain/src/main/res/values-sr/strings.xml index 0806b9f1a..7b9ef3238 100644 --- a/OpenKeychain/src/main/res/values-sr/strings.xml +++ b/OpenKeychain/src/main/res/values-sr/strings.xml @@ -173,20 +173,16 @@ ХТТП СОЦКС - Не користи Тор Инсталирати Орбот да бих користио Тор? Инсталирај Морате имати Орбот инсталиран и активиран да бисте преусмерили саобраћај кроз њега. Желите ли да га инсталирате? Одустани - Не користи Тор Да покренем Орбот? - Чини се да Орбот није покренут. Желите ли да га покренете и повежете са Тором? Покрени Орбот Покрени Орбот Одустани - Не користи Тор ]]> ]]> @@ -570,7 +566,6 @@ Почни претрагу Keybase.io нуди „доказе“ који потврђују да власник овог кључа: - Напомена: Докази са Keybase.io су експериментална функција Отвореног кључарника. Препорука је да очитавате бар-кôдове или размењујете кључеве преко НФЦ-а како бисте их потврдили. Објављује на Твитеру као %s Познат је на Гитхабу као %s diff --git a/OpenKeychain/src/main/res/values-sv/strings.xml b/OpenKeychain/src/main/res/values-sv/strings.xml index ae34fdc13..0d44b6415 100644 --- a/OpenKeychain/src/main/res/values-sv/strings.xml +++ b/OpenKeychain/src/main/res/values-sv/strings.xml @@ -500,7 +500,6 @@ Påbörja sökning Keybase.io erbjuder \"bevis\" som hävdar att ägaren av den här nyckeln: - Observera: Keybase.io bevis är en experimentell funktion i OpenKeychain. Vi uppmanar dig att skanna QR-koder eller utbyta nycklar via NFC utöver att bekräfta dem. Är känd på GitHub som %s Tyvärr kan detta bevis inte verifieras. diff --git a/OpenKeychain/src/main/res/values-zh-rTW/strings.xml b/OpenKeychain/src/main/res/values-zh-rTW/strings.xml index 1b23fe6ca..bc9f08a5e 100644 --- a/OpenKeychain/src/main/res/values-zh-rTW/strings.xml +++ b/OpenKeychain/src/main/res/values-zh-rTW/strings.xml @@ -156,20 +156,16 @@ HTTP SOCKS - 不使用Tor 是否安裝Orbot以使用Tor? 安裝 您必須安裝Orbot並透過它進行網路代理。您是否要安裝Orbot? 取消 - 不使用Tor 啟動Orbot? - Orbot尚未執行,您希望啟動它並連結到Tor嗎? 啟動Orbot 啟動Orbot 取消 - 不使用Tor %d 金鑰 @@ -500,7 +496,6 @@ 開始搜尋 Keybase.io提供“證據”證明這把金鑰的持有人: - 注意:Keybase.io證據是個OpenKeychain實驗性功能。我們推薦你另外以QR條碼或是NFC交換金鑰進行確認。 用下列身分在Twitter參與討論:%s 很不幸地我們沒法驗證這些證據。 -- cgit v1.2.3 From c04c698992c340410421519ca1a7b83bff1d9b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 26 Oct 2015 19:10:23 +0100 Subject: Version 3.6.1 --- OpenKeychain/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 3312df784..0c3b8bc6d 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -131,8 +131,8 @@ android { defaultConfig { minSdkVersion 15 targetSdkVersion 22 - versionCode 36000 - versionName "3.6" + versionCode 36100 + versionName "3.6.1" applicationId "org.sufficientlysecure.keychain" // the androidjunitrunner is broken regarding coverage, see here: // https://code.google.com/p/android/issues/detail?id=170607 -- cgit v1.2.3 From 96bed5ef1a8184b0ce7347f23bceea54b0c15fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 26 Oct 2015 19:58:56 +0100 Subject: Update zxing-android-embedded with new custom activity --- OpenKeychain/build.gradle | 37 ++++++----- OpenKeychain/src/main/AndroidManifest.xml | 3 +- .../keychain/ui/ImportKeysProxyActivity.java | 7 +- .../keychain/ui/QrCodeCaptureActivity.java | 74 ++++++++++++++++++++++ .../main/res/layout/qr_code_capture_activity.xml | 13 ++++ 5 files changed, 108 insertions(+), 26 deletions(-) create mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/QrCodeCaptureActivity.java create mode 100644 OpenKeychain/src/main/res/layout/qr_code_capture_activity.xml diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 0c3b8bc6d..4d3ee75da 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -41,8 +41,7 @@ dependencies { // JCenter etc. compile 'com.eftimoff:android-patternview:1.0.1@aar' - compile 'com.journeyapps:zxing-android-embedded:2.3.0@aar' - compile 'com.journeyapps:zxing-android-integration:2.3.0@aar' + compile 'com.journeyapps:zxing-android-embedded:3.0.2@aar' compile 'com.google.zxing:core:3.2.0' compile 'com.jpardogo.materialtabstrip:library:1.0.9' compile 'com.getbase:floatingactionbutton:1.9.0' @@ -86,8 +85,7 @@ dependencyVerification { 'com.android.support:recyclerview-v7:b0f530a5b14334d56ce0de85527ffe93ac419bc928e2884287ce1dddfedfb505', 'com.android.support:cardview-v7:2c2354761a4e20ba451ae903ab808f15c9acc8343b1e74001869c2d0a672c1fc', 'com.eftimoff:android-patternview:cec80e7265b8d8278b3c55b5fcdf551e4600ac2c8bf60d8dd76adca538af0b1e', - 'com.journeyapps:zxing-android-embedded:702a4f58154dbd9baa80f66b6a15410f7a4d403f3e73b66537a8bfb156b4b718', - 'com.journeyapps:zxing-android-integration:562737821b6d34c899b6fd2234ce0a8a31e02ff1fd7c59f6211961ce9767c7c8', + 'com.journeyapps:zxing-android-embedded:561c5d94391342bb77689b8d32a320d085a11853f72afda1128d595b815ef563', 'com.google.zxing:core:7fe5a8ff437635a540e56317649937b768b454795ce999ed5f244f83373dee7b', 'com.jpardogo.materialtabstrip:library:c6ef812fba4f74be7dc4a905faa4c2908cba261a94c13d4f96d5e67e4aad4aaa', 'com.getbase:floatingactionbutton:052aa2a94e49e5dccc97cb99f2add87e8698b84859f0e3ac181100c0bc7640ca', @@ -95,35 +93,36 @@ dependencyVerification { 'org.ocpsoft.prettytime:prettytime:a6bc2641b3ab7873df604b77b6680c75b86d98e78afefb367940972f925591b5', 'com.splitwise:tokenautocomplete:20bee71cc59b3828eb000b684d46ddf738efd56b8fee453a509cd16fda42c8cb', 'se.emilsjolander:stickylistheaders:8c05981ec5725be33f7cee5e68c13f3db49cd5c75f1aaeb04024920b1ef96ad4', - 'com.mikepenz:materialdrawer:70c3efb3842461db41df6a918ea93969a7da21e63c092be838b153e5a47a17bf', 'org.sufficientlysecure:html-textview:1d3bed31ef837437154de8d2362a0e6b0e59b6c3535d87ee48c2fab12c84f9bb', - 'com.mikepenz.iconics:octicons-typeface:67ed7d456a9ce5f5307b85f955797bfb3dd674e2f6defb31c6b8bbe2ede290be', 'com.mikepenz:iconics:c1a02203d8e0d638959463c00af3ab9096e0a7c1ad5928762eb10ef5ce8a63cd', - 'com.mikepenz.iconics:community-material-typeface:f1c5afee5f0f10d66beb3ed0df977246a02a9c46de4e05d7c0264bcde53b6b7f', + 'com.mikepenz:materialdrawer:70c3efb3842461db41df6a918ea93969a7da21e63c092be838b153e5a47a17bf', 'com.mikepenz.iconics:meteocons-typeface:39a8a9e70cd8287cdb119af57a672a41dd09240dba6697f5a0dbda1ccc33298b', - 'com.squareup.okhttp:okhttp:1cc716e29539adcda677949508162796daffedb4794cbf947a6f65e696f0381c', + 'com.mikepenz.iconics:octicons-typeface:67ed7d456a9ce5f5307b85f955797bfb3dd674e2f6defb31c6b8bbe2ede290be', 'com.nispok:snackbar:46b5eb9d630d329e13c2ce00ee9fb115ffb66c23c72cff32ee97eedd76824c6f', - 'org.apache.james:apache-mime4j-core:4d7434c68f94b81a253c12f28e6bbb4d6239c361d6086a46e22e594bb43ac660', + 'com.mikepenz.iconics:community-material-typeface:f1c5afee5f0f10d66beb3ed0df977246a02a9c46de4e05d7c0264bcde53b6b7f', 'com.squareup.okhttp:okhttp-urlconnection:79ec6f4e79e683105e87fe83278a531c693e538d30e3b9237000ce7c94fcb2cf', - 'org.thoughtcrime.ssl.pinning:AndroidPinning:afa1d74e699257fa75cb109ff29bac50726ef269c6e306bdeffe8223cee06ef4', + 'com.squareup.okhttp:okhttp:1cc716e29539adcda677949508162796daffedb4794cbf947a6f65e696f0381c', 'org.apache.james:apache-mime4j-dom:7e6b06ee164a1c21b7e477249ea0b74a18fddce44764e5764085f58dd8c34633', -// 'OpenKeychain.extern.openpgp-api-lib:openpgp-api:a3f8b2ed40aaf12169e2a4e1f25e3764aa5ccb430683e1e7ca7867471eaf2bba', + 'org.apache.james:apache-mime4j-core:4d7434c68f94b81a253c12f28e6bbb4d6239c361d6086a46e22e594bb43ac660', 'com.cocosw:bottomsheet:871f5f4d6c10936569caf3528271efd77594a67aa5511765c96d7096c9b05f96', -// 'OpenKeychain.extern.spongycastle:core:6006a83fa427f4e5c8c93458176ab5e3b54d8dba7942171cb76cb134fc574c58', -// 'OpenKeychain.extern.openkeychain-api-lib:openkeychain-intents:8582442aa26e13c5a4bdf3588a22cb94b2fa5de6c79b84244fb575aa401fc330', -// 'OpenKeychain.extern.spongycastle:pg:0fd64a60311c5557f230bec9b2b162c9e6e690ccc83ac6b5af6a8d616309da98', -// 'OpenKeychain.extern.spongycastle:pkix:2348474aa27cb0461a368191d4d8fe7479a212b6365b177da131f4efa4c57f24', -// 'OpenKeychain.extern.spongycastle:prov:85c9ed6e24c5c7e5f7ff7c22d367bb553d020693350bd1c75555e6895311bb69', -// 'OpenKeychain.extern.safeslinger-exchange:safeslinger-exchange:274b71f8a1c383fb506342fd0f614b4a0cdb25517b5b2a1dfef9a4a2575477ed', + 'org.thoughtcrime.ssl.pinning:AndroidPinning:afa1d74e699257fa75cb109ff29bac50726ef269c6e306bdeffe8223cee06ef4', +// 'OpenKeychain.extern.openkeychain-api-lib:openkeychain-intents:73d1bbf8f0288480d757d09b7cd655162ec65c05bdb0e214a8563cc05e48de8c', +// 'OpenKeychain.extern.openpgp-api-lib:openpgp-api:1928b3a927dd9fb9c3f3a27fb032b559556aa35f96302ce9594d3200be3b02bc', +// 'com.madgag.spongycastle:core:8fd58fd725f8a76de8875f0416e0a824e2fd11675e28ae4f6e2f4a5114c0fec1', +// 'com.madgag.spongycastle:pg:2b0bf8def92e41a13d177a394b0ab1784a6049a416eeb3d5e41359436051a2bd', +// 'com.madgag.spongycastle:pkix:98effd8c01547c266d5483d428263778f4629e5ed14b82cb8acd439db3b82caa', +// 'OpenKeychain.extern:minidns:c4a75e5ee4a32e28326e033337fb3eedd7e1cb22683e3bd9bd617e582673ffb1', +// 'com.madgag.spongycastle:prov:610e1ade360f147335e36939a4db5fff61fc1da93af2b81ed095fd29890f3019', 'com.android.support:support-annotations:beac5cae60bdb597df9af9c916f785c2f71f8c8ae4be9a32d4298dea85496a42', -// 'OpenKeychain.extern:minidns:25e351fa4145e2a9b0a76658c48619b307f71432db7492e9e8a6b34aa2e9bdcf', -// 'OpenKeychain.extern.KeybaseLib:Lib:79c78c1054b58200028211e21f2c89012dc4a1eafdb00cc99a5ce1f61ad16937', +// 'OpenKeychain.extern.KeybaseLib:Lib:e74bbf33600021993e493050768ca07b743a8308407daad7913aed44d86b0cea', +// 'OpenKeychain.extern.safeslinger-exchange:safeslinger-exchange:a38a6c1077a59491489304780b4e7afce52b4f5d594d7998e448e5c9e5363fb6', 'com.squareup.okio:okio:114bdc1f47338a68bcbc95abf2f5cdc72beeec91812f2fcd7b521c1937876266', ] } + android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index 3cac4ed10..8730a456e 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -499,7 +499,8 @@ - + = Build.VERSION_CODES.JELLY_BEAN) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/QrCodeCaptureActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/QrCodeCaptureActivity.java new file mode 100644 index 000000000..6172c8c8e --- /dev/null +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/QrCodeCaptureActivity.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2015 Dominik Schürmann + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.sufficientlysecure.keychain.ui; + +import android.os.Bundle; +import android.support.v4.app.FragmentActivity; +import android.view.KeyEvent; + +import com.journeyapps.barcodescanner.CaptureManager; +import com.journeyapps.barcodescanner.CompoundBarcodeView; + +import org.sufficientlysecure.keychain.R; + +public class QrCodeCaptureActivity extends FragmentActivity { + private CaptureManager capture; + private CompoundBarcodeView barcodeScannerView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.qr_code_capture_activity); + + barcodeScannerView = (CompoundBarcodeView) findViewById(R.id.zxing_barcode_scanner); + barcodeScannerView.setStatusText(getString(R.string.import_qr_code_text)); + + capture = new CaptureManager(this, barcodeScannerView); + capture.initializeFromIntent(getIntent(), savedInstanceState); + capture.decode(); + } + + @Override + protected void onResume() { + super.onResume(); + capture.onResume(); + } + + @Override + protected void onPause() { + super.onPause(); + capture.onPause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + capture.onDestroy(); + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + capture.onSaveInstanceState(outState); + } + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + return barcodeScannerView.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, event); + } +} \ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/qr_code_capture_activity.xml b/OpenKeychain/src/main/res/layout/qr_code_capture_activity.xml new file mode 100644 index 000000000..094901740 --- /dev/null +++ b/OpenKeychain/src/main/res/layout/qr_code_capture_activity.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file -- cgit v1.2.3 From ddc0315b454b4e206eeaf447596a3265c2094d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 26 Oct 2015 20:09:41 +0100 Subject: Update android-patternview, materialtabstrip, floatingactionbutton --- OpenKeychain/build.gradle | 14 +++++++------- OpenKeychain/src/main/res/layout/toolbar_tabs.xml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 4d3ee75da..766854e86 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -40,14 +40,14 @@ dependencies { } // JCenter etc. - compile 'com.eftimoff:android-patternview:1.0.1@aar' + compile 'com.eftimoff:android-patternview:1.0.3@aar' compile 'com.journeyapps:zxing-android-embedded:3.0.2@aar' compile 'com.google.zxing:core:3.2.0' - compile 'com.jpardogo.materialtabstrip:library:1.0.9' - compile 'com.getbase:floatingactionbutton:1.9.0' + compile 'com.jpardogo.materialtabstrip:library:1.1.0' + compile 'com.getbase:floatingactionbutton:1.10.1' compile 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.0' compile 'org.ocpsoft.prettytime:prettytime:3.2.7.Final' - compile "com.splitwise:tokenautocomplete:1.3.3@aar" + compile 'com.splitwise:tokenautocomplete:1.3.3@aar' compile 'se.emilsjolander:stickylistheaders:2.6.0' compile 'org.sufficientlysecure:html-textview:1.2' compile 'com.mikepenz:materialdrawer:3.0.9@aar' @@ -84,11 +84,11 @@ dependencyVerification { 'com.android.support:design:58be3ca6a73789615f7ece0937d2f683b98b594bb90aa10565fa760fb10b07ee', 'com.android.support:recyclerview-v7:b0f530a5b14334d56ce0de85527ffe93ac419bc928e2884287ce1dddfedfb505', 'com.android.support:cardview-v7:2c2354761a4e20ba451ae903ab808f15c9acc8343b1e74001869c2d0a672c1fc', - 'com.eftimoff:android-patternview:cec80e7265b8d8278b3c55b5fcdf551e4600ac2c8bf60d8dd76adca538af0b1e', + 'com.eftimoff:android-patternview:2e7a2bbfb4fed229d4b5598aa4e69e45066fbea72c971d69461db7d916cb7ebc', 'com.journeyapps:zxing-android-embedded:561c5d94391342bb77689b8d32a320d085a11853f72afda1128d595b815ef563', 'com.google.zxing:core:7fe5a8ff437635a540e56317649937b768b454795ce999ed5f244f83373dee7b', - 'com.jpardogo.materialtabstrip:library:c6ef812fba4f74be7dc4a905faa4c2908cba261a94c13d4f96d5e67e4aad4aaa', - 'com.getbase:floatingactionbutton:052aa2a94e49e5dccc97cb99f2add87e8698b84859f0e3ac181100c0bc7640ca', + 'com.jpardogo.materialtabstrip:library:24d19232b319f8c73e25793432357919a7ed972186f57a3b2c9093ea74ad8311', + 'com.getbase:floatingactionbutton:3edefa511aac4d90794c7b0496aca59cff2eee1e32679247b4f85acbeee05240', 'org.commonjava.googlecode.markdown4j:markdown4j:e952e825d29e1317d96f79f346bfb6786c7c5eef50bd26e54a80823704b62e13', 'org.ocpsoft.prettytime:prettytime:a6bc2641b3ab7873df604b77b6680c75b86d98e78afefb367940972f925591b5', 'com.splitwise:tokenautocomplete:20bee71cc59b3828eb000b684d46ddf738efd56b8fee453a509cd16fda42c8cb', diff --git a/OpenKeychain/src/main/res/layout/toolbar_tabs.xml b/OpenKeychain/src/main/res/layout/toolbar_tabs.xml index ed42ef52e..315aaf75a 100644 --- a/OpenKeychain/src/main/res/layout/toolbar_tabs.xml +++ b/OpenKeychain/src/main/res/layout/toolbar_tabs.xml @@ -18,7 +18,7 @@ android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" android:textColor="?attr/colorTabText" - app:pstsTextColorSelected="?attr/colorTabTextSelected" + app:pstsTabTextColor="?attr/colorTabTextSelected" app:pstsIndicatorColor="?attr/colorTabIndicator" /> -- cgit v1.2.3 From cf28da39c49497e2585611eb9dc0553b4646ba25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 26 Oct 2015 20:21:35 +0100 Subject: Update tokenautocomplete --- OpenKeychain/build.gradle | 13 +++++----- .../ui/widget/EncryptKeyCompletionView.java | 28 ++++++++++------------ 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 766854e86..162e2ac58 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -47,7 +47,7 @@ dependencies { compile 'com.getbase:floatingactionbutton:1.10.1' compile 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.0' compile 'org.ocpsoft.prettytime:prettytime:3.2.7.Final' - compile 'com.splitwise:tokenautocomplete:1.3.3@aar' + compile 'com.splitwise:tokenautocomplete:2.0.2@aar' compile 'se.emilsjolander:stickylistheaders:2.6.0' compile 'org.sufficientlysecure:html-textview:1.2' compile 'com.mikepenz:materialdrawer:3.0.9@aar' @@ -91,7 +91,7 @@ dependencyVerification { 'com.getbase:floatingactionbutton:3edefa511aac4d90794c7b0496aca59cff2eee1e32679247b4f85acbeee05240', 'org.commonjava.googlecode.markdown4j:markdown4j:e952e825d29e1317d96f79f346bfb6786c7c5eef50bd26e54a80823704b62e13', 'org.ocpsoft.prettytime:prettytime:a6bc2641b3ab7873df604b77b6680c75b86d98e78afefb367940972f925591b5', - 'com.splitwise:tokenautocomplete:20bee71cc59b3828eb000b684d46ddf738efd56b8fee453a509cd16fda42c8cb', + 'com.splitwise:tokenautocomplete:2fc238424130b42155b5f2e39799a90bbbd13b148850afbe534ab08bb913c7f7', 'se.emilsjolander:stickylistheaders:8c05981ec5725be33f7cee5e68c13f3db49cd5c75f1aaeb04024920b1ef96ad4', 'org.sufficientlysecure:html-textview:1d3bed31ef837437154de8d2362a0e6b0e59b6c3535d87ee48c2fab12c84f9bb', 'com.mikepenz:iconics:c1a02203d8e0d638959463c00af3ab9096e0a7c1ad5928762eb10ef5ce8a63cd', @@ -108,11 +108,11 @@ dependencyVerification { 'org.thoughtcrime.ssl.pinning:AndroidPinning:afa1d74e699257fa75cb109ff29bac50726ef269c6e306bdeffe8223cee06ef4', // 'OpenKeychain.extern.openkeychain-api-lib:openkeychain-intents:73d1bbf8f0288480d757d09b7cd655162ec65c05bdb0e214a8563cc05e48de8c', // 'OpenKeychain.extern.openpgp-api-lib:openpgp-api:1928b3a927dd9fb9c3f3a27fb032b559556aa35f96302ce9594d3200be3b02bc', -// 'com.madgag.spongycastle:core:8fd58fd725f8a76de8875f0416e0a824e2fd11675e28ae4f6e2f4a5114c0fec1', -// 'com.madgag.spongycastle:pg:2b0bf8def92e41a13d177a394b0ab1784a6049a416eeb3d5e41359436051a2bd', -// 'com.madgag.spongycastle:pkix:98effd8c01547c266d5483d428263778f4629e5ed14b82cb8acd439db3b82caa', +// 'OpenKeychain.extern.spongycastle:core:8fd58fd725f8a76de8875f0416e0a824e2fd11675e28ae4f6e2f4a5114c0fec1', +// 'OpenKeychain.extern.spongycastle:pg:2b0bf8def92e41a13d177a394b0ab1784a6049a416eeb3d5e41359436051a2bd', +// 'OpenKeychain.extern.spongycastle:pkix:98effd8c01547c266d5483d428263778f4629e5ed14b82cb8acd439db3b82caa', // 'OpenKeychain.extern:minidns:c4a75e5ee4a32e28326e033337fb3eedd7e1cb22683e3bd9bd617e582673ffb1', -// 'com.madgag.spongycastle:prov:610e1ade360f147335e36939a4db5fff61fc1da93af2b81ed095fd29890f3019', +// 'OpenKeychain.extern.spongycastle:prov:610e1ade360f147335e36939a4db5fff61fc1da93af2b81ed095fd29890f3019', 'com.android.support:support-annotations:beac5cae60bdb597df9af9c916f785c2f71f8c8ae4be9a32d4298dea85496a42', // 'OpenKeychain.extern.KeybaseLib:Lib:e74bbf33600021993e493050768ca07b743a8308407daad7913aed44d86b0cea', // 'OpenKeychain.extern.safeslinger-exchange:safeslinger-exchange:a38a6c1077a59491489304780b4e7afce52b4f5d594d7998e448e5c9e5363fb6', @@ -123,6 +123,7 @@ dependencyVerification { + android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java index 48e6c2cee..7fec47533 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java @@ -23,6 +23,7 @@ import android.database.Cursor; import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; +import android.support.annotation.NonNull; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.app.LoaderManager.LoaderCallbacks; @@ -46,14 +47,14 @@ import org.sufficientlysecure.keychain.ui.adapter.KeyAdapter.KeyItem; import org.sufficientlysecure.keychain.util.Log; -public class EncryptKeyCompletionView extends TokenCompleteTextView +public class EncryptKeyCompletionView extends TokenCompleteTextView implements LoaderCallbacks { public static final String ARG_QUERY = "query"; private KeyAdapter mAdapter; private LoaderManager mLoaderManager; - private String mPrefix; + private CharSequence mPrefix; public EncryptKeyCompletionView(Context context) { super(context); @@ -79,30 +80,27 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView } @Override - public void setPrefix(String p) { + public void setPrefix(CharSequence p) { // this one is private in the superclass, but we need it here mPrefix = p; super.setPrefix(p); } @Override - protected View getViewForObject(Object object) { - if (object instanceof KeyItem) { - LayoutInflater l = LayoutInflater.from(getContext()); - View view = l.inflate(R.layout.recipient_box_entry, null); - ((TextView) view.findViewById(android.R.id.text1)).setText(((KeyItem) object).getReadableName()); - return view; - } - return null; + protected View getViewForObject(KeyItem keyItem) { + LayoutInflater l = LayoutInflater.from(getContext()); + View view = l.inflate(R.layout.recipient_box_entry, null); + ((TextView) view.findViewById(android.R.id.text1)).setText(keyItem.getReadableName()); + return view; } @Override - protected Object defaultObject(String completionText) { + protected KeyItem defaultObject(String completionText) { // TODO: We could try to automagically download the key if it's unknown but a key id /*if (completionText.startsWith("0x")) { }*/ - return ""; + return null; } @Override @@ -128,7 +126,7 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView // These are the rows that we will retrieve. Uri baseUri = KeyRings.buildUnifiedKeyRingsUri(); - String[] projection = KeyAdapter.getProjectionWith(new String[] { + String[] projection = KeyAdapter.getProjectionWith(new String[]{ KeychainContract.KeyRings.HAS_ENCRYPT, }); @@ -179,7 +177,7 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView } @Override - protected void performFiltering(CharSequence text, int start, int end, int keyCode) { + protected void performFiltering(@NonNull CharSequence text, int start, int end, int keyCode) { super.performFiltering(text, start, end, keyCode); if (start < mPrefix.length()) { start = mPrefix.length(); -- cgit v1.2.3 From 33fea901e911fba90cff10a732f359028d02fd86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 26 Oct 2015 20:25:55 +0100 Subject: Update stickylistheaders, html-textview --- OpenKeychain/build.gradle | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 162e2ac58..bb6a1b05f 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -48,8 +48,8 @@ dependencies { compile 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.0' compile 'org.ocpsoft.prettytime:prettytime:3.2.7.Final' compile 'com.splitwise:tokenautocomplete:2.0.2@aar' - compile 'se.emilsjolander:stickylistheaders:2.6.0' - compile 'org.sufficientlysecure:html-textview:1.2' + compile 'se.emilsjolander:stickylistheaders:2.7.0' + compile 'org.sufficientlysecure:html-textview:1.3' compile 'com.mikepenz:materialdrawer:3.0.9@aar' compile 'com.mikepenz:iconics:1.0.2' compile 'com.mikepenz.iconics:octicons-typeface:2.2.0@aar' @@ -92,8 +92,8 @@ dependencyVerification { 'org.commonjava.googlecode.markdown4j:markdown4j:e952e825d29e1317d96f79f346bfb6786c7c5eef50bd26e54a80823704b62e13', 'org.ocpsoft.prettytime:prettytime:a6bc2641b3ab7873df604b77b6680c75b86d98e78afefb367940972f925591b5', 'com.splitwise:tokenautocomplete:2fc238424130b42155b5f2e39799a90bbbd13b148850afbe534ab08bb913c7f7', - 'se.emilsjolander:stickylistheaders:8c05981ec5725be33f7cee5e68c13f3db49cd5c75f1aaeb04024920b1ef96ad4', - 'org.sufficientlysecure:html-textview:1d3bed31ef837437154de8d2362a0e6b0e59b6c3535d87ee48c2fab12c84f9bb', + 'se.emilsjolander:stickylistheaders:a08ca948aa6b220f09d82f16bbbac395f6b78897e9eeac6a9f0b0ba755928eeb', + 'org.sufficientlysecure:html-textview:39048e35894e582adada388e6c00631803283f8defed8e07ad58a5f284f272ee', 'com.mikepenz:iconics:c1a02203d8e0d638959463c00af3ab9096e0a7c1ad5928762eb10ef5ce8a63cd', 'com.mikepenz:materialdrawer:70c3efb3842461db41df6a918ea93969a7da21e63c092be838b153e5a47a17bf', 'com.mikepenz.iconics:meteocons-typeface:39a8a9e70cd8287cdb119af57a672a41dd09240dba6697f5a0dbda1ccc33298b', @@ -121,9 +121,6 @@ dependencyVerification { } - - - android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion -- cgit v1.2.3 From 67a51cdfe3f6fb7982b27eb2b6d4b1b5d49f69aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 26 Oct 2015 20:53:32 +0100 Subject: Target SDK 23 and related fixes --- OpenKeychain/build.gradle | 38 ++++++++++++---------- .../keychain/linked/LinkedTokenResource.java | 5 ++- .../keychain/ui/adapter/KeySelectableAdapter.java | 9 +++-- OpenKeychain/src/main/res/values/colors.xml | 3 ++ build.gradle | 4 +-- extern/safeslinger-exchange | 2 +- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index bb6a1b05f..fd2b8d3a5 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -8,11 +8,11 @@ dependencies { // NOTE: libraries are pinned to a specific build, see below // from local Android SDK - compile 'com.android.support:support-v4:22.2.1' - compile 'com.android.support:appcompat-v7:22.2.1' - compile 'com.android.support:design:22.2.1' - compile 'com.android.support:recyclerview-v7:22.2.1' - compile 'com.android.support:cardview-v7:22.2.1' + compile 'com.android.support:support-v4:23.1.0' + compile 'com.android.support:appcompat-v7:23.1.0' + compile 'com.android.support:design:23.1.0' + compile 'com.android.support:recyclerview-v7:23.1.0' + compile 'com.android.support:cardview-v7:23.1.0' // Unit tests in the local JVM with Robolectric // https://developer.android.com/training/testing/unit-testing/local-unit-tests.html @@ -36,7 +36,7 @@ dependencies { // Temporary workaround for bug: https://code.google.com/p/android-test-kit/issues/detail?id=136 // from https://github.com/googlesamples/android-testing/blob/master/build.gradle#L21 configurations.all { - resolutionStrategy.force 'com.android.support:support-annotations:22.2.0' + resolutionStrategy.force 'com.android.support:support-annotations:23.1.0' } // JCenter etc. @@ -79,11 +79,11 @@ dependencies { // Comment out the libs referenced as git submodules! dependencyVerification { verify = [ - 'com.android.support:support-v4:c62f0d025dafa86f423f48df9185b0d89496adbc5f6a9be5a7c394d84cf91423', - 'com.android.support:appcompat-v7:4b5ccba8c4557ef04f99aa0a80f8aa7d50f05f926a709010a54afd5c878d3618', - 'com.android.support:design:58be3ca6a73789615f7ece0937d2f683b98b594bb90aa10565fa760fb10b07ee', - 'com.android.support:recyclerview-v7:b0f530a5b14334d56ce0de85527ffe93ac419bc928e2884287ce1dddfedfb505', - 'com.android.support:cardview-v7:2c2354761a4e20ba451ae903ab808f15c9acc8343b1e74001869c2d0a672c1fc', + 'com.android.support:support-v4:a0309e9c188afd25ad5dd38e484ad13610bc5f2ebfeafa40d2a07eea414896d5', + 'com.android.support:appcompat-v7:b5783b390d1440769c9b8a7b42290523a4ff058ef2d3fb90c983973934ca115b', + 'com.android.support:design:ff53a30489cf77c5ed83805e59709f712b8dae1727524422c0d4fafd9b6bafe5', + 'com.android.support:recyclerview-v7:464ec6e5004400a4fe0310f35343da9e5a2912386a3606db3585f7cf987c444a', + 'com.android.support:cardview-v7:7b44941673bb60566421781be0ed16b536ecf4b630b380fe9b8f48b376df33b7', 'com.eftimoff:android-patternview:2e7a2bbfb4fed229d4b5598aa4e69e45066fbea72c971d69461db7d916cb7ebc', 'com.journeyapps:zxing-android-embedded:561c5d94391342bb77689b8d32a320d085a11853f72afda1128d595b815ef563', 'com.google.zxing:core:7fe5a8ff437635a540e56317649937b768b454795ce999ed5f244f83373dee7b', @@ -108,26 +108,28 @@ dependencyVerification { 'org.thoughtcrime.ssl.pinning:AndroidPinning:afa1d74e699257fa75cb109ff29bac50726ef269c6e306bdeffe8223cee06ef4', // 'OpenKeychain.extern.openkeychain-api-lib:openkeychain-intents:73d1bbf8f0288480d757d09b7cd655162ec65c05bdb0e214a8563cc05e48de8c', // 'OpenKeychain.extern.openpgp-api-lib:openpgp-api:1928b3a927dd9fb9c3f3a27fb032b559556aa35f96302ce9594d3200be3b02bc', -// 'OpenKeychain.extern.spongycastle:core:8fd58fd725f8a76de8875f0416e0a824e2fd11675e28ae4f6e2f4a5114c0fec1', -// 'OpenKeychain.extern.spongycastle:pg:2b0bf8def92e41a13d177a394b0ab1784a6049a416eeb3d5e41359436051a2bd', -// 'OpenKeychain.extern.spongycastle:pkix:98effd8c01547c266d5483d428263778f4629e5ed14b82cb8acd439db3b82caa', +// 'com.madgag.spongycastle:core:8fd58fd725f8a76de8875f0416e0a824e2fd11675e28ae4f6e2f4a5114c0fec1', +// 'com.madgag.spongycastle:pg:2b0bf8def92e41a13d177a394b0ab1784a6049a416eeb3d5e41359436051a2bd', +// 'com.madgag.spongycastle:pkix:98effd8c01547c266d5483d428263778f4629e5ed14b82cb8acd439db3b82caa', // 'OpenKeychain.extern:minidns:c4a75e5ee4a32e28326e033337fb3eedd7e1cb22683e3bd9bd617e582673ffb1', -// 'OpenKeychain.extern.spongycastle:prov:610e1ade360f147335e36939a4db5fff61fc1da93af2b81ed095fd29890f3019', - 'com.android.support:support-annotations:beac5cae60bdb597df9af9c916f785c2f71f8c8ae4be9a32d4298dea85496a42', +// 'com.madgag.spongycastle:prov:610e1ade360f147335e36939a4db5fff61fc1da93af2b81ed095fd29890f3019', + 'com.android.support:support-annotations:d50996a4cbca17178989fef38635f2cc570c5d3a77870aaa57f4f7e4fc6de9dc', // 'OpenKeychain.extern.KeybaseLib:Lib:e74bbf33600021993e493050768ca07b743a8308407daad7913aed44d86b0cea', // 'OpenKeychain.extern.safeslinger-exchange:safeslinger-exchange:a38a6c1077a59491489304780b4e7afce52b4f5d594d7998e448e5c9e5363fb6', 'com.squareup.okio:okio:114bdc1f47338a68bcbc95abf2f5cdc72beeec91812f2fcd7b521c1937876266', ] } - android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion + // TODO: remove org.apache dependencies in LinkedTokenResource etc. + useLibrary 'org.apache.http.legacy' + defaultConfig { minSdkVersion 15 - targetSdkVersion 22 + targetSdkVersion 23 versionCode 36100 versionName "3.6.1" applicationId "org.sufficientlysecure.keychain" diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/linked/LinkedTokenResource.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/linked/LinkedTokenResource.java index 998ec3ad4..e5a128e32 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/linked/LinkedTokenResource.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/linked/LinkedTokenResource.java @@ -1,5 +1,7 @@ package org.sufficientlysecure.keychain.linked; +import android.content.Context; + import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; @@ -8,7 +10,6 @@ import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.params.BasicHttpParams; import org.json.JSONException; import org.sufficientlysecure.keychain.Constants; -import org.sufficientlysecure.keychain.linked.resources.DnsResource; import org.sufficientlysecure.keychain.linked.resources.GenericHttpsResource; import org.sufficientlysecure.keychain.linked.resources.GithubResource; import org.sufficientlysecure.keychain.linked.resources.TwitterResource; @@ -32,8 +33,6 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; -import android.content.Context; - public abstract class LinkedTokenResource extends LinkedResource { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeySelectableAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeySelectableAdapter.java index 471a20411..7cc37b3a3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeySelectableAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeySelectableAdapter.java @@ -1,13 +1,8 @@ package org.sufficientlysecure.keychain.ui.adapter; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - import android.content.Context; import android.database.Cursor; -import android.support.v7.internal.widget.AdapterViewCompat; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; @@ -18,6 +13,10 @@ import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.util.Log; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + public class KeySelectableAdapter extends KeyAdapter implements OnItemClickListener { diff --git a/OpenKeychain/src/main/res/values/colors.xml b/OpenKeychain/src/main/res/values/colors.xml index 06fe2a9cd..4eb9e7d68 100644 --- a/OpenKeychain/src/main/res/values/colors.xml +++ b/OpenKeychain/src/main/res/values/colors.xml @@ -33,4 +33,7 @@ #2A000000 #2A000000 + + #ff009688 + diff --git a/build.gradle b/build.gradle index 5f7f9b082..63bdffed9 100644 --- a/build.gradle +++ b/build.gradle @@ -43,6 +43,6 @@ project(':extern:spongycastle') { // SDK Version and Build Tools used by all subprojects // See http://tools.android.com/tech-docs/new-build-system/tips#TOC-Controlling-Android-properties-of-all-your-modules-from-the-main-project. ext { - compileSdkVersion = 22 - buildToolsVersion = '22.0.1' + compileSdkVersion = 23 + buildToolsVersion = '23.0.1' } diff --git a/extern/safeslinger-exchange b/extern/safeslinger-exchange index ca3300ac9..c7505ec7d 160000 --- a/extern/safeslinger-exchange +++ b/extern/safeslinger-exchange @@ -1 +1 @@ -Subproject commit ca3300ac9bac73df2124301f5024db309a03c29b +Subproject commit c7505ec7dec3991a04a9ea85c2506157107a96d5 -- cgit v1.2.3 From e89dba8f245f59afd9e4e3da9c62f98befcb4d47 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Mon, 26 Oct 2015 21:57:08 +0100 Subject: prevent crashes in EncryptKeyCompletionView (2) --- .../ui/widget/EncryptKeyCompletionView.java | 29 ++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java index 7fec47533..01d51af48 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java @@ -29,6 +29,7 @@ import android.support.v4.app.LoaderManager; import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; +import android.text.TextUtils; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; @@ -134,18 +135,19 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView + KeyRings.IS_EXPIRED + " = 0 AND " + Tables.KEYS + "." + KeyRings.IS_REVOKED + " = 0"; - if (args != null && args.containsKey(ARG_QUERY)) { - String query = args.getString(ARG_QUERY); - mAdapter.setSearchQuery(query); + if (args == null || !args.containsKey(ARG_QUERY)) { + // mAdapter.setSearchQuery(null); + // return new CursorLoader(getContext(), baseUri, projection, where, null, null); + return null; + } - where += " AND " + KeyRings.USER_ID + " LIKE ?"; + String query = args.getString(ARG_QUERY); + mAdapter.setSearchQuery(query); - return new CursorLoader(getContext(), baseUri, projection, where, - new String[]{"%" + query + "%"}, null); - } + where += " AND " + KeyRings.USER_ID + " LIKE ?"; - mAdapter.setSearchQuery(null); - return new CursorLoader(getContext(), baseUri, projection, where, null, null); + return new CursorLoader(getContext(), baseUri, projection, where, + new String[]{"%" + query + "%"}, null); } @@ -167,6 +169,8 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView super.showDropDown(); } + + @Override public void onFocusChanged(boolean hasFocus, int direction, Rect previous) { super.onFocusChanged(hasFocus, direction, previous); @@ -182,8 +186,13 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView if (start < mPrefix.length()) { start = mPrefix.length(); } + String query = text.subSequence(start, end).toString(); + if (TextUtils.isEmpty(query) || query.length() < 2) { + mLoaderManager.destroyLoader(0); + return; + } Bundle args = new Bundle(); - args.putString(ARG_QUERY, text.subSequence(start, end).toString()); + args.putString(ARG_QUERY, query); mLoaderManager.restartLoader(0, args, this); } -- cgit v1.2.3 From a1330f78e499840b386ea92e4280e9cdff9407f6 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Thu, 29 Oct 2015 14:50:29 +0100 Subject: uploadop: clean up, add logging --- .../keychain/keyimport/HkpKeyserver.java | 2 +- .../keychain/operations/BackupOperation.java | 4 +- .../keychain/operations/CertifyOperation.java | 2 +- .../keychain/operations/EditKeyOperation.java | 2 +- .../keychain/operations/UploadOperation.java | 141 +++++++++++++-------- .../operations/results/InputPendingResult.java | 7 +- .../operations/results/OperationResult.java | 15 ++- .../keychain/operations/results/UploadResult.java | 3 +- .../keychain/service/input/CryptoInputParcel.java | 1 + .../keychain/util/ParcelableProxy.java | 2 + .../keychain/util/Preferences.java | 7 + OpenKeychain/src/main/res/values-ja/strings.xml | 8 +- OpenKeychain/src/main/res/values/strings.xml | 15 ++- 13 files changed, 135 insertions(+), 74 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java index 7473705f3..3b52a0306 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java @@ -434,7 +434,7 @@ public class HkpKeyserver extends Keyserver { @Override public String toString() { - return mHost + ":" + mPort; + return getUrlPrefix() + mHost + ":" + mPort; } /** diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BackupOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BackupOperation.java index 206212387..ae9a2c180 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BackupOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BackupOperation.java @@ -252,7 +252,7 @@ public class BackupOperation extends BaseOperation { ring.encode(arOutStream); } catch (PgpGeneralException e) { - log.add(LogType.MSG_BACKUP_ERROR_KEY, 2); + log.add(LogType.MSG_UPLOAD_ERROR_IO, 2); } finally { if (arOutStream != null) { arOutStream.close(); @@ -273,7 +273,7 @@ public class BackupOperation extends BaseOperation { ring.encode(arOutStream); } catch (PgpGeneralException e) { - log.add(LogType.MSG_BACKUP_ERROR_KEY, 2); + log.add(LogType.MSG_UPLOAD_ERROR_IO, 2); } finally { if (arOutStream != null) { arOutStream.close(); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java index e1daac874..7d11fa1f1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java @@ -208,7 +208,7 @@ public class CertifyOperation extends BaseOperation { // these variables are used inside the following loop, but they need to be created only once UploadOperation uploadOperation = null; if (parcel.keyServerUri != null) { - uploadOperation = new UploadOperation(mContext, mProviderHelper, mProgressable); + uploadOperation = new UploadOperation(mContext, mProviderHelper, mProgressable, mCancelled); } // Write all certified keys into the database diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java index cf8928768..93ee76f3f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java @@ -148,7 +148,7 @@ public class EditKeyOperation extends BaseOperation { new UploadKeyringParcel(saveParcel.getUploadKeyserver(), keyringBytes); UploadResult uploadResult = - new UploadOperation(mContext, mProviderHelper, mProgressable) + new UploadOperation(mContext, mProviderHelper, mProgressable, mCancelled) .execute(exportKeyringParcel, cryptoInput); if (uploadResult.isPending()) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java index bac9a7975..d4bbaa9fd 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java @@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import android.content.Context; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import org.spongycastle.bcpg.ArmoredOutputStream; import org.sufficientlysecure.keychain.Constants; @@ -47,26 +48,17 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; import org.sufficientlysecure.keychain.service.input.RequiredInputParcel; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.util.Log; +import org.sufficientlysecure.keychain.util.ParcelableProxy; import org.sufficientlysecure.keychain.util.Preferences; +import org.sufficientlysecure.keychain.util.Preferences.ProxyPrefs; import org.sufficientlysecure.keychain.util.orbot.OrbotHelper; /** - * An operation class which implements high level export operations. - * This class receives a source and/or destination of keys as input and performs - * all steps for this export. - * - * @see org.sufficientlysecure.keychain.ui.adapter.ImportKeysAdapter#getSelectedEntries() - * For the export operation, the input consists of a set of key ids and - * either the name of a file or an output uri to write to. + * An operation class which implements the upload of a single key to a key server. */ public class UploadOperation extends BaseOperation { - public UploadOperation(Context context, ProviderHelper providerHelper, Progressable - progressable) { - super(context, providerHelper, progressable); - } - public UploadOperation(Context context, ProviderHelper providerHelper, Progressable progressable, AtomicBoolean cancelled) { super(context, providerHelper, progressable, cancelled); @@ -74,57 +66,99 @@ public class UploadOperation extends BaseOperation { @NonNull public UploadResult execute(UploadKeyringParcel uploadInput, CryptoInputParcel cryptoInput) { + OperationLog log = new OperationLog(); + + log.add(LogType.MSG_UPLOAD, 0); + updateProgress(R.string.progress_uploading, 0, 1); + Proxy proxy; - if (cryptoInput.getParcelableProxy() == null) { - // explicit proxy not set - if (!OrbotHelper.isOrbotInRequiredState(mContext)) { - return new UploadResult(null, RequiredInputParcel.createOrbotRequiredOperation(), cryptoInput); + { + boolean proxyIsTor = false; + + // Proxy priorities: + // 1. explicit proxy + // 2. orbot proxy state + // 3. proxy from preferences + ParcelableProxy parcelableProxy = cryptoInput.getParcelableProxy(); + if (parcelableProxy != null) { + proxy = parcelableProxy.getProxy(); + } else { + if ( ! OrbotHelper.isOrbotInRequiredState(mContext)) { + return new UploadResult(log, RequiredInputParcel.createOrbotRequiredOperation(), cryptoInput); + } + ProxyPrefs proxyPrefs = Preferences.getPreferences(mContext).getProxyPrefs(); + if (proxyPrefs.torEnabled) { + proxyIsTor = true; + } + proxy = proxyPrefs.getProxy(); } - proxy = Preferences.getPreferences(mContext).getProxyPrefs().parcelableProxy.getProxy(); - } else { - proxy = cryptoInput.getParcelableProxy().getProxy(); + + if (proxyIsTor) { + log.add(LogType.MSG_UPLOAD_PROXY_TOR, 1); + } else if (proxy != null && proxy != Proxy.NO_PROXY) { + log.add(LogType.MSG_UPLOAD_PROXY, 1, proxy.toString()); + } else { + log.add(LogType.MSG_UPLOAD_PROXY_DIRECT, 1); + } + + } + + HkpKeyserver hkpKeyserver; + { + hkpKeyserver = new HkpKeyserver(uploadInput.mKeyserver); + log.add(LogType.MSG_UPLOAD_SERVER, 1, hkpKeyserver.toString()); + } + + CanonicalizedPublicKeyRing keyring = getPublicKeyringFromInput(log, uploadInput); + if (keyring == null) { + return new UploadResult(UploadResult.RESULT_ERROR, log); + } + + return uploadKeyRingToServer(log, hkpKeyserver, keyring, proxy); + } + + @Nullable + private CanonicalizedPublicKeyRing getPublicKeyringFromInput(OperationLog log, UploadKeyringParcel uploadInput) { + + boolean hasMasterKeyId = uploadInput.mMasterKeyId != null; + boolean hasKeyringBytes = uploadInput.mUncachedKeyringBytes != null; + if (hasMasterKeyId == hasKeyringBytes) { + throw new IllegalArgumentException("either keyid xor bytes must be non-null for this method call!"); } - HkpKeyserver hkpKeyserver = new HkpKeyserver(uploadInput.mKeyserver); try { - CanonicalizedPublicKeyRing keyring; - if (uploadInput.mMasterKeyId != null) { - keyring = mProviderHelper.getCanonicalizedPublicKeyRing( - uploadInput.mMasterKeyId); - } else if (uploadInput.mUncachedKeyringBytes != null) { - CanonicalizedKeyRing canonicalizedRing = - UncachedKeyRing.decodeFromData(uploadInput.mUncachedKeyringBytes) - .canonicalize(new OperationLog(), 0, true); - if ( ! CanonicalizedPublicKeyRing.class.isInstance(canonicalizedRing)) { - throw new AssertionError("keyring bytes must contain public key ring!"); - } - keyring = (CanonicalizedPublicKeyRing) canonicalizedRing; - } else { - throw new AssertionError("key id or bytes must be non-null!"); + + if (hasMasterKeyId) { + log.add(LogType.MSG_UPLOAD_KEY, 0, KeyFormattingUtils.convertKeyIdToHex(uploadInput.mMasterKeyId)); + return mProviderHelper.getCanonicalizedPublicKeyRing(uploadInput.mMasterKeyId); } - return uploadKeyRingToServer(hkpKeyserver, keyring, proxy); + + CanonicalizedKeyRing canonicalizedRing = + UncachedKeyRing.decodeFromData(uploadInput.mUncachedKeyringBytes) + .canonicalize(new OperationLog(), 0, true); + if ( ! CanonicalizedPublicKeyRing.class.isInstance(canonicalizedRing)) { + throw new IllegalArgumentException("keyring bytes must contain public key ring!"); + } + log.add(LogType.MSG_UPLOAD_KEY, 0, KeyFormattingUtils.convertKeyIdToHex(canonicalizedRing.getMasterKeyId())); + return (CanonicalizedPublicKeyRing) canonicalizedRing; + } catch (ProviderHelper.NotFoundException e) { + log.add(LogType.MSG_UPLOAD_ERROR_NOT_FOUND, 1); + return null; + } catch (IOException | PgpGeneralException e) { + log.add(LogType.MSG_UPLOAD_ERROR_IO, 1); Log.e(Constants.TAG, "error uploading key", e); - return new UploadResult(UploadResult.RESULT_ERROR, new OperationLog()); - } catch (IOException e) { - e.printStackTrace(); - return new UploadResult(UploadResult.RESULT_ERROR, new OperationLog()); - } catch (PgpGeneralException e) { - e.printStackTrace(); - return new UploadResult(UploadResult.RESULT_ERROR, new OperationLog()); + return null; } - } - UploadResult uploadKeyRingToServer(HkpKeyserver server, CanonicalizedPublicKeyRing keyring, Proxy proxy) { + } - mProgressable.setProgress(R.string.progress_uploading, 0, 1); + @NonNull + private UploadResult uploadKeyRingToServer( + OperationLog log, HkpKeyserver server, CanonicalizedPublicKeyRing keyring, Proxy proxy) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ArmoredOutputStream aos = null; - OperationLog log = new OperationLog(); - log.add(LogType.MSG_BACKUP_UPLOAD_PUBLIC, 0, KeyFormattingUtils.convertKeyIdToHex( - keyring.getPublicKey().getKeyId() - )); try { aos = new ArmoredOutputStream(bos); @@ -134,20 +168,21 @@ public class UploadOperation extends BaseOperation { String armoredKey = bos.toString("UTF-8"); server.add(armoredKey, proxy); - log.add(LogType.MSG_BACKUP_UPLOAD_SUCCESS, 1); + updateProgress(R.string.progress_uploading, 1, 1); + + log.add(LogType.MSG_UPLOAD_SUCCESS, 1); return new UploadResult(UploadResult.RESULT_OK, log); } catch (IOException e) { Log.e(Constants.TAG, "IOException", e); - log.add(LogType.MSG_BACKUP_ERROR_KEY, 1); + log.add(LogType.MSG_UPLOAD_ERROR_IO, 1); return new UploadResult(UploadResult.RESULT_ERROR, log); } catch (AddKeyException e) { Log.e(Constants.TAG, "AddKeyException", e); - log.add(LogType.MSG_BACKUP_ERROR_UPLOAD, 1); + log.add(LogType.MSG_UPLOAD_ERROR_UPLOAD, 1); return new UploadResult(UploadResult.RESULT_ERROR, log); } finally { - mProgressable.setProgress(R.string.progress_uploading, 1, 1); try { if (aos != null) { aos.close(); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputPendingResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputPendingResult.java index 0a8c1f653..ed6674ef7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputPendingResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputPendingResult.java @@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.operations.results; import android.os.Parcel; +import android.support.annotation.NonNull; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; import org.sufficientlysecure.keychain.service.input.RequiredInputParcel; @@ -32,13 +33,13 @@ public class InputPendingResult extends OperationResult { // in case operation needs to add to/changes the cryptoInputParcel sent to it public final CryptoInputParcel mCryptoInputParcel; - public InputPendingResult(int result, OperationLog log) { + public InputPendingResult(int result, @NonNull OperationLog log) { super(result, log); mRequiredInput = null; mCryptoInputParcel = null; } - public InputPendingResult(OperationLog log, InputPendingResult result) { + public InputPendingResult(@NonNull OperationLog log, @NonNull InputPendingResult result) { super(RESULT_PENDING, log); if (!result.isPending()) { throw new AssertionError("sub result must be pending!"); @@ -47,7 +48,7 @@ public class InputPendingResult extends OperationResult { mCryptoInputParcel = result.mCryptoInputParcel; } - public InputPendingResult(OperationLog log, RequiredInputParcel requiredInput, + public InputPendingResult(@NonNull OperationLog log, RequiredInputParcel requiredInput, CryptoInputParcel cryptoInputParcel) { super(RESULT_PENDING, log); mRequiredInput = requiredInput; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java index 0b8c3e6c7..5b6b719ae 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java @@ -766,17 +766,24 @@ public abstract class OperationResult implements Parcelable { MSG_IMPORT_SUCCESS (LogLevel.OK, R.string.msg_import_success), MSG_BACKUP(LogLevel.START, R.plurals.msg_backup), - MSG_BACKUP_UPLOAD_PUBLIC(LogLevel.START, R.string.msg_backup_upload_public), MSG_BACKUP_PUBLIC(LogLevel.DEBUG, R.string.msg_backup_public), MSG_BACKUP_SECRET(LogLevel.DEBUG, R.string.msg_backup_secret), MSG_BACKUP_ALL(LogLevel.START, R.string.msg_backup_all), MSG_BACKUP_ERROR_URI_OPEN(LogLevel.ERROR, R.string.msg_backup_error_uri_open), MSG_BACKUP_ERROR_DB(LogLevel.ERROR, R.string.msg_backup_error_db), MSG_BACKUP_ERROR_IO(LogLevel.ERROR, R.string.msg_backup_error_io), - MSG_BACKUP_ERROR_KEY(LogLevel.ERROR, R.string.msg_backup_error_key), - MSG_BACKUP_ERROR_UPLOAD(LogLevel.ERROR, R.string.msg_backup_error_upload), MSG_BACKUP_SUCCESS(LogLevel.OK, R.string.msg_backup_success), - MSG_BACKUP_UPLOAD_SUCCESS(LogLevel.OK, R.string.msg_backup_upload_success), + + MSG_UPLOAD(LogLevel.START, R.string.msg_upload), + MSG_UPLOAD_KEY(LogLevel.INFO, R.string.msg_upload_key), + MSG_UPLOAD_PROXY_DIRECT(LogLevel.DEBUG, R.string.msg_upload_proxy_direct), + MSG_UPLOAD_PROXY_TOR(LogLevel.DEBUG, R.string.msg_upload_proxy_tor), + MSG_UPLOAD_PROXY(LogLevel.DEBUG, R.string.msg_upload_proxy), + MSG_UPLOAD_SERVER(LogLevel.DEBUG, R.string.msg_upload_server), + MSG_UPLOAD_SUCCESS(LogLevel.OK, R.string.msg_upload_success), + MSG_UPLOAD_ERROR_NOT_FOUND(LogLevel.ERROR, R.string.msg_upload_error_not_found), + MSG_UPLOAD_ERROR_IO(LogLevel.ERROR, R.string.msg_upload_error_key), + MSG_UPLOAD_ERROR_UPLOAD(LogLevel.ERROR, R.string.msg_upload_error_upload), MSG_CRT_UPLOAD_SUCCESS (LogLevel.OK, R.string.msg_crt_upload_success), diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/UploadResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/UploadResult.java index a88072de3..ea2b373a9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/UploadResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/UploadResult.java @@ -18,6 +18,7 @@ package org.sufficientlysecure.keychain.operations.results; import android.os.Parcel; +import android.support.annotation.NonNull; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; import org.sufficientlysecure.keychain.service.input.RequiredInputParcel; @@ -38,7 +39,7 @@ public class UploadResult extends InputPendingResult { } - public UploadResult(OperationLog log, RequiredInputParcel requiredInputParcel, + public UploadResult(@NonNull OperationLog log, RequiredInputParcel requiredInputParcel, CryptoInputParcel cryptoInputParcel) { super(log, requiredInputParcel, cryptoInputParcel); // we won't use these values diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java index 0d8569fe6..849418905 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java @@ -23,6 +23,7 @@ import android.os.Parcelable; import org.sufficientlysecure.keychain.util.ParcelableProxy; import org.sufficientlysecure.keychain.util.Passphrase; +import java.net.Proxy; import java.nio.ByteBuffer; import java.util.Date; import java.util.HashMap; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java index 7e788d04c..ade75f926 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java @@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.util; import android.os.Parcel; import android.os.Parcelable; +import android.support.annotation.Nullable; import java.net.InetSocketAddress; import java.net.Proxy; @@ -47,6 +48,7 @@ public class ParcelableProxy implements Parcelable { return new ParcelableProxy(null, -1, null); } + @Nullable public Proxy getProxy() { if (mProxyHost == null) { return null; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java index 8b2c3c66a..32d98826d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java @@ -23,6 +23,8 @@ import android.content.SharedPreferences; import android.content.res.Resources; import android.preference.PreferenceManager; +import android.support.annotation.Nullable; + import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants.Pref; import org.sufficientlysecure.keychain.service.KeyserverSyncAdapterService; @@ -322,6 +324,11 @@ public class Preferences { if (!torEnabled && !normalPorxyEnabled) this.parcelableProxy = new ParcelableProxy(null, -1, null); else this.parcelableProxy = new ParcelableProxy(hostName, port, type); } + + public Proxy getProxy() { + return parcelableProxy.getProxy(); + } + } // cloud prefs diff --git a/OpenKeychain/src/main/res/values-ja/strings.xml b/OpenKeychain/src/main/res/values-ja/strings.xml index db7f8ee98..a2e68ac66 100644 --- a/OpenKeychain/src/main/res/values-ja/strings.xml +++ b/OpenKeychain/src/main/res/values-ja/strings.xml @@ -1179,15 +1179,15 @@ すべての鍵とバックアップ 公開鍵 %s のバックアップを作成中 - 公開鍵 %s をアップロード中 + 公開鍵 %s をアップロード中 秘密鍵 %s のバックアップを作成中 URIオープン時にエラー! データベースエラー! 入出力エラー! - 鍵データの事前処理のエラー! - サーバに鍵をアップロード中にエラー! インターネット接続を確認してください + 鍵データの事前処理のエラー! + サーバに鍵をアップロード中にエラー! インターネット接続を確認してください バックアップ操作に成功 - 鍵サーバへアップロードに成功 + 鍵サーバへアップロードに成功 削除するものがありません! 秘密鍵は個別にしか削除できません! diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index fa745cb5b..bc22237d7 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -1299,15 +1299,22 @@ "Backup with all keys" "Creating backup of public key %s" - "Uploading public key %s" "Creating backup of secret key %s" "Error opening URI stream!" "Database error!" "Input/output error!" - "Error preprocessing key data!" - "Error uploading key to server! Please check your Internet connection" "Backup operation successful" - "Upload to keyserver successful" + + "Uploading public key" + "Using proxy: none" + "Using proxy: TOR" + "Using proxy: %s" + "Server: %s" + "Key id: %s" + "Error preprocessing key data!" + "Key not found!" + "Error uploading key to server! Please check your Internet connection" + "Upload to keyserver successful" "Nothing to delete!" "Secret keys can only be deleted individually!" -- cgit v1.2.3 From 64a09a89451b09aaa54090c2e6373814edb5d0eb Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Thu, 29 Oct 2015 15:08:57 +0100 Subject: encrypttext: fix mimetype check logic (#1574) --- .../java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java index 201465b52..0afb942b5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java @@ -28,6 +28,7 @@ import android.os.Bundle; import android.support.v4.app.FragmentTransaction; import android.widget.Toast; +import org.apache.james.mime4j.util.MimeUtil; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.intents.OpenKeychainIntents; @@ -64,7 +65,7 @@ public class EncryptTextActivity extends EncryptActivity { Log.logDebugBundle(extras, "extras"); // When sending to OpenKeychain Encrypt via share menu - if ("text/plain".equals(type)) { + if ( ! MimeUtil.isSameMimeType("text/plain", type)) { Toast.makeText(this, R.string.toast_wrong_mimetype, Toast.LENGTH_LONG).show(); finish(); return; -- cgit v1.2.3 From a665dd60fbf52eccb04980bb040569967a617ebe Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Thu, 29 Oct 2015 15:43:16 +0100 Subject: use Proxy.NO_PROXY instead of null value for no proxy --- .../sufficientlysecure/keychain/keyimport/CloudSearch.java | 9 ++++++--- .../sufficientlysecure/keychain/keyimport/HkpKeyserver.java | 8 +++++--- .../keychain/operations/ImportOperation.java | 11 ++++------- .../keychain/operations/UploadOperation.java | 6 +++--- .../org/sufficientlysecure/keychain/util/ParcelableProxy.java | 11 ++++++----- .../org/sufficientlysecure/keychain/util/Preferences.java | 2 ++ OpenKeychain/src/main/res/values/strings.xml | 2 +- 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java index 4e68e76c5..4d2bc8593 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java @@ -24,6 +24,9 @@ import java.net.Proxy; import java.util.ArrayList; import java.util.Vector; +import android.support.annotation.NonNull; + + /** * Search two or more types of server for online keys. */ @@ -31,8 +34,8 @@ public class CloudSearch { private final static long SECONDS = 1000; - public static ArrayList search(final String query, Preferences.CloudSearchPrefs cloudPrefs, - final Proxy proxy) + public static ArrayList search( + @NonNull final String query, Preferences.CloudSearchPrefs cloudPrefs, @NonNull final Proxy proxy) throws Keyserver.CloudSearchFailureException { final ArrayList servers = new ArrayList<>(); @@ -68,7 +71,7 @@ public class CloudSearch { // wait for either all the searches to come back, or 10 seconds. If using proxy, wait 30 seconds. synchronized (results) { try { - if (proxy != null) { + if (proxy == Proxy.NO_PROXY) { results.wait(30 * SECONDS); } else { results.wait(10 * SECONDS); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java index 3b52a0306..f05ff3836 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java @@ -46,6 +46,8 @@ import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; +import android.support.annotation.NonNull; + import de.measite.minidns.Client; import de.measite.minidns.Question; import de.measite.minidns.Record; @@ -226,7 +228,7 @@ public class HkpKeyserver extends Keyserver { return client; } - private String query(String request, Proxy proxy) throws QueryFailedException, HttpError { + private String query(String request, @NonNull Proxy proxy) throws QueryFailedException, HttpError { try { URL url = new URL(getUrlPrefix() + mHost + ":" + mPort + request); Log.d(Constants.TAG, "hkp keyserver query: " + url + " Proxy: " + proxy); @@ -243,7 +245,7 @@ public class HkpKeyserver extends Keyserver { } catch (IOException e) { Log.e(Constants.TAG, "IOException at HkpKeyserver", e); throw new QueryFailedException("Keyserver '" + mHost + "' is unavailable. Check your Internet connection!" + - (proxy == null ? "" : " Using proxy " + proxy)); + (proxy == Proxy.NO_PROXY ? "" : " Using proxy " + proxy)); } } @@ -373,7 +375,7 @@ public class HkpKeyserver extends Keyserver { } @Override - public String get(String keyIdHex, Proxy proxy) throws QueryFailedException { + public String get(String keyIdHex, @NonNull Proxy proxy) throws QueryFailedException { String request = "/pks/lookup?op=get&options=mr&search=" + keyIdHex; Log.d(Constants.TAG, "hkp keyserver get: " + request + " using Proxy: " + proxy); String data; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java index 89575338f..76223becc 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java @@ -133,7 +133,7 @@ public class ImportOperation extends BaseOperation { @NonNull private ImportKeyResult serialKeyRingImport(Iterator entries, int num, String keyServerUri, Progressable progressable, - Proxy proxy) { + @NonNull Proxy proxy) { if (progressable != null) { progressable.setProgress(R.string.progress_importing, 0, 100); } @@ -197,8 +197,7 @@ public class ImportOperation extends BaseOperation { if (entry.mExpectedFingerprint != null) { log.add(LogType.MSG_IMPORT_FETCH_KEYSERVER, 2, "0x" + entry.mExpectedFingerprint.substring(24)); - data = keyServer.get("0x" + entry.mExpectedFingerprint, proxy) - .getBytes(); + data = keyServer.get("0x" + entry.mExpectedFingerprint, proxy).getBytes(); } else { log.add(LogType.MSG_IMPORT_FETCH_KEYSERVER, 2, entry.mKeyIdHex); data = keyServer.get(entry.mKeyIdHex, proxy).getBytes(); @@ -400,8 +399,7 @@ public class ImportOperation extends BaseOperation { return new ImportKeyResult(null, RequiredInputParcel.createOrbotRequiredOperation(), cryptoInput); } - proxy = Preferences.getPreferences(mContext).getProxyPrefs().parcelableProxy - .getProxy(); + proxy = Preferences.getPreferences(mContext).getProxyPrefs().getProxy(); } else { proxy = cryptoInput.getParcelableProxy().getProxy(); } @@ -444,8 +442,7 @@ public class ImportOperation extends BaseOperation { ArrayList list = new ArrayList<>(); list.add(pkRing); - return serialKeyRingImport(list.iterator(), 1, keyServer, - ignoreProgressable, proxy); + return serialKeyRingImport(list.iterator(), 1, keyServer, ignoreProgressable, proxy); } }; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java index d4bbaa9fd..836894f59 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java @@ -95,10 +95,10 @@ public class UploadOperation extends BaseOperation { if (proxyIsTor) { log.add(LogType.MSG_UPLOAD_PROXY_TOR, 1); - } else if (proxy != null && proxy != Proxy.NO_PROXY) { - log.add(LogType.MSG_UPLOAD_PROXY, 1, proxy.toString()); - } else { + } else if (proxy == Proxy.NO_PROXY) { log.add(LogType.MSG_UPLOAD_PROXY_DIRECT, 1); + } else { + log.add(LogType.MSG_UPLOAD_PROXY, 1, proxy.toString()); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java index ade75f926..7e2328e99 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java @@ -17,13 +17,14 @@ package org.sufficientlysecure.keychain.util; -import android.os.Parcel; -import android.os.Parcelable; -import android.support.annotation.Nullable; import java.net.InetSocketAddress; import java.net.Proxy; +import android.os.Parcel; +import android.os.Parcelable; +import android.support.annotation.NonNull; + /** * used to simply transport java.net.Proxy objects created using InetSockets between services/activities */ @@ -48,10 +49,10 @@ public class ParcelableProxy implements Parcelable { return new ParcelableProxy(null, -1, null); } - @Nullable + @NonNull public Proxy getProxy() { if (mProxyHost == null) { - return null; + return Proxy.NO_PROXY; } /* * InetSocketAddress.createUnresolved so we can use this method even in the main thread diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java index 32d98826d..559c5556f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java @@ -23,6 +23,7 @@ import android.content.SharedPreferences; import android.content.res.Resources; import android.preference.PreferenceManager; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; import org.sufficientlysecure.keychain.Constants; @@ -325,6 +326,7 @@ public class Preferences { else this.parcelableProxy = new ParcelableProxy(hostName, port, type); } + @NonNull public Proxy getProxy() { return parcelableProxy.getProxy(); } diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index bc22237d7..d86022b54 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -1306,7 +1306,7 @@ "Backup operation successful" "Uploading public key" - "Using proxy: none" + "Using proxy: None" "Using proxy: TOR" "Using proxy: %s" "Server: %s" -- cgit v1.2.3 From 1c83c33d35ae68a301c18d94c155d3bb7ddf3dd0 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Thu, 29 Oct 2015 16:01:24 +0100 Subject: editkey: always return EditKeyResult --- .../keychain/operations/EditKeyOperation.java | 17 +++++++---------- .../keychain/operations/RevokeOperation.java | 8 ++++---- .../keychain/operations/results/EditKeyResult.java | 5 +++++ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java index 93ee76f3f..3b2c484be 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java @@ -26,7 +26,6 @@ import android.support.annotation.NonNull; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.operations.results.EditKeyResult; -import org.sufficientlysecure.keychain.operations.results.InputPendingResult; import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType; import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog; import org.sufficientlysecure.keychain.operations.results.PgpEditKeyResult; @@ -73,7 +72,7 @@ public class EditKeyOperation extends BaseOperation { * @return the result of the operation */ @NonNull - public InputPendingResult execute(SaveKeyringParcel saveParcel, CryptoInputParcel cryptoInput) { + public EditKeyResult execute(SaveKeyringParcel saveParcel, CryptoInputParcel cryptoInput) { OperationLog log = new OperationLog(); log.add(LogType.MSG_ED, 0); @@ -100,7 +99,8 @@ public class EditKeyOperation extends BaseOperation { modifyResult = keyOperations.modifySecretKeyRing(secRing, cryptoInput, saveParcel); if (modifyResult.isPending()) { - return modifyResult; + log.add(modifyResult, 1); + return new EditKeyResult(log, modifyResult); } } catch (NotFoundException e) { @@ -151,16 +151,13 @@ public class EditKeyOperation extends BaseOperation { new UploadOperation(mContext, mProviderHelper, mProgressable, mCancelled) .execute(exportKeyringParcel, cryptoInput); + log.add(uploadResult, 2); + if (uploadResult.isPending()) { - return uploadResult; + return new EditKeyResult(log, uploadResult); } else if (!uploadResult.success() && saveParcel.isUploadAtomic()) { // if atomic, update fail implies edit operation should also fail and not save - log.add(uploadResult, 2); - return new EditKeyResult(log, RequiredInputParcel.createRetryUploadOperation(), - cryptoInput); - } else { - // upload succeeded or not atomic so we continue - log.add(uploadResult, 2); + return new EditKeyResult(log, RequiredInputParcel.createRetryUploadOperation(), cryptoInput); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java index 975cf541a..3e787560a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java @@ -19,12 +19,13 @@ package org.sufficientlysecure.keychain.operations; + import android.content.Context; import android.net.Uri; import android.support.annotation.NonNull; import org.sufficientlysecure.keychain.Constants; -import org.sufficientlysecure.keychain.operations.results.InputPendingResult; +import org.sufficientlysecure.keychain.operations.results.EditKeyResult; import org.sufficientlysecure.keychain.operations.results.OperationResult; import org.sufficientlysecure.keychain.operations.results.RevokeResult; import org.sufficientlysecure.keychain.pgp.Progressable; @@ -79,9 +80,8 @@ public class RevokeOperation extends BaseOperation { saveKeyringParcel.mRevokeSubKeys.add(masterKeyId); - InputPendingResult revokeAndUploadResult = new EditKeyOperation(mContext, - mProviderHelper, mProgressable, mCancelled) - .execute(saveKeyringParcel, cryptoInputParcel); + EditKeyResult revokeAndUploadResult = new EditKeyOperation(mContext, + mProviderHelper, mProgressable, mCancelled).execute(saveKeyringParcel, cryptoInputParcel); if (revokeAndUploadResult.isPending()) { return revokeAndUploadResult; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/EditKeyResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/EditKeyResult.java index 6098d59d5..fa383a7b5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/EditKeyResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/EditKeyResult.java @@ -38,6 +38,11 @@ public class EditKeyResult extends InputPendingResult { mMasterKeyId = null; } + public EditKeyResult(OperationLog log, InputPendingResult result) { + super(log, result); + mMasterKeyId = null; + } + public EditKeyResult(Parcel source) { super(source); mMasterKeyId = source.readInt() != 0 ? source.readLong() : null; -- cgit v1.2.3 From ee79cc76d399ff499ee794ac694147341c8e5133 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Thu, 29 Oct 2015 16:58:20 +0100 Subject: make use of proxies a Keyserver property --- .../keychain/keyimport/CloudSearch.java | 8 ++--- .../keychain/keyimport/HkpKeyserver.java | 35 ++++++++++++---------- .../keychain/keyimport/KeybaseKeyserver.java | 24 ++++++++------- .../keychain/keyimport/Keyserver.java | 6 ++-- .../keychain/operations/ImportOperation.java | 10 +++---- .../keychain/operations/UploadOperation.java | 8 ++--- .../keychain/util/EmailKeyHelper.java | 13 ++++---- 7 files changed, 55 insertions(+), 49 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java index 4d2bc8593..869d107ab 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java @@ -35,7 +35,7 @@ public class CloudSearch { private final static long SECONDS = 1000; public static ArrayList search( - @NonNull final String query, Preferences.CloudSearchPrefs cloudPrefs, @NonNull final Proxy proxy) + @NonNull final String query, Preferences.CloudSearchPrefs cloudPrefs, @NonNull Proxy proxy) throws Keyserver.CloudSearchFailureException { final ArrayList servers = new ArrayList<>(); @@ -43,10 +43,10 @@ public class CloudSearch { final Vector problems = new Vector<>(); if (cloudPrefs.searchKeyserver) { - servers.add(new HkpKeyserver(cloudPrefs.keyserver)); + servers.add(new HkpKeyserver(cloudPrefs.keyserver, proxy)); } if (cloudPrefs.searchKeybase) { - servers.add(new KeybaseKeyserver()); + servers.add(new KeybaseKeyserver(proxy)); } final ImportKeysList results = new ImportKeysList(servers.size()); @@ -56,7 +56,7 @@ public class CloudSearch { @Override public void run() { try { - results.addAll(keyserver.search(query, proxy)); + results.addAll(keyserver.search(query)); } catch (Keyserver.CloudSearchFailureException e) { problems.add(e); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java index f05ff3836..6eab13126 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java @@ -76,6 +76,7 @@ public class HkpKeyserver extends Keyserver { private String mHost; private short mPort; + private Proxy mProxy; private boolean mSecure; /** @@ -152,17 +153,17 @@ public class HkpKeyserver extends Keyserver { * connect using {@link #PORT_DEFAULT}. However, port may be specified after colon * ("hostname:port", eg. "p80.pool.sks-keyservers.net:80"). */ - public HkpKeyserver(String hostAndPort) { + public HkpKeyserver(String hostAndPort, Proxy proxy) { String host = hostAndPort; short port = PORT_DEFAULT; boolean secure = false; String[] parts = hostAndPort.split(":"); if (parts.length > 1) { if (!parts[0].contains(".")) { // This is not a domain or ip, so it must be a protocol name - if (parts[0].equalsIgnoreCase("hkps") || parts[0].equalsIgnoreCase("https")) { + if ("hkps".equalsIgnoreCase(parts[0]) || "https".equalsIgnoreCase(parts[0])) { secure = true; port = PORT_DEFAULT_HKPS; - } else if (!parts[0].equalsIgnoreCase("hkp") && !parts[0].equalsIgnoreCase("http")) { + } else if (!"hkp".equalsIgnoreCase(parts[0]) && !"http".equalsIgnoreCase(parts[0])) { throw new IllegalArgumentException("Protocol " + parts[0] + " is unknown"); } host = parts[1]; @@ -179,16 +180,18 @@ public class HkpKeyserver extends Keyserver { } mHost = host; mPort = port; + mProxy = proxy; mSecure = secure; } - public HkpKeyserver(String host, short port) { - this(host, port, false); + public HkpKeyserver(String host, short port, Proxy proxy) { + this(host, port, proxy, false); } - public HkpKeyserver(String host, short port, boolean secure) { + public HkpKeyserver(String host, short port, Proxy proxy, boolean secure) { mHost = host; mPort = port; + mProxy = proxy; mSecure = secure; } @@ -253,7 +256,7 @@ public class HkpKeyserver extends Keyserver { * Results are sorted by creation date of key! */ @Override - public ArrayList search(String query, Proxy proxy) throws QueryFailedException, + public ArrayList search(String query) throws QueryFailedException, QueryNeedsRepairException { ArrayList results = new ArrayList<>(); @@ -271,7 +274,7 @@ public class HkpKeyserver extends Keyserver { String data; try { - data = query(request, proxy); + data = query(request, mProxy); } catch (HttpError e) { if (e.getData() != null) { Log.d(Constants.TAG, "returned error data: " + e.getData().toLowerCase(Locale.ENGLISH)); @@ -375,12 +378,12 @@ public class HkpKeyserver extends Keyserver { } @Override - public String get(String keyIdHex, @NonNull Proxy proxy) throws QueryFailedException { + public String get(String keyIdHex) throws QueryFailedException { String request = "/pks/lookup?op=get&options=mr&search=" + keyIdHex; - Log.d(Constants.TAG, "hkp keyserver get: " + request + " using Proxy: " + proxy); + Log.d(Constants.TAG, "hkp keyserver get: " + request + " using Proxy: " + mProxy); String data; try { - data = query(request, proxy); + data = query(request, mProxy); } catch (HttpError httpError) { Log.d(Constants.TAG, "Failed to get key at HkpKeyserver", httpError); throw new QueryFailedException("not found"); @@ -396,7 +399,7 @@ public class HkpKeyserver extends Keyserver { } @Override - public void add(String armoredKey, Proxy proxy) throws AddKeyException { + public void add(String armoredKey) throws AddKeyException { try { String path = "/pks/add"; String params; @@ -407,7 +410,7 @@ public class HkpKeyserver extends Keyserver { } URL url = new URL(getUrlPrefix() + mHost + ":" + mPort + path); - Log.d(Constants.TAG, "hkp keyserver add: " + url.toString()); + Log.d(Constants.TAG, "hkp keyserver add: " + url); Log.d(Constants.TAG, "params: " + params); RequestBody body = RequestBody.create(MediaType.parse("application/x-www-form-urlencoded"), params); @@ -419,7 +422,7 @@ public class HkpKeyserver extends Keyserver { .post(body) .build(); - Response response = getClient(url, proxy).newCall(request).execute(); + Response response = getClient(url, mProxy).newCall(request).execute(); Log.d(Constants.TAG, "response code: " + response.code()); Log.d(Constants.TAG, "answer: " + response.body().string()); @@ -445,7 +448,7 @@ public class HkpKeyserver extends Keyserver { * @return A responsible Keyserver or null if not found. * TODO: Add proxy functionality */ - public static HkpKeyserver resolve(String domain) { + public static HkpKeyserver resolve(String domain, Proxy proxy) { try { Record[] records = new Client().query(new Question("_hkp._tcp." + domain, Record.TYPE.SRV)).getAnswers(); if (records.length > 0) { @@ -460,7 +463,7 @@ public class HkpKeyserver extends Keyserver { Record record = records[0]; // This is our best choice if (record.getPayload().getType() == Record.TYPE.SRV) { return new HkpKeyserver(((SRV) record.getPayload()).getName(), - (short) ((SRV) record.getPayload()).getPort()); + (short) ((SRV) record.getPayload()).getPort(), proxy); } } } catch (Exception ignored) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserver.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserver.java index 486d658f6..e4cd6738b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserver.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserver.java @@ -33,10 +33,15 @@ import java.util.List; public class KeybaseKeyserver extends Keyserver { public static final String ORIGIN = "keybase:keybase.io"; - private String mQuery; + + Proxy mProxy; + + public KeybaseKeyserver(Proxy proxy) { + mProxy = proxy; + } @Override - public ArrayList search(String query, Proxy proxy) throws QueryFailedException, + public ArrayList search(String query) throws QueryFailedException, QueryNeedsRepairException { ArrayList results = new ArrayList<>(); @@ -47,14 +52,13 @@ public class KeybaseKeyserver extends Keyserver { if (query.isEmpty()) { throw new QueryTooShortException(); } - mQuery = query; try { KeybaseQuery keybaseQuery = new KeybaseQuery(new OkHttpKeybaseClient()); - keybaseQuery.setProxy(proxy); + keybaseQuery.setProxy(mProxy); Iterable matches = keybaseQuery.search(query); for (Match match : matches) { - results.add(makeEntry(match)); + results.add(makeEntry(match, query)); } } catch (KeybaseException e) { Log.e(Constants.TAG, "keybase result parsing error", e); @@ -64,9 +68,9 @@ public class KeybaseKeyserver extends Keyserver { return results; } - private ImportKeysListEntry makeEntry(Match match) throws KeybaseException { + private ImportKeysListEntry makeEntry(Match match, String query) throws KeybaseException { final ImportKeysListEntry entry = new ImportKeysListEntry(); - entry.setQuery(mQuery); + entry.setQuery(query); entry.addOrigin(ORIGIN); entry.setRevoked(false); // keybase doesn’t say anything about revoked keys @@ -102,10 +106,10 @@ public class KeybaseKeyserver extends Keyserver { } @Override - public String get(String id, Proxy proxy) throws QueryFailedException { + public String get(String id) throws QueryFailedException { try { KeybaseQuery keybaseQuery = new KeybaseQuery(new OkHttpKeybaseClient()); - keybaseQuery.setProxy(proxy); + keybaseQuery.setProxy(mProxy); return User.keyForUsername(keybaseQuery, id); } catch (KeybaseException e) { throw new QueryFailedException(e.getMessage()); @@ -113,7 +117,7 @@ public class KeybaseKeyserver extends Keyserver { } @Override - public void add(String armoredKey, Proxy proxy) throws AddKeyException { + public void add(String armoredKey) throws AddKeyException { throw new AddKeyException(); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/Keyserver.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/Keyserver.java index 15e0d94e9..00e8d6ac5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/Keyserver.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/Keyserver.java @@ -69,12 +69,12 @@ public abstract class Keyserver { private static final long serialVersionUID = -507574859137295530L; } - public abstract List search(String query, Proxy proxy) + public abstract List search(String query) throws QueryFailedException, QueryNeedsRepairException; - public abstract String get(String keyIdHex, Proxy proxy) throws QueryFailedException; + public abstract String get(String keyIdHex) throws QueryFailedException; - public abstract void add(String armoredKey, Proxy proxy) throws AddKeyException; + public abstract void add(String armoredKey) throws AddKeyException; public static String readAll(InputStream in, String encoding) throws IOException { ByteArrayOutputStream raw = new ByteArrayOutputStream(); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java index 76223becc..a04200ba1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java @@ -188,7 +188,7 @@ public class ImportOperation extends BaseOperation { // Make sure we have the keyserver instance cached if (keyServer == null) { log.add(LogType.MSG_IMPORT_KEYSERVER, 1, keyServerUri); - keyServer = new HkpKeyserver(keyServerUri); + keyServer = new HkpKeyserver(keyServerUri, proxy); } try { @@ -197,10 +197,10 @@ public class ImportOperation extends BaseOperation { if (entry.mExpectedFingerprint != null) { log.add(LogType.MSG_IMPORT_FETCH_KEYSERVER, 2, "0x" + entry.mExpectedFingerprint.substring(24)); - data = keyServer.get("0x" + entry.mExpectedFingerprint, proxy).getBytes(); + data = keyServer.get("0x" + entry.mExpectedFingerprint).getBytes(); } else { log.add(LogType.MSG_IMPORT_FETCH_KEYSERVER, 2, entry.mKeyIdHex); - data = keyServer.get(entry.mKeyIdHex, proxy).getBytes(); + data = keyServer.get(entry.mKeyIdHex).getBytes(); } key = UncachedKeyRing.decodeFromData(data); if (key != null) { @@ -218,12 +218,12 @@ public class ImportOperation extends BaseOperation { if (entry.mKeybaseName != null) { // Make sure we have this cached if (keybaseServer == null) { - keybaseServer = new KeybaseKeyserver(); + keybaseServer = new KeybaseKeyserver(proxy); } try { log.add(LogType.MSG_IMPORT_FETCH_KEYBASE, 2, entry.mKeybaseName); - byte[] data = keybaseServer.get(entry.mKeybaseName, proxy).getBytes(); + byte[] data = keybaseServer.get(entry.mKeybaseName).getBytes(); UncachedKeyRing keybaseKey = UncachedKeyRing.decodeFromData(data); // If there already is a key, merge the two diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java index 836894f59..e5f11eaa6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java @@ -105,7 +105,7 @@ public class UploadOperation extends BaseOperation { HkpKeyserver hkpKeyserver; { - hkpKeyserver = new HkpKeyserver(uploadInput.mKeyserver); + hkpKeyserver = new HkpKeyserver(uploadInput.mKeyserver, proxy); log.add(LogType.MSG_UPLOAD_SERVER, 1, hkpKeyserver.toString()); } @@ -114,7 +114,7 @@ public class UploadOperation extends BaseOperation { return new UploadResult(UploadResult.RESULT_ERROR, log); } - return uploadKeyRingToServer(log, hkpKeyserver, keyring, proxy); + return uploadKeyRingToServer(log, hkpKeyserver, keyring); } @Nullable @@ -155,7 +155,7 @@ public class UploadOperation extends BaseOperation { @NonNull private UploadResult uploadKeyRingToServer( - OperationLog log, HkpKeyserver server, CanonicalizedPublicKeyRing keyring, Proxy proxy) { + OperationLog log, HkpKeyserver server, CanonicalizedPublicKeyRing keyring) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ArmoredOutputStream aos = null; @@ -166,7 +166,7 @@ public class UploadOperation extends BaseOperation { aos.close(); String armoredKey = bos.toString("UTF-8"); - server.add(armoredKey, proxy); + server.add(armoredKey); updateProgress(R.string.progress_uploading, 1, 1); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java index 9a6d33260..a55249842 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java @@ -74,9 +74,9 @@ public class EmailKeyHelper { // Try _hkp._tcp SRV record first String[] mailparts = mail.split("@"); if (mailparts.length == 2) { - HkpKeyserver hkp = HkpKeyserver.resolve(mailparts[1]); + HkpKeyserver hkp = HkpKeyserver.resolve(mailparts[1], proxy); if (hkp != null) { - keys.addAll(getEmailKeys(mail, hkp, proxy)); + keys.addAll(getEmailKeys(mail, hkp)); } } @@ -84,18 +84,17 @@ public class EmailKeyHelper { // Most users don't have the SRV record, so ask a default server as well String server = Preferences.getPreferences(context).getPreferredKeyserver(); if (server != null) { - HkpKeyserver hkp = new HkpKeyserver(server); - keys.addAll(getEmailKeys(mail, hkp, proxy)); + HkpKeyserver hkp = new HkpKeyserver(server, proxy); + keys.addAll(getEmailKeys(mail, hkp)); } } return keys; } - public static List getEmailKeys(String mail, Keyserver keyServer, - Proxy proxy) { + public static List getEmailKeys(String mail, Keyserver keyServer) { Set keys = new HashSet<>(); try { - for (ImportKeysListEntry key : keyServer.search(mail, proxy)) { + for (ImportKeysListEntry key : keyServer.search(mail)) { if (key.isRevoked() || key.isExpired()) continue; for (String userId : key.getUserIds()) { if (userId.toLowerCase().contains(mail.toLowerCase(Locale.ENGLISH))) { -- cgit v1.2.3 From 55e22e68b45657d97128f99f0f13bc8a16a9d61a Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Thu, 29 Oct 2015 17:14:22 +0100 Subject: import: reduce number of threads a little, and code cleanup --- .../keychain/operations/ImportOperation.java | 76 +++++++++++----------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java index a04200ba1..948c0654e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java @@ -82,6 +82,8 @@ import org.sufficientlysecure.keychain.util.orbot.OrbotHelper; */ public class ImportOperation extends BaseOperation { + public static final int MAX_THREADS = 10; + public ImportOperation(Context context, ProviderHelper providerHelper, Progressable progressable) { super(context, providerHelper, progressable); @@ -412,61 +414,57 @@ public class ImportOperation extends BaseOperation { } @NonNull - private ImportKeyResult multiThreadedKeyImport(Iterator keyListIterator, + private ImportKeyResult multiThreadedKeyImport(@NonNull Iterator keyListIterator, int totKeys, final String keyServer, final Proxy proxy) { Log.d(Constants.TAG, "Multi-threaded key import starting"); - if (keyListIterator != null) { - KeyImportAccumulator accumulator = new KeyImportAccumulator(totKeys, mProgressable); + KeyImportAccumulator accumulator = new KeyImportAccumulator(totKeys, mProgressable); - final ProgressScaler ignoreProgressable = new ProgressScaler(); + final ProgressScaler ignoreProgressable = new ProgressScaler(); - final int maxThreads = 200; - ExecutorService importExecutor = new ThreadPoolExecutor(0, maxThreads, - 30L, TimeUnit.SECONDS, - new SynchronousQueue()); + ExecutorService importExecutor = new ThreadPoolExecutor(0, MAX_THREADS, 30L, TimeUnit.SECONDS, + new SynchronousQueue()); - ExecutorCompletionService importCompletionService = - new ExecutorCompletionService<>(importExecutor); + ExecutorCompletionService importCompletionService = + new ExecutorCompletionService<>(importExecutor); - while (keyListIterator.hasNext()) { // submit all key rings to be imported + while (keyListIterator.hasNext()) { // submit all key rings to be imported - final ParcelableKeyRing pkRing = keyListIterator.next(); + final ParcelableKeyRing pkRing = keyListIterator.next(); - Callable importOperationCallable = new Callable - () { + Callable importOperationCallable = new Callable + () { - @Override - public ImportKeyResult call() { + @Override + public ImportKeyResult call() { - ArrayList list = new ArrayList<>(); - list.add(pkRing); + ArrayList list = new ArrayList<>(); + list.add(pkRing); - return serialKeyRingImport(list.iterator(), 1, keyServer, ignoreProgressable, proxy); - } - }; + return serialKeyRingImport(list.iterator(), 1, keyServer, ignoreProgressable, proxy); + } + }; - importCompletionService.submit(importOperationCallable); - } + importCompletionService.submit(importOperationCallable); + } - while (!accumulator.isImportFinished()) { // accumulate the results of each import - try { - accumulator.accumulateKeyImport(importCompletionService.take().get()); - } catch (InterruptedException | ExecutionException e) { - Log.e(Constants.TAG, "A key could not be imported during multi-threaded " + - "import", e); - // do nothing? - if (e instanceof ExecutionException) { - // Since serialKeyRingImport does not throw any exceptions, this is what - // would have happened if - // we were importing the key on this thread - throw new RuntimeException(); - } + while (!accumulator.isImportFinished()) { // accumulate the results of each import + try { + accumulator.accumulateKeyImport(importCompletionService.take().get()); + } catch (InterruptedException | ExecutionException e) { + Log.e(Constants.TAG, "A key could not be imported during multi-threaded " + + "import", e); + // do nothing? + if (e instanceof ExecutionException) { + // Since serialKeyRingImport does not throw any exceptions, this is what + // would have happened if + // we were importing the key on this thread + throw new RuntimeException(); } } - return accumulator.getConsolidatedResult(); } - return new ImportKeyResult(ImportKeyResult.RESULT_FAIL_NOTHING, new OperationLog()); + return accumulator.getConsolidatedResult(); + } /** @@ -500,7 +498,7 @@ public class ImportOperation extends BaseOperation { } } - public synchronized void accumulateKeyImport(ImportKeyResult result) { + public void accumulateKeyImport(ImportKeyResult result) { mImportedKeys++; if (mProgressable != null) { -- cgit v1.2.3 From e45636c07a5bb17f8327e20ee8feac9904bebba8 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Thu, 29 Oct 2015 18:21:49 +0100 Subject: import: make operation cancelable (again), make "update all" cancelable (also, use unbounded blocking queue to fix update of more than 10 keys) --- .../keychain/keyimport/HkpKeyserver.java | 1 - .../keychain/operations/ImportOperation.java | 44 ++++++++++++++-------- .../keychain/ui/KeyListFragment.java | 4 +- .../keychain/ui/base/CryptoOperationHelper.java | 7 +++- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java index 6eab13126..c2190318b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java @@ -446,7 +446,6 @@ public class HkpKeyserver extends Keyserver { * Tries to find a server responsible for a given domain * * @return A responsible Keyserver or null if not found. - * TODO: Add proxy functionality */ public static HkpKeyserver resolve(String domain, Proxy proxy) { try { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java index 948c0654e..8a4998b8f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java @@ -28,7 +28,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.ExecutorService; -import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; @@ -262,12 +262,6 @@ public class ImportOperation extends BaseOperation { continue; } - // Another check if we have been cancelled - if (checkCancelled()) { - cancelled = true; - break; - } - SaveKeyringResult result; // synchronizing prevents https://github.com/open-keychain/open-keychain/issues/1221 // and https://github.com/open-keychain/open-keychain/issues/1480 @@ -366,13 +360,15 @@ public class ImportOperation extends BaseOperation { } } - // Final log entry, it's easier to do this individually - if ((newKeys > 0 || updatedKeys > 0) && badKeys > 0) { - log.add(LogType.MSG_IMPORT_PARTIAL, 1); - } else if (newKeys > 0 || updatedKeys > 0) { - log.add(LogType.MSG_IMPORT_SUCCESS, 1); - } else { - log.add(LogType.MSG_IMPORT_ERROR, 1); + if (!cancelled) { + // Final log entry, it's easier to do this individually + if ((newKeys > 0 || updatedKeys > 0) && badKeys > 0) { + log.add(LogType.MSG_IMPORT_PARTIAL, 1); + } else if (newKeys > 0 || updatedKeys > 0) { + log.add(LogType.MSG_IMPORT_SUCCESS, 1); + } else { + log.add(LogType.MSG_IMPORT_ERROR, 1); + } } return new ImportKeyResult(resultType, log, newKeys, updatedKeys, badKeys, secret, @@ -423,7 +419,7 @@ public class ImportOperation extends BaseOperation { final ProgressScaler ignoreProgressable = new ProgressScaler(); ExecutorService importExecutor = new ThreadPoolExecutor(0, MAX_THREADS, 30L, TimeUnit.SECONDS, - new SynchronousQueue()); + new LinkedBlockingQueue()); ExecutorCompletionService importCompletionService = new ExecutorCompletionService<>(importExecutor); @@ -438,6 +434,10 @@ public class ImportOperation extends BaseOperation { @Override public ImportKeyResult call() { + if (checkCancelled()) { + return null; + } + ArrayList list = new ArrayList<>(); list.add(pkRing); @@ -481,6 +481,7 @@ public class ImportOperation extends BaseOperation { private int mUpdatedKeys = 0; private int mSecret = 0; private int mResultType = 0; + private boolean mHasCancelledResult; /** * Accumulates keyring imports and updates the progressable whenever a new key is imported. @@ -501,11 +502,22 @@ public class ImportOperation extends BaseOperation { public void accumulateKeyImport(ImportKeyResult result) { mImportedKeys++; + if (result == null) { + return; + } + if (mProgressable != null) { mProgressable.setProgress(mImportedKeys, mTotalKeys); } - mImportLog.addAll(result.getLog().toList());//accumulates log + boolean notCancelledOrFirstCancelled = !result.cancelled() || !mHasCancelledResult; + if (notCancelledOrFirstCancelled) { + mImportLog.addAll(result.getLog().toList()); //accumulates log + if (result.cancelled()) { + mHasCancelledResult = true; + } + } + mBadKeys += result.mBadKeys; mNewKeys += result.mNewKeys; mUpdatedKeys += result.mUpdatedKeys; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java index ce6994ba4..38f160ea6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java @@ -559,8 +559,8 @@ public class KeyListFragment extends LoaderFragment mKeyserver = cloudPrefs.keyserver; } - mImportOpHelper = new CryptoOperationHelper<>(1, this, - this, R.string.progress_updating); + mImportOpHelper = new CryptoOperationHelper<>(1, this, this, R.string.progress_updating); + mImportOpHelper.setProgressCancellable(true); mImportOpHelper.cryptoOperation(); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationHelper.java index d2877d542..7ab9c7237 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationHelper.java @@ -84,6 +84,7 @@ public class CryptoOperationHelper Date: Thu, 29 Oct 2015 23:01:16 +0100 Subject: update material drawer library --- OpenKeychain/build.gradle | 48 ++++++++++++---------- .../keychain/ui/MainActivity.java | 42 +++++++++---------- 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index fd2b8d3a5..40bfa4707 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -50,11 +50,12 @@ dependencies { compile 'com.splitwise:tokenautocomplete:2.0.2@aar' compile 'se.emilsjolander:stickylistheaders:2.7.0' compile 'org.sufficientlysecure:html-textview:1.3' - compile 'com.mikepenz:materialdrawer:3.0.9@aar' - compile 'com.mikepenz:iconics:1.0.2' - compile 'com.mikepenz.iconics:octicons-typeface:2.2.0@aar' - compile 'com.mikepenz.iconics:meteocons-typeface:1.1.1@aar' - compile 'com.mikepenz.iconics:community-material-typeface:1.0.0@aar' + compile 'com.mikepenz:materialdrawer:4.4.2@aar' + compile 'com.mikepenz:materialize:0.2.7' + compile 'com.mikepenz:iconics-core:1.7.9@aar' + compile 'com.mikepenz:google-material-typeface:1.2.0.1@aar' + compile 'com.mikepenz:fontawesome-typeface:4.4.0.1@aar' + compile 'com.mikepenz:community-material-typeface:1.2.64.1@aar' compile 'com.nispok:snackbar:2.11.0' compile 'com.squareup.okhttp:okhttp:2.5.0' compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0' @@ -94,32 +95,35 @@ dependencyVerification { 'com.splitwise:tokenautocomplete:2fc238424130b42155b5f2e39799a90bbbd13b148850afbe534ab08bb913c7f7', 'se.emilsjolander:stickylistheaders:a08ca948aa6b220f09d82f16bbbac395f6b78897e9eeac6a9f0b0ba755928eeb', 'org.sufficientlysecure:html-textview:39048e35894e582adada388e6c00631803283f8defed8e07ad58a5f284f272ee', - 'com.mikepenz:iconics:c1a02203d8e0d638959463c00af3ab9096e0a7c1ad5928762eb10ef5ce8a63cd', - 'com.mikepenz:materialdrawer:70c3efb3842461db41df6a918ea93969a7da21e63c092be838b153e5a47a17bf', - 'com.mikepenz.iconics:meteocons-typeface:39a8a9e70cd8287cdb119af57a672a41dd09240dba6697f5a0dbda1ccc33298b', - 'com.mikepenz.iconics:octicons-typeface:67ed7d456a9ce5f5307b85f955797bfb3dd674e2f6defb31c6b8bbe2ede290be', + 'com.mikepenz:materialize:db365f859084048ac4e9cc4254642593dbb1ae9ce25c8fc26c93e2a5fadb3480', + 'com.mikepenz:materialdrawer:fe9726e0f045eb3fe63832aa5383d9e2c7bcd8b87a6f26478aba1c330e9d36fe', + 'com.mikepenz:google-material-typeface:a8319333a7f7ca369b9b5c62913f96787d934e312acefa8c9a5fcefd394fc6ee', + 'com.mikepenz:iconics-core:e1ba25442c1645b7adfb7d101871c26ed64a6c5b892e9abee8d4d2a80d948d9e', + 'com.mikepenz:community-material-typeface:520f1065730a1171763696ac9c4e770fedbbcf1a8dad6eb1028ba29489e1a2ce', + 'com.mikepenz:fontawesome-typeface:8c58117eb42efe301a170049336f7838af7559d84b0cc9a2bd7aca8b130f0a50', + 'com.squareup.okhttp:okhttp:1cc716e29539adcda677949508162796daffedb4794cbf947a6f65e696f0381c', 'com.nispok:snackbar:46b5eb9d630d329e13c2ce00ee9fb115ffb66c23c72cff32ee97eedd76824c6f', - 'com.mikepenz.iconics:community-material-typeface:f1c5afee5f0f10d66beb3ed0df977246a02a9c46de4e05d7c0264bcde53b6b7f', + 'org.apache.james:apache-mime4j-core:4d7434c68f94b81a253c12f28e6bbb4d6239c361d6086a46e22e594bb43ac660', 'com.squareup.okhttp:okhttp-urlconnection:79ec6f4e79e683105e87fe83278a531c693e538d30e3b9237000ce7c94fcb2cf', - 'com.squareup.okhttp:okhttp:1cc716e29539adcda677949508162796daffedb4794cbf947a6f65e696f0381c', + 'org.thoughtcrime.ssl.pinning:AndroidPinning:afa1d74e699257fa75cb109ff29bac50726ef269c6e306bdeffe8223cee06ef4', 'org.apache.james:apache-mime4j-dom:7e6b06ee164a1c21b7e477249ea0b74a18fddce44764e5764085f58dd8c34633', - 'org.apache.james:apache-mime4j-core:4d7434c68f94b81a253c12f28e6bbb4d6239c361d6086a46e22e594bb43ac660', + 'OpenKeychain.extern.openpgp-api-lib:openpgp-api:10d03912fdae6358c78f6cacd13445988755f3391a996a64ef08c8b3c7d78ae1', 'com.cocosw:bottomsheet:871f5f4d6c10936569caf3528271efd77594a67aa5511765c96d7096c9b05f96', - 'org.thoughtcrime.ssl.pinning:AndroidPinning:afa1d74e699257fa75cb109ff29bac50726ef269c6e306bdeffe8223cee06ef4', -// 'OpenKeychain.extern.openkeychain-api-lib:openkeychain-intents:73d1bbf8f0288480d757d09b7cd655162ec65c05bdb0e214a8563cc05e48de8c', -// 'OpenKeychain.extern.openpgp-api-lib:openpgp-api:1928b3a927dd9fb9c3f3a27fb032b559556aa35f96302ce9594d3200be3b02bc', -// 'com.madgag.spongycastle:core:8fd58fd725f8a76de8875f0416e0a824e2fd11675e28ae4f6e2f4a5114c0fec1', -// 'com.madgag.spongycastle:pg:2b0bf8def92e41a13d177a394b0ab1784a6049a416eeb3d5e41359436051a2bd', -// 'com.madgag.spongycastle:pkix:98effd8c01547c266d5483d428263778f4629e5ed14b82cb8acd439db3b82caa', -// 'OpenKeychain.extern:minidns:c4a75e5ee4a32e28326e033337fb3eedd7e1cb22683e3bd9bd617e582673ffb1', -// 'com.madgag.spongycastle:prov:610e1ade360f147335e36939a4db5fff61fc1da93af2b81ed095fd29890f3019', +// 'OpenKeychain.extern.spongycastle:core:d898b5b81ce9d456c65a3a2fe0b0be9b74e366aabe4ee1d13499a865cd20ee19', +// 'OpenKeychain.extern.openkeychain-api-lib:openkeychain-intents:c25d0c05cc129e2975161f8454350a8868dbe1ffca8583e900935cb0b38db842', +// 'OpenKeychain.extern.spongycastle:pg:abd30d5a3c6ab6edbf7e2b60de3dae865bb5b5e4b41925ea8ac985e2a7fce4a0', +// 'OpenKeychain.extern.spongycastle:pkix:c5fd572191d31d2b05d7143d9e22d74ee3e8a43552c26d31114a27022b7a06ce', +// 'OpenKeychain.extern.spongycastle:prov:7a28f314e20683281254f92124f137d48173ea1dc3364a709d7cc66a5e46ec4e', +// 'OpenKeychain.extern.safeslinger-exchange:safeslinger-exchange:75a3d23eff4d5c14fdc8912b5d593bf340f07b833ceabacbcd60a8e83b5b8b79', 'com.android.support:support-annotations:d50996a4cbca17178989fef38635f2cc570c5d3a77870aaa57f4f7e4fc6de9dc', -// 'OpenKeychain.extern.KeybaseLib:Lib:e74bbf33600021993e493050768ca07b743a8308407daad7913aed44d86b0cea', -// 'OpenKeychain.extern.safeslinger-exchange:safeslinger-exchange:a38a6c1077a59491489304780b4e7afce52b4f5d594d7998e448e5c9e5363fb6', +// 'OpenKeychain.extern:minidns:0084c81e30a4b06edac9b00689eeaa3cbbb9ea3b26aaa4fad205bb660ea0fcdb', +// 'OpenKeychain.extern.KeybaseLib:Lib:c11785bf613f3fad8bf1670ef9fce1a10027cefbf2b3a67d487c6b8964f0e05a', 'com.squareup.okio:okio:114bdc1f47338a68bcbc95abf2f5cdc72beeec91812f2fcd7b521c1937876266', ] } + + android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java index 7e9b4953c..7bd7bafcc 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2014 Dominik Schürmann + * Copyright (C) 2012-2015 Dominik Schürmann * Copyright (C) 2014 Vincent Breitmoser * Copyright (C) 2015 Kai Jiang * @@ -27,13 +27,13 @@ import android.support.v4.app.FragmentManager.OnBackStackChangedListener; import android.support.v4.app.FragmentTransaction; import android.support.v7.widget.Toolbar; import android.view.View; -import android.widget.AdapterView; import com.mikepenz.community_material_typeface_library.CommunityMaterial; +import com.mikepenz.fontawesome_typeface_library.FontAwesome; import com.mikepenz.google_material_typeface_library.GoogleMaterial; -import com.mikepenz.iconics.typeface.FontAwesome; import com.mikepenz.materialdrawer.Drawer; import com.mikepenz.materialdrawer.DrawerBuilder; +import com.mikepenz.materialdrawer.model.DividerDrawerItem; import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; @@ -75,25 +75,23 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac .withToolbar(mToolbar) .addDrawerItems( new PrimaryDrawerItem().withName(R.string.nav_keys).withIcon(CommunityMaterial.Icon.cmd_key) - .withIdentifier(ID_KEYS).withCheckable(false), + .withIdentifier(ID_KEYS).withSelectable(false), new PrimaryDrawerItem().withName(R.string.nav_encrypt_decrypt).withIcon(FontAwesome.Icon.faw_lock) - .withIdentifier(ID_ENCRYPT_DECRYPT).withCheckable(false), + .withIdentifier(ID_ENCRYPT_DECRYPT).withSelectable(false), new PrimaryDrawerItem().withName(R.string.title_api_registered_apps).withIcon(CommunityMaterial.Icon.cmd_apps) - .withIdentifier(ID_APPS).withCheckable(false), + .withIdentifier(ID_APPS).withSelectable(false), new PrimaryDrawerItem().withName(R.string.nav_backup).withIcon(CommunityMaterial.Icon.cmd_backup_restore) - .withIdentifier(ID_BACKUP).withCheckable(false) - ) - .addStickyDrawerItems( - // display and stick on bottom of drawer - new PrimaryDrawerItem().withName(R.string.menu_preferences).withIcon(GoogleMaterial.Icon.gmd_settings).withIdentifier(ID_SETTINGS).withCheckable(false), - new PrimaryDrawerItem().withName(R.string.menu_help).withIcon(CommunityMaterial.Icon.cmd_help_circle).withIdentifier(ID_HELP).withCheckable(false) + .withIdentifier(ID_BACKUP).withSelectable(false), + new DividerDrawerItem(), + new PrimaryDrawerItem().withName(R.string.menu_preferences).withIcon(GoogleMaterial.Icon.gmd_settings).withIdentifier(ID_SETTINGS).withSelectable(false), + new PrimaryDrawerItem().withName(R.string.menu_help).withIcon(CommunityMaterial.Icon.cmd_help_circle).withIdentifier(ID_HELP).withSelectable(false) ) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override - public boolean onItemClick(AdapterView parent, View view, int position, long id, IDrawerItem drawerItem) { + public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { if (drawerItem != null) { Intent intent = null; - switch(drawerItem.getIdentifier()) { + switch (drawerItem.getIdentifier()) { case ID_KEYS: onKeysSelected(); break; @@ -182,28 +180,28 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac private void onKeysSelected() { mToolbar.setTitle(R.string.app_name); - mDrawer.setSelectionByIdentifier(ID_KEYS, false); + mDrawer.setSelection(ID_KEYS, false); Fragment frag = new KeyListFragment(); setFragment(frag, false); } private void onEnDecryptSelected() { mToolbar.setTitle(R.string.nav_encrypt_decrypt); - mDrawer.setSelectionByIdentifier(ID_ENCRYPT_DECRYPT, false); + mDrawer.setSelection(ID_ENCRYPT_DECRYPT, false); Fragment frag = new EncryptDecryptFragment(); setFragment(frag, true); } private void onAppsSelected() { mToolbar.setTitle(R.string.nav_apps); - mDrawer.setSelectionByIdentifier(ID_APPS, false); + mDrawer.setSelection(ID_APPS, false); Fragment frag = new AppsListFragment(); setFragment(frag, true); } private void onBackupSelected() { mToolbar.setTitle(R.string.nav_backup); - mDrawer.setSelectionByIdentifier(ID_BACKUP, false); + mDrawer.setSelection(ID_BACKUP, false); Fragment frag = new BackupRestoreFragment(); setFragment(frag, true); } @@ -258,16 +256,16 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac // make sure the selected icon is the one shown at this point if (frag instanceof KeyListFragment) { mToolbar.setTitle(R.string.app_name); - mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_KEYS), false); + mDrawer.setSelection(mDrawer.getPosition(ID_KEYS), false); } else if (frag instanceof EncryptDecryptFragment) { mToolbar.setTitle(R.string.nav_encrypt_decrypt); - mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_ENCRYPT_DECRYPT), false); + mDrawer.setSelection(mDrawer.getPosition(ID_ENCRYPT_DECRYPT), false); } else if (frag instanceof AppsListFragment) { mToolbar.setTitle(R.string.nav_apps); - mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_APPS), false); + mDrawer.setSelection(mDrawer.getPosition(ID_APPS), false); } else if (frag instanceof BackupRestoreFragment) { mToolbar.setTitle(R.string.nav_backup); - mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_BACKUP), false); + mDrawer.setSelection(mDrawer.getPosition(ID_BACKUP), false); } } -- cgit v1.2.3 From 0641b9cba68aa0093f1b1b7aa937caa50e9f5669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 29 Oct 2015 23:03:11 +0100 Subject: comment git dependency again --- OpenKeychain/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 40bfa4707..62043aef3 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -107,7 +107,7 @@ dependencyVerification { 'com.squareup.okhttp:okhttp-urlconnection:79ec6f4e79e683105e87fe83278a531c693e538d30e3b9237000ce7c94fcb2cf', 'org.thoughtcrime.ssl.pinning:AndroidPinning:afa1d74e699257fa75cb109ff29bac50726ef269c6e306bdeffe8223cee06ef4', 'org.apache.james:apache-mime4j-dom:7e6b06ee164a1c21b7e477249ea0b74a18fddce44764e5764085f58dd8c34633', - 'OpenKeychain.extern.openpgp-api-lib:openpgp-api:10d03912fdae6358c78f6cacd13445988755f3391a996a64ef08c8b3c7d78ae1', +// 'OpenKeychain.extern.openpgp-api-lib:openpgp-api:10d03912fdae6358c78f6cacd13445988755f3391a996a64ef08c8b3c7d78ae1', 'com.cocosw:bottomsheet:871f5f4d6c10936569caf3528271efd77594a67aa5511765c96d7096c9b05f96', // 'OpenKeychain.extern.spongycastle:core:d898b5b81ce9d456c65a3a2fe0b0be9b74e366aabe4ee1d13499a865cd20ee19', // 'OpenKeychain.extern.openkeychain-api-lib:openkeychain-intents:c25d0c05cc129e2975161f8454350a8868dbe1ffca8583e900935cb0b38db842', -- cgit v1.2.3 From 4284aac0aa0d0bf4ce6f0edbc65a9837c06e1c8e Mon Sep 17 00:00:00 2001 From: Adithya Abraham Philip Date: Sat, 31 Oct 2015 00:20:00 +0530 Subject: changed KeyserverSyncAdapterService to work with START_REDELIVER_INTENT --- .../keychain/operations/ImportOperation.java | 4 +- .../service/KeyserverSyncAdapterService.java | 122 ++++++++++++++------- 2 files changed, 87 insertions(+), 39 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java index 8a4998b8f..19a05790f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java @@ -540,7 +540,9 @@ public class ImportOperation extends BaseOperation { // adding required information to mResultType // special case,no keys requested for import - if (mBadKeys == 0 && mNewKeys == 0 && mUpdatedKeys == 0) { + if (mBadKeys == 0 && mNewKeys == 0 && mUpdatedKeys == 0 + && (mResultType & ImportKeyResult.RESULT_CANCELLED) + != ImportKeyResult.RESULT_CANCELLED) { mResultType = ImportKeyResult.RESULT_FAIL_NOTHING; } else { if (mNewKeys > 0) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeyserverSyncAdapterService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeyserverSyncAdapterService.java index 8aebae7aa..122eb6cf4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeyserverSyncAdapterService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeyserverSyncAdapterService.java @@ -59,11 +59,12 @@ public class KeyserverSyncAdapterService extends Service { // time since last update after which a key should be updated again, in s public static final long KEY_UPDATE_LIMIT = Constants.DEBUG_KEYSERVER_SYNC ? 1 : TimeUnit.DAYS.toSeconds(7); - // time by which a sync is postponed in case of a + // time by which a sync is postponed in case screen is on public static final long SYNC_POSTPONE_TIME = Constants.DEBUG_KEYSERVER_SYNC ? 30 * 1000 : TimeUnit.MINUTES.toMillis(5); // Time taken by Orbot before a new circuit is created - public static final int ORBOT_CIRCUIT_TIMEOUT = (int) TimeUnit.MINUTES.toMillis(10); + public static final int ORBOT_CIRCUIT_TIMEOUT_SECONDS = + Constants.DEBUG_KEYSERVER_SYNC ? 2 : (int) TimeUnit.MINUTES.toSeconds(10); private static final String ACTION_IGNORE_TOR = "ignore_tor"; @@ -77,10 +78,14 @@ public class KeyserverSyncAdapterService extends Service { @Override public int onStartCommand(final Intent intent, int flags, final int startId) { + if (intent == null || intent.getAction() == null) { + // introduced due to https://github.com/open-keychain/open-keychain/issues/1573 + return START_NOT_STICKY; // we can't act on this Intent and don't want it redelivered + } switch (intent.getAction()) { case ACTION_CANCEL: { mCancelled.set(true); - break; + return START_NOT_STICKY; } // the reason for the separation betweyeen SYNC_NOW and UPDATE_ALL is so that starting // the sync directly from the notification is possible while the screen is on with @@ -92,44 +97,47 @@ public class KeyserverSyncAdapterService extends Service { Constants.PROVIDER_AUTHORITY, new Bundle() ); - break; + return START_NOT_STICKY; } case ACTION_UPDATE_ALL: { // does not check for screen on/off - asyncKeyUpdate(this, new CryptoInputParcel()); - break; + asyncKeyUpdate(this, new CryptoInputParcel(), startId); + // we depend on handleUpdateResult to call stopSelf when it is no longer necessary + // for the intent to be redelivered + return START_REDELIVER_INTENT; } case ACTION_IGNORE_TOR: { NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); manager.cancel(Constants.Notification.KEYSERVER_SYNC_FAIL_ORBOT); - asyncKeyUpdate(this, new CryptoInputParcel(ParcelableProxy.getForNoProxy())); - break; + asyncKeyUpdate(this, new CryptoInputParcel(ParcelableProxy.getForNoProxy()), + startId); + // we depend on handleUpdateResult to call stopSelf when it is no longer necessary + // for the intent to be redelivered + return START_REDELIVER_INTENT; } case ACTION_START_ORBOT: { - NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + NotificationManager manager = (NotificationManager) + getSystemService(NOTIFICATION_SERVICE); manager.cancel(Constants.Notification.KEYSERVER_SYNC_FAIL_ORBOT); + Intent startOrbot = new Intent(this, OrbotRequiredDialogActivity.class); startOrbot.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startOrbot.putExtra(OrbotRequiredDialogActivity.EXTRA_START_ORBOT, true); + Messenger messenger = new Messenger( new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case OrbotRequiredDialogActivity.MESSAGE_ORBOT_STARTED: { - asyncKeyUpdate(KeyserverSyncAdapterService.this, - new CryptoInputParcel()); - break; - } - case OrbotRequiredDialogActivity.MESSAGE_ORBOT_IGNORE: { - asyncKeyUpdate(KeyserverSyncAdapterService.this, - new CryptoInputParcel( - ParcelableProxy.getForNoProxy())); + startServiceWithUpdateAll(); break; } + case OrbotRequiredDialogActivity.MESSAGE_ORBOT_IGNORE: case OrbotRequiredDialogActivity.MESSAGE_DIALOG_CANCEL: { - // just stop service - stopSelf(); + // not possible since we proceed to Orbot's Activity + // directly, by starting OrbotRequiredDialogActivity with + // EXTRA_START_ORBOT set to true break; } } @@ -138,13 +146,17 @@ public class KeyserverSyncAdapterService extends Service { ); startOrbot.putExtra(OrbotRequiredDialogActivity.EXTRA_MESSENGER, messenger); startActivity(startOrbot); - break; + // since we return START_NOT_STICKY, we also postpone the sync as a backup in case + // the service is killed before OrbotRequiredDialogActivity can get back to us + postponeSync(); + // if use START_REDELIVER_INTENT, we might annoy the user by repeatedly starting the + // Orbot Activity when our service is killed and restarted + return START_NOT_STICKY; } case ACTION_DISMISS_NOTIFICATION: { NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); manager.cancel(Constants.Notification.KEYSERVER_SYNC_FAIL_ORBOT); - stopSelf(startId); - break; + return START_NOT_STICKY; } } return START_NOT_STICKY; @@ -167,10 +179,7 @@ public class KeyserverSyncAdapterService extends Service { boolean isScreenOn = pm.isScreenOn(); if (!isScreenOn) { - Intent serviceIntent = new Intent(KeyserverSyncAdapterService.this, - KeyserverSyncAdapterService.class); - serviceIntent.setAction(ACTION_UPDATE_ALL); - startService(serviceIntent); + startServiceWithUpdateAll(); } else { postponeSync(); } @@ -188,16 +197,24 @@ public class KeyserverSyncAdapterService extends Service { return new KeyserverSyncAdapter().getSyncAdapterBinder(); } - private void handleUpdateResult(ImportKeyResult result) { + /** + * Since we're returning START_REDELIVER_INTENT in onStartCommand, we need to remember to call + * stopSelf(int) to prevent the Intent from being redelivered if our work is already done + * + * @param result result of keyserver sync + * @param startId startId provided to the onStartCommand call which resulted in this sync + */ + private void handleUpdateResult(ImportKeyResult result, final int startId) { if (result.isPending()) { + Log.d(Constants.TAG, "Orbot required for sync but not running, attempting to start"); // result is pending due to Orbot not being started // try to start it silently, if disabled show notifications new OrbotHelper.SilentStartManager() { @Override protected void onOrbotStarted() { // retry the update - asyncKeyUpdate(KeyserverSyncAdapterService.this, - new CryptoInputParcel()); + startServiceWithUpdateAll(); + stopSelf(startId); // startServiceWithUpdateAll will deliver a new Intent } @Override @@ -207,16 +224,24 @@ public class KeyserverSyncAdapterService extends Service { (NotificationManager) getSystemService(NOTIFICATION_SERVICE); manager.notify(Constants.Notification.KEYSERVER_SYNC_FAIL_ORBOT, getOrbotNoification(KeyserverSyncAdapterService.this)); + // further action on user interaction with notification, intent should not be + // redelivered, therefore: + stopSelf(startId); } }.startOrbotAndListen(this, false); + // if we're killed before we get a response from Orbot, we need the intent to be + // redelivered, so no stopSelf(int) here } else if (isUpdateCancelled()) { Log.d(Constants.TAG, "Keyserver sync cancelled, postponing by" + SYNC_POSTPONE_TIME + "ms"); postponeSync(); + // postponeSync creates a new intent, so we don't need this to be redelivered + stopSelf(startId); } else { Log.d(Constants.TAG, "Keyserver sync completed: Updated: " + result.mUpdatedKeys + " Failed: " + result.mBadKeys); - stopSelf(); + // key sync completed successfully, we can stop + stopSelf(startId); } } @@ -234,12 +259,12 @@ public class KeyserverSyncAdapterService extends Service { } private void asyncKeyUpdate(final Context context, - final CryptoInputParcel cryptoInputParcel) { + final CryptoInputParcel cryptoInputParcel, final int startId) { new Thread(new Runnable() { @Override public void run() { ImportKeyResult result = updateKeysFromKeyserver(context, cryptoInputParcel); - handleUpdateResult(result); + handleUpdateResult(result, startId); } }).start(); } @@ -278,7 +303,6 @@ public class KeyserverSyncAdapterService extends Service { ); } - /** * will perform a staggered update of user's keys using delays to ensure new Tor circuits, as * performed by parcimonie. Relevant issue and method at: @@ -290,17 +314,31 @@ public class KeyserverSyncAdapterService extends Service { CryptoInputParcel cryptoInputParcel) { Log.d(Constants.TAG, "Starting staggered update"); // final int WEEK_IN_SECONDS = (int) TimeUnit.DAYS.toSeconds(7); + // we are limiting our randomness to ORBOT_CIRCUIT_TIMEOUT_SECONDS for now final int WEEK_IN_SECONDS = 0; + ImportOperation.KeyImportAccumulator accumulator = new ImportOperation.KeyImportAccumulator(keyList.size(), null); + + // so that the first key can be updated without waiting. This is so that there isn't a + // large gap between a "Start Orbot" notification and the next key update + boolean first = true; + for (ParcelableKeyRing keyRing : keyList) { int waitTime; int staggeredTime = new Random().nextInt(1 + 2 * (WEEK_IN_SECONDS / keyList.size())); - if (staggeredTime >= ORBOT_CIRCUIT_TIMEOUT) { + if (staggeredTime >= ORBOT_CIRCUIT_TIMEOUT_SECONDS) { waitTime = staggeredTime; } else { - waitTime = ORBOT_CIRCUIT_TIMEOUT + new Random().nextInt(ORBOT_CIRCUIT_TIMEOUT); + waitTime = ORBOT_CIRCUIT_TIMEOUT_SECONDS + + new Random().nextInt(1 + ORBOT_CIRCUIT_TIMEOUT_SECONDS); + } + + if (first) { + waitTime = 0; + first = false; } + Log.d(Constants.TAG, "Updating key with fingerprint " + keyRing.mExpectedFingerprint + " with a wait time of " + waitTime + "s"); try { @@ -362,13 +400,15 @@ public class KeyserverSyncAdapterService extends Service { ); ArrayList ignoreMasterKeyIds = new ArrayList<>(); - while (updatedKeysCursor.moveToNext()) { + while (updatedKeysCursor != null && updatedKeysCursor.moveToNext()) { long masterKeyId = updatedKeysCursor.getLong(INDEX_UPDATED_KEYS_MASTER_KEY_ID); Log.d(Constants.TAG, "Keyserver sync: Ignoring {" + masterKeyId + "} last updated at {" + updatedKeysCursor.getLong(INDEX_LAST_UPDATED) + "}s"); ignoreMasterKeyIds.add(masterKeyId); } - updatedKeysCursor.close(); + if (updatedKeysCursor != null) { + updatedKeysCursor.close(); + } // 2. Make a list of public keys which should be updated final int INDEX_MASTER_KEY_ID = 0; @@ -413,7 +453,7 @@ public class KeyserverSyncAdapterService extends Service { /** * will cancel an update already in progress. We send an Intent to cancel it instead of simply - * modifying a static variable sync the service is running in a process that is different from + * modifying a static variable since the service is running in a process that is different from * the default application process where the UI code runs. * * @param context used to send an Intent to the service requesting cancellation. @@ -491,6 +531,12 @@ public class KeyserverSyncAdapterService extends Service { } } + private void startServiceWithUpdateAll() { + Intent serviceIntent = new Intent(this, KeyserverSyncAdapterService.class); + serviceIntent.setAction(ACTION_UPDATE_ALL); + this.startService(serviceIntent); + } + // from de.azapps.mirakel.helper.Helpers from https://github.com/MirakelX/mirakel-android private Bitmap getBitmap(int resId, Context context) { int mLargeIconWidth = (int) context.getResources().getDimension( -- cgit v1.2.3 From 3411a5c087688f4e2033247b83ce10ea1e49d837 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sun, 1 Nov 2015 22:29:13 +0100 Subject: keylist: add "search for query" button to empty view --- .../keychain/ui/KeyListFragment.java | 65 +++++++++++++++++----- .../src/main/res/layout/key_list_fragment.xml | 31 ++++++++++- OpenKeychain/src/main/res/values/strings.xml | 1 + 3 files changed, 81 insertions(+), 16 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java index 38f160ea6..328dab037 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java @@ -30,6 +30,7 @@ import android.graphics.Color; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; @@ -46,8 +47,10 @@ import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AbsListView.MultiChoiceModeListener; import android.widget.AdapterView; +import android.widget.Button; import android.widget.ListView; import android.widget.TextView; +import android.widget.ViewAnimator; import com.getbase.floatingactionbutton.FloatingActionButton; import com.getbase.floatingactionbutton.FloatingActionsMenu; @@ -97,6 +100,8 @@ public class KeyListFragment extends LoaderFragment // saves the mode object for multiselect, needed for reset at some point private ActionMode mActionMode = null; + private Button vSearchButton; + private ViewAnimator vSearchContainer; private String mQuery; private FloatingActionsMenu mFab; @@ -161,7 +166,9 @@ public class KeyListFragment extends LoaderFragment super.onActivityCreated(savedInstanceState); // show app name instead of "keys" from nav drawer - getActivity().setTitle(R.string.app_name); + final FragmentActivity activity = getActivity(); + + activity.setTitle(R.string.app_name); mStickyList.setOnItemClickListener(this); mStickyList.setAreHeadersSticky(true); @@ -170,7 +177,7 @@ public class KeyListFragment extends LoaderFragment // Adds an empty footer view so that the Floating Action Button won't block content // in last few rows. - View footer = new View(getActivity()); + View footer = new View(activity); int spacing = (int) android.util.TypedValue.applyDimension( android.util.TypedValue.COMPLEX_UNIT_DIP, 72, getResources().getDisplayMetrics() @@ -194,7 +201,7 @@ public class KeyListFragment extends LoaderFragment @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { - android.view.MenuInflater inflater = getActivity().getMenuInflater(); + android.view.MenuInflater inflater = activity.getMenuInflater(); inflater.inflate(R.menu.key_list_multi, menu); mActionMode = mode; return true; @@ -234,7 +241,7 @@ public class KeyListFragment extends LoaderFragment @Override public void onItemCheckedStateChanged(ActionMode mode, int position, long id, - boolean checked) { + boolean checked) { if (checked) { mAdapter.setNewSelection(position, true); } else { @@ -254,8 +261,21 @@ public class KeyListFragment extends LoaderFragment // Start out with a progress indicator. setContentShown(false); + // this view is made visible if no data is available + mStickyList.setEmptyView(activity.findViewById(R.id.key_list_empty)); + + // click on search button (in empty view) starts query for search string + vSearchContainer = (ViewAnimator) activity.findViewById(R.id.search_container); + vSearchButton = (Button) activity.findViewById(R.id.search_button); + vSearchButton.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + startSearchForQuery(); + } + }); + // Create an empty adapter we will use to display the loaded data. - mAdapter = new KeyListAdapter(getActivity(), null, 0); + mAdapter = new KeyListAdapter(activity, null, 0); mStickyList.setAdapter(mAdapter); // Prepare the loader. Either re-connect with an existing one, @@ -263,6 +283,18 @@ public class KeyListFragment extends LoaderFragment getLoaderManager().initLoader(0, null, this); } + private void startSearchForQuery() { + Activity activity = getActivity(); + if (activity == null) { + return; + } + + Intent searchIntent = new Intent(activity, ImportKeysActivity.class); + searchIntent.putExtra(ImportKeysActivity.EXTRA_QUERY, mQuery); + searchIntent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER); + startActivity(searchIntent); + } + static final String ORDER = KeyRings.HAS_ANY_SECRET + " DESC, UPPER(" + KeyRings.USER_ID + ") ASC"; @@ -318,9 +350,6 @@ public class KeyListFragment extends LoaderFragment mStickyList.setAdapter(mAdapter); - // this view is made visible if no data is available - mStickyList.setEmptyView(getActivity().findViewById(R.id.key_list_empty)); - // end action mode, if any if (mActionMode != null) { mActionMode.finish(); @@ -482,17 +511,25 @@ public class KeyListFragment extends LoaderFragment @Override public boolean onQueryTextChange(String s) { Log.d(Constants.TAG, "onQueryTextChange s:" + s); - // Called when the action bar search text has changed. Update - // the search filter, and restart the loader to do a new query - // with this filter. + // Called when the action bar search text has changed. Update the + // search filter, and restart the loader to do a new query with this + // filter. // If the nav drawer is opened, onQueryTextChange("") is executed. // This hack prevents restarting the loader. - // TODO: better way to fix this? - String tmp = (mQuery == null) ? "" : mQuery; - if (!s.equals(tmp)) { + if (!s.equals(mQuery)) { mQuery = s; getLoaderManager().restartLoader(0, null, this); } + + if (s.length() > 2) { + vSearchButton.setText(getString(R.string.btn_search_for_query, mQuery)); + vSearchContainer.setDisplayedChild(1); + vSearchContainer.setVisibility(View.VISIBLE); + } else { + vSearchContainer.setDisplayedChild(0); + vSearchContainer.setVisibility(View.GONE); + } + return true; } diff --git a/OpenKeychain/src/main/res/layout/key_list_fragment.xml b/OpenKeychain/src/main/res/layout/key_list_fragment.xml index 26cedd362..6aaf5be25 100644 --- a/OpenKeychain/src/main/res/layout/key_list_fragment.xml +++ b/OpenKeychain/src/main/res/layout/key_list_fragment.xml @@ -3,6 +3,8 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent" + xmlns:tools="http://schemas.android.com/tools" + xmlns:custom="http://schemas.android.com/apk/res-auto" > @@ -23,10 +25,11 @@ + android:animateLayoutChanges="true" + > + + + + +