More cleanup in providerHelper

This commit is contained in:
Dominik Schürmann 2014-04-11 17:58:32 +02:00
parent 094fb698de
commit c4d9fd88aa

View File

@ -384,7 +384,6 @@ public class ProviderHelper {
* Saves a PGPSecretKeyRing in the DB. This will only work if a corresponding public keyring * Saves a PGPSecretKeyRing in the DB. This will only work if a corresponding public keyring
* is already in the database! * is already in the database!
*/ */
@SuppressWarnings("unchecked")
public void saveKeyRing(PGPSecretKeyRing keyRing) throws IOException { public void saveKeyRing(PGPSecretKeyRing keyRing) throws IOException {
long masterKeyId = keyRing.getPublicKey().getKeyID(); 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 * Saves (or updates) a pair of public and secret KeyRings in the database
*/ */
@SuppressWarnings("unchecked")
public void saveKeyRing(PGPPublicKeyRing pubRing, PGPSecretKeyRing privRing) throws IOException { public void saveKeyRing(PGPPublicKeyRing pubRing, PGPSecretKeyRing privRing) throws IOException {
long masterKeyId = pubRing.getPublicKey().getKeyID(); long masterKeyId = pubRing.getPublicKey().getKeyID();
@ -510,8 +508,14 @@ public class ProviderHelper {
return getKeyRingAsArmoredString(data); return getKeyRingAsArmoredString(data);
} }
// TODO This method is NOT ACTUALLY USED. Is this preparation for something, or just dead code? /**
public ArrayList<String> 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<String> getKeyRingsAsArmoredString(long[] masterKeyIds)
throws IOException { throws IOException {
ArrayList<String> output = new ArrayList<String>(); ArrayList<String> output = new ArrayList<String>();
@ -521,7 +525,7 @@ public class ProviderHelper {
} }
// Build a cursor for the selected masterKeyIds // Build a cursor for the selected masterKeyIds
Cursor cursor = null; Cursor cursor;
{ {
String inMasterKeyList = KeyRingData.MASTER_KEY_ID + " IN ("; String inMasterKeyList = KeyRingData.MASTER_KEY_ID + " IN (";
for (int i = 0; i < masterKeyIds.length; ++i) { for (int i = 0; i < masterKeyIds.length; ++i) {
@ -532,7 +536,7 @@ public class ProviderHelper {
} }
inMasterKeyList += ")"; 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 KeyRingData._ID, KeyRingData.MASTER_KEY_ID, KeyRingData.KEY_RING_DATA
}, inMasterKeyList, null, null); }, inMasterKeyList, null, null);
} }
@ -613,13 +617,6 @@ public class ProviderHelper {
mContentResolver.insert(uri, contentValueForApiAccounts(accSettings)); 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) { public void updateApiAccount(AccountSettings accSettings, Uri uri) {
if (mContentResolver.update(uri, contentValueForApiAccounts(accSettings), null, if (mContentResolver.update(uri, contentValueForApiAccounts(accSettings), null,
null) <= 0) { null) <= 0) {