That fuck shit the fascists are using
1package org.tm.archive.contacts;
2
3import android.content.Context;
4import android.database.Cursor;
5import android.net.Uri;
6import android.provider.ContactsContract;
7import android.provider.ContactsContract.Contacts;
8import android.provider.ContactsContract.PhoneLookup;
9
10import java.util.LinkedList;
11import java.util.List;
12
13class ContactIdentityManagerICS extends ContactIdentityManager {
14
15 public ContactIdentityManagerICS(Context context) {
16 super(context);
17 }
18
19 @Override
20 public Uri getSelfIdentityUri() {
21 String[] PROJECTION = new String[] {
22 PhoneLookup.DISPLAY_NAME,
23 PhoneLookup.LOOKUP_KEY,
24 PhoneLookup._ID,
25 };
26
27 Cursor cursor = null;
28
29 try {
30 cursor = context.getContentResolver().query(ContactsContract.Profile.CONTENT_URI,
31 PROJECTION, null, null, null);
32
33 if (cursor != null && cursor.moveToFirst()) {
34 return Contacts.getLookupUri(cursor.getLong(2), cursor.getString(1));
35 }
36 } finally {
37 if (cursor != null)
38 cursor.close();
39 }
40
41 return null;
42 }
43
44 @Override
45 public boolean isSelfIdentityAutoDetected() {
46 return true;
47 }
48
49 @Override
50 public List<Long> getSelfIdentityRawContactIds() {
51 List<Long> results = new LinkedList<Long>();
52
53 String[] PROJECTION = new String[] {
54 ContactsContract.Profile._ID
55 };
56
57 Cursor cursor = null;
58
59 try {
60 cursor = context.getContentResolver().query(ContactsContract.Profile.CONTENT_RAW_CONTACTS_URI,
61 PROJECTION, null, null, null);
62
63 if (cursor == null || cursor.getCount() == 0)
64 return null;
65
66 while (cursor.moveToNext()) {
67 results.add(cursor.getLong(0));
68 }
69
70 return results;
71 } finally {
72 if (cursor != null)
73 cursor.close();
74 }
75 }
76}