From c4d9fd88aae38a6b7cfd9c840c3e0d8716cc7ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 11 Apr 2014 17:58:32 +0200 Subject: More cleanup in providerHelper --- .../keychain/provider/ProviderHelper.java | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index 414a79ef8..1da4ffe55 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -384,7 +384,6 @@ public class ProviderHelper { * Saves a PGPSecretKeyRing in the DB. This will only work if a corresponding public keyring * is already in the database! */ - @SuppressWarnings("unchecked") public void saveKeyRing(PGPSecretKeyRing keyRing) throws IOException { long masterKeyId = keyRing.getPublicKey().getKeyID(); @@ -400,7 +399,6 @@ public class ProviderHelper { /** * Saves (or updates) a pair of public and secret KeyRings in the database */ - @SuppressWarnings("unchecked") public void saveKeyRing(PGPPublicKeyRing pubRing, PGPSecretKeyRing privRing) throws IOException { long masterKeyId = pubRing.getPublicKey().getKeyID(); @@ -510,8 +508,14 @@ public class ProviderHelper { return getKeyRingAsArmoredString(data); } - // TODO This method is NOT ACTUALLY USED. Is this preparation for something, or just dead code? - public ArrayList getKeyRingsAsArmoredString(Context context, long[] masterKeyIds) + /** + * TODO: currently not used, but will be needed to upload many keys at once! + * + * @param masterKeyIds + * @return + * @throws IOException + */ + public ArrayList getKeyRingsAsArmoredString(long[] masterKeyIds) throws IOException { ArrayList output = new ArrayList(); @@ -521,7 +525,7 @@ public class ProviderHelper { } // Build a cursor for the selected masterKeyIds - Cursor cursor = null; + Cursor cursor; { String inMasterKeyList = KeyRingData.MASTER_KEY_ID + " IN ("; for (int i = 0; i < masterKeyIds.length; ++i) { @@ -532,7 +536,7 @@ public class ProviderHelper { } inMasterKeyList += ")"; - cursor = context.getContentResolver().query(KeyRingData.buildPublicKeyRingUri(), new String[]{ + cursor = mContentResolver.query(KeyRingData.buildPublicKeyRingUri(), new String[]{ KeyRingData._ID, KeyRingData.MASTER_KEY_ID, KeyRingData.KEY_RING_DATA }, inMasterKeyList, null, null); } @@ -613,13 +617,6 @@ public class ProviderHelper { mContentResolver.insert(uri, contentValueForApiAccounts(accSettings)); } - public void updateApiApp(AppSettings appSettings, Uri uri) { - if (mContentResolver.update(uri, contentValueForApiApps(appSettings), null, - null) <= 0) { - throw new RuntimeException(); - } - } - public void updateApiAccount(AccountSettings accSettings, Uri uri) { if (mContentResolver.update(uri, contentValueForApiAccounts(accSettings), null, null) <= 0) { -- cgit v1.2.3