openpgp-setup: move crypto provider to global settings

This commit is contained in:
Vincent Breitmoser 2016-04-08 15:56:17 +02:00 committed by Vincent Breitmoser
parent 19b7d4491d
commit 46046f8926
45 changed files with 169 additions and 155 deletions

View file

@ -157,7 +157,6 @@ public class Account implements BaseAccount, StoreConfig {
public static final SortType DEFAULT_SORT_TYPE = SortType.SORT_DATE; public static final SortType DEFAULT_SORT_TYPE = SortType.SORT_DATE;
public static final boolean DEFAULT_SORT_ASCENDING = false; public static final boolean DEFAULT_SORT_ASCENDING = false;
public static final String NO_OPENPGP_PROVIDER = "";
public static final long NO_OPENPGP_KEY = 0; public static final long NO_OPENPGP_KEY = 0;
private DeletePolicy mDeletePolicy = DeletePolicy.NEVER; private DeletePolicy mDeletePolicy = DeletePolicy.NEVER;
@ -220,8 +219,6 @@ public class Account implements BaseAccount, StoreConfig {
private boolean mReplyAfterQuote; private boolean mReplyAfterQuote;
private boolean mStripSignature; private boolean mStripSignature;
private boolean mSyncRemoteDeletions; private boolean mSyncRemoteDeletions;
private String mCryptoApp;
private boolean mCryptoAppIsDeprecatedApg;
private long mCryptoKey; private long mCryptoKey;
private boolean mCryptoSupportSignOnly; private boolean mCryptoSupportSignOnly;
private boolean mMarkMessageAsReadOnView; private boolean mMarkMessageAsReadOnView;
@ -318,7 +315,6 @@ public class Account implements BaseAccount, StoreConfig {
mReplyAfterQuote = DEFAULT_REPLY_AFTER_QUOTE; mReplyAfterQuote = DEFAULT_REPLY_AFTER_QUOTE;
mStripSignature = DEFAULT_STRIP_SIGNATURE; mStripSignature = DEFAULT_STRIP_SIGNATURE;
mSyncRemoteDeletions = true; mSyncRemoteDeletions = true;
mCryptoApp = NO_OPENPGP_PROVIDER;
mCryptoKey = NO_OPENPGP_KEY; mCryptoKey = NO_OPENPGP_KEY;
mCryptoSupportSignOnly = false; mCryptoSupportSignOnly = false;
mAllowRemoteSearch = false; mAllowRemoteSearch = false;
@ -468,8 +464,6 @@ public class Account implements BaseAccount, StoreConfig {
mIsSignatureBeforeQuotedText = storage.getBoolean(mUuid + ".signatureBeforeQuotedText", false); mIsSignatureBeforeQuotedText = storage.getBoolean(mUuid + ".signatureBeforeQuotedText", false);
identities = loadIdentities(storage); identities = loadIdentities(storage);
String cryptoApp = storage.getString(mUuid + ".cryptoApp", NO_OPENPGP_PROVIDER);
setCryptoApp(cryptoApp);
mCryptoKey = storage.getLong(mUuid + ".cryptoKey", NO_OPENPGP_KEY); mCryptoKey = storage.getLong(mUuid + ".cryptoKey", NO_OPENPGP_KEY);
mCryptoSupportSignOnly = storage.getBoolean(mUuid + ".cryptoSupportSignOnly", false); mCryptoSupportSignOnly = storage.getBoolean(mUuid + ".cryptoSupportSignOnly", false);
mAllowRemoteSearch = storage.getBoolean(mUuid + ".allowRemoteSearch", false); mAllowRemoteSearch = storage.getBoolean(mUuid + ".allowRemoteSearch", false);
@ -560,7 +554,7 @@ public class Account implements BaseAccount, StoreConfig {
editor.remove(mUuid + ".showPicturesEnum"); editor.remove(mUuid + ".showPicturesEnum");
editor.remove(mUuid + ".replyAfterQuote"); editor.remove(mUuid + ".replyAfterQuote");
editor.remove(mUuid + ".stripSignature"); editor.remove(mUuid + ".stripSignature");
editor.remove(mUuid + ".cryptoApp"); editor.remove(mUuid + ".cryptoApp"); // this is no longer set, but cleans up legacy values
editor.remove(mUuid + ".cryptoAutoSignature"); editor.remove(mUuid + ".cryptoAutoSignature");
editor.remove(mUuid + ".cryptoAutoEncrypt"); editor.remove(mUuid + ".cryptoAutoEncrypt");
editor.remove(mUuid + ".cryptoApp"); editor.remove(mUuid + ".cryptoApp");
@ -737,7 +731,6 @@ public class Account implements BaseAccount, StoreConfig {
editor.putBoolean(mUuid + ".defaultQuotedTextShown", mDefaultQuotedTextShown); editor.putBoolean(mUuid + ".defaultQuotedTextShown", mDefaultQuotedTextShown);
editor.putBoolean(mUuid + ".replyAfterQuote", mReplyAfterQuote); editor.putBoolean(mUuid + ".replyAfterQuote", mReplyAfterQuote);
editor.putBoolean(mUuid + ".stripSignature", mStripSignature); editor.putBoolean(mUuid + ".stripSignature", mStripSignature);
editor.putString(mUuid + ".cryptoApp", mCryptoApp);
editor.putLong(mUuid + ".cryptoKey", mCryptoKey); editor.putLong(mUuid + ".cryptoKey", mCryptoKey);
editor.putBoolean(mUuid + ".cryptoSupportSignOnly", mCryptoSupportSignOnly); editor.putBoolean(mUuid + ".cryptoSupportSignOnly", mCryptoSupportSignOnly);
editor.putBoolean(mUuid + ".allowRemoteSearch", mAllowRemoteSearch); editor.putBoolean(mUuid + ".allowRemoteSearch", mAllowRemoteSearch);
@ -1603,24 +1596,6 @@ public class Account implements BaseAccount, StoreConfig {
mStripSignature = stripSignature; mStripSignature = stripSignature;
} }
public String getCryptoApp() {
return mCryptoApp;
}
public void setCryptoApp(String cryptoApp) {
boolean isApgCryptoProvider = "apg".equals(cryptoApp);
if (cryptoApp == null || isApgCryptoProvider) {
mCryptoAppIsDeprecatedApg = isApgCryptoProvider;
mCryptoApp = NO_OPENPGP_PROVIDER;
} else {
mCryptoApp = cryptoApp;
}
}
public boolean isCryptoAppDeprecatedApg() {
return mCryptoAppIsDeprecatedApg;
}
public long getCryptoKey() { public long getCryptoKey() {
return mCryptoKey; return mCryptoKey;
} }
@ -1677,17 +1652,6 @@ public class Account implements BaseAccount, StoreConfig {
lastSelectedFolderName = folderName; lastSelectedFolderName = folderName;
} }
public synchronized String getOpenPgpProvider() {
if (!isOpenPgpProviderConfigured()) {
return null;
}
return getCryptoApp();
}
public synchronized boolean isOpenPgpProviderConfigured() {
return !NO_OPENPGP_PROVIDER.equals(getCryptoApp());
}
public synchronized NotificationSetting getNotificationSetting() { public synchronized NotificationSetting getNotificationSetting() {
return mNotificationSetting; return mNotificationSetting;
} }

View file

@ -242,6 +242,8 @@ public class K9 extends Application {
private static boolean mHideUserAgent = false; private static boolean mHideUserAgent = false;
private static boolean mHideTimeZone = false; private static boolean mHideTimeZone = false;
private static String sCryptoProvider = "";
private static SortType mSortType; private static SortType mSortType;
private static Map<SortType, Boolean> mSortAscending = new HashMap<SortType, Boolean>(); private static Map<SortType, Boolean> mSortAscending = new HashMap<SortType, Boolean>();
@ -311,6 +313,7 @@ public class K9 extends Application {
public static final int BOOT_RECEIVER_WAKE_LOCK_TIMEOUT = 60000; public static final int BOOT_RECEIVER_WAKE_LOCK_TIMEOUT = 60000;
public static final String NO_CRYPTO_PROVIDER = "";
public static class Intents { public static class Intents {
@ -465,6 +468,8 @@ public class K9 extends Application {
editor.putBoolean("hideUserAgent", mHideUserAgent); editor.putBoolean("hideUserAgent", mHideUserAgent);
editor.putBoolean("hideTimeZone", mHideTimeZone); editor.putBoolean("hideTimeZone", mHideTimeZone);
editor.putString("cryptoProvider", sCryptoProvider);
editor.putString("language", language); editor.putString("language", language);
editor.putInt("theme", theme.ordinal()); editor.putInt("theme", theme.ordinal());
editor.putInt("messageViewTheme", messageViewTheme.ordinal()); editor.putInt("messageViewTheme", messageViewTheme.ordinal());
@ -683,6 +688,8 @@ public class K9 extends Application {
mHideUserAgent = storage.getBoolean("hideUserAgent", false); mHideUserAgent = storage.getBoolean("hideUserAgent", false);
mHideTimeZone = storage.getBoolean("hideTimeZone", false); mHideTimeZone = storage.getBoolean("hideTimeZone", false);
sCryptoProvider = storage.getString("cryptoProvider", NO_CRYPTO_PROVIDER);
mConfirmDelete = storage.getBoolean("confirmDelete", false); mConfirmDelete = storage.getBoolean("confirmDelete", false);
mConfirmDiscardMessage = storage.getBoolean("confirmDiscardMessage", true); mConfirmDiscardMessage = storage.getBoolean("confirmDiscardMessage", true);
mConfirmDeleteStarred = storage.getBoolean("confirmDeleteStarred", false); mConfirmDeleteStarred = storage.getBoolean("confirmDeleteStarred", false);
@ -1228,6 +1235,18 @@ public class K9 extends Application {
mHideTimeZone = state; mHideTimeZone = state;
} }
public static boolean isCryptoProviderConfigured() {
return !NO_CRYPTO_PROVIDER.equals(sCryptoProvider);
}
public static String getCryptoProvider() {
return sCryptoProvider;
}
public static void setCryptoProvider(String cryptoProvider) {
sCryptoProvider = cryptoProvider;
}
public static String getAttachmentDefaultPath() { public static String getAttachmentDefaultPath() {
return mAttachmentDefaultPath; return mAttachmentDefaultPath;
} }

View file

@ -202,7 +202,7 @@ public class MessageLoaderHelper {
return; return;
} }
if (account.isOpenPgpProviderConfigured()) { if (K9.isCryptoProviderConfigured()) {
startOrResumeCryptoOperation(); startOrResumeCryptoOperation();
return; return;
} }
@ -262,7 +262,7 @@ public class MessageLoaderHelper {
if (retainCryptoHelperFragment.hasData()) { if (retainCryptoHelperFragment.hasData()) {
messageCryptoHelper = retainCryptoHelperFragment.getData(); messageCryptoHelper = retainCryptoHelperFragment.getData();
} else { } else {
messageCryptoHelper = new MessageCryptoHelper(context, account.getOpenPgpProvider()); messageCryptoHelper = new MessageCryptoHelper(context);
retainCryptoHelperFragment.setData(messageCryptoHelper); retainCryptoHelperFragment.setData(messageCryptoHelper);
} }
messageCryptoHelper.asyncStartOrResumeProcessingMessage( messageCryptoHelper.asyncStartOrResumeProcessingMessage(

View file

@ -16,6 +16,7 @@ import android.content.pm.ResolveInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.VisibleForTesting; import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
@ -270,8 +271,8 @@ public class RecipientPresenter implements PermissionPingCallback {
updateRecipientExpanderVisibility(); updateRecipientExpanderVisibility();
} }
String cryptoProvider = account.getOpenPgpProvider(); // This does not strictly depend on the account, but this is as good a point to set this as any
setCryptoProvider(cryptoProvider); setupCryptoProvider();
} }
@SuppressWarnings("UnusedParameters") @SuppressWarnings("UnusedParameters")
@ -609,7 +610,11 @@ public class RecipientPresenter implements PermissionPingCallback {
} }
} }
private void setCryptoProvider(String cryptoProvider) { private void setupCryptoProvider() {
String cryptoProvider = K9.getCryptoProvider();
if (TextUtils.isEmpty(cryptoProvider)) {
cryptoProvider = null;
}
boolean providerIsBound = openPgpServiceConnection != null && openPgpServiceConnection.isBound(); boolean providerIsBound = openPgpServiceConnection != null && openPgpServiceConnection.isBound();
boolean isSameProvider = cryptoProvider != null && cryptoProvider.equals(this.cryptoProvider); boolean isSameProvider = cryptoProvider != null && cryptoProvider.equals(this.cryptoProvider);

View file

@ -9,8 +9,6 @@ import java.util.Map;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
@ -21,9 +19,11 @@ import android.preference.EditTextPreference;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.preference.RingtonePreference; import android.preference.RingtonePreference;
import android.util.Log; import android.util.Log;
import android.widget.Toast;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.Account.DeletePolicy; import com.fsck.k9.Account.DeletePolicy;
@ -48,10 +48,7 @@ import com.fsck.k9.mail.Store;
import com.fsck.k9.mailstore.LocalFolder; import com.fsck.k9.mailstore.LocalFolder;
import com.fsck.k9.mailstore.StorageManager; import com.fsck.k9.mailstore.StorageManager;
import com.fsck.k9.service.MailService; import com.fsck.k9.service.MailService;
import com.fsck.k9.ui.dialog.ApgDeprecationWarningDialog;
import org.openintents.openpgp.util.OpenPgpAppPreference;
import org.openintents.openpgp.util.OpenPgpKeyPreference; import org.openintents.openpgp.util.OpenPgpKeyPreference;
import org.openintents.openpgp.util.OpenPgpUtils;
public class AccountSettings extends K9PreferenceActivity { public class AccountSettings extends K9PreferenceActivity {
@ -59,7 +56,6 @@ public class AccountSettings extends K9PreferenceActivity {
private static final int DIALOG_COLOR_PICKER_ACCOUNT = 1; private static final int DIALOG_COLOR_PICKER_ACCOUNT = 1;
private static final int DIALOG_COLOR_PICKER_LED = 2; private static final int DIALOG_COLOR_PICKER_LED = 2;
private static final int DIALOG_APG_DEPRECATION_WARNING = 3;
private static final int SELECT_AUTO_EXPAND_FOLDER = 1; private static final int SELECT_AUTO_EXPAND_FOLDER = 1;
@ -116,7 +112,6 @@ public class AccountSettings extends K9PreferenceActivity {
private static final String PREFERENCE_STRIP_SIGNATURE = "strip_signature"; private static final String PREFERENCE_STRIP_SIGNATURE = "strip_signature";
private static final String PREFERENCE_SYNC_REMOTE_DELETIONS = "account_sync_remote_deletetions"; private static final String PREFERENCE_SYNC_REMOTE_DELETIONS = "account_sync_remote_deletetions";
private static final String PREFERENCE_CRYPTO = "crypto"; private static final String PREFERENCE_CRYPTO = "crypto";
private static final String PREFERENCE_CRYPTO_APP = "crypto_app";
private static final String PREFERENCE_CRYPTO_KEY = "crypto_key"; private static final String PREFERENCE_CRYPTO_KEY = "crypto_key";
private static final String PREFERENCE_CRYPTO_SUPPORT_SIGN_ONLY = "crypto_support_sign_only"; private static final String PREFERENCE_CRYPTO_SUPPORT_SIGN_ONLY = "crypto_support_sign_only";
private static final String PREFERENCE_CLOUD_SEARCH_ENABLED = "remote_search_enabled"; private static final String PREFERENCE_CLOUD_SEARCH_ENABLED = "remote_search_enabled";
@ -131,7 +126,6 @@ public class AccountSettings extends K9PreferenceActivity {
private static final String PREFERENCE_SPAM_FOLDER = "spam_folder"; private static final String PREFERENCE_SPAM_FOLDER = "spam_folder";
private static final String PREFERENCE_TRASH_FOLDER = "trash_folder"; private static final String PREFERENCE_TRASH_FOLDER = "trash_folder";
private static final String PREFERENCE_ALWAYS_SHOW_CC_BCC = "always_show_cc_bcc"; private static final String PREFERENCE_ALWAYS_SHOW_CC_BCC = "always_show_cc_bcc";
public static final String APG_PROVIDER_PLACEHOLDER = "apg-placeholder";
private Account mAccount; private Account mAccount;
@ -185,7 +179,6 @@ public class AccountSettings extends K9PreferenceActivity {
private ListPreference mIdleRefreshPeriod; private ListPreference mIdleRefreshPeriod;
private ListPreference mMaxPushFolders; private ListPreference mMaxPushFolders;
private boolean mHasCrypto = false; private boolean mHasCrypto = false;
private OpenPgpAppPreference mCryptoApp;
private OpenPgpKeyPreference mCryptoKey; private OpenPgpKeyPreference mCryptoKey;
private CheckBoxPreference mCryptoSupportSignOnly; private CheckBoxPreference mCryptoSupportSignOnly;
@ -701,34 +694,14 @@ public class AccountSettings extends K9PreferenceActivity {
} }
}); });
mHasCrypto = OpenPgpUtils.isAvailable(this); mHasCrypto = K9.isCryptoProviderConfigured();
PreferenceScreen cryptoMenu = (PreferenceScreen) findPreference(PREFERENCE_CRYPTO);
if (mHasCrypto) { if (mHasCrypto) {
mCryptoApp = (OpenPgpAppPreference) findPreference(PREFERENCE_CRYPTO_APP);
mCryptoKey = (OpenPgpKeyPreference) findPreference(PREFERENCE_CRYPTO_KEY); mCryptoKey = (OpenPgpKeyPreference) findPreference(PREFERENCE_CRYPTO_KEY);
mCryptoSupportSignOnly = (CheckBoxPreference) findPreference(PREFERENCE_CRYPTO_SUPPORT_SIGN_ONLY); mCryptoSupportSignOnly = (CheckBoxPreference) findPreference(PREFERENCE_CRYPTO_SUPPORT_SIGN_ONLY);
mCryptoApp.setValue(String.valueOf(mAccount.getCryptoApp()));
if (OpenPgpAppPreference.isApgInstalled(getApplicationContext())) {
mCryptoApp.addLegacyProvider(APG_PROVIDER_PLACEHOLDER, getString(R.string.apg), R.drawable.ic_apg_small);
}
mCryptoApp.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
String value = newValue.toString();
if (APG_PROVIDER_PLACEHOLDER.equals(value)) {
mCryptoApp.setValue("");
mCryptoKey.setOpenPgpProvider("");
showDialog(DIALOG_APG_DEPRECATION_WARNING);
} else {
mCryptoApp.setValue(value);
mCryptoKey.setOpenPgpProvider(value);
}
return false;
}
});
mCryptoKey.setValue(mAccount.getCryptoKey()); mCryptoKey.setValue(mAccount.getCryptoKey());
mCryptoKey.setOpenPgpProvider(mCryptoApp.getValue()); mCryptoKey.setOpenPgpProvider(K9.getCryptoProvider());
// TODO: other identities? // TODO: other identities?
mCryptoKey.setDefaultUserId(OpenPgpApiHelper.buildUserId(mAccount.getIdentity(0))); mCryptoKey.setDefaultUserId(OpenPgpApiHelper.buildUserId(mAccount.getIdentity(0)));
mCryptoKey.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { mCryptoKey.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@ -740,10 +713,21 @@ public class AccountSettings extends K9PreferenceActivity {
}); });
mCryptoSupportSignOnly.setChecked(mAccount.getCryptoSupportSignOnly()); mCryptoSupportSignOnly.setChecked(mAccount.getCryptoSupportSignOnly());
cryptoMenu.setOnPreferenceClickListener(null);
} else { } else {
final Preference mCryptoMenu = findPreference(PREFERENCE_CRYPTO); cryptoMenu.setSummary(R.string.account_settings_no_openpgp_provider_configured);
mCryptoMenu.setEnabled(false); cryptoMenu.setOnPreferenceClickListener(new OnPreferenceClickListener() {
mCryptoMenu.setSummary(R.string.account_settings_no_openpgp_provider_installed); @Override
public boolean onPreferenceClick(Preference preference) {
Dialog dialog = ((PreferenceScreen) preference).getDialog();
if (dialog != null) {
dialog.dismiss();
}
Toast.makeText(AccountSettings.this,
R.string.no_crypto_provider_see_global, Toast.LENGTH_SHORT).show();
return true;
}
});
} }
} }
@ -806,11 +790,9 @@ public class AccountSettings extends K9PreferenceActivity {
mAccount.setStripSignature(mStripSignature.isChecked()); mAccount.setStripSignature(mStripSignature.isChecked());
mAccount.setLocalStorageProviderId(mLocalStorageProvider.getValue()); mAccount.setLocalStorageProviderId(mLocalStorageProvider.getValue());
if (mHasCrypto) { if (mHasCrypto) {
mAccount.setCryptoApp(mCryptoApp.getValue());
mAccount.setCryptoKey(mCryptoKey.getValue()); mAccount.setCryptoKey(mCryptoKey.getValue());
mAccount.setCryptoSupportSignOnly(mCryptoSupportSignOnly.isChecked()); mAccount.setCryptoSupportSignOnly(mCryptoSupportSignOnly.isChecked());
} else { } else {
mAccount.setCryptoApp(Account.NO_OPENPGP_PROVIDER);
mAccount.setCryptoKey(Account.NO_OPENPGP_KEY); mAccount.setCryptoKey(Account.NO_OPENPGP_KEY);
mAccount.setCryptoSupportSignOnly(false); mAccount.setCryptoSupportSignOnly(false);
} }
@ -953,16 +935,6 @@ public class AccountSettings extends K9PreferenceActivity {
break; break;
} }
case DIALOG_APG_DEPRECATION_WARNING: {
dialog = new ApgDeprecationWarningDialog(this);
dialog.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
mCryptoApp.show();
}
});
break;
}
} }
return dialog; return dialog;

View file

@ -7,7 +7,10 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -36,6 +39,8 @@ import com.fsck.k9.preferences.StorageEditor;
import com.fsck.k9.preferences.TimePickerPreference; import com.fsck.k9.preferences.TimePickerPreference;
import com.fsck.k9.service.MailService; import com.fsck.k9.service.MailService;
import com.fsck.k9.ui.dialog.ApgDeprecationWarningDialog;
import org.openintents.openpgp.util.OpenPgpAppPreference;
public class Prefs extends K9PreferenceActivity { public class Prefs extends K9PreferenceActivity {
@ -88,6 +93,8 @@ public class Prefs extends K9PreferenceActivity {
private static final String PREFERENCE_HIDE_USERAGENT = "privacy_hide_useragent"; private static final String PREFERENCE_HIDE_USERAGENT = "privacy_hide_useragent";
private static final String PREFERENCE_HIDE_TIMEZONE = "privacy_hide_timezone"; private static final String PREFERENCE_HIDE_TIMEZONE = "privacy_hide_timezone";
private static final String PREFERENCE_CRYPTO_APP = "crypto_app";
private static final String PREFERENCE_AUTOFIT_WIDTH = "messageview_autofit_width"; private static final String PREFERENCE_AUTOFIT_WIDTH = "messageview_autofit_width";
private static final String PREFERENCE_BACKGROUND_OPS = "background_ops"; private static final String PREFERENCE_BACKGROUND_OPS = "background_ops";
private static final String PREFERENCE_DEBUG_LOGGING = "debug_logging"; private static final String PREFERENCE_DEBUG_LOGGING = "debug_logging";
@ -99,8 +106,12 @@ public class Prefs extends K9PreferenceActivity {
private static final String PREFERENCE_FOLDERLIST_WRAP_NAME = "folderlist_wrap_folder_name"; private static final String PREFERENCE_FOLDERLIST_WRAP_NAME = "folderlist_wrap_folder_name";
private static final String PREFERENCE_SPLITVIEW_MODE = "splitview_mode"; private static final String PREFERENCE_SPLITVIEW_MODE = "splitview_mode";
private static final String APG_PROVIDER_PLACEHOLDER = "apg-placeholder";
private static final int ACTIVITY_CHOOSE_FOLDER = 1; private static final int ACTIVITY_CHOOSE_FOLDER = 1;
private static final int DIALOG_APG_DEPRECATION_WARNING = 1;
// Named indices for the mVisibleRefileActions field // Named indices for the mVisibleRefileActions field
private static final int VISIBLE_REFILE_ACTIONS_DELETE = 0; private static final int VISIBLE_REFILE_ACTIONS_DELETE = 0;
private static final int VISIBLE_REFILE_ACTIONS_ARCHIVE = 1; private static final int VISIBLE_REFILE_ACTIONS_ARCHIVE = 1;
@ -143,6 +154,8 @@ public class Prefs extends K9PreferenceActivity {
private CheckBoxPreference mWrapFolderNames; private CheckBoxPreference mWrapFolderNames;
private CheckBoxListPreference mVisibleRefileActions; private CheckBoxListPreference mVisibleRefileActions;
private OpenPgpAppPreference mCryptoProvider;
private CheckBoxPreference mQuietTimeEnabled; private CheckBoxPreference mQuietTimeEnabled;
private CheckBoxPreference mDisableNotificationDuringQuietTime; private CheckBoxPreference mDisableNotificationDuringQuietTime;
private com.fsck.k9.preferences.TimePickerPreference mQuietTimeStarts; private com.fsck.k9.preferences.TimePickerPreference mQuietTimeStarts;
@ -369,6 +382,25 @@ public class Prefs extends K9PreferenceActivity {
mHideUserAgent.setChecked(K9.hideUserAgent()); mHideUserAgent.setChecked(K9.hideUserAgent());
mHideTimeZone.setChecked(K9.hideTimeZone()); mHideTimeZone.setChecked(K9.hideTimeZone());
mCryptoProvider = (OpenPgpAppPreference) findPreference(PREFERENCE_CRYPTO_APP);
mCryptoProvider.setValue(K9.getCryptoProvider());
if (OpenPgpAppPreference.isApgInstalled(getApplicationContext())) {
mCryptoProvider.addLegacyProvider(
APG_PROVIDER_PLACEHOLDER, getString(R.string.apg), R.drawable.ic_apg_small);
}
mCryptoProvider.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
String value = newValue.toString();
if (APG_PROVIDER_PLACEHOLDER.equals(value)) {
mCryptoProvider.setValue("");
showDialog(DIALOG_APG_DEPRECATION_WARNING);
} else {
mCryptoProvider.setValue(value);
}
return false;
}
});
mAttachmentPathPreference = findPreference(PREFERENCE_ATTACHMENT_DEF_PATH); mAttachmentPathPreference = findPreference(PREFERENCE_ATTACHMENT_DEF_PATH);
mAttachmentPathPreference.setSummary(K9.getAttachmentDefaultPath()); mAttachmentPathPreference.setSummary(K9.getAttachmentDefaultPath());
mAttachmentPathPreference mAttachmentPathPreference
@ -524,6 +556,8 @@ public class Prefs extends K9PreferenceActivity {
K9.setHideUserAgent(mHideUserAgent.isChecked()); K9.setHideUserAgent(mHideUserAgent.isChecked());
K9.setHideTimeZone(mHideTimeZone.isChecked()); K9.setHideTimeZone(mHideTimeZone.isChecked());
K9.setCryptoProvider(mCryptoProvider.getValue());
StorageEditor editor = storage.edit(); StorageEditor editor = storage.edit();
K9.save(editor); K9.save(editor);
editor.commit(); editor.commit();
@ -552,6 +586,25 @@ public class Prefs extends K9PreferenceActivity {
K9.getContactNameColor()).show(); K9.getContactNameColor()).show();
} }
@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog = null;
switch (id) {
case DIALOG_APG_DEPRECATION_WARNING: {
dialog = new ApgDeprecationWarningDialog(this);
dialog.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
mCryptoProvider.show();
}
});
break;
}
}
return dialog;
}
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) { switch (requestCode) {

View file

@ -62,10 +62,6 @@ public class AccountSettings {
s.put("chipColor", Settings.versions( s.put("chipColor", Settings.versions(
new V(1, new ColorSetting(0xFF0000FF)) new V(1, new ColorSetting(0xFF0000FF))
)); ));
s.put("cryptoApp", Settings.versions(
new V(1, new StringSetting("apg")),
new V(36, new StringSetting(Account.NO_OPENPGP_PROVIDER))
));
s.put("defaultQuotedTextShown", Settings.versions( s.put("defaultQuotedTextShown", Settings.versions(
new V(1, new BooleanSetting(Account.DEFAULT_QUOTED_TEXT_SHOWN)) new V(1, new BooleanSetting(Account.DEFAULT_QUOTED_TEXT_SHOWN))
)); ));

View file

@ -30,6 +30,7 @@ import com.fsck.k9.preferences.Settings.InvalidSettingValueException;
import com.fsck.k9.preferences.Settings.PseudoEnumSetting; import com.fsck.k9.preferences.Settings.PseudoEnumSetting;
import com.fsck.k9.preferences.Settings.SettingsDescription; import com.fsck.k9.preferences.Settings.SettingsDescription;
import com.fsck.k9.preferences.Settings.SettingsUpgrader; import com.fsck.k9.preferences.Settings.SettingsUpgrader;
import com.fsck.k9.preferences.Settings.StringSetting;
import com.fsck.k9.preferences.Settings.V; import com.fsck.k9.preferences.Settings.V;
import com.fsck.k9.preferences.Settings.WebFontSizeSetting; import com.fsck.k9.preferences.Settings.WebFontSizeSetting;
@ -289,6 +290,9 @@ public class GlobalSettings {
s.put("pgpSignOnlyDialogCounter", Settings.versions( s.put("pgpSignOnlyDialogCounter", Settings.versions(
new V(45, new IntegerRangeSetting(0, Integer.MAX_VALUE, 0)) new V(45, new IntegerRangeSetting(0, Integer.MAX_VALUE, 0))
)); ));
s.put("cryptoProvider", Settings.versions(
new V(46, new StringSetting(K9.NO_CRYPTO_PROVIDER))
));
SETTINGS = Collections.unmodifiableMap(s); SETTINGS = Collections.unmodifiableMap(s);

View file

@ -36,7 +36,7 @@ public class Settings {
* *
* @see SettingsExporter * @see SettingsExporter
*/ */
public static final int VERSION = 45; public static final int VERSION = 46;
static Map<String, Object> validate(int version, Map<String, TreeMap<Integer, SettingsDescription>> settings, static Map<String, Object> validate(int version, Map<String, TreeMap<Integer, SettingsDescription>> settings,
Map<String, String> importedSettings, boolean useDefaultValues) { Map<String, String> importedSettings, boolean useDefaultValues) {

View file

@ -18,7 +18,6 @@ import android.support.annotation.Nullable;
import android.support.annotation.WorkerThread; import android.support.annotation.WorkerThread;
import android.util.Log; import android.util.Log;
import com.fsck.k9.Account;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.crypto.MessageDecryptVerifier; import com.fsck.k9.crypto.MessageDecryptVerifier;
import com.fsck.k9.mail.Address; import com.fsck.k9.mail.Address;
@ -63,7 +62,6 @@ public class MessageCryptoHelper {
private final Context context; private final Context context;
private final String openPgpProviderPackage;
private final Object callbackLock = new Object(); private final Object callbackLock = new Object();
private final Deque<CryptoPart> partsToDecryptOrVerify = new ArrayDeque<>(); private final Deque<CryptoPart> partsToDecryptOrVerify = new ArrayDeque<>();
@ -88,11 +86,10 @@ public class MessageCryptoHelper {
private OpenPgpServiceConnection openPgpServiceConnection; private OpenPgpServiceConnection openPgpServiceConnection;
public MessageCryptoHelper(Context context, String openPgpProviderPackage) { public MessageCryptoHelper(Context context) {
this.context = context.getApplicationContext(); this.context = context.getApplicationContext();
this.openPgpProviderPackage = openPgpProviderPackage;
if (openPgpProviderPackage == null || Account.NO_OPENPGP_PROVIDER.equals(openPgpProviderPackage)) { if (!K9.isCryptoProviderConfigured()) {
throw new IllegalStateException("MessageCryptoHelper must only be called with a openpgp provider!"); throw new IllegalStateException("MessageCryptoHelper must only be called with a openpgp provider!");
} }
} }
@ -210,6 +207,7 @@ public class MessageCryptoHelper {
} }
private void connectToCryptoProviderService() { private void connectToCryptoProviderService() {
String openPgpProviderPackage = K9.getCryptoProvider();
openPgpServiceConnection = new OpenPgpServiceConnection(context, openPgpProviderPackage, openPgpServiceConnection = new OpenPgpServiceConnection(context, openPgpProviderPackage,
new OnBound() { new OnBound() {
@Override @Override

View file

@ -98,20 +98,20 @@ public class MessageCryptoPresenter implements OnCryptoClickListener {
} }
case CANCELLED: { case CANCELLED: {
Drawable providerIcon = getOpenPgpApiProviderIcon(messageView.getContext(), account); Drawable providerIcon = getOpenPgpApiProviderIcon(messageView.getContext());
messageView.showMessageCryptoCancelledView(messageViewInfo, providerIcon); messageView.showMessageCryptoCancelledView(messageViewInfo, providerIcon);
break; break;
} }
case INCOMPLETE_ENCRYPTED: { case INCOMPLETE_ENCRYPTED: {
Drawable providerIcon = getOpenPgpApiProviderIcon(messageView.getContext(), account); Drawable providerIcon = getOpenPgpApiProviderIcon(messageView.getContext());
messageView.showMessageEncryptedButIncomplete(messageViewInfo, providerIcon); messageView.showMessageEncryptedButIncomplete(messageViewInfo, providerIcon);
break; break;
} }
case ENCRYPTED_ERROR: case ENCRYPTED_ERROR:
case UNSUPPORTED_ENCRYPTED: { case UNSUPPORTED_ENCRYPTED: {
Drawable providerIcon = getOpenPgpApiProviderIcon(messageView.getContext(), account); Drawable providerIcon = getOpenPgpApiProviderIcon(messageView.getContext());
messageView.showMessageCryptoErrorView(messageViewInfo, providerIcon); messageView.showMessageCryptoErrorView(messageViewInfo, providerIcon);
break; break;
} }
@ -137,7 +137,7 @@ public class MessageCryptoPresenter implements OnCryptoClickListener {
messageView.showMessage(account, messageViewInfo); messageView.showMessage(account, messageViewInfo);
return; return;
} }
Drawable providerIcon = getOpenPgpApiProviderIcon(messageView.getContext(), account); Drawable providerIcon = getOpenPgpApiProviderIcon(messageView.getContext());
messageView.showMessageCryptoWarning(messageViewInfo, providerIcon, warningStringRes); messageView.showMessageCryptoWarning(messageViewInfo, providerIcon, warningStringRes);
} }
@ -220,10 +220,10 @@ public class MessageCryptoPresenter implements OnCryptoClickListener {
} }
@Nullable @Nullable
private static Drawable getOpenPgpApiProviderIcon(Context context, Account account) { private static Drawable getOpenPgpApiProviderIcon(Context context) {
try { try {
String openPgpProvider = account.getOpenPgpProvider(); String openPgpProvider = K9.getCryptoProvider();
if (Account.NO_OPENPGP_PROVIDER.equals(openPgpProvider)) { if (K9.NO_CRYPTO_PROVIDER.equals(openPgpProvider)) {
return null; return null;
} }
return context.getPackageManager().getApplicationIcon(openPgpProvider); return context.getPackageManager().getApplicationIcon(openPgpProvider);

View file

@ -234,7 +234,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
mMessageView, mAccount, messageViewInfo); mMessageView, mAccount, messageViewInfo);
if (!handledByCryptoPresenter) { if (!handledByCryptoPresenter) {
mMessageView.showMessage(mAccount, messageViewInfo); mMessageView.showMessage(mAccount, messageViewInfo);
if (mAccount.isOpenPgpProviderConfigured()) { if (K9.isCryptoProviderConfigured()) {
mMessageView.getMessageHeaderView().setCryptoStatusDisabled(); mMessageView.getMessageHeaderView().setCryptoStatusDisabled();
} else { } else {
mMessageView.getMessageHeaderView().hideCryptoStatus(); mMessageView.getMessageHeaderView().hideCryptoStatus();
@ -244,7 +244,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
private void displayHeaderForLoadingMessage(LocalMessage message) { private void displayHeaderForLoadingMessage(LocalMessage message) {
mMessageView.setHeaders(message, mAccount); mMessageView.setHeaders(message, mAccount);
if (mAccount.isOpenPgpProviderConfigured()) { if (K9.isCryptoProviderConfigured()) {
mMessageView.getMessageHeaderView().setCryptoStatusLoading(); mMessageView.getMessageHeaderView().setCryptoStatusLoading();
} }
displayMessageSubject(getSubjectForMessage(message)); displayMessageSubject(getSubjectForMessage(message));

View file

@ -476,7 +476,7 @@ K-9 Mail е мощен, безплатен имейл клиент за Андр
<string name="account_settings_crypto">Криптография</string> <string name="account_settings_crypto">Криптография</string>
<string name="account_settings_crypto_app">OpenPGP приложение</string> <string name="account_settings_crypto_app">OpenPGP приложение</string>
<string name="account_settings_crypto_key">Моят ключ</string> <string name="account_settings_crypto_key">Моят ключ</string>
<string name="account_settings_no_openpgp_provider_installed">Липсва инсталирано OpenPGP приложение</string> <string name="account_settings_no_openpgp_provider_configured">Липсва инсталирано OpenPGP приложение</string>
<string name="account_settings_mail_check_frequency_label">Честота на проверка на папката</string> <string name="account_settings_mail_check_frequency_label">Честота на проверка на папката</string>
<string name="account_settings_storage_title">Място</string> <string name="account_settings_storage_title">Място</string>
<string name="account_settings_color_label">Цвят на профила</string> <string name="account_settings_color_label">Цвят на профила</string>

View file

@ -479,7 +479,7 @@ Chybová hlášení prosím posílejte, přispívejte novými funkcemi a ptejte
<string name="account_settings_crypto">Šifrování</string> <string name="account_settings_crypto">Šifrování</string>
<string name="account_settings_crypto_app">Aplikace OpenPGP</string> <string name="account_settings_crypto_app">Aplikace OpenPGP</string>
<string name="account_settings_crypto_key">Můj klíč</string> <string name="account_settings_crypto_key">Můj klíč</string>
<string name="account_settings_no_openpgp_provider_installed">Aplikace OpenPGP není nainstalována</string> <string name="account_settings_no_openpgp_provider_configured">Aplikace OpenPGP není nainstalována</string>
<string name="account_settings_mail_check_frequency_label">Frekvence dotazování složky</string> <string name="account_settings_mail_check_frequency_label">Frekvence dotazování složky</string>
<string name="account_settings_storage_title">Úložiště</string> <string name="account_settings_storage_title">Úložiště</string>
<string name="account_settings_color_label">Barva účtu</string> <string name="account_settings_color_label">Barva účtu</string>

View file

@ -477,7 +477,7 @@ Bitte senden Sie Fehlerberichte, Ideen für neue Funktionen und stellen Sie Frag
<string name="account_settings_crypto">Kryptographie</string> <string name="account_settings_crypto">Kryptographie</string>
<string name="account_settings_crypto_app">OpenPGP App</string> <string name="account_settings_crypto_app">OpenPGP App</string>
<string name="account_settings_crypto_key">Mein Schlüssel</string> <string name="account_settings_crypto_key">Mein Schlüssel</string>
<string name="account_settings_no_openpgp_provider_installed">Keine OpenPGP App installiert</string> <string name="account_settings_no_openpgp_provider_configured">Keine OpenPGP App installiert</string>
<string name="account_settings_mail_check_frequency_label">Häufigkeit der E-Mail-Abfrage</string> <string name="account_settings_mail_check_frequency_label">Häufigkeit der E-Mail-Abfrage</string>
<string name="account_settings_storage_title">Speicher</string> <string name="account_settings_storage_title">Speicher</string>
<string name="account_settings_color_label">Kontofarbe</string> <string name="account_settings_color_label">Kontofarbe</string>

View file

@ -478,7 +478,7 @@
<string name="account_settings_crypto">Κρυπτογραφία</string> <string name="account_settings_crypto">Κρυπτογραφία</string>
<string name="account_settings_crypto_app">OpenPGP εφαρμογή</string> <string name="account_settings_crypto_app">OpenPGP εφαρμογή</string>
<string name="account_settings_crypto_key">Το κλειδί μου</string> <string name="account_settings_crypto_key">Το κλειδί μου</string>
<string name="account_settings_no_openpgp_provider_installed">Δεν υπάρχει εγκατεστημένη OpenPGP εφαρμογή</string> <string name="account_settings_no_openpgp_provider_configured">Δεν υπάρχει εγκατεστημένη OpenPGP εφαρμογή</string>
<string name="account_settings_mail_check_frequency_label">Συχνότητα ενημέρωσης φακέλων</string> <string name="account_settings_mail_check_frequency_label">Συχνότητα ενημέρωσης φακέλων</string>
<string name="account_settings_storage_title">Αποθήκευση</string> <string name="account_settings_storage_title">Αποθήκευση</string>
<string name="account_settings_color_label">Χρώμα λογαριασμού</string> <string name="account_settings_color_label">Χρώμα λογαριασμού</string>

View file

@ -476,7 +476,7 @@ Por favor informe de fallos, aporte nueva funcionalidad o envíe sus preguntas a
<string name="account_settings_crypto">Cifrado</string> <string name="account_settings_crypto">Cifrado</string>
<string name="account_settings_crypto_app">Aplicación OpenPGP</string> <string name="account_settings_crypto_app">Aplicación OpenPGP</string>
<string name="account_settings_crypto_key">Mi clave</string> <string name="account_settings_crypto_key">Mi clave</string>
<string name="account_settings_no_openpgp_provider_installed">No hay aplicación OpenPGP instalada</string> <string name="account_settings_no_openpgp_provider_configured">No hay aplicación OpenPGP instalada</string>
<string name="account_settings_mail_check_frequency_label">Frecuencia de comprobación</string> <string name="account_settings_mail_check_frequency_label">Frecuencia de comprobación</string>
<string name="account_settings_storage_title">Almacenamiento</string> <string name="account_settings_storage_title">Almacenamiento</string>
<string name="account_settings_color_label">Color de la cuenta</string> <string name="account_settings_color_label">Color de la cuenta</string>

View file

@ -399,7 +399,7 @@
<string name="account_settings_crypto">رمزنگاری</string> <string name="account_settings_crypto">رمزنگاری</string>
<string name="account_settings_crypto_app">باز کردن برنامه پی جی پی</string> <string name="account_settings_crypto_app">باز کردن برنامه پی جی پی</string>
<string name="account_settings_crypto_key">کلید من</string> <string name="account_settings_crypto_key">کلید من</string>
<string name="account_settings_no_openpgp_provider_installed">هیچ برنامه باز پی جی پی نصب نشده است</string> <string name="account_settings_no_openpgp_provider_configured">هیچ برنامه باز پی جی پی نصب نشده است</string>
<string name="account_settings_mail_check_frequency_label">تکرار نظرسنجی پوشه</string> <string name="account_settings_mail_check_frequency_label">تکرار نظرسنجی پوشه</string>
<string name="account_settings_storage_title">نگهدارنده</string> <string name="account_settings_storage_title">نگهدارنده</string>
<string name="account_settings_color_label">رنگ حساب کاربری</string> <string name="account_settings_color_label">رنگ حساب کاربری</string>

View file

@ -476,7 +476,7 @@ Ilmoita virheistä, ota osaa sovelluskehitykseen ja esitä kysymyksiä osoittees
<string name="account_settings_crypto">Salausmenetelmä</string> <string name="account_settings_crypto">Salausmenetelmä</string>
<string name="account_settings_crypto_app">OpenPGP-sovellus</string> <string name="account_settings_crypto_app">OpenPGP-sovellus</string>
<string name="account_settings_crypto_key">Oma avain</string> <string name="account_settings_crypto_key">Oma avain</string>
<string name="account_settings_no_openpgp_provider_installed">OpenPGP-sovellusta ei ole asennettu</string> <string name="account_settings_no_openpgp_provider_configured">OpenPGP-sovellusta ei ole asennettu</string>
<string name="account_settings_mail_check_frequency_label">Kansioiden tarkistus</string> <string name="account_settings_mail_check_frequency_label">Kansioiden tarkistus</string>
<string name="account_settings_storage_title">Tallennus</string> <string name="account_settings_storage_title">Tallennus</string>
<string name="account_settings_color_label">Tilin väri</string> <string name="account_settings_color_label">Tilin väri</string>

View file

@ -478,7 +478,7 @@ jusqu\'à <xliff:g id="messages_to_load">%d</xliff:g> de plus</string>
<string name="account_settings_crypto">Cryptographie</string> <string name="account_settings_crypto">Cryptographie</string>
<string name="account_settings_crypto_app">Appli OpenPGP</string> <string name="account_settings_crypto_app">Appli OpenPGP</string>
<string name="account_settings_crypto_key">Ma clef</string> <string name="account_settings_crypto_key">Ma clef</string>
<string name="account_settings_no_openpgp_provider_installed">Aucune appli OpenPGP installée</string> <string name="account_settings_no_openpgp_provider_configured">Aucune appli OpenPGP installée</string>
<string name="account_settings_mail_check_frequency_label">Fréquence de vérification du dossier</string> <string name="account_settings_mail_check_frequency_label">Fréquence de vérification du dossier</string>
<string name="account_settings_storage_title">Stockage</string> <string name="account_settings_storage_title">Stockage</string>
<string name="account_settings_color_label">Couleur du compte</string> <string name="account_settings_color_label">Couleur du compte</string>

View file

@ -427,7 +427,7 @@
<string name="account_settings_crypto">Cifraxe</string> <string name="account_settings_crypto">Cifraxe</string>
<string name="account_settings_crypto_app">App OpenPGP</string> <string name="account_settings_crypto_app">App OpenPGP</string>
<string name="account_settings_crypto_key">A miña chave</string> <string name="account_settings_crypto_key">A miña chave</string>
<string name="account_settings_no_openpgp_provider_installed">Sen app OpenPGP instalada</string> <string name="account_settings_no_openpgp_provider_configured">Sen app OpenPGP instalada</string>
<string name="account_settings_mail_check_frequency_label">Frecuencia de comprobación</string> <string name="account_settings_mail_check_frequency_label">Frecuencia de comprobación</string>
<string name="account_settings_storage_title">Almacenamento</string> <string name="account_settings_storage_title">Almacenamento</string>
<string name="account_settings_color_label">Cor da conta</string> <string name="account_settings_color_label">Cor da conta</string>

View file

@ -434,7 +434,7 @@
<string name="account_settings_crypto">Šifriranje</string> <string name="account_settings_crypto">Šifriranje</string>
<string name="account_settings_crypto_app">Aplikacija OtvorenogPGP-a</string> <string name="account_settings_crypto_app">Aplikacija OtvorenogPGP-a</string>
<string name="account_settings_crypto_key">Moj Ključ</string> <string name="account_settings_crypto_key">Moj Ključ</string>
<string name="account_settings_no_openpgp_provider_installed">Nema instalirane aplikacije OtvorenogPGP-a</string> <string name="account_settings_no_openpgp_provider_configured">Nema instalirane aplikacije OtvorenogPGP-a</string>
<string name="account_settings_mail_check_frequency_label">Učestalost provjere mape</string> <string name="account_settings_mail_check_frequency_label">Učestalost provjere mape</string>
<string name="account_settings_storage_title">Pohrana</string> <string name="account_settings_storage_title">Pohrana</string>
<string name="account_settings_color_label">Boja računa</string> <string name="account_settings_color_label">Boja računa</string>

View file

@ -465,7 +465,7 @@ Kérünk küldj hibajelentést, hozzájárulva az új verziókhoz, és tegyél f
<string name="account_settings_crypto">Titkosítás</string> <string name="account_settings_crypto">Titkosítás</string>
<string name="account_settings_crypto_app">OpenPGP alkalmazás</string> <string name="account_settings_crypto_app">OpenPGP alkalmazás</string>
<string name="account_settings_crypto_key">Kulcsom</string> <string name="account_settings_crypto_key">Kulcsom</string>
<string name="account_settings_no_openpgp_provider_installed">Nincs OpenPGP alkalmazás telepítve</string> <string name="account_settings_no_openpgp_provider_configured">Nincs OpenPGP alkalmazás telepítve</string>
<string name="account_settings_mail_check_frequency_label">Frissítés gyakorisága</string> <string name="account_settings_mail_check_frequency_label">Frissítés gyakorisága</string>
<string name="account_settings_storage_title">Tárolás</string> <string name="account_settings_storage_title">Tárolás</string>
<string name="account_settings_color_label">Fiók színe</string> <string name="account_settings_color_label">Fiók színe</string>

View file

@ -478,7 +478,7 @@ Invia segnalazioni di bug, contribuisci con nuove funzionalità e poni domande s
<string name="account_settings_crypto">Crittografia</string> <string name="account_settings_crypto">Crittografia</string>
<string name="account_settings_crypto_app">Applicazione OpenPGP</string> <string name="account_settings_crypto_app">Applicazione OpenPGP</string>
<string name="account_settings_crypto_key">La mia chiave</string> <string name="account_settings_crypto_key">La mia chiave</string>
<string name="account_settings_no_openpgp_provider_installed">Nessuna applicazione OpenPGP installata</string> <string name="account_settings_no_openpgp_provider_configured">Nessuna applicazione OpenPGP installata</string>
<string name="account_settings_mail_check_frequency_label">Frequenza verifica cartella</string> <string name="account_settings_mail_check_frequency_label">Frequenza verifica cartella</string>
<string name="account_settings_storage_title">Archiviazione</string> <string name="account_settings_storage_title">Archiviazione</string>
<string name="account_settings_color_label">Colore dell\'account</string> <string name="account_settings_color_label">Colore dell\'account</string>

View file

@ -475,7 +475,7 @@ K-9 は大多数のメールクライアントと同様に、ほとんどのフ
<string name="account_settings_crypto">暗号化</string> <string name="account_settings_crypto">暗号化</string>
<string name="account_settings_crypto_app">OpenPGPアプリケーション</string> <string name="account_settings_crypto_app">OpenPGPアプリケーション</string>
<string name="account_settings_crypto_key">マイ キー</string> <string name="account_settings_crypto_key">マイ キー</string>
<string name="account_settings_no_openpgp_provider_installed">OpenPGPアプリケーションがインストールされていません</string> <string name="account_settings_no_openpgp_provider_configured">OpenPGPアプリケーションがインストールされていません</string>
<string name="account_settings_mail_check_frequency_label">同期フォルダの同期間隔</string> <string name="account_settings_mail_check_frequency_label">同期フォルダの同期間隔</string>
<string name="account_settings_storage_title">ストレージ</string> <string name="account_settings_storage_title">ストレージ</string>
<string name="account_settings_color_label">アカウントの色</string> <string name="account_settings_color_label">アカウントの色</string>

View file

@ -440,7 +440,7 @@
<string name="account_settings_crypto">암호화 방법</string> <string name="account_settings_crypto">암호화 방법</string>
<string name="account_settings_crypto_app">OpenPGP 앱</string> <string name="account_settings_crypto_app">OpenPGP 앱</string>
<string name="account_settings_crypto_key">내 키</string> <string name="account_settings_crypto_key">내 키</string>
<string name="account_settings_no_openpgp_provider_installed">OpenPGP 앱이 설치되지 않음</string> <string name="account_settings_no_openpgp_provider_configured">OpenPGP 앱이 설치되지 않음</string>
<string name="account_settings_mail_check_frequency_label">폴더 수신 빈도</string> <string name="account_settings_mail_check_frequency_label">폴더 수신 빈도</string>
<string name="account_settings_storage_title">저장 장치</string> <string name="account_settings_storage_title">저장 장치</string>
<string name="account_settings_color_label">계정 색깔</string> <string name="account_settings_color_label">계정 색깔</string>

View file

@ -479,7 +479,7 @@ pat <xliff:g id="messages_to_load">%d</xliff:g> vairāk</string>
<string name="account_settings_crypto">Šifrēšana</string> <string name="account_settings_crypto">Šifrēšana</string>
<string name="account_settings_crypto_app">OpenPGP lietotne</string> <string name="account_settings_crypto_app">OpenPGP lietotne</string>
<string name="account_settings_crypto_key">Mans pieejas kods</string> <string name="account_settings_crypto_key">Mans pieejas kods</string>
<string name="account_settings_no_openpgp_provider_installed">OpenPGP lietotne nav instalēta</string> <string name="account_settings_no_openpgp_provider_configured">OpenPGP lietotne nav instalēta</string>
<string name="account_settings_mail_check_frequency_label">Mapes pārbaudes biežums</string> <string name="account_settings_mail_check_frequency_label">Mapes pārbaudes biežums</string>
<string name="account_settings_storage_title">Krātuve</string> <string name="account_settings_storage_title">Krātuve</string>
<string name="account_settings_color_label">Konta krāsa</string> <string name="account_settings_color_label">Konta krāsa</string>

View file

@ -478,7 +478,7 @@ til <xliff:g id="messages_to_load">%d</xliff:g> flere</string>
<string name="account_settings_crypto">Kryptografi</string> <string name="account_settings_crypto">Kryptografi</string>
<string name="account_settings_crypto_app">OpenPGP app</string> <string name="account_settings_crypto_app">OpenPGP app</string>
<string name="account_settings_crypto_key">Min nøkkel</string> <string name="account_settings_crypto_key">Min nøkkel</string>
<string name="account_settings_no_openpgp_provider_installed">Ingen OpenPGP app er installert</string> <string name="account_settings_no_openpgp_provider_configured">Ingen OpenPGP app er installert</string>
<string name="account_settings_mail_check_frequency_label">Oppdateringsfrekvens for mappe</string> <string name="account_settings_mail_check_frequency_label">Oppdateringsfrekvens for mappe</string>
<string name="account_settings_storage_title">Lagring</string> <string name="account_settings_storage_title">Lagring</string>
<string name="account_settings_color_label">Kontofarge</string> <string name="account_settings_color_label">Kontofarge</string>

View file

@ -472,7 +472,7 @@ Graag foutrapporten sturen, bijdragen voor nieuwe functies en vragen stellen op
<string name="account_settings_crypto">Cryptografie</string> <string name="account_settings_crypto">Cryptografie</string>
<string name="account_settings_crypto_app">OpenPGP app</string> <string name="account_settings_crypto_app">OpenPGP app</string>
<string name="account_settings_crypto_key">Mijn sleutel</string> <string name="account_settings_crypto_key">Mijn sleutel</string>
<string name="account_settings_no_openpgp_provider_installed">Er is geen OpenPGP app geinstalleerd</string> <string name="account_settings_no_openpgp_provider_configured">Er is geen OpenPGP app geinstalleerd</string>
<string name="account_settings_mail_check_frequency_label">Mappen poll controleer frequentie</string> <string name="account_settings_mail_check_frequency_label">Mappen poll controleer frequentie</string>
<string name="account_settings_storage_title">Opslag</string> <string name="account_settings_storage_title">Opslag</string>
<string name="account_settings_color_label">Account kleur</string> <string name="account_settings_color_label">Account kleur</string>

View file

@ -442,7 +442,7 @@ Wysłane za pomocą K-9 Mail.</string>
<string name="account_settings_crypto">Kryptografia</string> <string name="account_settings_crypto">Kryptografia</string>
<string name="account_settings_crypto_app">Aplikacja OpenPGP</string> <string name="account_settings_crypto_app">Aplikacja OpenPGP</string>
<string name="account_settings_crypto_key">Mój Klucz</string> <string name="account_settings_crypto_key">Mój Klucz</string>
<string name="account_settings_no_openpgp_provider_installed">Aplikacja OpenPGP nie jest zainstalowana</string> <string name="account_settings_no_openpgp_provider_configured">Aplikacja OpenPGP nie jest zainstalowana</string>
<string name="account_settings_mail_check_frequency_label">Sprawdzanie konta</string> <string name="account_settings_mail_check_frequency_label">Sprawdzanie konta</string>
<string name="account_settings_storage_title">Przechowanie</string> <string name="account_settings_storage_title">Przechowanie</string>
<string name="account_settings_color_label">Kolor konta</string> <string name="account_settings_color_label">Kolor konta</string>

View file

@ -472,7 +472,7 @@ Por favor encaminhe relatórios de bugs, contribua com novos recursos e tire dú
<string name="account_settings_crypto">Criptografia</string> <string name="account_settings_crypto">Criptografia</string>
<string name="account_settings_crypto_app">Aplicativo OpenPGP</string> <string name="account_settings_crypto_app">Aplicativo OpenPGP</string>
<string name="account_settings_crypto_key">Minha chave</string> <string name="account_settings_crypto_key">Minha chave</string>
<string name="account_settings_no_openpgp_provider_installed">Nenhum aplicativo OpenPGP instalado</string> <string name="account_settings_no_openpgp_provider_configured">Nenhum aplicativo OpenPGP instalado</string>
<string name="account_settings_mail_check_frequency_label">Frequência de verificação de e-mail</string> <string name="account_settings_mail_check_frequency_label">Frequência de verificação de e-mail</string>
<string name="account_settings_storage_title">Armazenamento</string> <string name="account_settings_storage_title">Armazenamento</string>
<string name="account_settings_color_label">Cor da conta</string> <string name="account_settings_color_label">Cor da conta</string>

View file

@ -477,7 +477,7 @@ Por favor envie relatórios de falhas, contribua com novas funcionalidades e col
<string name="account_settings_crypto">Criptografia</string> <string name="account_settings_crypto">Criptografia</string>
<string name="account_settings_crypto_app">Aplicação OpenPGP</string> <string name="account_settings_crypto_app">Aplicação OpenPGP</string>
<string name="account_settings_crypto_key">Minha chave</string> <string name="account_settings_crypto_key">Minha chave</string>
<string name="account_settings_no_openpgp_provider_installed">Nenhuma aplicação OpenPGP instalada</string> <string name="account_settings_no_openpgp_provider_configured">Nenhuma aplicação OpenPGP instalada</string>
<string name="account_settings_mail_check_frequency_label">Frequência de verificação de pastas</string> <string name="account_settings_mail_check_frequency_label">Frequência de verificação de pastas</string>
<string name="account_settings_storage_title">Armazenamento</string> <string name="account_settings_storage_title">Armazenamento</string>
<string name="account_settings_color_label">Cor da conta</string> <string name="account_settings_color_label">Cor da conta</string>

View file

@ -481,7 +481,7 @@ Uneori datorită faptului că cineva încearcă să te atace pe tine sau serveru
<string name="account_settings_crypto">Criptare</string> <string name="account_settings_crypto">Criptare</string>
<string name="account_settings_crypto_app">Aplicația OpenPGP</string> <string name="account_settings_crypto_app">Aplicația OpenPGP</string>
<string name="account_settings_crypto_key">Cheia mea</string> <string name="account_settings_crypto_key">Cheia mea</string>
<string name="account_settings_no_openpgp_provider_installed">Aplicația OpenPGP neinstalată</string> <string name="account_settings_no_openpgp_provider_configured">Aplicația OpenPGP neinstalată</string>
<string name="account_settings_mail_check_frequency_label">Frecvență accesare dosar</string> <string name="account_settings_mail_check_frequency_label">Frecvență accesare dosar</string>
<string name="account_settings_storage_title">Stocare</string> <string name="account_settings_storage_title">Stocare</string>
<string name="account_settings_color_label">Culoarea contului</string> <string name="account_settings_color_label">Culoarea contului</string>

View file

@ -480,7 +480,7 @@ K-9 Mail — почтовый клиент для Android.
<string name="account_settings_crypto">Криптография</string> <string name="account_settings_crypto">Криптография</string>
<string name="account_settings_crypto_app">OpenPGP</string> <string name="account_settings_crypto_app">OpenPGP</string>
<string name="account_settings_crypto_key">Мой ключ</string> <string name="account_settings_crypto_key">Мой ключ</string>
<string name="account_settings_no_openpgp_provider_installed">OpenPGP не установлен</string> <string name="account_settings_no_openpgp_provider_configured">OpenPGP не установлен</string>
<string name="account_settings_mail_check_frequency_label">Интервал проверки</string> <string name="account_settings_mail_check_frequency_label">Интервал проверки</string>
<string name="account_settings_storage_title">Хранение</string> <string name="account_settings_storage_title">Хранение</string>
<string name="account_settings_color_label">Цвет</string> <string name="account_settings_color_label">Цвет</string>

View file

@ -479,7 +479,7 @@ Prosím, nahlasujte prípadné chyby, prispievajte novými funkciami a pýtajte
<string name="account_settings_crypto">Šifrovanie</string> <string name="account_settings_crypto">Šifrovanie</string>
<string name="account_settings_crypto_app">Aplikácia OpenPGP</string> <string name="account_settings_crypto_app">Aplikácia OpenPGP</string>
<string name="account_settings_crypto_key">Môj kľúč</string> <string name="account_settings_crypto_key">Môj kľúč</string>
<string name="account_settings_no_openpgp_provider_installed">Žiadna nainštalovaná aplikácia OpenPGP</string> <string name="account_settings_no_openpgp_provider_configured">Žiadna nainštalovaná aplikácia OpenPGP</string>
<string name="account_settings_mail_check_frequency_label">Frekvencia synchronizácie priečinkov</string> <string name="account_settings_mail_check_frequency_label">Frekvencia synchronizácie priečinkov</string>
<string name="account_settings_storage_title">Ukladací priestor</string> <string name="account_settings_storage_title">Ukladací priestor</string>
<string name="account_settings_color_label">Farba účtu</string> <string name="account_settings_color_label">Farba účtu</string>

View file

@ -482,7 +482,7 @@ Prosimo pošljite poročila o napakah, predloge za nove funkcije in vprašanja n
<string name="account_settings_crypto">Kriptografija</string> <string name="account_settings_crypto">Kriptografija</string>
<string name="account_settings_crypto_app">OpenPGP aplikacija</string> <string name="account_settings_crypto_app">OpenPGP aplikacija</string>
<string name="account_settings_crypto_key">My Key</string> <string name="account_settings_crypto_key">My Key</string>
<string name="account_settings_no_openpgp_provider_installed">Aplikacija OpenPGP ni nameščena</string> <string name="account_settings_no_openpgp_provider_configured">Aplikacija OpenPGP ni nameščena</string>
<string name="account_settings_mail_check_frequency_label">Pogostost izpraševanja map</string> <string name="account_settings_mail_check_frequency_label">Pogostost izpraševanja map</string>
<string name="account_settings_storage_title">Pomnilnik</string> <string name="account_settings_storage_title">Pomnilnik</string>
<string name="account_settings_color_label">Barva za račun</string> <string name="account_settings_color_label">Barva za račun</string>

View file

@ -479,7 +479,7 @@
<string name="account_settings_crypto">Криптографија</string> <string name="account_settings_crypto">Криптографија</string>
<string name="account_settings_crypto_app">ОпенПГП апликација</string> <string name="account_settings_crypto_app">ОпенПГП апликација</string>
<string name="account_settings_crypto_key">Мој кључ</string> <string name="account_settings_crypto_key">Мој кључ</string>
<string name="account_settings_no_openpgp_provider_installed">Нема инсталиране апликације за ОпенПГП</string> <string name="account_settings_no_openpgp_provider_configured">Нема инсталиране апликације за ОпенПГП</string>
<string name="account_settings_mail_check_frequency_label">Учесталост провере фасцикли</string> <string name="account_settings_mail_check_frequency_label">Учесталост провере фасцикли</string>
<string name="account_settings_storage_title">Складиште</string> <string name="account_settings_storage_title">Складиште</string>
<string name="account_settings_color_label">Боја налога</string> <string name="account_settings_color_label">Боја налога</string>

View file

@ -477,7 +477,7 @@ Skicka gärna in rapporter om buggar, eller bidra med nya funktioner eller stäl
<string name="account_settings_crypto">Kryptering</string> <string name="account_settings_crypto">Kryptering</string>
<string name="account_settings_crypto_app">OpenPGP-app</string> <string name="account_settings_crypto_app">OpenPGP-app</string>
<string name="account_settings_crypto_key">Min nyckel</string> <string name="account_settings_crypto_key">Min nyckel</string>
<string name="account_settings_no_openpgp_provider_installed">Ingen OpenPGP-app installerad</string> <string name="account_settings_no_openpgp_provider_configured">Ingen OpenPGP-app installerad</string>
<string name="account_settings_mail_check_frequency_label">Frekvens för att kontrollera mappar</string> <string name="account_settings_mail_check_frequency_label">Frekvens för att kontrollera mappar</string>
<string name="account_settings_storage_title">Lagring</string> <string name="account_settings_storage_title">Lagring</string>
<string name="account_settings_color_label">Kontofärg</string> <string name="account_settings_color_label">Kontofärg</string>

View file

@ -447,7 +447,7 @@
<string name="account_settings_crypto">Şifreleme</string> <string name="account_settings_crypto">Şifreleme</string>
<string name="account_settings_crypto_app">OpenPGP prg</string> <string name="account_settings_crypto_app">OpenPGP prg</string>
<string name="account_settings_crypto_key">Anahtarım</string> <string name="account_settings_crypto_key">Anahtarım</string>
<string name="account_settings_no_openpgp_provider_installed">Hiç OpenPGP prg yüklenmemiş</string> <string name="account_settings_no_openpgp_provider_configured">Hiç OpenPGP prg yüklenmemiş</string>
<string name="account_settings_mail_check_frequency_label">Klasör veri toplama sıklığı</string> <string name="account_settings_mail_check_frequency_label">Klasör veri toplama sıklığı</string>
<string name="account_settings_storage_title">Depolama</string> <string name="account_settings_storage_title">Depolama</string>
<string name="account_settings_color_label">Hesap rengi</string> <string name="account_settings_color_label">Hesap rengi</string>

View file

@ -479,7 +479,7 @@ K-9 Mail — це вільний клієнт електронної пошти
<string name="account_settings_crypto">Шифрування</string> <string name="account_settings_crypto">Шифрування</string>
<string name="account_settings_crypto_app">Програма OpenPGP</string> <string name="account_settings_crypto_app">Програма OpenPGP</string>
<string name="account_settings_crypto_key">Мій ключ</string> <string name="account_settings_crypto_key">Мій ключ</string>
<string name="account_settings_no_openpgp_provider_installed">Не встановлено програми OpenPGP</string> <string name="account_settings_no_openpgp_provider_configured">Не встановлено програми OpenPGP</string>
<string name="account_settings_mail_check_frequency_label">Частота опитування папок</string> <string name="account_settings_mail_check_frequency_label">Частота опитування папок</string>
<string name="account_settings_storage_title">Пам’ять</string> <string name="account_settings_storage_title">Пам’ять</string>
<string name="account_settings_color_label">Колір облікового запису</string> <string name="account_settings_color_label">Колір облікового запису</string>

View file

@ -579,7 +579,7 @@ Please submit bug reports, contribute new features and ask questions at
<string name="account_settings_crypto">Cryptography</string> <string name="account_settings_crypto">Cryptography</string>
<string name="account_settings_crypto_app">OpenPGP app</string> <string name="account_settings_crypto_app">OpenPGP app</string>
<string name="account_settings_crypto_key">My Key</string> <string name="account_settings_crypto_key">My Key</string>
<string name="account_settings_no_openpgp_provider_installed">No OpenPGP app installed</string> <string name="account_settings_no_openpgp_provider_configured">No OpenPGP app configured</string>
<string name="account_settings_mail_check_frequency_label">Folder poll frequency</string> <string name="account_settings_mail_check_frequency_label">Folder poll frequency</string>
@ -1216,5 +1216,6 @@ Please submit bug reports, contribute new features and ask questions at
<string name="apg_learn_more">You can <a href="https://k9mail.github.io/2017/01/13/Why-APG-is-no-longer-supported.html">click here</a> to learn more.</string> <string name="apg_learn_more">You can <a href="https://k9mail.github.io/2017/01/13/Why-APG-is-no-longer-supported.html">click here</a> to learn more.</string>
<string name="apg_deprecated_ok">Got it!</string> <string name="apg_deprecated_ok">Got it!</string>
<string name="apg">APG</string> <string name="apg">APG</string>
<string name="no_crypto_provider_see_global">No OpenPGP app configured, see global settings!</string>
</resources> </resources>

View file

@ -474,11 +474,6 @@
android:title="@string/account_settings_crypto" android:title="@string/account_settings_crypto"
android:key="crypto"> android:key="crypto">
<org.openintents.openpgp.util.OpenPgpAppPreference
android:persistent="false"
android:key="crypto_app"
android:title="@string/account_settings_crypto_app" />
<org.openintents.openpgp.util.OpenPgpKeyPreference <org.openintents.openpgp.util.OpenPgpKeyPreference
android:persistent="false" android:persistent="false"
android:key="crypto_key" android:key="crypto_key"

View file

@ -389,7 +389,6 @@
android:persistent="false" android:persistent="false"
android:key="privacy_hide_timezone" android:key="privacy_hide_timezone"
android:title="@string/global_settings_privacy_hide_timezone"/> android:title="@string/global_settings_privacy_hide_timezone"/>
</PreferenceScreen> </PreferenceScreen>
<PreferenceScreen <PreferenceScreen
@ -409,4 +408,9 @@
android:summary="@string/debug_enable_sensitive_logging_summary" /> android:summary="@string/debug_enable_sensitive_logging_summary" />
</PreferenceScreen> </PreferenceScreen>
<org.openintents.openpgp.util.OpenPgpAppPreference
android:persistent="false"
android:key="crypto_app"
android:title="@string/account_settings_crypto_app" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -10,6 +10,7 @@ import android.content.Intent;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.K9;
import com.fsck.k9.K9RobolectricTestRunner; import com.fsck.k9.K9RobolectricTestRunner;
import com.fsck.k9.activity.compose.RecipientMvpView.CryptoSpecialModeDisplayType; import com.fsck.k9.activity.compose.RecipientMvpView.CryptoSpecialModeDisplayType;
import com.fsck.k9.activity.compose.RecipientMvpView.CryptoStatusDisplayType; import com.fsck.k9.activity.compose.RecipientMvpView.CryptoStatusDisplayType;
@ -253,8 +254,8 @@ public class RecipientPresenterTest {
IOpenPgpService2 openPgpService2 = mock(IOpenPgpService2.class); IOpenPgpService2 openPgpService2 = mock(IOpenPgpService2.class);
Intent permissionPingIntent = new Intent(); Intent permissionPingIntent = new Intent();
K9.setCryptoProvider(CRYPTO_PROVIDER);
permissionPingIntent.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS); permissionPingIntent.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS);
when(account.getOpenPgpProvider()).thenReturn(CRYPTO_PROVIDER);
when(account.getCryptoKey()).thenReturn(CRYPTO_KEY_ID); when(account.getCryptoKey()).thenReturn(CRYPTO_KEY_ID);
when(openPgpServiceConnection.isBound()).thenReturn(true); when(openPgpServiceConnection.isBound()).thenReturn(true);
when(openPgpServiceConnection.getService()).thenReturn(openPgpService2); when(openPgpServiceConnection.getService()).thenReturn(openPgpService2);

View file

@ -270,19 +270,21 @@ public class OpenPgpAppPreference extends DialogPreference {
Intent intent = new Intent(OpenPgpApi.SERVICE_INTENT_2); Intent intent = new Intent(OpenPgpApi.SERVICE_INTENT_2);
List<ResolveInfo> resInfo = getContext().getPackageManager().queryIntentServices(intent, 0); List<ResolveInfo> resInfo = getContext().getPackageManager().queryIntentServices(intent, 0);
boolean hasNonBlacklistedChoices = false; boolean hasNonBlacklistedChoices = false;
for (ResolveInfo resolveInfo : resInfo) { if (resInfo != null) {
if (resolveInfo.serviceInfo == null) { for (ResolveInfo resolveInfo : resInfo) {
continue; if (resolveInfo.serviceInfo == null) {
} continue;
}
String packageName = resolveInfo.serviceInfo.packageName; String packageName = resolveInfo.serviceInfo.packageName;
String simpleName = String.valueOf(resolveInfo.serviceInfo.loadLabel(getContext() String simpleName = String.valueOf(resolveInfo.serviceInfo.loadLabel(getContext()
.getPackageManager())); .getPackageManager()));
Drawable icon = resolveInfo.serviceInfo.loadIcon(getContext().getPackageManager()); Drawable icon = resolveInfo.serviceInfo.loadIcon(getContext().getPackageManager());
if (!PROVIDER_BLACKLIST.contains(packageName)) { if (!PROVIDER_BLACKLIST.contains(packageName)) {
mList.add(new OpenPgpProviderEntry(packageName, simpleName, icon)); mList.add(new OpenPgpProviderEntry(packageName, simpleName, icon));
hasNonBlacklistedChoices = true; hasNonBlacklistedChoices = true;
}
} }
} }