blob: b8c056e4bb109ff36553f9982a7fe200b0bd4ba8 [file] [log] [blame]
Ihab Awad807fe0a2014-07-09 12:30:52 -07001/*
2 * Copyright (C) 2014 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
Tyler Gunnef9f6f92014-09-12 22:16:17 -070017package android.telecom;
Ihab Awad807fe0a2014-07-09 12:30:52 -070018
Tyler Gunnc9503d62020-01-27 10:30:51 -080019import static android.Manifest.permission.MODIFY_PHONE_STATE;
20
Tyler Gunn5567d742019-10-31 13:04:37 -070021import android.annotation.NonNull;
Tyler Gunnc9503d62020-01-27 10:30:51 -080022import android.annotation.RequiresPermission;
Evan Charlton0e094d92014-11-08 15:49:16 -080023import android.annotation.SystemApi;
Brad Ebinger3636d742019-05-21 15:28:19 -070024import android.content.Intent;
Santos Cordoncad84a22015-05-13 11:17:25 -070025import android.graphics.drawable.Icon;
Ihab Awad94cf4bf2014-07-17 11:21:19 -070026import android.net.Uri;
Tyler Gunn25ed2d72015-10-05 14:14:38 -070027import android.os.Bundle;
Ihab Awad807fe0a2014-07-09 12:30:52 -070028import android.os.Parcel;
29import android.os.Parcelable;
Brad Ebinger722cacf2021-05-14 01:53:56 +000030import android.telephony.CarrierConfigManager;
Hall Liu221f8042020-09-23 15:36:58 -070031import android.telephony.TelephonyManager;
Tyler Gunnf5b29dc2014-09-03 09:09:12 -070032import android.text.TextUtils;
Ihab Awad807fe0a2014-07-09 12:30:52 -070033
Tyler Gunnf5b29dc2014-09-03 09:09:12 -070034import java.util.ArrayList;
35import java.util.Collections;
36import java.util.List;
Tyler Gunn3b347812018-08-24 14:17:05 -070037import java.util.Objects;
Ihab Awad807fe0a2014-07-09 12:30:52 -070038
39/**
Santos Cordon32c65a52014-10-27 14:57:49 -070040 * Represents a distinct method to place or receive a phone call. Apps which can place calls and
41 * want those calls to be integrated into the dialer and in-call UI should build an instance of
Brian Attwellad147f42014-12-19 11:37:16 -080042 * this class and register it with the system using {@link TelecomManager}.
Santos Cordon32c65a52014-10-27 14:57:49 -070043 * <p>
44 * {@link TelecomManager} uses registered {@link PhoneAccount}s to present the user with
45 * alternative options when placing a phone call. When building a {@link PhoneAccount}, the app
Brian Attwellad147f42014-12-19 11:37:16 -080046 * should supply a valid {@link PhoneAccountHandle} that references the connection service
Santos Cordon32c65a52014-10-27 14:57:49 -070047 * implementation Telecom will use to interact with the app.
Ihab Awad807fe0a2014-07-09 12:30:52 -070048 */
Yorke Lee400470f2015-05-12 13:31:25 -070049public final class PhoneAccount implements Parcelable {
Ihab Awad94cf4bf2014-07-17 11:21:19 -070050
51 /**
Hall Liu4bb53ec2020-09-29 15:15:24 -070052 * Integer extra which determines the order in which {@link PhoneAccount}s are sorted
Hall Liu2ef04112020-09-14 18:34:10 -070053 *
54 * This is an extras key set via {@link Builder#setExtras} which determines the order in which
55 * {@link PhoneAccount}s from the same {@link ConnectionService} are sorted. The accounts
Hall Liu4bb53ec2020-09-29 15:15:24 -070056 * are sorted in ascending order by this key, and this ordering is used to
Hall Liu2ef04112020-09-14 18:34:10 -070057 * determine priority when a call can be placed via multiple accounts.
Hall Liu221f8042020-09-23 15:36:58 -070058 *
59 * When multiple {@link PhoneAccount}s are supplied with the same sort order key, no ordering is
60 * guaranteed between those {@link PhoneAccount}s. Additionally, no ordering is guaranteed
61 * between {@link PhoneAccount}s that do not supply this extra, and all such accounts
62 * will be sorted after the accounts that do supply this extra.
63 *
64 * An example of a sort order key is slot index (see {@link TelephonyManager#getSlotIndex()}),
65 * which is the one used by the cell Telephony stack.
Srikanth Chintala62428402017-03-27 19:27:52 +053066 * @hide
67 */
Hall Liu2ef04112020-09-14 18:34:10 -070068 @SystemApi
Srikanth Chintala62428402017-03-27 19:27:52 +053069 public static final String EXTRA_SORT_ORDER =
70 "android.telecom.extra.SORT_ORDER";
71
72 /**
73 * {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which determines the
Tyler Gunnd426b202015-10-13 13:33:53 -070074 * maximum permitted length of a call subject specified via the
75 * {@link TelecomManager#EXTRA_CALL_SUBJECT} extra on an
76 * {@link android.content.Intent#ACTION_CALL} intent. Ultimately a {@link ConnectionService} is
77 * responsible for enforcing the maximum call subject length when sending the message, however
78 * this extra is provided so that the user interface can proactively limit the length of the
79 * call subject as the user types it.
80 */
81 public static final String EXTRA_CALL_SUBJECT_MAX_LENGTH =
82 "android.telecom.extra.CALL_SUBJECT_MAX_LENGTH";
83
84 /**
85 * {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which determines the
86 * character encoding to be used when determining the length of messages.
87 * The user interface can use this when determining the number of characters the user may type
88 * in a call subject. If empty-string, the call subject message size limit will be enforced on
89 * a 1:1 basis. That is, each character will count towards the messages size limit as a single
90 * character. If a character encoding is specified, the message size limit will be based on the
91 * number of bytes in the message per the specified encoding. See
92 * {@link #EXTRA_CALL_SUBJECT_MAX_LENGTH} for more information on the call subject maximum
93 * length.
94 */
95 public static final String EXTRA_CALL_SUBJECT_CHARACTER_ENCODING =
96 "android.telecom.extra.CALL_SUBJECT_CHARACTER_ENCODING";
97
Hall Liue576fc42020-01-22 17:17:13 -080098 /**
99 * Boolean {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which
100 * indicates that all calls from this {@link PhoneAccount} should be treated as VoIP calls
Hall Liu2ef04112020-09-14 18:34:10 -0700101 * rather than cellular calls by the Telecom audio handling logic.
Srikanth Chintalaf77d4a12017-04-03 18:08:14 +0530102 */
103 public static final String EXTRA_ALWAYS_USE_VOIP_AUDIO_MODE =
104 "android.telecom.extra.ALWAYS_USE_VOIP_AUDIO_MODE";
105
Tyler Gunnd426b202015-10-13 13:33:53 -0700106 /**
Tyler Gunn8bf76572017-04-06 15:30:08 -0700107 * Boolean {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which
108 * indicates whether this {@link PhoneAccount} is capable of supporting a request to handover a
Sanket Padawea8eddd42017-11-03 11:07:35 -0700109 * connection (see {@code android.telecom.Call#handoverTo()}) to this {@link PhoneAccount} from
110 * a {@link PhoneAccount} specifying {@link #EXTRA_SUPPORTS_HANDOVER_FROM}.
Tyler Gunn8bf76572017-04-06 15:30:08 -0700111 * <p>
112 * A handover request is initiated by the user from the default dialer app to indicate a desire
113 * to handover a call from one {@link PhoneAccount}/{@link ConnectionService} to another.
Tyler Gunn8bf76572017-04-06 15:30:08 -0700114 */
115 public static final String EXTRA_SUPPORTS_HANDOVER_TO =
116 "android.telecom.extra.SUPPORTS_HANDOVER_TO";
117
118 /**
119 * Boolean {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which
Ta-wei Yen9d20d982017-06-02 11:07:07 -0700120 * indicates whether this {@link PhoneAccount} supports using a fallback if video calling is
121 * not available. This extra is for device level support, {@link
122 * android.telephony.CarrierConfigManager#KEY_ALLOW_VIDEO_CALLING_FALLBACK_BOOL} should also
123 * be checked to ensure it is not disabled by individual carrier.
124 *
125 * @hide
126 */
127 public static final String EXTRA_SUPPORTS_VIDEO_CALLING_FALLBACK =
128 "android.telecom.extra.SUPPORTS_VIDEO_CALLING_FALLBACK";
129
130 /**
131 * Boolean {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which
Tyler Gunn8bf76572017-04-06 15:30:08 -0700132 * indicates whether this {@link PhoneAccount} is capable of supporting a request to handover a
133 * connection from this {@link PhoneAccount} to another {@link PhoneAccount}.
Sanket Padawea8eddd42017-11-03 11:07:35 -0700134 * (see {@code android.telecom.Call#handoverTo()}) which specifies
Tyler Gunn8bf76572017-04-06 15:30:08 -0700135 * {@link #EXTRA_SUPPORTS_HANDOVER_TO}.
136 * <p>
137 * A handover request is initiated by the user from the default dialer app to indicate a desire
138 * to handover a call from one {@link PhoneAccount}/{@link ConnectionService} to another.
Tyler Gunn8bf76572017-04-06 15:30:08 -0700139 */
140 public static final String EXTRA_SUPPORTS_HANDOVER_FROM =
141 "android.telecom.extra.SUPPORTS_HANDOVER_FROM";
142
Tyler Gunn9f6f0472017-04-17 18:25:22 -0700143
144 /**
145 * Boolean {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which
146 * indicates whether a Self-Managed {@link PhoneAccount} should log its calls to the call log.
Brad Ebingerbb1a55f2017-06-26 13:26:14 -0700147 * Self-Managed {@link PhoneAccount}s are responsible for their own notifications, so the system
148 * will not create a notification when a missed call is logged.
Tyler Gunn9f6f0472017-04-17 18:25:22 -0700149 * <p>
150 * By default, Self-Managed {@link PhoneAccount}s do not log their calls to the call log.
151 * Setting this extra to {@code true} provides a means for them to log their calls.
Tyler Gunn2155c4c2018-04-05 09:43:41 -0700152 * <p>
153 * Note: Only calls where the {@link Call.Details#getHandle()} {@link Uri#getScheme()} is
154 * {@link #SCHEME_SIP} or {@link #SCHEME_TEL} will be logged at the current time.
Tyler Gunn9f6f0472017-04-17 18:25:22 -0700155 */
156 public static final String EXTRA_LOG_SELF_MANAGED_CALLS =
157 "android.telecom.extra.LOG_SELF_MANAGED_CALLS";
158
Tyler Gunn8bf76572017-04-06 15:30:08 -0700159 /**
Tyler Gunnacdb6862018-01-29 14:30:52 -0800160 * Boolean {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which
161 * indicates whether calls for a {@link PhoneAccount} should generate a "call recording tone"
162 * when the user is recording audio on the device.
163 * <p>
164 * The call recording tone is played over the telephony audio stream so that the remote party
165 * has an audible indication that it is possible their call is being recorded using a call
166 * recording app on the device.
167 * <p>
168 * This extra only has an effect for calls placed via Telephony (e.g.
169 * {@link #CAPABILITY_SIM_SUBSCRIPTION}).
170 * <p>
171 * The call recording tone is a 1400 hz tone which repeats every 15 seconds while recording is
172 * in progress.
173 * @hide
174 */
Hall Liu2ef04112020-09-14 18:34:10 -0700175 @SystemApi
Tyler Gunnacdb6862018-01-29 14:30:52 -0800176 public static final String EXTRA_PLAY_CALL_RECORDING_TONE =
177 "android.telecom.extra.PLAY_CALL_RECORDING_TONE";
178
179 /**
Sean Kelley4d3c1782018-05-22 14:35:27 -0700180 * Boolean {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()} which
181 * indicates whether calls for a {@link PhoneAccount} should skip call filtering.
182 * <p>
183 * If not specified, this will default to false; all calls will undergo call filtering unless
184 * specifically exempted (e.g. {@link Connection#PROPERTY_EMERGENCY_CALLBACK_MODE}.) However,
185 * this may be used to skip call filtering when it has already been performed on another device.
186 * @hide
187 */
188 public static final String EXTRA_SKIP_CALL_FILTERING =
189 "android.telecom.extra.SKIP_CALL_FILTERING";
190
191 /**
Grace Jiae99fde92021-01-19 14:58:01 -0800192 * Boolean {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which
193 * indicates whether a Self-managed {@link PhoneAccount} want to expose its calls to all
194 * {@link InCallService} which declares the metadata
195 * {@link TelecomManager#METADATA_INCLUDE_SELF_MANAGED_CALLS}.
196 */
197 public static final String EXTRA_ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE =
198 "android.telecom.extra.ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE";
199
200 /**
Ihab Awadf8b69882014-07-25 15:14:01 -0700201 * Flag indicating that this {@code PhoneAccount} can act as a connection manager for
202 * other connections. The {@link ConnectionService} associated with this {@code PhoneAccount}
203 * will be allowed to manage phone calls including using its own proprietary phone-call
204 * implementation (like VoIP calling) to make calls instead of the telephony stack.
205 * <p>
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700206 * When a user opts to place a call using the SIM-based telephony stack, the
207 * {@link ConnectionService} associated with this {@code PhoneAccount} will be attempted first
208 * if the user has explicitly selected it to be used as the default connection manager.
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700209 * <p>
210 * See {@link #getCapabilities}
211 */
Ihab Awadf8b69882014-07-25 15:14:01 -0700212 public static final int CAPABILITY_CONNECTION_MANAGER = 0x1;
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700213
214 /**
Evan Charlton8c8a0622014-07-20 12:31:00 -0700215 * Flag indicating that this {@code PhoneAccount} can make phone calls in place of
Evan Charlton6eb262c2014-07-19 18:18:19 -0700216 * traditional SIM-based telephony calls. This account will be treated as a distinct method
217 * for placing calls alongside the traditional SIM-based telephony stack. This flag is
Ihab Awadf8b69882014-07-25 15:14:01 -0700218 * distinct from {@link #CAPABILITY_CONNECTION_MANAGER} in that it is not allowed to manage
Santos Cordon32c65a52014-10-27 14:57:49 -0700219 * or place calls from the built-in telephony stack.
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700220 * <p>
221 * See {@link #getCapabilities}
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700222 * <p>
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700223 */
224 public static final int CAPABILITY_CALL_PROVIDER = 0x2;
225
Ihab Awad7522bbd62014-07-18 15:53:17 -0700226 /**
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700227 * Flag indicating that this {@code PhoneAccount} represents a built-in PSTN SIM
Evan Charlton6eb262c2014-07-19 18:18:19 -0700228 * subscription.
Ihab Awad7522bbd62014-07-18 15:53:17 -0700229 * <p>
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700230 * Only the Android framework can register a {@code PhoneAccount} having this capability.
231 * <p>
232 * See {@link #getCapabilities}
Ihab Awad7522bbd62014-07-18 15:53:17 -0700233 */
234 public static final int CAPABILITY_SIM_SUBSCRIPTION = 0x4;
235
Ihab Awadf8b69882014-07-25 15:14:01 -0700236 /**
Tyler Gunn58cbd7a2016-11-11 11:31:28 -0800237 * Flag indicating that this {@code PhoneAccount} is currently able to place video calls.
238 * <p>
239 * See also {@link #CAPABILITY_SUPPORTS_VIDEO_CALLING} which indicates whether the
240 * {@code PhoneAccount} supports placing video calls.
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700241 * <p>
242 * See {@link #getCapabilities}
Ihab Awadf8b69882014-07-25 15:14:01 -0700243 */
244 public static final int CAPABILITY_VIDEO_CALLING = 0x8;
245
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700246 /**
Tyler Gunna1ed7d12014-09-08 09:52:22 -0700247 * Flag indicating that this {@code PhoneAccount} is capable of placing emergency calls.
248 * By default all PSTN {@code PhoneAccount}s are capable of placing emergency calls.
249 * <p>
250 * See {@link #getCapabilities}
251 */
252 public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 0x10;
253
254 /**
Evan Charlton134dd682014-11-25 14:12:57 -0800255 * Flag indicating that this {@code PhoneAccount} is capable of being used by all users. This
256 * should only be used by system apps (and will be ignored for all other apps trying to use it).
257 * <p>
258 * See {@link #getCapabilities}
259 * @hide
260 */
Brian Attwellad147f42014-12-19 11:37:16 -0800261 @SystemApi
Evan Charlton134dd682014-11-25 14:12:57 -0800262 public static final int CAPABILITY_MULTI_USER = 0x20;
263
264 /**
Tyler Gunn65a3d342015-07-27 16:06:16 -0700265 * Flag indicating that this {@code PhoneAccount} supports a subject for Calls. This means a
266 * caller is able to specify a short subject line for an outgoing call. A capable receiving
267 * device displays the call subject on the incoming call screen.
268 * <p>
269 * See {@link #getCapabilities}
270 */
271 public static final int CAPABILITY_CALL_SUBJECT = 0x40;
272
273 /**
Bryce Leeb96d89c2015-10-14 16:48:40 -0700274 * Flag indicating that this {@code PhoneAccount} should only be used for emergency calls.
275 * <p>
276 * See {@link #getCapabilities}
277 * @hide
278 */
Hall Liu2ef04112020-09-14 18:34:10 -0700279 @SystemApi
Bryce Leeb96d89c2015-10-14 16:48:40 -0700280 public static final int CAPABILITY_EMERGENCY_CALLS_ONLY = 0x80;
281
282 /**
Tyler Gunn9a365752015-12-09 15:00:18 -0800283 * Flag indicating that for this {@code PhoneAccount}, the ability to make a video call to a
284 * number relies on presence. Should only be set if the {@code PhoneAccount} also has
285 * {@link #CAPABILITY_VIDEO_CALLING}.
286 * <p>
Brad Ebinger722cacf2021-05-14 01:53:56 +0000287 * Note: As of Android 12, using the
Tyler Gunn9a365752015-12-09 15:00:18 -0800288 * {@link android.provider.ContactsContract.Data#CARRIER_PRESENCE_VT_CAPABLE} bit on the
289 * {@link android.provider.ContactsContract.Data#CARRIER_PRESENCE} column to indicate whether
Brad Ebinger722cacf2021-05-14 01:53:56 +0000290 * a contact's phone number supports video calling has been deprecated and should only be used
291 * on devices where {@link CarrierConfigManager#KEY_USE_RCS_PRESENCE_BOOL} is set. On newer
292 * devices, applications must use {@link android.telephony.ims.RcsUceAdapter} instead to
293 * determine whether or not a contact's phone number supports carrier video calling.
Tyler Gunn9a365752015-12-09 15:00:18 -0800294 * <p>
295 * See {@link #getCapabilities}
296 */
297 public static final int CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE = 0x100;
298
299 /**
Tyler Gunncee9ea62016-03-24 11:45:43 -0700300 * Flag indicating that for this {@link PhoneAccount}, emergency video calling is allowed.
301 * <p>
302 * When set, Telecom will allow emergency video calls to be placed. When not set, Telecom will
303 * convert all outgoing video calls to emergency numbers to audio-only.
304 * @hide
305 */
Hall Liu2ef04112020-09-14 18:34:10 -0700306 @SystemApi
Tyler Gunncee9ea62016-03-24 11:45:43 -0700307 public static final int CAPABILITY_EMERGENCY_VIDEO_CALLING = 0x200;
308
309 /**
Tyler Gunn58cbd7a2016-11-11 11:31:28 -0800310 * Flag indicating that this {@link PhoneAccount} supports video calling.
311 * This is not an indication that the {@link PhoneAccount} is currently able to make a video
312 * call, but rather that it has the ability to make video calls (but not necessarily at this
313 * time).
314 * <p>
315 * Whether a {@link PhoneAccount} can make a video call is ultimately controlled by
316 * {@link #CAPABILITY_VIDEO_CALLING}, which indicates whether the {@link PhoneAccount} is
317 * currently capable of making a video call. Consider a case where, for example, a
318 * {@link PhoneAccount} supports making video calls (e.g.
319 * {@link #CAPABILITY_SUPPORTS_VIDEO_CALLING}), but a current lack of network connectivity
320 * prevents video calls from being made (e.g. {@link #CAPABILITY_VIDEO_CALLING}).
321 * <p>
322 * See {@link #getCapabilities}
323 */
324 public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 0x400;
325
326 /**
Tyler Gunnf5035432017-01-09 09:43:12 -0800327 * Flag indicating that this {@link PhoneAccount} is responsible for managing its own
328 * {@link Connection}s. This type of {@link PhoneAccount} is ideal for use with standalone
329 * calling apps which do not wish to use the default phone app for {@link Connection} UX,
330 * but which want to leverage the call and audio routing capabilities of the Telecom framework.
331 * <p>
332 * When set, {@link Connection}s created by the self-managed {@link ConnectionService} will not
333 * be surfaced to implementations of the {@link InCallService} API. Thus it is the
334 * responsibility of a self-managed {@link ConnectionService} to provide a user interface for
335 * its {@link Connection}s.
336 * <p>
337 * Self-managed {@link Connection}s will, however, be displayed on connected Bluetooth devices.
338 */
339 public static final int CAPABILITY_SELF_MANAGED = 0x800;
340
341 /**
Hall Liu95d55872017-01-25 17:12:49 -0800342 * Flag indicating that this {@link PhoneAccount} is capable of making a call with an
343 * RTT (Real-time text) session.
344 * When set, Telecom will attempt to open an RTT session on outgoing calls that specify
345 * that they should be placed with an RTT session , and the in-call app will be displayed
346 * with text entry fields for RTT. Likewise, the in-call app can request that an RTT
347 * session be opened during a call if this bit is set.
348 */
349 public static final int CAPABILITY_RTT = 0x1000;
350
Brad Ebinger3636d742019-05-21 15:28:19 -0700351 /**
352 * Flag indicating that this {@link PhoneAccount} is the preferred SIM subscription for
Hall Liu2ef04112020-09-14 18:34:10 -0700353 * emergency calls. A {@link PhoneAccount} that sets this capability must also
Brad Ebinger3636d742019-05-21 15:28:19 -0700354 * set the {@link #CAPABILITY_SIM_SUBSCRIPTION} and {@link #CAPABILITY_PLACE_EMERGENCY_CALLS}
Hall Liu2ef04112020-09-14 18:34:10 -0700355 * capabilities. There must only be one emergency preferred {@link PhoneAccount} on the device.
Brad Ebinger3636d742019-05-21 15:28:19 -0700356 * <p>
357 * When set, Telecom will prefer this {@link PhoneAccount} over others for emergency calling,
358 * even if the emergency call was placed with a specific {@link PhoneAccount} set using the
359 * extra{@link TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE} in
360 * {@link Intent#ACTION_CALL_EMERGENCY} or {@link TelecomManager#placeCall(Uri, Bundle)}.
361 *
362 * @hide
363 */
Hall Liu2ef04112020-09-14 18:34:10 -0700364 @SystemApi
Brad Ebinger3636d742019-05-21 15:28:19 -0700365 public static final int CAPABILITY_EMERGENCY_PREFERRED = 0x2000;
366
Ravi Paluri80aa2142019-12-02 11:57:37 +0530367 /**
368 * An adhoc conference call is established by providing a list of addresses to
369 * {@code TelecomManager#startConference(List<Uri>, int videoState)} where the
370 * {@link ConnectionService} is responsible for connecting all indicated participants
371 * to a conference simultaneously.
372 * This is in contrast to conferences formed by merging calls together (e.g. using
373 * {@link android.telecom.Call#mergeConference()}).
374 */
375 public static final int CAPABILITY_ADHOC_CONFERENCE_CALLING = 0x4000;
376
Shuo Qiand24aea32020-11-24 15:08:49 -0800377 /**
378 * Flag indicating whether this {@link PhoneAccount} is capable of supporting the call composer
379 * functionality for enriched calls.
380 */
381 public static final int CAPABILITY_CALL_COMPOSER = 0x8000;
382
Hunter Knepshield25265682022-01-19 02:25:06 -0800383 /**
384 * Flag indicating that this {@link PhoneAccount} provides SIM-based voice calls, potentially as
385 * an over-the-top solution such as wi-fi calling.
386 *
387 * <p>Similar to {@link #CAPABILITY_SUPPORTS_VIDEO_CALLING}, this capability indicates this
388 * {@link PhoneAccount} has the ability to make voice calls (but not necessarily at this time).
389 * Whether this {@link PhoneAccount} can make a voice call is ultimately controlled by {@link
390 * #CAPABILITY_VOICE_CALLING_AVAILABLE}, which indicates whether this {@link PhoneAccount} is
391 * currently capable of making a voice call. Consider a case where, for example, a {@link
392 * PhoneAccount} supports making voice calls (e.g. {@link
393 * #CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS}), but a current lack of network connectivity
394 * prevents voice calls from being made (e.g. {@link #CAPABILITY_VOICE_CALLING_AVAILABLE}).
395 *
396 * <p>In order to declare this capability, this {@link PhoneAccount} must also declare {@link
397 * #CAPABILITY_SIM_SUBSCRIPTION} or {@link #CAPABILITY_CONNECTION_MANAGER} and satisfy the
398 * associated requirements.
399 *
400 * @see #CAPABILITY_VOICE_CALLING_AVAILABLE
401 * @see #getCapabilities
402 */
403 public static final int CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS = 0x10000;
404
405 /**
406 * Flag indicating that this {@link PhoneAccount} is <em>currently</em> able to place SIM-based
407 * voice calls, similar to {@link #CAPABILITY_VIDEO_CALLING}.
408 *
409 * <p>See also {@link #CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS}, which indicates whether
410 * the {@code PhoneAccount} supports placing SIM-based voice calls or not.
411 *
412 * <p>In order to declare this capability, this {@link PhoneAccount} must also declare {@link
413 * #CAPABILITY_SIM_SUBSCRIPTION} or {@link #CAPABILITY_CONNECTION_MANAGER} and satisfy the
414 * associated requirements.
415 *
416 * @see #CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS
417 * @see #getCapabilities
418 */
419 public static final int CAPABILITY_VOICE_CALLING_AVAILABLE = 0x20000;
420
Thomas Stuart9bfb2432022-09-27 15:02:07 -0700421
422 /**
423 * Flag indicating that this {@link PhoneAccount} supports the use TelecomManager APIs that
424 * utilize {@link android.os.OutcomeReceiver}s or {@link java.util.function.Consumer}s.
425 * Be aware, if this capability is set, {@link #CAPABILITY_SELF_MANAGED} will be amended by
426 * Telecom when this {@link PhoneAccount} is registered via
427 * {@link TelecomManager#registerPhoneAccount(PhoneAccount)}.
428 *
429 * <p>
430 * {@link android.os.OutcomeReceiver}s and {@link java.util.function.Consumer}s represent
431 * transactional operations because the operation can succeed or fail. An app wishing to use
432 * transactional operations should define behavior for a successful and failed TelecomManager
433 * API call.
434 *
435 * @see #CAPABILITY_SELF_MANAGED
436 * @see #getCapabilities
437 */
438 public static final int CAPABILITY_SUPPORTS_TRANSACTIONAL_OPERATIONS = 0x40000;
439
Grace Jiaef5a4cc2022-12-13 11:08:55 -0800440 /**
441 * Flag indicating that this voip app {@link PhoneAccount} supports the call streaming session
442 * to stream call audio to another remote device via streaming app.
443 *
444 * @see #getCapabilities
445 */
446 public static final int CAPABILITY_SUPPORTS_CALL_STREAMING = 0x80000;
447
448 /* NEXT CAPABILITY: [0x100000, 0x200000, 0x400000] */
Hall Liu95d55872017-01-25 17:12:49 -0800449
450 /**
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700451 * URI scheme for telephone number URIs.
452 */
453 public static final String SCHEME_TEL = "tel";
454
455 /**
456 * URI scheme for voicemail URIs.
457 */
458 public static final String SCHEME_VOICEMAIL = "voicemail";
459
460 /**
461 * URI scheme for SIP URIs.
462 */
463 public static final String SCHEME_SIP = "sip";
464
Nancy Chen3ace54b2014-10-22 17:45:26 -0700465 /**
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800466 * Indicating no icon tint is set.
Santos Cordoncad84a22015-05-13 11:17:25 -0700467 * @hide
Nancy Chen3ace54b2014-10-22 17:45:26 -0700468 */
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800469 public static final int NO_ICON_TINT = 0;
470
471 /**
472 * Indicating no hightlight color is set.
473 */
474 public static final int NO_HIGHLIGHT_COLOR = 0;
Nancy Chen3ace54b2014-10-22 17:45:26 -0700475
Ihab Awad476cc832014-11-03 09:47:51 -0800476 /**
477 * Indicating no resource ID is set.
478 */
479 public static final int NO_RESOURCE_ID = -1;
480
Evan Charlton8c8a0622014-07-20 12:31:00 -0700481 private final PhoneAccountHandle mAccountHandle;
Andrew Lee3085a6c2014-09-04 10:59:13 -0700482 private final Uri mAddress;
483 private final Uri mSubscriptionAddress;
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700484 private final int mCapabilities;
Ihab Awad476cc832014-11-03 09:47:51 -0800485 private final int mHighlightColor;
Santos Cordon146a3e32014-07-21 00:00:44 -0700486 private final CharSequence mLabel;
487 private final CharSequence mShortDescription;
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700488 private final List<String> mSupportedUriSchemes;
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800489 private final int mSupportedAudioRoutes;
Santos Cordoncad84a22015-05-13 11:17:25 -0700490 private final Icon mIcon;
Tyler Gunn25ed2d72015-10-05 14:14:38 -0700491 private final Bundle mExtras;
Santos Cordon91371dc02015-05-08 13:52:09 -0700492 private boolean mIsEnabled;
Brad Ebinger7298f3b2016-06-10 17:19:42 -0700493 private String mGroupId;
Ihab Awad807fe0a2014-07-09 12:30:52 -0700494
Tyler Gunn3b347812018-08-24 14:17:05 -0700495 @Override
496 public boolean equals(Object o) {
497 if (this == o) return true;
498 if (o == null || getClass() != o.getClass()) return false;
499 PhoneAccount that = (PhoneAccount) o;
500 return mCapabilities == that.mCapabilities &&
501 mHighlightColor == that.mHighlightColor &&
502 mSupportedAudioRoutes == that.mSupportedAudioRoutes &&
503 mIsEnabled == that.mIsEnabled &&
504 Objects.equals(mAccountHandle, that.mAccountHandle) &&
505 Objects.equals(mAddress, that.mAddress) &&
506 Objects.equals(mSubscriptionAddress, that.mSubscriptionAddress) &&
507 Objects.equals(mLabel, that.mLabel) &&
508 Objects.equals(mShortDescription, that.mShortDescription) &&
509 Objects.equals(mSupportedUriSchemes, that.mSupportedUriSchemes) &&
510 areBundlesEqual(mExtras, that.mExtras) &&
511 Objects.equals(mGroupId, that.mGroupId);
512 }
513
514 @Override
515 public int hashCode() {
516 return Objects.hash(mAccountHandle, mAddress, mSubscriptionAddress, mCapabilities,
517 mHighlightColor, mLabel, mShortDescription, mSupportedUriSchemes,
518 mSupportedAudioRoutes,
519 mExtras, mIsEnabled, mGroupId);
520 }
521
Santos Cordon32c65a52014-10-27 14:57:49 -0700522 /**
523 * Helper class for creating a {@link PhoneAccount}.
524 */
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700525 public static class Builder {
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800526
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700527 private PhoneAccountHandle mAccountHandle;
Andrew Lee3085a6c2014-09-04 10:59:13 -0700528 private Uri mAddress;
529 private Uri mSubscriptionAddress;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700530 private int mCapabilities;
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800531 private int mSupportedAudioRoutes = CallAudioState.ROUTE_ALL;
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800532 private int mHighlightColor = NO_HIGHLIGHT_COLOR;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700533 private CharSequence mLabel;
534 private CharSequence mShortDescription;
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700535 private List<String> mSupportedUriSchemes = new ArrayList<String>();
Santos Cordoncad84a22015-05-13 11:17:25 -0700536 private Icon mIcon;
Tyler Gunn25ed2d72015-10-05 14:14:38 -0700537 private Bundle mExtras;
Santos Cordon91371dc02015-05-08 13:52:09 -0700538 private boolean mIsEnabled = false;
Brad Ebinger7298f3b2016-06-10 17:19:42 -0700539 private String mGroupId = "";
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700540
Santos Cordon32c65a52014-10-27 14:57:49 -0700541 /**
542 * Creates a builder with the specified {@link PhoneAccountHandle} and label.
543 */
Andrew Lee3085a6c2014-09-04 10:59:13 -0700544 public Builder(PhoneAccountHandle accountHandle, CharSequence label) {
545 this.mAccountHandle = accountHandle;
546 this.mLabel = label;
547 }
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700548
Tyler Gunna1ed7d12014-09-08 09:52:22 -0700549 /**
550 * Creates an instance of the {@link PhoneAccount.Builder} from an existing
551 * {@link PhoneAccount}.
552 *
553 * @param phoneAccount The {@link PhoneAccount} used to initialize the builder.
554 */
555 public Builder(PhoneAccount phoneAccount) {
556 mAccountHandle = phoneAccount.getAccountHandle();
557 mAddress = phoneAccount.getAddress();
558 mSubscriptionAddress = phoneAccount.getSubscriptionAddress();
559 mCapabilities = phoneAccount.getCapabilities();
Ihab Awad476cc832014-11-03 09:47:51 -0800560 mHighlightColor = phoneAccount.getHighlightColor();
Tyler Gunna1ed7d12014-09-08 09:52:22 -0700561 mLabel = phoneAccount.getLabel();
562 mShortDescription = phoneAccount.getShortDescription();
563 mSupportedUriSchemes.addAll(phoneAccount.getSupportedUriSchemes());
Santos Cordoncad84a22015-05-13 11:17:25 -0700564 mIcon = phoneAccount.getIcon();
Santos Cordon91371dc02015-05-08 13:52:09 -0700565 mIsEnabled = phoneAccount.isEnabled();
Tyler Gunnd426b202015-10-13 13:33:53 -0700566 mExtras = phoneAccount.getExtras();
Brad Ebinger7298f3b2016-06-10 17:19:42 -0700567 mGroupId = phoneAccount.getGroupId();
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800568 mSupportedAudioRoutes = phoneAccount.getSupportedAudioRoutes();
Tyler Gunna1ed7d12014-09-08 09:52:22 -0700569 }
570
Santos Cordon32c65a52014-10-27 14:57:49 -0700571 /**
Tyler Gunn37653562017-03-13 18:15:15 -0700572 * Sets the label. See {@link PhoneAccount#getLabel()}.
573 *
574 * @param label The label of the phone account.
575 * @return The builder.
576 * @hide
577 */
578 public Builder setLabel(CharSequence label) {
579 this.mLabel = label;
580 return this;
581 }
582
583 /**
Santos Cordon32c65a52014-10-27 14:57:49 -0700584 * Sets the address. See {@link PhoneAccount#getAddress}.
585 *
586 * @param value The address of the phone account.
587 * @return The builder.
588 */
Andrew Lee3085a6c2014-09-04 10:59:13 -0700589 public Builder setAddress(Uri value) {
590 this.mAddress = value;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700591 return this;
592 }
593
Santos Cordon32c65a52014-10-27 14:57:49 -0700594 /**
595 * Sets the subscription address. See {@link PhoneAccount#getSubscriptionAddress}.
596 *
597 * @param value The subscription address.
598 * @return The builder.
599 */
Andrew Lee3085a6c2014-09-04 10:59:13 -0700600 public Builder setSubscriptionAddress(Uri value) {
601 this.mSubscriptionAddress = value;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700602 return this;
603 }
604
Santos Cordon32c65a52014-10-27 14:57:49 -0700605 /**
606 * Sets the capabilities. See {@link PhoneAccount#getCapabilities}.
607 *
608 * @param value The capabilities to set.
609 * @return The builder.
610 */
Andrew Lee3085a6c2014-09-04 10:59:13 -0700611 public Builder setCapabilities(int value) {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700612 this.mCapabilities = value;
613 return this;
614 }
615
Santos Cordon32c65a52014-10-27 14:57:49 -0700616 /**
Santos Cordoncad84a22015-05-13 11:17:25 -0700617 * Sets the icon. See {@link PhoneAccount#getIcon}.
Santos Cordon32c65a52014-10-27 14:57:49 -0700618 *
Santos Cordoncad84a22015-05-13 11:17:25 -0700619 * @param icon The icon to set.
Santos Cordon32c65a52014-10-27 14:57:49 -0700620 */
Santos Cordoncad84a22015-05-13 11:17:25 -0700621 public Builder setIcon(Icon icon) {
622 mIcon = icon;
Ihab Awad074bf102014-10-24 11:42:32 -0700623 return this;
624 }
625
626 /**
Ihab Awad476cc832014-11-03 09:47:51 -0800627 * Sets the highlight color. See {@link PhoneAccount#getHighlightColor}.
Ihab Awad074bf102014-10-24 11:42:32 -0700628 *
Ihab Awad476cc832014-11-03 09:47:51 -0800629 * @param value The highlight color.
Ihab Awad074bf102014-10-24 11:42:32 -0700630 * @return The builder.
631 */
Ihab Awad476cc832014-11-03 09:47:51 -0800632 public Builder setHighlightColor(int value) {
633 this.mHighlightColor = value;
Nancy Chen3ace54b2014-10-22 17:45:26 -0700634 return this;
635 }
636
Santos Cordon32c65a52014-10-27 14:57:49 -0700637 /**
638 * Sets the short description. See {@link PhoneAccount#getShortDescription}.
639 *
640 * @param value The short description.
641 * @return The builder.
642 */
Andrew Lee3085a6c2014-09-04 10:59:13 -0700643 public Builder setShortDescription(CharSequence value) {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700644 this.mShortDescription = value;
645 return this;
646 }
647
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700648 /**
649 * Specifies an additional URI scheme supported by the {@link PhoneAccount}.
650 *
651 * @param uriScheme The URI scheme.
Santos Cordon32c65a52014-10-27 14:57:49 -0700652 * @return The builder.
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700653 */
Andrew Lee3085a6c2014-09-04 10:59:13 -0700654 public Builder addSupportedUriScheme(String uriScheme) {
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700655 if (!TextUtils.isEmpty(uriScheme) && !mSupportedUriSchemes.contains(uriScheme)) {
656 this.mSupportedUriSchemes.add(uriScheme);
657 }
658 return this;
659 }
660
661 /**
Andrew Lee3085a6c2014-09-04 10:59:13 -0700662 * Specifies the URI schemes supported by the {@link PhoneAccount}.
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700663 *
664 * @param uriSchemes The URI schemes.
Santos Cordon32c65a52014-10-27 14:57:49 -0700665 * @return The builder.
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700666 */
Andrew Lee3085a6c2014-09-04 10:59:13 -0700667 public Builder setSupportedUriSchemes(List<String> uriSchemes) {
668 mSupportedUriSchemes.clear();
669
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700670 if (uriSchemes != null && !uriSchemes.isEmpty()) {
671 for (String uriScheme : uriSchemes) {
Andrew Lee3085a6c2014-09-04 10:59:13 -0700672 addSupportedUriScheme(uriScheme);
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700673 }
674 }
675 return this;
676 }
677
Tyler Gunna1ed7d12014-09-08 09:52:22 -0700678 /**
Tyler Gunn25ed2d72015-10-05 14:14:38 -0700679 * Specifies the extras associated with the {@link PhoneAccount}.
680 * <p>
681 * {@code PhoneAccount}s only support extra values of type: {@link String}, {@link Integer},
682 * and {@link Boolean}. Extras which are not of these types are ignored.
683 *
684 * @param extras
685 * @return
686 */
687 public Builder setExtras(Bundle extras) {
688 mExtras = extras;
689 return this;
690 }
691
692 /**
Santos Cordon91371dc02015-05-08 13:52:09 -0700693 * Sets the enabled state of the phone account.
694 *
695 * @param isEnabled The enabled state.
696 * @return The builder.
697 * @hide
698 */
699 public Builder setIsEnabled(boolean isEnabled) {
700 mIsEnabled = isEnabled;
701 return this;
702 }
703
704 /**
Brad Ebinger7298f3b2016-06-10 17:19:42 -0700705 * Sets the group Id of the {@link PhoneAccount}. When a new {@link PhoneAccount} is
706 * registered to Telecom, it will replace another {@link PhoneAccount} that is already
707 * registered in Telecom and take on the current user defaults and enabled status. There can
708 * only be one {@link PhoneAccount} with a non-empty group number registered to Telecom at a
709 * time. By default, there is no group Id for a {@link PhoneAccount} (an empty String). Only
710 * grouped {@link PhoneAccount}s with the same {@link ConnectionService} can be replaced.
Tyler Gunn5567d742019-10-31 13:04:37 -0700711 * <p>
Tyler Gunnc9503d62020-01-27 10:30:51 -0800712 * Note: This is an API specific to the Telephony stack; the group Id will be ignored for
713 * callers not holding the correct permission.
Tyler Gunn5567d742019-10-31 13:04:37 -0700714 *
Brad Ebinger7298f3b2016-06-10 17:19:42 -0700715 * @param groupId The group Id of the {@link PhoneAccount} that will replace any other
716 * registered {@link PhoneAccount} in Telecom with the same Group Id.
717 * @return The builder
718 * @hide
719 */
Tyler Gunn5567d742019-10-31 13:04:37 -0700720 @SystemApi
Tyler Gunnc9503d62020-01-27 10:30:51 -0800721 @RequiresPermission(MODIFY_PHONE_STATE)
Tyler Gunn5567d742019-10-31 13:04:37 -0700722 public @NonNull Builder setGroupId(@NonNull String groupId) {
Brad Ebinger7298f3b2016-06-10 17:19:42 -0700723 if (groupId != null) {
724 mGroupId = groupId;
725 } else {
726 mGroupId = "";
727 }
728 return this;
729 }
730
731 /**
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800732 * Sets the audio routes supported by this {@link PhoneAccount}.
733 *
734 * @param routes bit mask of available routes.
735 * @return The builder.
736 * @hide
737 */
738 public Builder setSupportedAudioRoutes(int routes) {
739 mSupportedAudioRoutes = routes;
740 return this;
741 }
742
743 /**
Tyler Gunna1ed7d12014-09-08 09:52:22 -0700744 * Creates an instance of a {@link PhoneAccount} based on the current builder settings.
745 *
746 * @return The {@link PhoneAccount}.
747 */
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700748 public PhoneAccount build() {
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700749 // If no supported URI schemes were defined, assume "tel" is supported.
750 if (mSupportedUriSchemes.isEmpty()) {
Andrew Lee3085a6c2014-09-04 10:59:13 -0700751 addSupportedUriScheme(SCHEME_TEL);
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700752 }
753
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700754 return new PhoneAccount(
755 mAccountHandle,
Andrew Lee3085a6c2014-09-04 10:59:13 -0700756 mAddress,
757 mSubscriptionAddress,
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700758 mCapabilities,
Santos Cordoncad84a22015-05-13 11:17:25 -0700759 mIcon,
Ihab Awad476cc832014-11-03 09:47:51 -0800760 mHighlightColor,
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700761 mLabel,
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700762 mShortDescription,
Santos Cordon91371dc02015-05-08 13:52:09 -0700763 mSupportedUriSchemes,
Tyler Gunn25ed2d72015-10-05 14:14:38 -0700764 mExtras,
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800765 mSupportedAudioRoutes,
Brad Ebinger7298f3b2016-06-10 17:19:42 -0700766 mIsEnabled,
767 mGroupId);
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700768 }
769 }
770
771 private PhoneAccount(
Evan Charlton6eb262c2014-07-19 18:18:19 -0700772 PhoneAccountHandle account,
Andrew Lee3085a6c2014-09-04 10:59:13 -0700773 Uri address,
774 Uri subscriptionAddress,
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700775 int capabilities,
Santos Cordoncad84a22015-05-13 11:17:25 -0700776 Icon icon,
Ihab Awad476cc832014-11-03 09:47:51 -0800777 int highlightColor,
Santos Cordon146a3e32014-07-21 00:00:44 -0700778 CharSequence label,
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700779 CharSequence shortDescription,
Santos Cordon91371dc02015-05-08 13:52:09 -0700780 List<String> supportedUriSchemes,
Tyler Gunn25ed2d72015-10-05 14:14:38 -0700781 Bundle extras,
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800782 int supportedAudioRoutes,
Brad Ebinger7298f3b2016-06-10 17:19:42 -0700783 boolean isEnabled,
784 String groupId) {
Evan Charlton8c8a0622014-07-20 12:31:00 -0700785 mAccountHandle = account;
Andrew Lee3085a6c2014-09-04 10:59:13 -0700786 mAddress = address;
787 mSubscriptionAddress = subscriptionAddress;
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700788 mCapabilities = capabilities;
Santos Cordoncad84a22015-05-13 11:17:25 -0700789 mIcon = icon;
Ihab Awad476cc832014-11-03 09:47:51 -0800790 mHighlightColor = highlightColor;
Ihab Awad807fe0a2014-07-09 12:30:52 -0700791 mLabel = label;
792 mShortDescription = shortDescription;
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700793 mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes);
Tyler Gunn25ed2d72015-10-05 14:14:38 -0700794 mExtras = extras;
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800795 mSupportedAudioRoutes = supportedAudioRoutes;
Santos Cordon91371dc02015-05-08 13:52:09 -0700796 mIsEnabled = isEnabled;
Brad Ebinger7298f3b2016-06-10 17:19:42 -0700797 mGroupId = groupId;
Ihab Awad807fe0a2014-07-09 12:30:52 -0700798 }
799
Andrew Lee3085a6c2014-09-04 10:59:13 -0700800 public static Builder builder(
801 PhoneAccountHandle accountHandle,
802 CharSequence label) {
803 return new Builder(accountHandle, label);
804 }
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700805
Ihab Awad807fe0a2014-07-09 12:30:52 -0700806 /**
Tyler Gunna1ed7d12014-09-08 09:52:22 -0700807 * Returns a builder initialized with the current {@link PhoneAccount} instance.
808 *
809 * @return The builder.
Tyler Gunna1ed7d12014-09-08 09:52:22 -0700810 */
811 public Builder toBuilder() { return new Builder(this); }
812
813 /**
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700814 * The unique identifier of this {@code PhoneAccount}.
Ihab Awad807fe0a2014-07-09 12:30:52 -0700815 *
Evan Charlton6eb262c2014-07-19 18:18:19 -0700816 * @return A {@code PhoneAccountHandle}.
Ihab Awad807fe0a2014-07-09 12:30:52 -0700817 */
Evan Charlton8c8a0622014-07-20 12:31:00 -0700818 public PhoneAccountHandle getAccountHandle() {
819 return mAccountHandle;
Ihab Awad807fe0a2014-07-09 12:30:52 -0700820 }
821
822 /**
Andrew Lee3085a6c2014-09-04 10:59:13 -0700823 * The address (e.g., a phone number) associated with this {@code PhoneAccount}. This
Evan Charlton8c8a0622014-07-20 12:31:00 -0700824 * represents the destination from which outgoing calls using this {@code PhoneAccount}
Evan Charlton6eb262c2014-07-19 18:18:19 -0700825 * will appear to come, if applicable, and the destination to which incoming calls using this
Evan Charlton8c8a0622014-07-20 12:31:00 -0700826 * {@code PhoneAccount} may be addressed.
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700827 *
Andrew Lee3085a6c2014-09-04 10:59:13 -0700828 * @return A address expressed as a {@code Uri}, for example, a phone number.
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700829 */
Andrew Lee3085a6c2014-09-04 10:59:13 -0700830 public Uri getAddress() {
831 return mAddress;
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700832 }
833
834 /**
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700835 * The raw callback number used for this {@code PhoneAccount}, as distinct from
Andrew Lee3085a6c2014-09-04 10:59:13 -0700836 * {@link #getAddress()}. For the majority of {@code PhoneAccount}s this should be registered
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700837 * as {@code null}. It is used by the system for SIM-based {@code PhoneAccount} registration
Junda Liuf52ac902014-09-25 17:36:48 +0000838 * where {@link android.telephony.TelephonyManager#setLine1NumberForDisplay(String, String)}
839 * has been used to alter the callback number.
840 * <p>
Evan Charlton222db5252014-07-17 16:59:18 -0700841 *
842 * @return The subscription number, suitable for display to the user.
843 */
Andrew Lee3085a6c2014-09-04 10:59:13 -0700844 public Uri getSubscriptionAddress() {
845 return mSubscriptionAddress;
Evan Charlton222db5252014-07-17 16:59:18 -0700846 }
847
848 /**
Evan Charlton8c8a0622014-07-20 12:31:00 -0700849 * The capabilities of this {@code PhoneAccount}.
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700850 *
Evan Charlton8c8a0622014-07-20 12:31:00 -0700851 * @return A bit field of flags describing this {@code PhoneAccount}'s capabilities.
Ihab Awad94cf4bf2014-07-17 11:21:19 -0700852 */
853 public int getCapabilities() {
854 return mCapabilities;
855 }
856
857 /**
Tyler Gunna1ed7d12014-09-08 09:52:22 -0700858 * Determines if this {@code PhoneAccount} has a capabilities specified by the passed in
859 * bit mask.
860 *
861 * @param capability The capabilities to check.
Santos Cordon895d4b82015-06-25 16:41:48 -0700862 * @return {@code true} if the phone account has the capability.
Tyler Gunna1ed7d12014-09-08 09:52:22 -0700863 */
864 public boolean hasCapabilities(int capability) {
865 return (mCapabilities & capability) == capability;
866 }
867
868 /**
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800869 * Determines if this {@code PhoneAccount} has routes specified by the passed in bit mask.
870 *
871 * @param route The routes to check.
872 * @return {@code true} if the phone account has the routes.
873 * @hide
874 */
875 public boolean hasAudioRoutes(int routes) {
876 return (mSupportedAudioRoutes & routes) == routes;
877 }
878
879 /**
Santos Cordon146a3e32014-07-21 00:00:44 -0700880 * A short label describing a {@code PhoneAccount}.
Ihab Awad807fe0a2014-07-09 12:30:52 -0700881 *
Evan Charlton8c8a0622014-07-20 12:31:00 -0700882 * @return A label for this {@code PhoneAccount}.
Ihab Awad807fe0a2014-07-09 12:30:52 -0700883 */
Santos Cordon146a3e32014-07-21 00:00:44 -0700884 public CharSequence getLabel() {
Ihab Awad807fe0a2014-07-09 12:30:52 -0700885 return mLabel;
886 }
887
888 /**
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700889 * A short paragraph describing this {@code PhoneAccount}.
Ihab Awad807fe0a2014-07-09 12:30:52 -0700890 *
Evan Charlton8c8a0622014-07-20 12:31:00 -0700891 * @return A description for this {@code PhoneAccount}.
Ihab Awad807fe0a2014-07-09 12:30:52 -0700892 */
Santos Cordon146a3e32014-07-21 00:00:44 -0700893 public CharSequence getShortDescription() {
Ihab Awad807fe0a2014-07-09 12:30:52 -0700894 return mShortDescription;
895 }
896
897 /**
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700898 * The URI schemes supported by this {@code PhoneAccount}.
899 *
900 * @return The URI schemes.
901 */
902 public List<String> getSupportedUriSchemes() {
903 return mSupportedUriSchemes;
904 }
905
906 /**
Tyler Gunn25ed2d72015-10-05 14:14:38 -0700907 * The extras associated with this {@code PhoneAccount}.
908 * <p>
909 * A {@link ConnectionService} may provide implementation specific information about the
910 * {@link PhoneAccount} via the extras.
911 *
912 * @return The extras.
913 */
914 public Bundle getExtras() {
915 return mExtras;
916 }
917
918 /**
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800919 * The audio routes supported by this {@code PhoneAccount}.
920 *
921 * @hide
922 */
923 public int getSupportedAudioRoutes() {
924 return mSupportedAudioRoutes;
925 }
926
927 /**
Santos Cordoncad84a22015-05-13 11:17:25 -0700928 * The icon to represent this {@code PhoneAccount}.
929 *
930 * @return The icon.
931 */
932 public Icon getIcon() {
933 return mIcon;
934 }
935
936 /**
Santos Cordon895d4b82015-06-25 16:41:48 -0700937 * Indicates whether the user has enabled this {@code PhoneAccount} or not. This value is only
938 * populated for {@code PhoneAccount}s returned by {@link TelecomManager#getPhoneAccount}.
Santos Cordon91371dc02015-05-08 13:52:09 -0700939 *
Santos Cordon895d4b82015-06-25 16:41:48 -0700940 * @return {@code true} if the account is enabled by the user, {@code false} otherwise.
Santos Cordon91371dc02015-05-08 13:52:09 -0700941 */
942 public boolean isEnabled() {
943 return mIsEnabled;
944 }
945
946 /**
Brad Ebinger7298f3b2016-06-10 17:19:42 -0700947 * A non-empty {@link String} representing the group that A {@link PhoneAccount} is in or an
948 * empty {@link String} if the {@link PhoneAccount} is not in a group. If this
949 * {@link PhoneAccount} is in a group, this new {@link PhoneAccount} will replace a registered
950 * {@link PhoneAccount} that is in the same group. When the {@link PhoneAccount} is replaced,
951 * its user defined defaults and enabled status will also pass to this new {@link PhoneAccount}.
952 * Only {@link PhoneAccount}s that share the same {@link ConnectionService} can be replaced.
953 *
954 * @return A non-empty String Id if this {@link PhoneAccount} belongs to a group.
955 * @hide
956 */
957 public String getGroupId() {
958 return mGroupId;
959 }
960
961 /**
Andrew Lee3085a6c2014-09-04 10:59:13 -0700962 * Determines if the {@link PhoneAccount} supports calls to/from addresses with a specified URI
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700963 * scheme.
964 *
965 * @param uriScheme The URI scheme to check.
Santos Cordon895d4b82015-06-25 16:41:48 -0700966 * @return {@code true} if the {@code PhoneAccount} supports calls to/from addresses with the
Tyler Gunnf5b29dc2014-09-03 09:09:12 -0700967 * specified URI scheme.
968 */
969 public boolean supportsUriScheme(String uriScheme) {
970 if (mSupportedUriSchemes == null || uriScheme == null) {
971 return false;
972 }
973
974 for (String scheme : mSupportedUriSchemes) {
975 if (scheme != null && scheme.equals(uriScheme)) {
976 return true;
977 }
978 }
979 return false;
980 }
981
982 /**
Ihab Awad476cc832014-11-03 09:47:51 -0800983 * A highlight color to use in displaying information about this {@code PhoneAccount}.
984 *
985 * @return A hexadecimal color value.
986 */
987 public int getHighlightColor() {
988 return mHighlightColor;
989 }
990
Santos Cordon91371dc02015-05-08 13:52:09 -0700991 /**
992 * Sets the enabled state of the phone account.
993 * @hide
994 */
995 public void setIsEnabled(boolean isEnabled) {
996 mIsEnabled = isEnabled;
997 }
998
Tyler Gunnf5035432017-01-09 09:43:12 -0800999 /**
1000 * @return {@code true} if the {@link PhoneAccount} is self-managed, {@code false} otherwise.
1001 * @hide
1002 */
1003 public boolean isSelfManaged() {
1004 return (mCapabilities & CAPABILITY_SELF_MANAGED) == CAPABILITY_SELF_MANAGED;
1005 }
1006
Ihab Awad807fe0a2014-07-09 12:30:52 -07001007 //
1008 // Parcelable implementation
1009 //
1010
1011 @Override
1012 public int describeContents() {
1013 return 0;
1014 }
1015
1016 @Override
1017 public void writeToParcel(Parcel out, int flags) {
Ihab Awad476cc832014-11-03 09:47:51 -08001018 if (mAccountHandle == null) {
1019 out.writeInt(0);
1020 } else {
1021 out.writeInt(1);
1022 mAccountHandle.writeToParcel(out, flags);
1023 }
1024 if (mAddress == null) {
1025 out.writeInt(0);
1026 } else {
1027 out.writeInt(1);
1028 mAddress.writeToParcel(out, flags);
1029 }
1030 if (mSubscriptionAddress == null) {
1031 out.writeInt(0);
1032 } else {
1033 out.writeInt(1);
1034 mSubscriptionAddress.writeToParcel(out, flags);
1035 }
Ihab Awad94cf4bf2014-07-17 11:21:19 -07001036 out.writeInt(mCapabilities);
Ihab Awad476cc832014-11-03 09:47:51 -08001037 out.writeInt(mHighlightColor);
Santos Cordon146a3e32014-07-21 00:00:44 -07001038 out.writeCharSequence(mLabel);
1039 out.writeCharSequence(mShortDescription);
Ihab Awad476cc832014-11-03 09:47:51 -08001040 out.writeStringList(mSupportedUriSchemes);
Santos Cordon91371dc02015-05-08 13:52:09 -07001041
Santos Cordoncad84a22015-05-13 11:17:25 -07001042 if (mIcon == null) {
1043 out.writeInt(0);
1044 } else {
1045 out.writeInt(1);
1046 mIcon.writeToParcel(out, flags);
1047 }
Santos Cordon91371dc02015-05-08 13:52:09 -07001048 out.writeByte((byte) (mIsEnabled ? 1 : 0));
Tyler Gunnef829ec2015-10-08 09:46:23 -07001049 out.writeBundle(mExtras);
Brad Ebinger7298f3b2016-06-10 17:19:42 -07001050 out.writeString(mGroupId);
Christine Hallstrom2830ce92016-11-30 16:06:42 -08001051 out.writeInt(mSupportedAudioRoutes);
Ihab Awad807fe0a2014-07-09 12:30:52 -07001052 }
1053
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -07001054 public static final @android.annotation.NonNull Creator<PhoneAccount> CREATOR
Evan Charlton8c8a0622014-07-20 12:31:00 -07001055 = new Creator<PhoneAccount>() {
Ihab Awad807fe0a2014-07-09 12:30:52 -07001056 @Override
Evan Charlton8c8a0622014-07-20 12:31:00 -07001057 public PhoneAccount createFromParcel(Parcel in) {
1058 return new PhoneAccount(in);
Ihab Awad807fe0a2014-07-09 12:30:52 -07001059 }
1060
1061 @Override
Evan Charlton8c8a0622014-07-20 12:31:00 -07001062 public PhoneAccount[] newArray(int size) {
1063 return new PhoneAccount[size];
Ihab Awad807fe0a2014-07-09 12:30:52 -07001064 }
1065 };
1066
Evan Charlton8c8a0622014-07-20 12:31:00 -07001067 private PhoneAccount(Parcel in) {
Ihab Awad476cc832014-11-03 09:47:51 -08001068 if (in.readInt() > 0) {
1069 mAccountHandle = PhoneAccountHandle.CREATOR.createFromParcel(in);
1070 } else {
1071 mAccountHandle = null;
1072 }
1073 if (in.readInt() > 0) {
1074 mAddress = Uri.CREATOR.createFromParcel(in);
1075 } else {
1076 mAddress = null;
1077 }
1078 if (in.readInt() > 0) {
1079 mSubscriptionAddress = Uri.CREATOR.createFromParcel(in);
1080 } else {
1081 mSubscriptionAddress = null;
1082 }
Ihab Awad94cf4bf2014-07-17 11:21:19 -07001083 mCapabilities = in.readInt();
Ihab Awad476cc832014-11-03 09:47:51 -08001084 mHighlightColor = in.readInt();
Santos Cordon146a3e32014-07-21 00:00:44 -07001085 mLabel = in.readCharSequence();
1086 mShortDescription = in.readCharSequence();
Ihab Awad476cc832014-11-03 09:47:51 -08001087 mSupportedUriSchemes = Collections.unmodifiableList(in.createStringArrayList());
Santos Cordoncad84a22015-05-13 11:17:25 -07001088 if (in.readInt() > 0) {
1089 mIcon = Icon.CREATOR.createFromParcel(in);
1090 } else {
1091 mIcon = null;
1092 }
Santos Cordon91371dc02015-05-08 13:52:09 -07001093 mIsEnabled = in.readByte() == 1;
Tyler Gunnef829ec2015-10-08 09:46:23 -07001094 mExtras = in.readBundle();
Brad Ebinger7298f3b2016-06-10 17:19:42 -07001095 mGroupId = in.readString();
Christine Hallstrom2830ce92016-11-30 16:06:42 -08001096 mSupportedAudioRoutes = in.readInt();
Ihab Awad807fe0a2014-07-09 12:30:52 -07001097 }
Tyler Gunn76c01a52014-09-30 14:47:51 -07001098
1099 @Override
1100 public String toString() {
Santos Cordon91371dc02015-05-08 13:52:09 -07001101 StringBuilder sb = new StringBuilder().append("[[")
1102 .append(mIsEnabled ? 'X' : ' ')
1103 .append("] PhoneAccount: ")
Tyler Gunn76c01a52014-09-30 14:47:51 -07001104 .append(mAccountHandle)
1105 .append(" Capabilities: ")
Christine Hallstrom2830ce92016-11-30 16:06:42 -08001106 .append(capabilitiesToString())
1107 .append(" Audio Routes: ")
1108 .append(audioRoutesToString())
Tyler Gunn76c01a52014-09-30 14:47:51 -07001109 .append(" Schemes: ");
1110 for (String scheme : mSupportedUriSchemes) {
1111 sb.append(scheme)
1112 .append(" ");
1113 }
Tyler Gunnef829ec2015-10-08 09:46:23 -07001114 sb.append(" Extras: ");
Tyler Gunn25ed2d72015-10-05 14:14:38 -07001115 sb.append(mExtras);
Brad Ebinger7298f3b2016-06-10 17:19:42 -07001116 sb.append(" GroupId: ");
1117 sb.append(Log.pii(mGroupId));
Tyler Gunn76c01a52014-09-30 14:47:51 -07001118 sb.append("]");
1119 return sb.toString();
1120 }
Tyler Gunn3e122f72016-01-11 19:25:00 -08001121
1122 /**
1123 * Generates a string representation of a capabilities bitmask.
1124 *
Tyler Gunn3e122f72016-01-11 19:25:00 -08001125 * @return String representation of the capabilities bitmask.
Tyler Gunn1847b4e2018-11-09 08:43:02 -08001126 * @hide
Tyler Gunn3e122f72016-01-11 19:25:00 -08001127 */
Tyler Gunn1847b4e2018-11-09 08:43:02 -08001128 public String capabilitiesToString() {
Tyler Gunn3e122f72016-01-11 19:25:00 -08001129 StringBuilder sb = new StringBuilder();
Tyler Gunnf5035432017-01-09 09:43:12 -08001130 if (hasCapabilities(CAPABILITY_SELF_MANAGED)) {
1131 sb.append("SelfManaged ");
1132 }
Tyler Gunn58cbd7a2016-11-11 11:31:28 -08001133 if (hasCapabilities(CAPABILITY_SUPPORTS_VIDEO_CALLING)) {
1134 sb.append("SuppVideo ");
1135 }
Tyler Gunn3e122f72016-01-11 19:25:00 -08001136 if (hasCapabilities(CAPABILITY_VIDEO_CALLING)) {
1137 sb.append("Video ");
1138 }
1139 if (hasCapabilities(CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE)) {
1140 sb.append("Presence ");
1141 }
1142 if (hasCapabilities(CAPABILITY_CALL_PROVIDER)) {
1143 sb.append("CallProvider ");
1144 }
1145 if (hasCapabilities(CAPABILITY_CALL_SUBJECT)) {
1146 sb.append("CallSubject ");
1147 }
1148 if (hasCapabilities(CAPABILITY_CONNECTION_MANAGER)) {
1149 sb.append("ConnectionMgr ");
1150 }
1151 if (hasCapabilities(CAPABILITY_EMERGENCY_CALLS_ONLY)) {
1152 sb.append("EmergOnly ");
1153 }
1154 if (hasCapabilities(CAPABILITY_MULTI_USER)) {
1155 sb.append("MultiUser ");
1156 }
1157 if (hasCapabilities(CAPABILITY_PLACE_EMERGENCY_CALLS)) {
1158 sb.append("PlaceEmerg ");
1159 }
Brad Ebinger3636d742019-05-21 15:28:19 -07001160 if (hasCapabilities(CAPABILITY_EMERGENCY_PREFERRED)) {
1161 sb.append("EmerPrefer ");
1162 }
Tyler Gunncee9ea62016-03-24 11:45:43 -07001163 if (hasCapabilities(CAPABILITY_EMERGENCY_VIDEO_CALLING)) {
1164 sb.append("EmergVideo ");
1165 }
Tyler Gunn3e122f72016-01-11 19:25:00 -08001166 if (hasCapabilities(CAPABILITY_SIM_SUBSCRIPTION)) {
1167 sb.append("SimSub ");
1168 }
Hall Liu47ed6202017-11-20 16:25:39 -08001169 if (hasCapabilities(CAPABILITY_RTT)) {
Hunter Knepshield25265682022-01-19 02:25:06 -08001170 sb.append("Rtt ");
Hall Liu47ed6202017-11-20 16:25:39 -08001171 }
Ravi Paluri80aa2142019-12-02 11:57:37 +05301172 if (hasCapabilities(CAPABILITY_ADHOC_CONFERENCE_CALLING)) {
Hunter Knepshield25265682022-01-19 02:25:06 -08001173 sb.append("AdhocConf ");
Ravi Paluri80aa2142019-12-02 11:57:37 +05301174 }
Shuo Qiand24aea32020-11-24 15:08:49 -08001175 if (hasCapabilities(CAPABILITY_CALL_COMPOSER)) {
1176 sb.append("CallComposer ");
1177 }
Hunter Knepshield25265682022-01-19 02:25:06 -08001178 if (hasCapabilities(CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS)) {
1179 sb.append("SuppVoice ");
1180 }
1181 if (hasCapabilities(CAPABILITY_VOICE_CALLING_AVAILABLE)) {
1182 sb.append("Voice ");
1183 }
Tyler Gunn3e122f72016-01-11 19:25:00 -08001184 return sb.toString();
1185 }
Christine Hallstrom2830ce92016-11-30 16:06:42 -08001186
1187 private String audioRoutesToString() {
1188 StringBuilder sb = new StringBuilder();
1189
1190 if (hasAudioRoutes(CallAudioState.ROUTE_BLUETOOTH)) {
1191 sb.append("B");
1192 }
1193 if (hasAudioRoutes(CallAudioState.ROUTE_EARPIECE)) {
1194 sb.append("E");
1195 }
1196 if (hasAudioRoutes(CallAudioState.ROUTE_SPEAKER)) {
1197 sb.append("S");
1198 }
1199 if (hasAudioRoutes(CallAudioState.ROUTE_WIRED_HEADSET)) {
1200 sb.append("W");
1201 }
1202
1203 return sb.toString();
1204 }
Tyler Gunn3b347812018-08-24 14:17:05 -07001205
1206 /**
1207 * Determines if two {@link Bundle}s are equal.
1208 * @param extras First {@link Bundle} to check.
1209 * @param newExtras {@link Bundle} to compare against.
1210 * @return {@code true} if the {@link Bundle}s are equal, {@code false} otherwise.
1211 */
1212 private static boolean areBundlesEqual(Bundle extras, Bundle newExtras) {
1213 if (extras == null || newExtras == null) {
1214 return extras == newExtras;
1215 }
1216
1217 if (extras.size() != newExtras.size()) {
1218 return false;
1219 }
1220
1221 for(String key : extras.keySet()) {
1222 if (key != null) {
1223 final Object value = extras.get(key);
1224 final Object newValue = newExtras.get(key);
1225 if (!Objects.equals(value, newValue)) {
1226 return false;
1227 }
1228 }
1229 }
1230 return true;
1231 }
Ihab Awad807fe0a2014-07-09 12:30:52 -07001232}