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 com.android.dialer.calllog.PhoneNumberDisplayUtil;
     20 
     21 import android.content.Context;
     22 import android.net.Uri;
     23 import android.provider.CallLog.Calls;
     24 import android.telecom.PhoneAccountHandle;
     25 
     26 /**
     27  * The details of a phone call to be shown in the UI.
     28  */
     29 public class PhoneCallDetails {
     30     // The number of the other party involved in the call.
     31     public CharSequence number;
     32     // The number presenting rules set by the network, e.g., {@link Calls#PRESENTATION_ALLOWED}
     33     public int numberPresentation;
     34     // The formatted version of {@link #number}.
     35     public CharSequence formattedNumber;
     36     // The country corresponding with the phone number.
     37     public String countryIso;
     38     // The geocoded location for the phone number.
     39     public String geocode;
     40 
     41     /**
     42      * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}.
     43      * <p>
     44      * There might be multiple types if this represents a set of entries grouped together.
     45      */
     46     public int[] callTypes;
     47 
     48     // The date of the call, in milliseconds since the epoch.
     49     public long date;
     50     // The duration of the call in milliseconds, or 0 for missed calls.
     51     public long duration;
     52     // The name of the contact, or the empty string.
     53     public CharSequence name;
     54     // The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available.
     55     public int numberType;
     56     // The custom label associated with the phone number in the contact, or the empty string.
     57     public CharSequence numberLabel;
     58     // The URI of the contact associated with this phone call.
     59     public Uri contactUri;
     60 
     61     /**
     62      * The photo URI of the picture of the contact that is associated with this phone call or
     63      * null if there is none.
     64      * <p>
     65      * This is meant to store the high-res photo only.
     66      */
     67     public Uri photoUri;
     68 
     69     // The source type of the contact associated with this call.
     70     public int sourceType;
     71 
     72     // The object id type of the contact associated with this call.
     73     public String objectId;
     74 
     75     // The unique identifier for the account associated with the call.
     76     public PhoneAccountHandle accountHandle;
     77 
     78     // Features applicable to this call.
     79     public int features;
     80 
     81     // Total data usage for this call.
     82     public Long dataUsage;
     83 
     84     // Voicemail transcription
     85     public String transcription;
     86 
     87     // The display string for the number.
     88     public String displayNumber;
     89 
     90     // Whether the contact number is a voicemail number.
     91     public boolean isVoicemail;
     92 
     93     /**
     94      * If this is a voicemail, whether the message is read. For other types of calls, this defaults
     95      * to {@code true}.
     96      */
     97     public boolean isRead = true;
     98 
     99     /**
    100      * Constructor with required fields for the details of a call with a number associated with a
    101      * contact.
    102      */
    103     public PhoneCallDetails(
    104             Context context,
    105             CharSequence number,
    106             int numberPresentation,
    107             CharSequence formattedNumber,
    108             boolean isVoicemail) {
    109         this.number = number;
    110         this.numberPresentation = numberPresentation;
    111         this.formattedNumber = formattedNumber;
    112         this.isVoicemail = isVoicemail;
    113         this.displayNumber = PhoneNumberDisplayUtil.getDisplayNumber(
    114                 context,
    115                 this.number,
    116                 this.numberPresentation,
    117                 this.formattedNumber,
    118                 this.isVoicemail).toString();
    119     }
    120 }
    121