blob: 4e01ab5a42a71876d919eb222445a512cd07fe7f [file] [log] [blame]
Chiao Cheng94b10b52012-08-17 16:59:12 -07001/*
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
17package com.android.dialer;
18
19import android.net.Uri;
20import android.provider.CallLog.Calls;
21import android.provider.ContactsContract.CommonDataKinds.Phone;
22
23/**
24 * The details of a phone call to be shown in the UI.
25 */
26public class PhoneCallDetails {
27 /** The number of the other party involved in the call. */
28 public final CharSequence number;
Jay Shrauner719a7ad2013-05-30 15:41:13 -070029 /** The number presenting rules set by the network, e.g., {@link Calls#PRESENTATION_ALLOWED} */
30 public final int numberPresentation;
Chiao Cheng94b10b52012-08-17 16:59:12 -070031 /** 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;
Yorke Lee56cb0ef2014-02-21 10:02:18 -080062 /**
63 * The source type of the contact associated with this call.
64 */
65 public final int sourceType;
Chiao Cheng94b10b52012-08-17 16:59:12 -070066
67 /** Create the details for a call with a number not associated with a contact. */
Jay Shrauner719a7ad2013-05-30 15:41:13 -070068 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,
Yorke Lee56cb0ef2014-02-21 10:02:18 -080072 callTypes, date, duration, "", 0, "", null, null, 0);
Chiao Cheng94b10b52012-08-17 16:59:12 -070073 }
74
75 /** Create the details for a call with a number associated with a contact. */
Jay Shrauner719a7ad2013-05-30 15:41:13 -070076 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,
Yorke Lee56cb0ef2014-02-21 10:02:18 -080080 Uri photoUri, int sourceType) {
Chiao Cheng94b10b52012-08-17 16:59:12 -070081 this.number = number;
Jay Shrauner719a7ad2013-05-30 15:41:13 -070082 this.numberPresentation = numberPresentation;
Chiao Cheng94b10b52012-08-17 16:59:12 -070083 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;
Yorke Lee56cb0ef2014-02-21 10:02:18 -080094 this.sourceType = sourceType;
Chiao Cheng94b10b52012-08-17 16:59:12 -070095 }
96}