summaryrefslogtreecommitdiffstats
path: root/src/com/android/dialer/service/CachedNumberLookupService.java
blob: e91d458ceac89f350ac4f8f08f5869a24ff316de (plain)
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
package com.android.dialer.service;

import android.content.Context;

import com.android.dialer.calllog.ContactInfo;

public interface CachedNumberLookupService {

    public interface CachedContactInfo {
        public static final int SOURCE_TYPE_DIRECTORY = 1;
        public static final int SOURCE_TYPE_EXTENDED = 2;
        public static final int SOURCE_TYPE_PLACES = 3;
        public static final int SOURCE_TYPE_PROFILE = 4;
        public static final int SOURCE_TYPE_CNAP = 5;

        public ContactInfo getContactInfo();

        public void setSource(int sourceType, String name, long directoryId);
        public void setDirectorySource(String name, long directoryId);
        public void setExtendedSource(String name, long directoryId);
        public void setLookupKey(String lookupKey);
    }

    public CachedContactInfo buildCachedContactInfo(ContactInfo info);

    /**
     * Perform a lookup using the cached number lookup service to return contact
     * information stored in the cache that corresponds to the given number.
     *
     * @param context Valid context
     * @param number Phone number to lookup the cache for
     * @return A {@link CachedContactInfo} containing the contact information if the phone
     * number is found in the cache, {@link ContactInfo#EMPTY} if the phone number was
     * not found in the cache, and null if there was an error when querying the cache.
     */
    public CachedContactInfo lookupCachedContactFromNumber(Context context, String number);

    public void addContact(Context context, CachedContactInfo info);

    public boolean isCacheUri(String uri);

    public boolean isBusiness(int sourceType);
    public boolean canReportAsInvalid(int sourceType, String objectId);

    public boolean addPhoto(Context context, String number, byte[] photo);

    /**
     * Remove all cached phone number entries from the cache, regardless of how old they
     * are.
     *
     * @param context Valid context
     */
    public void clearAllCacheEntries(Context context);
}