blob: 403c4e86ca05909c99033c4ba577e73f44be9ea1 [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
Andrew Lee49efd912015-05-19 12:17:26 -070019import com.android.dialer.calllog.PhoneNumberDisplayUtil;
Yorke Lee8cd94232014-07-23 14:05:31 -070020
Andrew Lee49efd912015-05-19 12:17:26 -070021import android.content.Context;
Chiao Cheng94b10b52012-08-17 16:59:12 -070022import android.net.Uri;
23import android.provider.CallLog.Calls;
Nancy Chene80d6222014-10-08 20:17:55 -070024import android.telecom.PhoneAccountHandle;
Chiao Cheng94b10b52012-08-17 16:59:12 -070025
26/**
27 * The details of a phone call to be shown in the UI.
28 */
29public class PhoneCallDetails {
Andrew Leeedb22da2015-06-09 18:22:14 -070030 // 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
Chiao Cheng94b10b52012-08-17 16:59:12 -070041 /**
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 */
Andrew Leeedb22da2015-06-09 18:22:14 -070046 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;
Andrew Lee2f05af32015-06-09 15:59:47 -070060
Chiao Cheng94b10b52012-08-17 16:59:12 -070061 /**
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 */
Andrew Leeedb22da2015-06-09 18:22:14 -070067 public Uri photoUri;
68
69 // The source type of the contact associated with this call.
70 public int sourceType;
71
Andrew Lee2f05af32015-06-09 15:59:47 -070072 // The object id type of the contact associated with this call.
73 public String objectId;
74
Andrew Leeedb22da2015-06-09 18:22:14 -070075 // 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
Nancy Chen03aaf382015-06-11 20:06:26 -070087 // The display string for the number.
Andrew Leeedb22da2015-06-09 18:22:14 -070088 public String displayNumber;
Nancy Chen03aaf382015-06-11 20:06:26 -070089
90 // Whether the contact number is a voicemail number.
Andrew Leeedb22da2015-06-09 18:22:14 -070091 public boolean isVoicemail;
Nancy Chene80d6222014-10-08 20:17:55 -070092
Nancy Chen87ba4892014-06-11 17:56:07 -070093 /**
Nancy Chen03aaf382015-06-11 20:06:26 -070094 * 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 /**
Andrew Leeedb22da2015-06-09 18:22:14 -0700100 * Constructor with required fields for the details of a call with a number associated with a
101 * contact.
Nancy Chen19702632014-07-25 13:23:16 -0700102 */
Andrew Leeedb22da2015-06-09 18:22:14 -0700103 public PhoneCallDetails(
104 Context context,
105 CharSequence number,
106 int numberPresentation,
107 CharSequence formattedNumber,
Andrew Lee49efd912015-05-19 12:17:26 -0700108 boolean isVoicemail) {
Chiao Cheng94b10b52012-08-17 16:59:12 -0700109 this.number = number;
Jay Shrauner719a7ad2013-05-30 15:41:13 -0700110 this.numberPresentation = numberPresentation;
Chiao Cheng94b10b52012-08-17 16:59:12 -0700111 this.formattedNumber = formattedNumber;
Andrew Lee49efd912015-05-19 12:17:26 -0700112 this.isVoicemail = isVoicemail;
Andrew Lee49efd912015-05-19 12:17:26 -0700113 this.displayNumber = PhoneNumberDisplayUtil.getDisplayNumber(
114 context,
Andrew Lee49efd912015-05-19 12:17:26 -0700115 this.number,
116 this.numberPresentation,
117 this.formattedNumber,
118 this.isVoicemail).toString();
Chiao Cheng94b10b52012-08-17 16:59:12 -0700119 }
120}