| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 1 | /* |
| 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 Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 17 | package android.telecom; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 18 | |
| Evan Charlton | 0e094d9 | 2014-11-08 15:49:16 -0800 | [diff] [blame] | 19 | import android.annotation.SystemApi; |
| Ihab Awad | 074bf10 | 2014-10-24 11:42:32 -0700 | [diff] [blame] | 20 | import android.content.ComponentName; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 21 | import android.content.Context; |
| 22 | import android.content.pm.PackageManager; |
| Santos Cordon | e8dc4be | 2014-07-21 01:28:28 -0700 | [diff] [blame] | 23 | import android.content.res.Resources.NotFoundException; |
| Ihab Awad | 074bf10 | 2014-10-24 11:42:32 -0700 | [diff] [blame] | 24 | import android.graphics.Bitmap; |
| 25 | import android.graphics.Color; |
| 26 | import android.graphics.drawable.BitmapDrawable; |
| 27 | import android.graphics.drawable.ColorDrawable; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 28 | import android.graphics.drawable.Drawable; |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 29 | import android.graphics.drawable.Icon; |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 30 | import android.net.Uri; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 31 | import android.os.Parcel; |
| 32 | import android.os.Parcelable; |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 33 | import android.text.TextUtils; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 34 | |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 35 | import java.lang.String; |
| 36 | import java.util.ArrayList; |
| 37 | import java.util.Collections; |
| 38 | import java.util.List; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 39 | import java.util.MissingResourceException; |
| 40 | |
| 41 | /** |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 42 | * Represents a distinct method to place or receive a phone call. Apps which can place calls and |
| 43 | * want those calls to be integrated into the dialer and in-call UI should build an instance of |
| Brian Attwell | ad147f4 | 2014-12-19 11:37:16 -0800 | [diff] [blame] | 44 | * this class and register it with the system using {@link TelecomManager}. |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 45 | * <p> |
| 46 | * {@link TelecomManager} uses registered {@link PhoneAccount}s to present the user with |
| 47 | * alternative options when placing a phone call. When building a {@link PhoneAccount}, the app |
| Brian Attwell | ad147f4 | 2014-12-19 11:37:16 -0800 | [diff] [blame] | 48 | * should supply a valid {@link PhoneAccountHandle} that references the connection service |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 49 | * implementation Telecom will use to interact with the app. |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 50 | */ |
| Yorke Lee | 400470f | 2015-05-12 13:31:25 -0700 | [diff] [blame] | 51 | public final class PhoneAccount implements Parcelable { |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 52 | |
| 53 | /** |
| Ihab Awad | f8b6988 | 2014-07-25 15:14:01 -0700 | [diff] [blame] | 54 | * Flag indicating that this {@code PhoneAccount} can act as a connection manager for |
| 55 | * other connections. The {@link ConnectionService} associated with this {@code PhoneAccount} |
| 56 | * will be allowed to manage phone calls including using its own proprietary phone-call |
| 57 | * implementation (like VoIP calling) to make calls instead of the telephony stack. |
| 58 | * <p> |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 59 | * When a user opts to place a call using the SIM-based telephony stack, the |
| 60 | * {@link ConnectionService} associated with this {@code PhoneAccount} will be attempted first |
| 61 | * if the user has explicitly selected it to be used as the default connection manager. |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 62 | * <p> |
| 63 | * See {@link #getCapabilities} |
| 64 | */ |
| Ihab Awad | f8b6988 | 2014-07-25 15:14:01 -0700 | [diff] [blame] | 65 | public static final int CAPABILITY_CONNECTION_MANAGER = 0x1; |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 66 | |
| 67 | /** |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 68 | * Flag indicating that this {@code PhoneAccount} can make phone calls in place of |
| Evan Charlton | 6eb262c | 2014-07-19 18:18:19 -0700 | [diff] [blame] | 69 | * traditional SIM-based telephony calls. This account will be treated as a distinct method |
| 70 | * for placing calls alongside the traditional SIM-based telephony stack. This flag is |
| Ihab Awad | f8b6988 | 2014-07-25 15:14:01 -0700 | [diff] [blame] | 71 | * distinct from {@link #CAPABILITY_CONNECTION_MANAGER} in that it is not allowed to manage |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 72 | * or place calls from the built-in telephony stack. |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 73 | * <p> |
| 74 | * See {@link #getCapabilities} |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 75 | * <p> |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 76 | */ |
| 77 | public static final int CAPABILITY_CALL_PROVIDER = 0x2; |
| 78 | |
| Ihab Awad | 7522bbd6 | 2014-07-18 15:53:17 -0700 | [diff] [blame] | 79 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 80 | * Flag indicating that this {@code PhoneAccount} represents a built-in PSTN SIM |
| Evan Charlton | 6eb262c | 2014-07-19 18:18:19 -0700 | [diff] [blame] | 81 | * subscription. |
| Ihab Awad | 7522bbd6 | 2014-07-18 15:53:17 -0700 | [diff] [blame] | 82 | * <p> |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 83 | * Only the Android framework can register a {@code PhoneAccount} having this capability. |
| 84 | * <p> |
| 85 | * See {@link #getCapabilities} |
| Ihab Awad | 7522bbd6 | 2014-07-18 15:53:17 -0700 | [diff] [blame] | 86 | */ |
| 87 | public static final int CAPABILITY_SIM_SUBSCRIPTION = 0x4; |
| 88 | |
| Ihab Awad | f8b6988 | 2014-07-25 15:14:01 -0700 | [diff] [blame] | 89 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 90 | * Flag indicating that this {@code PhoneAccount} is capable of placing video calls. |
| 91 | * <p> |
| 92 | * See {@link #getCapabilities} |
| Ihab Awad | f8b6988 | 2014-07-25 15:14:01 -0700 | [diff] [blame] | 93 | */ |
| 94 | public static final int CAPABILITY_VIDEO_CALLING = 0x8; |
| 95 | |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 96 | /** |
| Tyler Gunn | a1ed7d1 | 2014-09-08 09:52:22 -0700 | [diff] [blame] | 97 | * Flag indicating that this {@code PhoneAccount} is capable of placing emergency calls. |
| 98 | * By default all PSTN {@code PhoneAccount}s are capable of placing emergency calls. |
| 99 | * <p> |
| 100 | * See {@link #getCapabilities} |
| 101 | */ |
| 102 | public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 0x10; |
| 103 | |
| 104 | /** |
| Evan Charlton | 134dd68 | 2014-11-25 14:12:57 -0800 | [diff] [blame] | 105 | * Flag indicating that this {@code PhoneAccount} is capable of being used by all users. This |
| 106 | * should only be used by system apps (and will be ignored for all other apps trying to use it). |
| 107 | * <p> |
| 108 | * See {@link #getCapabilities} |
| 109 | * @hide |
| 110 | */ |
| Brian Attwell | ad147f4 | 2014-12-19 11:37:16 -0800 | [diff] [blame] | 111 | @SystemApi |
| Evan Charlton | 134dd68 | 2014-11-25 14:12:57 -0800 | [diff] [blame] | 112 | public static final int CAPABILITY_MULTI_USER = 0x20; |
| 113 | |
| 114 | /** |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 115 | * URI scheme for telephone number URIs. |
| 116 | */ |
| 117 | public static final String SCHEME_TEL = "tel"; |
| 118 | |
| 119 | /** |
| 120 | * URI scheme for voicemail URIs. |
| 121 | */ |
| 122 | public static final String SCHEME_VOICEMAIL = "voicemail"; |
| 123 | |
| 124 | /** |
| 125 | * URI scheme for SIP URIs. |
| 126 | */ |
| 127 | public static final String SCHEME_SIP = "sip"; |
| 128 | |
| Nancy Chen | 3ace54b | 2014-10-22 17:45:26 -0700 | [diff] [blame] | 129 | /** |
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 130 | * Indicating no icon tint is set. |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 131 | * @hide |
| Nancy Chen | 3ace54b | 2014-10-22 17:45:26 -0700 | [diff] [blame] | 132 | */ |
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 133 | public static final int NO_ICON_TINT = 0; |
| 134 | |
| 135 | /** |
| 136 | * Indicating no hightlight color is set. |
| 137 | */ |
| 138 | public static final int NO_HIGHLIGHT_COLOR = 0; |
| Nancy Chen | 3ace54b | 2014-10-22 17:45:26 -0700 | [diff] [blame] | 139 | |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 140 | /** |
| 141 | * Indicating no resource ID is set. |
| 142 | */ |
| 143 | public static final int NO_RESOURCE_ID = -1; |
| 144 | |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 145 | private final PhoneAccountHandle mAccountHandle; |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 146 | private final Uri mAddress; |
| 147 | private final Uri mSubscriptionAddress; |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 148 | private final int mCapabilities; |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 149 | private final int mHighlightColor; |
| Santos Cordon | 146a3e3 | 2014-07-21 00:00:44 -0700 | [diff] [blame] | 150 | private final CharSequence mLabel; |
| 151 | private final CharSequence mShortDescription; |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 152 | private final List<String> mSupportedUriSchemes; |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 153 | private final Icon mIcon; |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 154 | private boolean mIsEnabled; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 155 | |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 156 | /** |
| 157 | * Helper class for creating a {@link PhoneAccount}. |
| 158 | */ |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 159 | public static class Builder { |
| 160 | private PhoneAccountHandle mAccountHandle; |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 161 | private Uri mAddress; |
| 162 | private Uri mSubscriptionAddress; |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 163 | private int mCapabilities; |
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 164 | private int mHighlightColor = NO_HIGHLIGHT_COLOR; |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 165 | private CharSequence mLabel; |
| 166 | private CharSequence mShortDescription; |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 167 | private List<String> mSupportedUriSchemes = new ArrayList<String>(); |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 168 | private Icon mIcon; |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 169 | private boolean mIsEnabled = false; |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 170 | |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 171 | /** |
| 172 | * Creates a builder with the specified {@link PhoneAccountHandle} and label. |
| 173 | */ |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 174 | public Builder(PhoneAccountHandle accountHandle, CharSequence label) { |
| 175 | this.mAccountHandle = accountHandle; |
| 176 | this.mLabel = label; |
| 177 | } |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 178 | |
| Tyler Gunn | a1ed7d1 | 2014-09-08 09:52:22 -0700 | [diff] [blame] | 179 | /** |
| 180 | * Creates an instance of the {@link PhoneAccount.Builder} from an existing |
| 181 | * {@link PhoneAccount}. |
| 182 | * |
| 183 | * @param phoneAccount The {@link PhoneAccount} used to initialize the builder. |
| 184 | */ |
| 185 | public Builder(PhoneAccount phoneAccount) { |
| 186 | mAccountHandle = phoneAccount.getAccountHandle(); |
| 187 | mAddress = phoneAccount.getAddress(); |
| 188 | mSubscriptionAddress = phoneAccount.getSubscriptionAddress(); |
| 189 | mCapabilities = phoneAccount.getCapabilities(); |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 190 | mHighlightColor = phoneAccount.getHighlightColor(); |
| Tyler Gunn | a1ed7d1 | 2014-09-08 09:52:22 -0700 | [diff] [blame] | 191 | mLabel = phoneAccount.getLabel(); |
| 192 | mShortDescription = phoneAccount.getShortDescription(); |
| 193 | mSupportedUriSchemes.addAll(phoneAccount.getSupportedUriSchemes()); |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 194 | mIcon = phoneAccount.getIcon(); |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 195 | mIsEnabled = phoneAccount.isEnabled(); |
| Tyler Gunn | a1ed7d1 | 2014-09-08 09:52:22 -0700 | [diff] [blame] | 196 | } |
| 197 | |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 198 | /** |
| 199 | * Sets the address. See {@link PhoneAccount#getAddress}. |
| 200 | * |
| 201 | * @param value The address of the phone account. |
| 202 | * @return The builder. |
| 203 | */ |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 204 | public Builder setAddress(Uri value) { |
| 205 | this.mAddress = value; |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 206 | return this; |
| 207 | } |
| 208 | |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 209 | /** |
| 210 | * Sets the subscription address. See {@link PhoneAccount#getSubscriptionAddress}. |
| 211 | * |
| 212 | * @param value The subscription address. |
| 213 | * @return The builder. |
| 214 | */ |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 215 | public Builder setSubscriptionAddress(Uri value) { |
| 216 | this.mSubscriptionAddress = value; |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 217 | return this; |
| 218 | } |
| 219 | |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 220 | /** |
| 221 | * Sets the capabilities. See {@link PhoneAccount#getCapabilities}. |
| 222 | * |
| 223 | * @param value The capabilities to set. |
| 224 | * @return The builder. |
| 225 | */ |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 226 | public Builder setCapabilities(int value) { |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 227 | this.mCapabilities = value; |
| 228 | return this; |
| 229 | } |
| 230 | |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 231 | /** |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 232 | * Sets the icon. See {@link PhoneAccount#getIcon}. |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 233 | * |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 234 | * @param icon The icon to set. |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 235 | */ |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 236 | public Builder setIcon(Icon icon) { |
| 237 | mIcon = icon; |
| Ihab Awad | 074bf10 | 2014-10-24 11:42:32 -0700 | [diff] [blame] | 238 | return this; |
| 239 | } |
| 240 | |
| 241 | /** |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 242 | * Sets the highlight color. See {@link PhoneAccount#getHighlightColor}. |
| Ihab Awad | 074bf10 | 2014-10-24 11:42:32 -0700 | [diff] [blame] | 243 | * |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 244 | * @param value The highlight color. |
| Ihab Awad | 074bf10 | 2014-10-24 11:42:32 -0700 | [diff] [blame] | 245 | * @return The builder. |
| 246 | */ |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 247 | public Builder setHighlightColor(int value) { |
| 248 | this.mHighlightColor = value; |
| Nancy Chen | 3ace54b | 2014-10-22 17:45:26 -0700 | [diff] [blame] | 249 | return this; |
| 250 | } |
| 251 | |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 252 | /** |
| 253 | * Sets the short description. See {@link PhoneAccount#getShortDescription}. |
| 254 | * |
| 255 | * @param value The short description. |
| 256 | * @return The builder. |
| 257 | */ |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 258 | public Builder setShortDescription(CharSequence value) { |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 259 | this.mShortDescription = value; |
| 260 | return this; |
| 261 | } |
| 262 | |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 263 | /** |
| 264 | * Specifies an additional URI scheme supported by the {@link PhoneAccount}. |
| 265 | * |
| 266 | * @param uriScheme The URI scheme. |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 267 | * @return The builder. |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 268 | */ |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 269 | public Builder addSupportedUriScheme(String uriScheme) { |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 270 | if (!TextUtils.isEmpty(uriScheme) && !mSupportedUriSchemes.contains(uriScheme)) { |
| 271 | this.mSupportedUriSchemes.add(uriScheme); |
| 272 | } |
| 273 | return this; |
| 274 | } |
| 275 | |
| 276 | /** |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 277 | * Specifies the URI schemes supported by the {@link PhoneAccount}. |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 278 | * |
| 279 | * @param uriSchemes The URI schemes. |
| Santos Cordon | 32c65a5 | 2014-10-27 14:57:49 -0700 | [diff] [blame] | 280 | * @return The builder. |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 281 | */ |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 282 | public Builder setSupportedUriSchemes(List<String> uriSchemes) { |
| 283 | mSupportedUriSchemes.clear(); |
| 284 | |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 285 | if (uriSchemes != null && !uriSchemes.isEmpty()) { |
| 286 | for (String uriScheme : uriSchemes) { |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 287 | addSupportedUriScheme(uriScheme); |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 288 | } |
| 289 | } |
| 290 | return this; |
| 291 | } |
| 292 | |
| Tyler Gunn | a1ed7d1 | 2014-09-08 09:52:22 -0700 | [diff] [blame] | 293 | /** |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 294 | * Sets the enabled state of the phone account. |
| 295 | * |
| 296 | * @param isEnabled The enabled state. |
| 297 | * @return The builder. |
| 298 | * @hide |
| 299 | */ |
| 300 | public Builder setIsEnabled(boolean isEnabled) { |
| 301 | mIsEnabled = isEnabled; |
| 302 | return this; |
| 303 | } |
| 304 | |
| 305 | /** |
| Tyler Gunn | a1ed7d1 | 2014-09-08 09:52:22 -0700 | [diff] [blame] | 306 | * Creates an instance of a {@link PhoneAccount} based on the current builder settings. |
| 307 | * |
| 308 | * @return The {@link PhoneAccount}. |
| 309 | */ |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 310 | public PhoneAccount build() { |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 311 | // If no supported URI schemes were defined, assume "tel" is supported. |
| 312 | if (mSupportedUriSchemes.isEmpty()) { |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 313 | addSupportedUriScheme(SCHEME_TEL); |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 314 | } |
| 315 | |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 316 | return new PhoneAccount( |
| 317 | mAccountHandle, |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 318 | mAddress, |
| 319 | mSubscriptionAddress, |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 320 | mCapabilities, |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 321 | mIcon, |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 322 | mHighlightColor, |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 323 | mLabel, |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 324 | mShortDescription, |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 325 | mSupportedUriSchemes, |
| 326 | mIsEnabled); |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 327 | } |
| 328 | } |
| 329 | |
| 330 | private PhoneAccount( |
| Evan Charlton | 6eb262c | 2014-07-19 18:18:19 -0700 | [diff] [blame] | 331 | PhoneAccountHandle account, |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 332 | Uri address, |
| 333 | Uri subscriptionAddress, |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 334 | int capabilities, |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 335 | Icon icon, |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 336 | int highlightColor, |
| Santos Cordon | 146a3e3 | 2014-07-21 00:00:44 -0700 | [diff] [blame] | 337 | CharSequence label, |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 338 | CharSequence shortDescription, |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 339 | List<String> supportedUriSchemes, |
| 340 | boolean isEnabled) { |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 341 | mAccountHandle = account; |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 342 | mAddress = address; |
| 343 | mSubscriptionAddress = subscriptionAddress; |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 344 | mCapabilities = capabilities; |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 345 | mIcon = icon; |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 346 | mHighlightColor = highlightColor; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 347 | mLabel = label; |
| 348 | mShortDescription = shortDescription; |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 349 | mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes); |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 350 | mIsEnabled = isEnabled; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 351 | } |
| 352 | |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 353 | public static Builder builder( |
| 354 | PhoneAccountHandle accountHandle, |
| 355 | CharSequence label) { |
| 356 | return new Builder(accountHandle, label); |
| 357 | } |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 358 | |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 359 | /** |
| Tyler Gunn | a1ed7d1 | 2014-09-08 09:52:22 -0700 | [diff] [blame] | 360 | * Returns a builder initialized with the current {@link PhoneAccount} instance. |
| 361 | * |
| 362 | * @return The builder. |
| Tyler Gunn | a1ed7d1 | 2014-09-08 09:52:22 -0700 | [diff] [blame] | 363 | */ |
| 364 | public Builder toBuilder() { return new Builder(this); } |
| 365 | |
| 366 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 367 | * The unique identifier of this {@code PhoneAccount}. |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 368 | * |
| Evan Charlton | 6eb262c | 2014-07-19 18:18:19 -0700 | [diff] [blame] | 369 | * @return A {@code PhoneAccountHandle}. |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 370 | */ |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 371 | public PhoneAccountHandle getAccountHandle() { |
| 372 | return mAccountHandle; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 373 | } |
| 374 | |
| 375 | /** |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 376 | * The address (e.g., a phone number) associated with this {@code PhoneAccount}. This |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 377 | * represents the destination from which outgoing calls using this {@code PhoneAccount} |
| Evan Charlton | 6eb262c | 2014-07-19 18:18:19 -0700 | [diff] [blame] | 378 | * will appear to come, if applicable, and the destination to which incoming calls using this |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 379 | * {@code PhoneAccount} may be addressed. |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 380 | * |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 381 | * @return A address expressed as a {@code Uri}, for example, a phone number. |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 382 | */ |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 383 | public Uri getAddress() { |
| 384 | return mAddress; |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 388 | * The raw callback number used for this {@code PhoneAccount}, as distinct from |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 389 | * {@link #getAddress()}. For the majority of {@code PhoneAccount}s this should be registered |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 390 | * as {@code null}. It is used by the system for SIM-based {@code PhoneAccount} registration |
| Junda Liu | f52ac90 | 2014-09-25 17:36:48 +0000 | [diff] [blame] | 391 | * where {@link android.telephony.TelephonyManager#setLine1NumberForDisplay(String, String)} |
| 392 | * has been used to alter the callback number. |
| 393 | * <p> |
| Evan Charlton | 222db525 | 2014-07-17 16:59:18 -0700 | [diff] [blame] | 394 | * |
| 395 | * @return The subscription number, suitable for display to the user. |
| 396 | */ |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 397 | public Uri getSubscriptionAddress() { |
| 398 | return mSubscriptionAddress; |
| Evan Charlton | 222db525 | 2014-07-17 16:59:18 -0700 | [diff] [blame] | 399 | } |
| 400 | |
| 401 | /** |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 402 | * The capabilities of this {@code PhoneAccount}. |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 403 | * |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 404 | * @return A bit field of flags describing this {@code PhoneAccount}'s capabilities. |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 405 | */ |
| 406 | public int getCapabilities() { |
| 407 | return mCapabilities; |
| 408 | } |
| 409 | |
| 410 | /** |
| Tyler Gunn | a1ed7d1 | 2014-09-08 09:52:22 -0700 | [diff] [blame] | 411 | * Determines if this {@code PhoneAccount} has a capabilities specified by the passed in |
| 412 | * bit mask. |
| 413 | * |
| 414 | * @param capability The capabilities to check. |
| 415 | * @return {@code True} if the phone account has the capability. |
| 416 | */ |
| 417 | public boolean hasCapabilities(int capability) { |
| 418 | return (mCapabilities & capability) == capability; |
| 419 | } |
| 420 | |
| 421 | /** |
| Santos Cordon | 146a3e3 | 2014-07-21 00:00:44 -0700 | [diff] [blame] | 422 | * A short label describing a {@code PhoneAccount}. |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 423 | * |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 424 | * @return A label for this {@code PhoneAccount}. |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 425 | */ |
| Santos Cordon | 146a3e3 | 2014-07-21 00:00:44 -0700 | [diff] [blame] | 426 | public CharSequence getLabel() { |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 427 | return mLabel; |
| 428 | } |
| 429 | |
| 430 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 431 | * A short paragraph describing this {@code PhoneAccount}. |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 432 | * |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 433 | * @return A description for this {@code PhoneAccount}. |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 434 | */ |
| Santos Cordon | 146a3e3 | 2014-07-21 00:00:44 -0700 | [diff] [blame] | 435 | public CharSequence getShortDescription() { |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 436 | return mShortDescription; |
| 437 | } |
| 438 | |
| 439 | /** |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 440 | * The URI schemes supported by this {@code PhoneAccount}. |
| 441 | * |
| 442 | * @return The URI schemes. |
| 443 | */ |
| 444 | public List<String> getSupportedUriSchemes() { |
| 445 | return mSupportedUriSchemes; |
| 446 | } |
| 447 | |
| 448 | /** |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 449 | * The icon to represent this {@code PhoneAccount}. |
| 450 | * |
| 451 | * @return The icon. |
| 452 | */ |
| 453 | public Icon getIcon() { |
| 454 | return mIcon; |
| 455 | } |
| 456 | |
| 457 | /** |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 458 | * Indicates whether the user has enabled this phone account or not {@code PhoneAccounts}. |
| 459 | * |
| 460 | * @return The {@code true} if the account is enabled by the user, {@code false} otherwise. |
| 461 | */ |
| 462 | public boolean isEnabled() { |
| 463 | return mIsEnabled; |
| 464 | } |
| 465 | |
| 466 | /** |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 467 | * Determines if the {@link PhoneAccount} supports calls to/from addresses with a specified URI |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 468 | * scheme. |
| 469 | * |
| 470 | * @param uriScheme The URI scheme to check. |
| Andrew Lee | 3085a6c | 2014-09-04 10:59:13 -0700 | [diff] [blame] | 471 | * @return {@code True} if the {@code PhoneAccount} supports calls to/from addresses with the |
| Tyler Gunn | f5b29dc | 2014-09-03 09:09:12 -0700 | [diff] [blame] | 472 | * specified URI scheme. |
| 473 | */ |
| 474 | public boolean supportsUriScheme(String uriScheme) { |
| 475 | if (mSupportedUriSchemes == null || uriScheme == null) { |
| 476 | return false; |
| 477 | } |
| 478 | |
| 479 | for (String scheme : mSupportedUriSchemes) { |
| 480 | if (scheme != null && scheme.equals(uriScheme)) { |
| 481 | return true; |
| 482 | } |
| 483 | } |
| 484 | return false; |
| 485 | } |
| 486 | |
| 487 | /** |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 488 | * A highlight color to use in displaying information about this {@code PhoneAccount}. |
| 489 | * |
| 490 | * @return A hexadecimal color value. |
| 491 | */ |
| 492 | public int getHighlightColor() { |
| 493 | return mHighlightColor; |
| 494 | } |
| 495 | |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 496 | /** |
| 497 | * Sets the enabled state of the phone account. |
| 498 | * @hide |
| 499 | */ |
| 500 | public void setIsEnabled(boolean isEnabled) { |
| 501 | mIsEnabled = isEnabled; |
| 502 | } |
| 503 | |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 504 | // |
| 505 | // Parcelable implementation |
| 506 | // |
| 507 | |
| 508 | @Override |
| 509 | public int describeContents() { |
| 510 | return 0; |
| 511 | } |
| 512 | |
| 513 | @Override |
| 514 | public void writeToParcel(Parcel out, int flags) { |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 515 | if (mAccountHandle == null) { |
| 516 | out.writeInt(0); |
| 517 | } else { |
| 518 | out.writeInt(1); |
| 519 | mAccountHandle.writeToParcel(out, flags); |
| 520 | } |
| 521 | if (mAddress == null) { |
| 522 | out.writeInt(0); |
| 523 | } else { |
| 524 | out.writeInt(1); |
| 525 | mAddress.writeToParcel(out, flags); |
| 526 | } |
| 527 | if (mSubscriptionAddress == null) { |
| 528 | out.writeInt(0); |
| 529 | } else { |
| 530 | out.writeInt(1); |
| 531 | mSubscriptionAddress.writeToParcel(out, flags); |
| 532 | } |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 533 | out.writeInt(mCapabilities); |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 534 | out.writeInt(mHighlightColor); |
| Santos Cordon | 146a3e3 | 2014-07-21 00:00:44 -0700 | [diff] [blame] | 535 | out.writeCharSequence(mLabel); |
| 536 | out.writeCharSequence(mShortDescription); |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 537 | out.writeStringList(mSupportedUriSchemes); |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 538 | |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 539 | if (mIcon == null) { |
| 540 | out.writeInt(0); |
| 541 | } else { |
| 542 | out.writeInt(1); |
| 543 | mIcon.writeToParcel(out, flags); |
| 544 | } |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 545 | out.writeByte((byte) (mIsEnabled ? 1 : 0)); |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 546 | } |
| 547 | |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 548 | public static final Creator<PhoneAccount> CREATOR |
| 549 | = new Creator<PhoneAccount>() { |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 550 | @Override |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 551 | public PhoneAccount createFromParcel(Parcel in) { |
| 552 | return new PhoneAccount(in); |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 553 | } |
| 554 | |
| 555 | @Override |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 556 | public PhoneAccount[] newArray(int size) { |
| 557 | return new PhoneAccount[size]; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 558 | } |
| 559 | }; |
| 560 | |
| Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 561 | private PhoneAccount(Parcel in) { |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 562 | if (in.readInt() > 0) { |
| 563 | mAccountHandle = PhoneAccountHandle.CREATOR.createFromParcel(in); |
| 564 | } else { |
| 565 | mAccountHandle = null; |
| 566 | } |
| 567 | if (in.readInt() > 0) { |
| 568 | mAddress = Uri.CREATOR.createFromParcel(in); |
| 569 | } else { |
| 570 | mAddress = null; |
| 571 | } |
| 572 | if (in.readInt() > 0) { |
| 573 | mSubscriptionAddress = Uri.CREATOR.createFromParcel(in); |
| 574 | } else { |
| 575 | mSubscriptionAddress = null; |
| 576 | } |
| Ihab Awad | 94cf4bf | 2014-07-17 11:21:19 -0700 | [diff] [blame] | 577 | mCapabilities = in.readInt(); |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 578 | mHighlightColor = in.readInt(); |
| Santos Cordon | 146a3e3 | 2014-07-21 00:00:44 -0700 | [diff] [blame] | 579 | mLabel = in.readCharSequence(); |
| 580 | mShortDescription = in.readCharSequence(); |
| Ihab Awad | 476cc83 | 2014-11-03 09:47:51 -0800 | [diff] [blame] | 581 | mSupportedUriSchemes = Collections.unmodifiableList(in.createStringArrayList()); |
| Santos Cordon | cad84a2 | 2015-05-13 11:17:25 -0700 | [diff] [blame] | 582 | if (in.readInt() > 0) { |
| 583 | mIcon = Icon.CREATOR.createFromParcel(in); |
| 584 | } else { |
| 585 | mIcon = null; |
| 586 | } |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 587 | mIsEnabled = in.readByte() == 1; |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 588 | } |
| Tyler Gunn | 76c01a5 | 2014-09-30 14:47:51 -0700 | [diff] [blame] | 589 | |
| 590 | @Override |
| 591 | public String toString() { |
| Santos Cordon | 91371dc0 | 2015-05-08 13:52:09 -0700 | [diff] [blame^] | 592 | StringBuilder sb = new StringBuilder().append("[[") |
| 593 | .append(mIsEnabled ? 'X' : ' ') |
| 594 | .append("] PhoneAccount: ") |
| Tyler Gunn | 76c01a5 | 2014-09-30 14:47:51 -0700 | [diff] [blame] | 595 | .append(mAccountHandle) |
| 596 | .append(" Capabilities: ") |
| 597 | .append(mCapabilities) |
| 598 | .append(" Schemes: "); |
| 599 | for (String scheme : mSupportedUriSchemes) { |
| 600 | sb.append(scheme) |
| 601 | .append(" "); |
| 602 | } |
| 603 | sb.append("]"); |
| 604 | return sb.toString(); |
| 605 | } |
| Ihab Awad | 807fe0a | 2014-07-09 12:30:52 -0700 | [diff] [blame] | 606 | } |