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 formatted version of {@link #number}. */ 30 public final CharSequence formattedNumber; 31 /** The country corresponding with the phone number. */ 32 public final String countryIso; 33 /** The geocoded location for the phone number. */ 34 public final String geocode; 35 /** 36 * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}. 37 * <p> 38 * There might be multiple types if this represents a set of entries grouped together. 39 */ 40 public final int[] callTypes; 41 /** The date of the call, in milliseconds since the epoch. */ 42 public final long date; 43 /** The duration of the call in milliseconds, or 0 for missed calls. */ 44 public final long duration; 45 /** The name of the contact, or the empty string. */ 46 public final CharSequence name; 47 /** The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. */ 48 public final int numberType; 49 /** The custom label associated with the phone number in the contact, or the empty string. */ 50 public final CharSequence numberLabel; 51 /** The URI of the contact associated with this phone call. */ 52 public final Uri contactUri; 53 /** 54 * The photo URI of the picture of the contact that is associated with this phone call or 55 * null if there is none. 56 * <p> 57 * This is meant to store the high-res photo only. 58 */ 59 public final Uri photoUri; 60 61 /** Create the details for a call with a number not associated with a contact. */ 62 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, 63 String countryIso, String geocode, int[] callTypes, long date, long duration) { 64 this(number, formattedNumber, countryIso, geocode, callTypes, date, duration, "", 0, "", 65 null, null); 66 } 67 68 /** Create the details for a call with a number associated with a contact. */ 69 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, 70 String countryIso, String geocode, int[] callTypes, long date, long duration, 71 CharSequence name, int numberType, CharSequence numberLabel, Uri contactUri, 72 Uri photoUri) { 73 this.number = number; 74 this.formattedNumber = formattedNumber; 75 this.countryIso = countryIso; 76 this.geocode = geocode; 77 this.callTypes = callTypes; 78 this.date = date; 79 this.duration = duration; 80 this.name = name; 81 this.numberType = numberType; 82 this.numberLabel = numberLabel; 83 this.contactUri = contactUri; 84 this.photoUri = photoUri; 85 } 86 } 87