CachedNumberLookupService.java revision 173ec96476278f0d6aa147d31a60aa3e419e5ca3
1034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Leepackage com.android.dialer.service;
2034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee
3173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shraunerimport android.content.ContentValues;
4034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Leeimport android.content.Context;
5034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee
6034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Leeimport com.android.dialer.calllog.ContactInfo;
7034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee
8034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Leepublic interface CachedNumberLookupService {
9173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner
10173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner    public class CachedContactInfo extends ContactInfo {
11173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner        public static final int SOURCE_TYPE_DIRECTORY = 1;
12173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner        public static final int SOURCE_TYPE_EXTENDED = 2;
13173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner        public static final int SOURCE_TYPE_PLACES = 3;
14173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner        public static final int SOURCE_TYPE_PROFILE = 4;
15173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner
16173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner        public int    sourceType;
17173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner        public int    sourceId;
18173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner        public String lookupKey;
19173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner    }
20173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner
21034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee    /**
22034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee     * Perform a lookup using the cached number lookup service to return contact
23034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee     * information stored in the cache that corresponds to the given number.
24034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee     *
25034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee     * @param context Valid context
26034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee     * @param number Phone number to lookup the cache for
27034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee     * @return A {@link ContactInfo} containing the contact information if the phone
28034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee     * number is found in the cache, {@link ContactInfo#EMPTY} if the phone number was
29034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee     * not found in the cache, and null if there was an error when querying the cache.
30034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee     */
31034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee    public ContactInfo lookupCachedContactFromNumber(Context context, String number);
32173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner
33173ec96476278f0d6aa147d31a60aa3e419e5ca3Jay Shrauner    public void addContact(Context context, CachedContactInfo info);
34034a2b329e469bf6888fbbcf91992f974015c2a8Yorke Lee}
35