1 package com.android.dialer.service;
2 
3 import android.content.ContentValues;
4 import android.content.Context;
5 
6 import com.android.dialer.calllog.ContactInfo;
7 
8 public interface CachedNumberLookupService {
9 
10     public interface CachedContactInfo {
getContactInfo()11         public ContactInfo getContactInfo();
12 
setDirectorySource(String name, long directoryId)13         public void setDirectorySource(String name, long directoryId);
setExtendedSource(String name, long directoryId)14         public void setExtendedSource(String name, long directoryId);
setLookupKey(String lookupKey)15         public void setLookupKey(String lookupKey);
16     }
17 
buildCachedContactInfo(ContactInfo info)18     public CachedContactInfo buildCachedContactInfo(ContactInfo info);
19 
20     /**
21      * Perform a lookup using the cached number lookup service to return contact
22      * information stored in the cache that corresponds to the given number.
23      *
24      * @param context Valid context
25      * @param number Phone number to lookup the cache for
26      * @return A {@link CachedContactInfo} containing the contact information if the phone
27      * number is found in the cache, {@link ContactInfo#EMPTY} if the phone number was
28      * not found in the cache, and null if there was an error when querying the cache.
29      */
lookupCachedContactFromNumber(Context context, String number)30     public CachedContactInfo lookupCachedContactFromNumber(Context context, String number);
31 
addContact(Context context, CachedContactInfo info)32     public void addContact(Context context, CachedContactInfo info);
33 
isCacheUri(String uri)34     public boolean isCacheUri(String uri);
35 
isBusiness(int sourceType)36     public boolean isBusiness(int sourceType);
canReportAsInvalid(int sourceType, String objectId)37     public boolean canReportAsInvalid(int sourceType, String objectId);
38 
addPhoto(Context context, String number, byte[] photo)39     public boolean addPhoto(Context context, String number, byte[] photo);
40 
41     /**
42      * Remove all cached phone number entries from the cache, regardless of how old they
43      * are.
44      *
45      * @param context Valid context
46      */
clearAllCacheEntries(Context context)47     public void clearAllCacheEntries(Context context);
48 }
49