diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-03-08 01:49:22 +0100 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-03-08 01:49:22 +0100 |
commit | 2b5023a75d0c98738ed1aea2ea89de007cf2e3d7 (patch) | |
tree | 8617aa8dcad7e32c9cb5b8483534d888aaf0c7d0 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util | |
parent | 581cad5b3f7b54fae652e2598b4e760eb19678d2 (diff) | |
parent | 4f11fb5a2f08ecf5fb81c86d590d04387cd1cd9a (diff) | |
download | open-keychain-2b5023a75d0c98738ed1aea2ea89de007cf2e3d7.tar.gz open-keychain-2b5023a75d0c98738ed1aea2ea89de007cf2e3d7.tar.bz2 open-keychain-2b5023a75d0c98738ed1aea2ea89de007cf2e3d7.zip |
Merge branch 'development' into linked-identities
Conflicts:
OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java | 4 | ||||
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java | 97 |
2 files changed, 8 insertions, 93 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java index 44bcc52a5..c66dc04d0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java @@ -296,7 +296,9 @@ public class ContactHelper { ContentResolver resolver = context.getContentResolver(); Set<Long> deletedKeys = getRawContactMasterKeyIds(resolver); -// debugDeleteRawContacts(resolver); + if (Constants.DEBUG_SYNC_REMOVE_CONTACTS) { + debugDeleteRawContacts(resolver); + } // ContentProviderClient client = resolver.acquireContentProviderClient(ContactsContract.AUTHORITY_URI); // ContentValues values = new ContentValues(); 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 a36af5c87..44c1e6b6c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java @@ -20,11 +20,7 @@ package org.sufficientlysecure.keychain.util; import android.content.Context; import android.content.SharedPreferences; -import android.os.Build; -import org.spongycastle.bcpg.CompressionAlgorithmTags; -import org.spongycastle.bcpg.HashAlgorithmTags; -import org.spongycastle.openpgp.PGPEncryptedData; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants.Pref; @@ -59,12 +55,8 @@ public class Preferences { } public void updateSharedPreferences(Context context) { - // multi-process preferences - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - mSharedPreferences = context.getSharedPreferences("APG.main", Context.MODE_MULTI_PROCESS); - } else { - mSharedPreferences = context.getSharedPreferences("APG.main", Context.MODE_PRIVATE); - } + // multi-process safe preferences + mSharedPreferences = context.getSharedPreferences("APG.main", Context.MODE_MULTI_PROCESS); } public String getLanguage() { @@ -103,60 +95,6 @@ public class Preferences { editor.commit(); } - public int getDefaultEncryptionAlgorithm() { - return mSharedPreferences.getInt(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM, - PGPEncryptedData.AES_256); - } - - public void setDefaultEncryptionAlgorithm(int value) { - SharedPreferences.Editor editor = mSharedPreferences.edit(); - editor.putInt(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM, value); - editor.commit(); - } - - public int getDefaultHashAlgorithm() { - return mSharedPreferences.getInt(Constants.Pref.DEFAULT_HASH_ALGORITHM, - HashAlgorithmTags.SHA256); - } - - public void setDefaultHashAlgorithm(int value) { - SharedPreferences.Editor editor = mSharedPreferences.edit(); - editor.putInt(Constants.Pref.DEFAULT_HASH_ALGORITHM, value); - editor.commit(); - } - - public int getDefaultMessageCompression() { - return mSharedPreferences.getInt(Constants.Pref.DEFAULT_MESSAGE_COMPRESSION, - CompressionAlgorithmTags.ZLIB); - } - - public void setDefaultMessageCompression(int value) { - SharedPreferences.Editor editor = mSharedPreferences.edit(); - editor.putInt(Constants.Pref.DEFAULT_MESSAGE_COMPRESSION, value); - editor.commit(); - } - - public int getDefaultFileCompression() { - return mSharedPreferences.getInt(Constants.Pref.DEFAULT_FILE_COMPRESSION, - CompressionAlgorithmTags.UNCOMPRESSED); - } - - public void setDefaultFileCompression(int value) { - SharedPreferences.Editor editor = mSharedPreferences.edit(); - editor.putInt(Constants.Pref.DEFAULT_FILE_COMPRESSION, value); - editor.commit(); - } - - public boolean getDefaultAsciiArmor() { - return mSharedPreferences.getBoolean(Constants.Pref.DEFAULT_ASCII_ARMOR, false); - } - - public void setDefaultAsciiArmor(boolean value) { - SharedPreferences.Editor editor = mSharedPreferences.edit(); - editor.putBoolean(Constants.Pref.DEFAULT_ASCII_ARMOR, value); - editor.commit(); - } - public boolean getCachedConsolidate() { return mSharedPreferences.getBoolean(Pref.CACHED_CONSOLIDATE, false); } @@ -210,6 +148,7 @@ public class Preferences { } return servers.toArray(chunks); } + public String getPreferredKeyserver() { return getKeyServers()[0]; } @@ -231,21 +170,12 @@ public class Preferences { editor.commit(); } - public void setWriteVersionHeader(boolean conceal) { - SharedPreferences.Editor editor = mSharedPreferences.edit(); - editor.putBoolean(Constants.Pref.WRITE_VERSION_HEADER, conceal); - editor.commit(); - } - - public boolean getWriteVersionHeader() { - return mSharedPreferences.getBoolean(Constants.Pref.WRITE_VERSION_HEADER, false); - } - public void setSearchKeyserver(boolean searchKeyserver) { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putBoolean(Pref.SEARCH_KEYSERVER, searchKeyserver); editor.commit(); } + public void setSearchKeybase(boolean searchKeybase) { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putBoolean(Pref.SEARCH_KEYBASE, searchKeybase); @@ -253,7 +183,7 @@ public class Preferences { } public CloudSearchPrefs getCloudSearchPrefs() { - return new CloudSearchPrefs(mSharedPreferences.getBoolean(Pref.SEARCH_KEYSERVER, true), + return new CloudSearchPrefs(mSharedPreferences.getBoolean(Pref.SEARCH_KEYSERVER, true), mSharedPreferences.getBoolean(Pref.SEARCH_KEYBASE, true), getPreferredKeyserver()); } @@ -301,26 +231,9 @@ public class Preferences { } setKeyServers(servers.toArray(new String[servers.size()])); - - // migrate old uncompressed constant to new one - if (mSharedPreferences.getInt(Constants.Pref.DEFAULT_FILE_COMPRESSION, 0) - == 0x21070001) { - setDefaultFileCompression(CompressionAlgorithmTags.UNCOMPRESSED); - } - - // migrate away from MD5 - if (mSharedPreferences.getInt(Constants.Pref.DEFAULT_HASH_ALGORITHM, 0) - == HashAlgorithmTags.MD5) { - setDefaultHashAlgorithm(HashAlgorithmTags.SHA256); - } } // fall through case 4: { - // for compatibility: change from SHA512 to SHA256 - if (mSharedPreferences.getInt(Constants.Pref.DEFAULT_HASH_ALGORITHM, 0) - == HashAlgorithmTags.SHA512) { - setDefaultHashAlgorithm(HashAlgorithmTags.SHA256); - } } } |