blob: 3562b170f5782313e91ae12fd14f7fab777b61dc [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;
Nancy Chen87ba4892014-06-11 17:56:07 -070023import android.telecomm.Subscription;
Chiao Cheng94b10b52012-08-17 16:59:12 -070024
25/**
26 * The details of a phone call to be shown in the UI.
27 */
28public class PhoneCallDetails {
29 /** The number of the other party involved in the call. */
30 public final CharSequence number;
Jay Shrauner719a7ad2013-05-30 15:41:13 -070031 /** The number presenting rules set by the network, e.g., {@link Calls#PRESENTATION_ALLOWED} */
32 public final int numberPresentation;
Chiao Cheng94b10b52012-08-17 16:59:12 -070033 /** The formatted version of {@link #number}. */
34 public final CharSequence formattedNumber;
35 /** The country corresponding with the phone number. */
36 public final String countryIso;
37 /** The geocoded location for the phone number. */
38 public final String geocode;
39 /**
40 * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}.
41 * <p>
42 * There might be multiple types if this represents a set of entries grouped together.
43 */
44 public final int[] callTypes;
45 /** The date of the call, in milliseconds since the epoch. */
46 public final long date;
47 /** The duration of the call in milliseconds, or 0 for missed calls. */
48 public final long duration;
49 /** The name of the contact, or the empty string. */
50 public final CharSequence name;
51 /** The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. */
52 public final int numberType;
53 /** The custom label associated with the phone number in the contact, or the empty string. */
54 public final CharSequence numberLabel;
55 /** The URI of the contact associated with this phone call. */
56 public final Uri contactUri;
57 /**
58 * The photo URI of the picture of the contact that is associated with this phone call or
59 * null if there is none.
60 * <p>
61 * This is meant to store the high-res photo only.
62 */
63 public final Uri photoUri;
Yorke Lee56cb0ef2014-02-21 10:02:18 -080064 /**
65 * The source type of the contact associated with this call.
66 */
67 public final int sourceType;
Nancy Chen87ba4892014-06-11 17:56:07 -070068 /**
69 * The unique identifier for the provider associated with the call.
70 */
71 public final Drawable subscriptionIcon;
Chiao Cheng94b10b52012-08-17 16:59:12 -070072
73 /** Create the details for a call with a number not associated with a contact. */
Jay Shrauner719a7ad2013-05-30 15:41:13 -070074 public PhoneCallDetails(CharSequence number, int numberPresentation,
75 CharSequence formattedNumber, String countryIso, String geocode,
Nancy Chen87ba4892014-06-11 17:56:07 -070076 int[] callTypes, long date, long duration, Drawable subscriptionIcon) {
Jay Shrauner719a7ad2013-05-30 15:41:13 -070077 this(number, numberPresentation, formattedNumber, countryIso, geocode,
Nancy Chen87ba4892014-06-11 17:56:07 -070078 callTypes, date, duration, "", 0, "", null, null, 0, subscriptionIcon);
Chiao Cheng94b10b52012-08-17 16:59:12 -070079 }
80
81 /** Create the details for a call with a number associated with a contact. */
Jay Shrauner719a7ad2013-05-30 15:41:13 -070082 public PhoneCallDetails(CharSequence number, int numberPresentation,
83 CharSequence formattedNumber, String countryIso, String geocode,
84 int[] callTypes, long date, long duration, CharSequence name,
85 int numberType, CharSequence numberLabel, Uri contactUri,
Nancy Chen87ba4892014-06-11 17:56:07 -070086 Uri photoUri, int sourceType, Drawable subscriptionIcon) {
Chiao Cheng94b10b52012-08-17 16:59:12 -070087 this.number = number;
Jay Shrauner719a7ad2013-05-30 15:41:13 -070088 this.numberPresentation = numberPresentation;
Chiao Cheng94b10b52012-08-17 16:59:12 -070089 this.formattedNumber = formattedNumber;
90 this.countryIso = countryIso;
91 this.geocode = geocode;
92 this.callTypes = callTypes;
93 this.date = date;
94 this.duration = duration;
95 this.name = name;
96 this.numberType = numberType;
97 this.numberLabel = numberLabel;
98 this.contactUri = contactUri;
99 this.photoUri = photoUri;
Yorke Lee56cb0ef2014-02-21 10:02:18 -0800100 this.sourceType = sourceType;
Nancy Chen87ba4892014-06-11 17:56:07 -0700101 this.subscriptionIcon = subscriptionIcon;
Chiao Cheng94b10b52012-08-17 16:59:12 -0700102 }
103}