blob: 0dc6fd3e6ea37531fb2e29ab7c8be118f3f07bbc [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
Nancy Chen87ba4892014-06-11 17:56:07 -070019import android.graphics.drawable.Drawable;
Chiao Cheng94b10b52012-08-17 16:59:12 -070020import android.net.Uri;
21import android.provider.CallLog.Calls;
22import android.provider.ContactsContract.CommonDataKinds.Phone;
23
24/**
25 * The details of a phone call to be shown in the UI.
26 */
27public class PhoneCallDetails {
28 /** The number of the other party involved in the call. */
29 public final CharSequence number;
Jay Shrauner719a7ad2013-05-30 15:41:13 -070030 /** The number presenting rules set by the network, e.g., {@link Calls#PRESENTATION_ALLOWED} */
31 public final int numberPresentation;
Chiao Cheng94b10b52012-08-17 16:59:12 -070032 /** The formatted version of {@link #number}. */
33 public final CharSequence formattedNumber;
34 /** The country corresponding with the phone number. */
35 public final String countryIso;
36 /** The geocoded location for the phone number. */
37 public final String geocode;
38 /**
39 * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}.
40 * <p>
41 * There might be multiple types if this represents a set of entries grouped together.
42 */
43 public final int[] callTypes;
44 /** The date of the call, in milliseconds since the epoch. */
45 public final long date;
46 /** The duration of the call in milliseconds, or 0 for missed calls. */
47 public final long duration;
48 /** The name of the contact, or the empty string. */
49 public final CharSequence name;
50 /** The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. */
51 public final int numberType;
52 /** The custom label associated with the phone number in the contact, or the empty string. */
53 public final CharSequence numberLabel;
54 /** The URI of the contact associated with this phone call. */
55 public final Uri contactUri;
56 /**
57 * The photo URI of the picture of the contact that is associated with this phone call or
58 * null if there is none.
59 * <p>
60 * This is meant to store the high-res photo only.
61 */
62 public final Uri photoUri;
Yorke Lee56cb0ef2014-02-21 10:02:18 -080063 /**
64 * The source type of the contact associated with this call.
65 */
66 public final int sourceType;
Nancy Chen87ba4892014-06-11 17:56:07 -070067 /**
68 * The unique identifier for the provider associated with the call.
69 */
Ihab Awad1d1bd0d2014-06-30 21:24:01 -070070 public final Drawable accountIcon;
Tyler Gunn8b0e8582014-07-10 12:28:43 -070071 /**
72 * Features applicable to this call.
73 */
74 public final int features;
75 /**
76 * Total data usage for this call.
77 */
78 public final Long dataUsage;
Chiao Cheng94b10b52012-08-17 16:59:12 -070079
80 /** Create the details for a call with a number not associated with a contact. */
Jay Shrauner719a7ad2013-05-30 15:41:13 -070081 public PhoneCallDetails(CharSequence number, int numberPresentation,
82 CharSequence formattedNumber, String countryIso, String geocode,
Tyler Gunn8b0e8582014-07-10 12:28:43 -070083 int[] callTypes, long date, long duration, Drawable accountIcon, int features,
84 Long dataUsage) {
Jay Shrauner719a7ad2013-05-30 15:41:13 -070085 this(number, numberPresentation, formattedNumber, countryIso, geocode,
Tyler Gunn8b0e8582014-07-10 12:28:43 -070086 callTypes, date, duration, "", 0, "", null, null, 0, accountIcon, features,
87 dataUsage);
Chiao Cheng94b10b52012-08-17 16:59:12 -070088 }
89
90 /** Create the details for a call with a number associated with a contact. */
Jay Shrauner719a7ad2013-05-30 15:41:13 -070091 public PhoneCallDetails(CharSequence number, int numberPresentation,
92 CharSequence formattedNumber, String countryIso, String geocode,
93 int[] callTypes, long date, long duration, CharSequence name,
94 int numberType, CharSequence numberLabel, Uri contactUri,
Tyler Gunn8b0e8582014-07-10 12:28:43 -070095 Uri photoUri, int sourceType, Drawable accountIcon, int features, Long dataUsage) {
Chiao Cheng94b10b52012-08-17 16:59:12 -070096 this.number = number;
Jay Shrauner719a7ad2013-05-30 15:41:13 -070097 this.numberPresentation = numberPresentation;
Chiao Cheng94b10b52012-08-17 16:59:12 -070098 this.formattedNumber = formattedNumber;
99 this.countryIso = countryIso;
100 this.geocode = geocode;
101 this.callTypes = callTypes;
102 this.date = date;
103 this.duration = duration;
104 this.name = name;
105 this.numberType = numberType;
106 this.numberLabel = numberLabel;
107 this.contactUri = contactUri;
108 this.photoUri = photoUri;
Yorke Lee56cb0ef2014-02-21 10:02:18 -0800109 this.sourceType = sourceType;
Ihab Awad1d1bd0d2014-06-30 21:24:01 -0700110 this.accountIcon = accountIcon;
Tyler Gunn8b0e8582014-07-10 12:28:43 -0700111 this.features = features;
112 this.dataUsage = dataUsage;
Chiao Cheng94b10b52012-08-17 16:59:12 -0700113 }
114}