1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License 15 */ 16 17 package com.android.incallui.bindings; 18 19 import android.graphics.Bitmap; 20 import com.android.dialer.logging.ContactLookupResult; 21 22 /** Provides phone number lookup services. */ 23 public interface PhoneNumberService { 24 25 /** 26 * Get a phone number number asynchronously. 27 * 28 * @param phoneNumber The phone number to lookup. 29 * @param listener The listener to notify when the phone number lookup is complete. 30 * @param imageListener The listener to notify when the image lookup is complete. 31 */ getPhoneNumberInfo( String phoneNumber, NumberLookupListener listener, ImageLookupListener imageListener, boolean isIncoming)32 void getPhoneNumberInfo( 33 String phoneNumber, 34 NumberLookupListener listener, 35 ImageLookupListener imageListener, 36 boolean isIncoming); 37 38 interface NumberLookupListener { 39 40 /** 41 * Callback when a phone number has been looked up. 42 * 43 * @param info The looked up information. Or (@literal null} if there are no results. 44 */ onPhoneNumberInfoComplete(PhoneNumberInfo info)45 void onPhoneNumberInfoComplete(PhoneNumberInfo info); 46 } 47 48 interface ImageLookupListener { 49 50 /** 51 * Callback when a image has been fetched. 52 * 53 * @param bitmap The fetched image. 54 */ onImageFetchComplete(Bitmap bitmap)55 void onImageFetchComplete(Bitmap bitmap); 56 } 57 58 interface PhoneNumberInfo { 59 getDisplayName()60 String getDisplayName(); 61 getNumber()62 String getNumber(); 63 getPhoneType()64 int getPhoneType(); 65 getPhoneLabel()66 String getPhoneLabel(); 67 getNormalizedNumber()68 String getNormalizedNumber(); 69 getImageUrl()70 String getImageUrl(); 71 getLookupKey()72 String getLookupKey(); 73 isBusiness()74 boolean isBusiness(); 75 getLookupSource()76 ContactLookupResult.Type getLookupSource(); 77 } 78 } 79