Home | History | Annotate | Download | only in dialer
      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     /** Create the details for a call with a number not associated with a contact. */
     64     public PhoneCallDetails(CharSequence number, int numberPresentation,
     65             CharSequence formattedNumber, String countryIso, String geocode,
     66             int[] callTypes, long date, long duration) {
     67         this(number, numberPresentation, formattedNumber, countryIso, geocode,
     68                 callTypes, date, duration, "", 0, "", null, null);
     69     }
     70 
     71     /** Create the details for a call with a number associated with a contact. */
     72     public PhoneCallDetails(CharSequence number, int numberPresentation,
     73             CharSequence formattedNumber, String countryIso, String geocode,
     74             int[] callTypes, long date, long duration, CharSequence name,
     75             int numberType, CharSequence numberLabel, Uri contactUri,
     76             Uri photoUri) {
     77         this.number = number;
     78         this.numberPresentation = numberPresentation;
     79         this.formattedNumber = formattedNumber;
     80         this.countryIso = countryIso;
     81         this.geocode = geocode;
     82         this.callTypes = callTypes;
     83         this.date = date;
     84         this.duration = duration;
     85         this.name = name;
     86         this.numberType = numberType;
     87         this.numberLabel = numberLabel;
     88         this.contactUri = contactUri;
     89         this.photoUri = photoUri;
     90     }
     91 }
     92