aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2015-11-23 12:57:26 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2015-11-23 12:57:26 +0100
commitaf8fd8db695e538de5250af8c9d0f6c19d260a01 (patch)
tree4ccad3581ad76580c4e9c5be1827726bc8481112 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util
parenteda53d42de111bbba199060e77881fa044a71c7a (diff)
downloadopen-keychain-af8fd8db695e538de5250af8c9d0f6c19d260a01.tar.gz
open-keychain-af8fd8db695e538de5250af8c9d0f6c19d260a01.tar.bz2
open-keychain-af8fd8db695e538de5250af8c9d0f6c19d260a01.zip
No need to delete by raw contact id
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java38
1 files changed, 8 insertions, 30 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 2284cc626..ab9587910 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java
@@ -516,22 +516,22 @@ public class ContactHelper {
deletedKeys.remove(masterKeyId);
- // get raw contact to this master key id
- long rawContactId = findRawContactId(resolver, masterKeyId);
- Log.d(Constants.TAG, "rawContactId: " + rawContactId);
-
ArrayList<ContentProviderOperation> ops = new ArrayList<>();
// Do not store expired or revoked or unverified keys in contact db - and
// remove them if they already exist. Secret keys do not reach this point
if (isExpired || isRevoked || !isVerified) {
- Log.d(Constants.TAG, "Expired or revoked or unverified: Deleting rawContactId "
- + rawContactId);
- if (rawContactId != -1) {
- deleteRawContactById(resolver, rawContactId);
+ Log.d(Constants.TAG, "Expired or revoked or unverified: Deleting masterKeyId "
+ + masterKeyId);
+ if (masterKeyId != -1) {
+ deleteRawContactByMasterKeyId(resolver, masterKeyId);
}
} else if (userIdSplit.name != null) {
+ // get raw contact to this master key id
+ long rawContactId = findRawContactId(resolver, masterKeyId);
+ Log.d(Constants.TAG, "rawContactId: " + rawContactId);
+
// Create a new rawcontact with corresponding key if it does not exist yet
if (rawContactId == -1) {
Log.d(Constants.TAG, "Insert new raw contact with masterKeyId " + masterKeyId);
@@ -710,28 +710,6 @@ public class ContactHelper {
}
/**
- * Deletes raw contacts from ContactsContract.RawContacts based on rawContactId. Does not
- * delete contacts from the "me" contact defined in ContactsContract.Profile
- *
- * @param resolver
- * @param rawContactId
- * @return number of rows deleted
- */
- private static int deleteRawContactById(ContentResolver resolver, long rawContactId) {
- // CALLER_IS_SYNCADAPTER allows us to actually wipe the RawContact from the device, otherwise
- // would be just flagged for deletion
- Uri deleteUri = ContactsContract.RawContacts.CONTENT_URI.buildUpon().
- appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build();
-
- return resolver.delete(deleteUri,
- ContactsContract.RawContacts.ACCOUNT_TYPE + "=? AND " +
- ContactsContract.RawContacts._ID + "=?",
- new String[]{
- Constants.ACCOUNT_TYPE, Long.toString(rawContactId)
- });
- }
-
- /**
* Deletes raw contacts from ContactsContract.RawContacts based on masterKeyId. Does not
* delete contacts from the "me" contact defined in ContactsContract.Profile
*