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.service; 18 19 import android.graphics.Bitmap; 20 21 /** 22 * Provides phone number lookup services. 23 */ 24 public interface PhoneNumberService { 25 26 /** 27 * Get a phone number number asynchronously. 28 * 29 * @param phoneNumber The phone number to lookup. 30 * @param listener The listener to notify when the phone number lookup is complete. 31 * @param imageListener The listener to notify when the image lookup is complete. 32 */ getPhoneNumberInfo(String phoneNumber, NumberLookupListener listener, ImageLookupListener imageListener, boolean isIncoming)33 public void getPhoneNumberInfo(String phoneNumber, NumberLookupListener listener, 34 ImageLookupListener imageListener, boolean isIncoming); 35 36 public interface NumberLookupListener { 37 38 /** 39 * Callback when a phone number has been looked up. 40 * 41 * @param info The looked up information. Or (@literal null} if there are no results. 42 */ onPhoneNumberInfoComplete(PhoneNumberInfo info)43 public void onPhoneNumberInfoComplete(PhoneNumberInfo info); 44 } 45 46 public interface ImageLookupListener { 47 48 /** 49 * Callback when a image has been fetched. 50 * 51 * @param bitmap The fetched image. 52 */ onImageFetchComplete(Bitmap bitmap)53 public void onImageFetchComplete(Bitmap bitmap); 54 } 55 56 public interface PhoneNumberInfo { getDisplayName()57 public String getDisplayName(); getNumber()58 public String getNumber(); getPhoneType()59 public int getPhoneType(); getPhoneLabel()60 public String getPhoneLabel(); getNormalizedNumber()61 public String getNormalizedNumber(); getImageUrl()62 public String getImageUrl(); getLookupKey()63 public String getLookupKey(); isBusiness()64 public boolean isBusiness(); getLookupSource()65 public int getLookupSource(); 66 } 67 } 68