-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContacts.java
More file actions
2435 lines (2195 loc) · 88.5 KB
/
Copy pathContacts.java
File metadata and controls
2435 lines (2195 loc) · 88.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.provider;
import com.android.internal.R;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import android.widget.ImageView;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
/**
* The Contacts provider stores all information about contacts.
*
* @deprecated The APIs have been superseded by {@link ContactsContract}. The newer APIs allow
* access multiple accounts and support aggregation of similar contacts. These APIs continue to
* work but will only return data for the first Google account created, which matches the original
* behavior.
*/
@Deprecated
public class Contacts {
private static final String TAG = "Contacts";
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String AUTHORITY = "contacts";
/**
* The content:// style URL for this provider
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
/**
* Signifies an email address row that is stored in the ContactMethods table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int KIND_EMAIL = 1;
/**
* Signifies a postal address row that is stored in the ContactMethods table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int KIND_POSTAL = 2;
/**
* Signifies an IM address row that is stored in the ContactMethods table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int KIND_IM = 3;
/**
* Signifies an Organization row that is stored in the Organizations table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int KIND_ORGANIZATION = 4;
/**
* Signifies a Phone row that is stored in the Phones table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int KIND_PHONE = 5;
/**
* no public constructor since this is a utility class
*/
private Contacts() {}
/**
* Columns from the Settings table that other columns join into themselves.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public interface SettingsColumns {
/**
* The _SYNC_ACCOUNT to which this setting corresponds. This may be null.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String _SYNC_ACCOUNT = "_sync_account";
/**
* The _SYNC_ACCOUNT_TYPE to which this setting corresponds. This may be null.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String _SYNC_ACCOUNT_TYPE = "_sync_account_type";
/**
* The key of this setting.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String KEY = "key";
/**
* The value of this setting.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String VALUE = "value";
}
/**
* The settings over all of the people
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final class Settings implements BaseColumns, SettingsColumns {
/**
* no public constructor since this is a utility class
*/
private Settings() {}
/**
* The content:// style URL for this table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final Uri CONTENT_URI =
Uri.parse("content://contacts/settings");
/**
* The directory twig for this sub-table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String CONTENT_DIRECTORY = "settings";
/**
* The default sort order for this table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String DEFAULT_SORT_ORDER = "key ASC";
/**
* A setting that is used to indicate if we should sync down all groups for the
* specified account. For this setting the _SYNC_ACCOUNT column must be set.
* If this isn't set then we will only sync the groups whose SHOULD_SYNC column
* is set to true.
* <p>
* This is a boolean setting. It is true if it is set and it is anything other than the
* emptry string or "0".
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String SYNC_EVERYTHING = "syncEverything";
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static String getSetting(ContentResolver cr, String account, String key) {
// For now we only support a single account and the UI doesn't know what
// the account name is, so we're using a global setting for SYNC_EVERYTHING.
// Some day when we add multiple accounts to the UI this should honor the account
// that was asked for.
String selectString;
String[] selectArgs;
if (false) {
selectString = (account == null)
? "_sync_account is null AND key=?"
: "_sync_account=? AND key=?";
// : "_sync_account=? AND _sync_account_type=? AND key=?";
selectArgs = (account == null)
? new String[]{key}
: new String[]{account, key};
} else {
selectString = "key=?";
selectArgs = new String[] {key};
}
Cursor cursor = cr.query(Settings.CONTENT_URI, new String[]{VALUE},
selectString, selectArgs, null);
try {
if (!cursor.moveToNext()) return null;
return cursor.getString(0);
} finally {
cursor.close();
}
}
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static void setSetting(ContentResolver cr, String account, String key,
String value) {
ContentValues values = new ContentValues();
// For now we only support a single account and the UI doesn't know what
// the account name is, so we're using a global setting for SYNC_EVERYTHING.
// Some day when we add multiple accounts to the UI this should honor the account
// that was asked for.
//values.put(_SYNC_ACCOUNT, account.mName);
//values.put(_SYNC_ACCOUNT_TYPE, account.mType);
values.put(KEY, key);
values.put(VALUE, value);
cr.update(Settings.CONTENT_URI, values, null, null);
}
}
/**
* Columns from the People table that other tables join into themselves.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public interface PeopleColumns {
/**
* The person's name.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String NAME = "name";
/**
* Phonetic equivalent of the person's name, in a locale-dependent
* character set (e.g. hiragana for Japanese).
* Used for pronunciation and/or collation in some languages.
* <p>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String PHONETIC_NAME = "phonetic_name";
/**
* The display name. If name is not null name, else if number is not null number,
* else if email is not null email.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String DISPLAY_NAME = "display_name";
/**
* The field for sorting list phonetically. The content of this field
* may not be human readable but phonetically sortable.
* <P>Type: TEXT</p>
* @hide Used only in Contacts application for now.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String SORT_STRING = "sort_string";
/**
* Notes about the person.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String NOTES = "notes";
/**
* The number of times a person has been contacted
* <P>Type: INTEGER</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String TIMES_CONTACTED = "times_contacted";
/**
* The last time a person was contacted.
* <P>Type: INTEGER</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String LAST_TIME_CONTACTED = "last_time_contacted";
/**
* A custom ringtone associated with a person. Not always present.
* <P>Type: TEXT (URI to the ringtone)</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String CUSTOM_RINGTONE = "custom_ringtone";
/**
* Whether the person should always be sent to voicemail. Not always
* present.
* <P>Type: INTEGER (0 for false, 1 for true)</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String SEND_TO_VOICEMAIL = "send_to_voicemail";
/**
* Is the contact starred?
* <P>Type: INTEGER (boolean)</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String STARRED = "starred";
/**
* The server version of the photo
* <P>Type: TEXT (the version number portion of the photo URI)</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String PHOTO_VERSION = "photo_version";
}
/**
* This table contains people.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final class People implements BaseColumns, PeopleColumns,
PhonesColumns, PresenceColumns {
/**
* no public constructor since this is a utility class
* @deprecated see {@link android.provider.ContactsContract}
*/
private People() {}
/**
* The content:// style URL for this table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final Uri CONTENT_URI =
Uri.parse("content://contacts/people");
/**
* The content:// style URL for filtering people by name. The filter
* argument should be passed as an additional path segment after this URI.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final Uri CONTENT_FILTER_URI =
Uri.parse("content://contacts/people/filter");
/**
* The content:// style URL for the table that holds the deleted
* contacts.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final Uri DELETED_CONTENT_URI =
Uri.parse("content://contacts/deleted_people");
/**
* The content:// style URL for filtering people that have a specific
* E-mail or IM address. The filter argument should be passed as an
* additional path segment after this URI. This matches any people with
* at least one E-mail or IM {@link ContactMethods} that match the
* filter.
*
* Not exposed because we expect significant changes in the contacts
* schema and do not want to have to support this.
* @hide
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final Uri WITH_EMAIL_OR_IM_FILTER_URI =
Uri.parse("content://contacts/people/with_email_or_im_filter");
/**
* The MIME type of {@link #CONTENT_URI} providing a directory of
* people.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/person";
/**
* The MIME type of a {@link #CONTENT_URI} subdirectory of a single
* person.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/person";
/**
* The default sort order for this table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String DEFAULT_SORT_ORDER = People.NAME + " ASC";
/**
* The ID of the persons preferred phone number.
* <P>Type: INTEGER (foreign key to phones table on the _ID field)</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String PRIMARY_PHONE_ID = "primary_phone";
/**
* The ID of the persons preferred email.
* <P>Type: INTEGER (foreign key to contact_methods table on the
* _ID field)</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String PRIMARY_EMAIL_ID = "primary_email";
/**
* The ID of the persons preferred organization.
* <P>Type: INTEGER (foreign key to organizations table on the
* _ID field)</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String PRIMARY_ORGANIZATION_ID = "primary_organization";
/**
* Mark a person as having been contacted.
*
* @param resolver the ContentResolver to use
* @param personId the person who was contacted
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static void markAsContacted(ContentResolver resolver, long personId) {
Uri uri = ContentUris.withAppendedId(CONTENT_URI, personId);
uri = Uri.withAppendedPath(uri, "update_contact_time");
ContentValues values = new ContentValues();
// There is a trigger in place that will update TIMES_CONTACTED when
// LAST_TIME_CONTACTED is modified.
values.put(LAST_TIME_CONTACTED, System.currentTimeMillis());
resolver.update(uri, values, null, null);
}
/**
* @hide Used in vCard parser code.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static long tryGetMyContactsGroupId(ContentResolver resolver) {
Cursor groupsCursor = resolver.query(Groups.CONTENT_URI, GROUPS_PROJECTION,
Groups.SYSTEM_ID + "='" + Groups.GROUP_MY_CONTACTS + "'", null, null);
if (groupsCursor != null) {
try {
if (groupsCursor.moveToFirst()) {
return groupsCursor.getLong(0);
}
} finally {
groupsCursor.close();
}
}
return 0;
}
/**
* Adds a person to the My Contacts group.
*
* @param resolver the resolver to use
* @param personId the person to add to the group
* @return the URI of the group membership row
* @throws IllegalStateException if the My Contacts group can't be found
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static Uri addToMyContactsGroup(ContentResolver resolver, long personId) {
long groupId = tryGetMyContactsGroupId(resolver);
if (groupId == 0) {
throw new IllegalStateException("Failed to find the My Contacts group");
}
return addToGroup(resolver, personId, groupId);
}
/**
* Adds a person to a group referred to by name.
*
* @param resolver the resolver to use
* @param personId the person to add to the group
* @param groupName the name of the group to add the contact to
* @return the URI of the group membership row
* @throws IllegalStateException if the group can't be found
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static Uri addToGroup(ContentResolver resolver, long personId, String groupName) {
long groupId = 0;
Cursor groupsCursor = resolver.query(Groups.CONTENT_URI, GROUPS_PROJECTION,
Groups.NAME + "=?", new String[] { groupName }, null);
if (groupsCursor != null) {
try {
if (groupsCursor.moveToFirst()) {
groupId = groupsCursor.getLong(0);
}
} finally {
groupsCursor.close();
}
}
if (groupId == 0) {
throw new IllegalStateException("Failed to find the My Contacts group");
}
return addToGroup(resolver, personId, groupId);
}
/**
* Adds a person to a group.
*
* @param resolver the resolver to use
* @param personId the person to add to the group
* @param groupId the group to add the person to
* @return the URI of the group membership row
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static Uri addToGroup(ContentResolver resolver, long personId, long groupId) {
ContentValues values = new ContentValues();
values.put(GroupMembership.PERSON_ID, personId);
values.put(GroupMembership.GROUP_ID, groupId);
return resolver.insert(GroupMembership.CONTENT_URI, values);
}
private static final String[] GROUPS_PROJECTION = new String[] {
Groups._ID,
};
/**
* Creates a new contacts and adds it to the "My Contacts" group.
*
* @param resolver the ContentResolver to use
* @param values the values to use when creating the contact
* @return the URI of the contact, or null if the operation fails
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static Uri createPersonInMyContactsGroup(ContentResolver resolver,
ContentValues values) {
Uri contactUri = resolver.insert(People.CONTENT_URI, values);
if (contactUri == null) {
Log.e(TAG, "Failed to create the contact");
return null;
}
if (addToMyContactsGroup(resolver, ContentUris.parseId(contactUri)) == null) {
resolver.delete(contactUri, null, null);
return null;
}
return contactUri;
}
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static Cursor queryGroups(ContentResolver resolver, long person) {
return resolver.query(GroupMembership.CONTENT_URI, null, "person=?",
new String[]{String.valueOf(person)}, Groups.DEFAULT_SORT_ORDER);
}
/**
* Set the photo for this person. data may be null
* @param cr the ContentResolver to use
* @param person the Uri of the person whose photo is to be updated
* @param data the byte[] that represents the photo
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static void setPhotoData(ContentResolver cr, Uri person, byte[] data) {
Uri photoUri = Uri.withAppendedPath(person, Contacts.Photos.CONTENT_DIRECTORY);
ContentValues values = new ContentValues();
values.put(Photos.DATA, data);
cr.update(photoUri, values, null, null);
}
/**
* Opens an InputStream for the person's photo and returns the photo as a Bitmap.
* If the person's photo isn't present returns the placeholderImageResource instead.
* @param person the person whose photo should be used
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static InputStream openContactPhotoInputStream(ContentResolver cr, Uri person) {
Uri photoUri = Uri.withAppendedPath(person, Contacts.Photos.CONTENT_DIRECTORY);
Cursor cursor = cr.query(photoUri, new String[]{Photos.DATA}, null, null, null);
try {
if (cursor == null || !cursor.moveToNext()) {
return null;
}
byte[] data = cursor.getBlob(0);
if (data == null) {
return null;
}
return new ByteArrayInputStream(data);
} finally {
if (cursor != null) cursor.close();
}
}
/**
* Opens an InputStream for the person's photo and returns the photo as a Bitmap.
* If the person's photo isn't present returns the placeholderImageResource instead.
* @param context the Context
* @param person the person whose photo should be used
* @param placeholderImageResource the image resource to use if the person doesn't
* have a photo
* @param options the decoding options, can be set to null
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static Bitmap loadContactPhoto(Context context, Uri person,
int placeholderImageResource, BitmapFactory.Options options) {
if (person == null) {
return loadPlaceholderPhoto(placeholderImageResource, context, options);
}
InputStream stream = openContactPhotoInputStream(context.getContentResolver(), person);
Bitmap bm = stream != null ? BitmapFactory.decodeStream(stream, null, options) : null;
if (bm == null) {
bm = loadPlaceholderPhoto(placeholderImageResource, context, options);
}
return bm;
}
private static Bitmap loadPlaceholderPhoto(int placeholderImageResource, Context context,
BitmapFactory.Options options) {
if (placeholderImageResource == 0) {
return null;
}
return BitmapFactory.decodeResource(context.getResources(),
placeholderImageResource, options);
}
/**
* A sub directory of a single person that contains all of their Phones.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final class Phones implements BaseColumns, PhonesColumns,
PeopleColumns {
/**
* no public constructor since this is a utility class
*/
private Phones() {}
/**
* The directory twig for this sub-table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String CONTENT_DIRECTORY = "phones";
/**
* The default sort order for this table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String DEFAULT_SORT_ORDER = "number ASC";
}
/**
* A subdirectory of a single person that contains all of their
* ContactMethods.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final class ContactMethods
implements BaseColumns, ContactMethodsColumns, PeopleColumns {
/**
* no public constructor since this is a utility class
*/
private ContactMethods() {}
/**
* The directory twig for this sub-table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String CONTENT_DIRECTORY = "contact_methods";
/**
* The default sort order for this table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String DEFAULT_SORT_ORDER = "data ASC";
}
/**
* The extensions for a person
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static class Extensions implements BaseColumns, ExtensionsColumns {
/**
* no public constructor since this is a utility class
* @deprecated see {@link android.provider.ContactsContract}
*/
private Extensions() {}
/**
* The directory twig for this sub-table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String CONTENT_DIRECTORY = "extensions";
/**
* The default sort order for this table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String DEFAULT_SORT_ORDER = "name ASC";
/**
* The ID of the person this phone number is assigned to.
* <P>Type: INTEGER (long)</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String PERSON_ID = "person";
}
}
/**
* Columns from the groups table.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public interface GroupsColumns {
/**
* The group name.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String NAME = "name";
/**
* Notes about the group.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String NOTES = "notes";
/**
* Whether this group should be synced if the SYNC_EVERYTHING settings is false
* for this group's account.
* <P>Type: INTEGER (boolean)</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String SHOULD_SYNC = "should_sync";
/**
* The ID of this group if it is a System Group, null otherwise.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String SYSTEM_ID = "system_id";
}
/**
* This table contains the groups for an account.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final class Groups
implements BaseColumns, GroupsColumns {
/**
* no public constructor since this is a utility class
*/
private Groups() {}
/**
* The content:// style URL for this table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final Uri CONTENT_URI =
Uri.parse("content://contacts/groups");
/**
* The content:// style URL for the table that holds the deleted
* groups.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final Uri DELETED_CONTENT_URI =
Uri.parse("content://contacts/deleted_groups");
/**
* The MIME type of {@link #CONTENT_URI} providing a directory of
* groups.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contactsgroup";
/**
* The MIME type of a {@link #CONTENT_URI} subdirectory of a single
* group.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contactsgroup";
/**
* The default sort order for this table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String DEFAULT_SORT_ORDER = NAME + " ASC";
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String GROUP_ANDROID_STARRED = "Starred in Android";
/**
* The "My Contacts" system group.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String GROUP_MY_CONTACTS = "Contacts";
}
/**
* Columns from the Phones table that other columns join into themselves.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public interface PhonesColumns {
/**
* The type of the the phone number.
* <P>Type: INTEGER (one of the constants below)</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String TYPE = "type";
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int TYPE_CUSTOM = 0;
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int TYPE_HOME = 1;
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int TYPE_MOBILE = 2;
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int TYPE_WORK = 3;
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int TYPE_FAX_WORK = 4;
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int TYPE_FAX_HOME = 5;
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int TYPE_PAGER = 6;
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final int TYPE_OTHER = 7;
/**
* The user provided label for the phone number, only used if TYPE is TYPE_CUSTOM.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String LABEL = "label";
/**
* The phone number as the user entered it.
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String NUMBER = "number";
/**
* The normalized phone number
* <P>Type: TEXT</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String NUMBER_KEY = "number_key";
/**
* Whether this is the primary phone number
* <P>Type: INTEGER (if set, non-0 means true)</P>
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final String ISPRIMARY = "isprimary";
}
/**
* This table stores phone numbers and a reference to the person that the
* contact method belongs to. Phone numbers are stored separately from
* other contact methods to make caller ID lookup more efficient.
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final class Phones
implements BaseColumns, PhonesColumns, PeopleColumns {
/**
* no public constructor since this is a utility class
*/
private Phones() {}
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final CharSequence getDisplayLabel(Context context, int type,
CharSequence label, CharSequence[] labelArray) {
CharSequence display = "";
if (type != People.Phones.TYPE_CUSTOM) {
CharSequence[] labels = labelArray != null? labelArray
: context.getResources().getTextArray(
com.android.internal.R.array.phoneTypes);
try {
display = labels[type - 1];
} catch (ArrayIndexOutOfBoundsException e) {
display = labels[People.Phones.TYPE_HOME - 1];
}
} else {
if (!TextUtils.isEmpty(label)) {
display = label;
}
}
return display;
}
/**
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final CharSequence getDisplayLabel(Context context, int type,
CharSequence label) {
return getDisplayLabel(context, type, label, null);
}
/**
* The content:// style URL for this table
* @deprecated see {@link android.provider.ContactsContract}
*/
@Deprecated
public static final Uri CONTENT_URI =
Uri.parse("content://contacts/phones");
/**
* The content:// style URL for filtering phone numbers
* @deprecated see {@link android.provider.ContactsContract}
*/