From 464f7c671834cd01c83b5453437c0df451510a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 30 Jan 2015 10:47:40 +0100 Subject: [PATCH] Fix saving of allowed keys --- .../keychain/provider/ProviderHelper.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) 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 db458254c..2bf62c2e0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -1310,7 +1310,6 @@ public class ProviderHelper { progress.setProgress(100, 100); log.add(LogType.MSG_CON_SUCCESS, indent); - indent -= 1; return new ConsolidateResult(ConsolidateResult.RESULT_OK, log); @@ -1528,20 +1527,15 @@ public class ProviderHelper { public void saveAllowedKeyIdsForApp(Uri uri, Set allowedKeyIds) throws RemoteException, OperationApplicationException { - ArrayList ops = new ArrayList<>(); - - // clear table - ops.add(ContentProviderOperation.newDelete(uri) - .build()); + // wipe whole table of allowed keys for this account + mContentResolver.delete(uri, null, null); // re-insert allowed key ids for (Long keyId : allowedKeyIds) { - ops.add(ContentProviderOperation.newInsert(uri) - .withValue(ApiAllowedKeys.KEY_ID, keyId) - .build()); + ContentValues values = new ContentValues(); + values.put(ApiAllowedKeys.KEY_ID, keyId); + mContentResolver.insert(uri, values); } - - getContentResolver().applyBatch(KeychainContract.CONTENT_AUTHORITY, ops); } public Set getAllFingerprints(Uri uri) {