1 /* 2 * Copyright (C) 2011 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.dialer; 18 19 import android.net.Uri; 20 import android.provider.CallLog.Calls; 21 import android.provider.ContactsContract.CommonDataKinds.Phone; 22 23 /** 24 * The details of a phone call to be shown in the UI. 25 */ 26 public class PhoneCallDetails { 27 /** The number of the other party involved in the call. */ 28 public final CharSequence number; 29 /** The number presenting rules set by the network, e.g., {@link Calls#PRESENTATION_ALLOWED} */ 30 public final int numberPresentation; 31 /** The formatted version of {@link #number}. */ 32 public final CharSequence formattedNumber; 33 /** The country corresponding with the phone number. */ 34 public final String countryIso; 35 /** The geocoded location for the phone number. */ 36 public final String geocode; 37 /** 38 * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}. 39 * <p> 40 * There might be multiple types if this represents a set of entries grouped together. 41 */ 42 public final int[] callTypes; 43 /** The date of the call, in milliseconds since the epoch. */ 44 public final long date; 45 /** The duration of the call in milliseconds, or 0 for missed calls. */ 46 public final long duration; 47 /** The name of the contact, or the empty string. */ 48 public final CharSequence name; 49 /** The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. */ 50 public final int numberType; 51 /** The custom label associated with the phone number in the contact, or the empty string. */ 52 public final CharSequence numberLabel; 53 /** The URI of the contact associated with this phone call. */ 54 public final Uri contactUri; 55 /** 56 * The photo URI of the picture of the contact that is associated with this phone call or 57 * null if there is none. 58 * <p> 59 * This is meant to store the high-res photo only. 60 */ 61 public final Uri photoUri; 62 /** 63 * The source type of the contact associated with this call. 64 */ 65 public final int sourceType; 66 67 /** Create the details for a call with a number not associated with a contact. */ 68 public PhoneCallDetails(CharSequence number, int numberPresentation, 69 CharSequence formattedNumber, String countryIso, String geocode, 70 int[] callTypes, long date, long duration) { 71 this(number, numberPresentation, formattedNumber, countryIso, geocode, 72 callTypes, date, duration, "", 0, "", null, null, 0); 73 } 74 75 /** Create the details for a call with a number associated with a contact. */ 76 public PhoneCallDetails(CharSequence number, int numberPresentation, 77 CharSequence formattedNumber, String countryIso, String geocode, 78 int[] callTypes, long date, long duration, CharSequence name, 79 int numberType, CharSequence numberLabel, Uri contactUri, 80 Uri photoUri, int sourceType) { 81 this.number = number; 82 this.numberPresentation = numberPresentation; 83 this.formattedNumber = formattedNumber; 84 this.countryIso = countryIso; 85 this.geocode = geocode; 86 this.callTypes = callTypes; 87 this.date = date; 88 this.duration = duration; 89 this.name = name; 90 this.numberType = numberType; 91 this.numberLabel = numberLabel; 92 this.contactUri = contactUri; 93 this.photoUri = photoUri; 94 this.sourceType = sourceType; 95 } 96 } 97