Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 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 | |
| 17 | package android.provider; |
| 18 | |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 19 | import android.annotation.IntDef; |
chen xu | 8165386 | 2019-02-28 10:44:54 -0800 | [diff] [blame] | 20 | import android.annotation.NonNull; |
Jayachandran C | 349b9ba | 2018-10-30 15:09:06 -0700 | [diff] [blame] | 21 | import android.annotation.RequiresPermission; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 22 | import android.annotation.SdkConstant; |
| 23 | import android.annotation.SdkConstant.SdkConstantType; |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 24 | import android.annotation.SystemApi; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 25 | import android.annotation.TestApi; |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 26 | import android.annotation.UnsupportedAppUsage; |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 27 | import android.app.job.JobService; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 28 | import android.content.ComponentName; |
| 29 | import android.content.ContentResolver; |
| 30 | import android.content.ContentValues; |
| 31 | import android.content.Context; |
| 32 | import android.content.Intent; |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 33 | import android.database.ContentObserver; |
Aurimas Liutikas | 7f69533 | 2018-05-31 21:07:32 -0700 | [diff] [blame] | 34 | import android.database.Cursor; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 35 | import android.database.sqlite.SqliteWrapper; |
| 36 | import android.net.Uri; |
Mathew Inwood | 8c854f8 | 2018-09-14 12:35:36 +0100 | [diff] [blame] | 37 | import android.os.Build; |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 38 | import android.telephony.Rlog; |
| 39 | import android.telephony.ServiceState; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 40 | import android.telephony.SmsMessage; |
| 41 | import android.telephony.SubscriptionManager; |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 42 | import android.telephony.TelephonyManager; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 43 | import android.text.TextUtils; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 44 | import android.util.Patterns; |
| 45 | |
| 46 | import com.android.internal.telephony.PhoneConstants; |
| 47 | import com.android.internal.telephony.SmsApplication; |
| 48 | |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 49 | import java.lang.annotation.Retention; |
| 50 | import java.lang.annotation.RetentionPolicy; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 51 | import java.util.HashSet; |
| 52 | import java.util.Set; |
| 53 | import java.util.regex.Matcher; |
| 54 | import java.util.regex.Pattern; |
| 55 | |
| 56 | /** |
| 57 | * The Telephony provider contains data related to phone operation, specifically SMS and MMS |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 58 | * messages, access to the APN list, including the MMSC to use, and the service state. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 59 | * |
| 60 | * <p class="note"><strong>Note:</strong> These APIs are not available on all Android-powered |
| 61 | * devices. If your app depends on telephony features such as for managing SMS messages, include |
| 62 | * a <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>} |
| 63 | * </a> element in your manifest that declares the {@code "android.hardware.telephony"} hardware |
| 64 | * feature. Alternatively, you can check for telephony availability at runtime using either |
| 65 | * {@link android.content.pm.PackageManager#hasSystemFeature |
| 66 | * hasSystemFeature(PackageManager.FEATURE_TELEPHONY)} or {@link |
| 67 | * android.telephony.TelephonyManager#getPhoneType}.</p> |
| 68 | * |
| 69 | * <h3>Creating an SMS app</h3> |
| 70 | * |
| 71 | * <p>Only the default SMS app (selected by the user in system settings) is able to write to the |
| 72 | * SMS Provider (the tables defined within the {@code Telephony} class) and only the default SMS |
| 73 | * app receives the {@link android.provider.Telephony.Sms.Intents#SMS_DELIVER_ACTION} broadcast |
| 74 | * when the user receives an SMS or the {@link |
| 75 | * android.provider.Telephony.Sms.Intents#WAP_PUSH_DELIVER_ACTION} broadcast when the user |
| 76 | * receives an MMS.</p> |
| 77 | * |
| 78 | * <p>Any app that wants to behave as the user's default SMS app must handle the following intents: |
| 79 | * <ul> |
| 80 | * <li>In a broadcast receiver, include an intent filter for {@link Sms.Intents#SMS_DELIVER_ACTION} |
| 81 | * (<code>"android.provider.Telephony.SMS_DELIVER"</code>). The broadcast receiver must also |
| 82 | * require the {@link android.Manifest.permission#BROADCAST_SMS} permission. |
| 83 | * <p>This allows your app to directly receive incoming SMS messages.</p></li> |
| 84 | * <li>In a broadcast receiver, include an intent filter for {@link |
| 85 | * Sms.Intents#WAP_PUSH_DELIVER_ACTION}} ({@code "android.provider.Telephony.WAP_PUSH_DELIVER"}) |
| 86 | * with the MIME type <code>"application/vnd.wap.mms-message"</code>. |
| 87 | * The broadcast receiver must also require the {@link |
| 88 | * android.Manifest.permission#BROADCAST_WAP_PUSH} permission. |
| 89 | * <p>This allows your app to directly receive incoming MMS messages.</p></li> |
| 90 | * <li>In your activity that delivers new messages, include an intent filter for |
| 91 | * {@link android.content.Intent#ACTION_SENDTO} (<code>"android.intent.action.SENDTO" |
| 92 | * </code>) with schemas, <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and |
| 93 | * <code>mmsto:</code>. |
| 94 | * <p>This allows your app to receive intents from other apps that want to deliver a |
| 95 | * message.</p></li> |
| 96 | * <li>In a service, include an intent filter for {@link |
| 97 | * android.telephony.TelephonyManager#ACTION_RESPOND_VIA_MESSAGE} |
| 98 | * (<code>"android.intent.action.RESPOND_VIA_MESSAGE"</code>) with schemas, |
| 99 | * <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and <code>mmsto:</code>. |
| 100 | * This service must also require the {@link |
| 101 | * android.Manifest.permission#SEND_RESPOND_VIA_MESSAGE} permission. |
| 102 | * <p>This allows users to respond to incoming phone calls with an immediate text message |
| 103 | * using your app.</p></li> |
| 104 | * </ul> |
| 105 | * |
| 106 | * <p>Other apps that are not selected as the default SMS app can only <em>read</em> the SMS |
| 107 | * Provider, but may also be notified when a new SMS arrives by listening for the {@link |
| 108 | * Sms.Intents#SMS_RECEIVED_ACTION} |
| 109 | * broadcast, which is a non-abortable broadcast that may be delivered to multiple apps. This |
| 110 | * broadcast is intended for apps that—while not selected as the default SMS app—need to |
| 111 | * read special incoming messages such as to perform phone number verification.</p> |
| 112 | * |
| 113 | * <p>For more information about building SMS apps, read the blog post, <a |
| 114 | * href="http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html" |
| 115 | * >Getting Your SMS Apps Ready for KitKat</a>.</p> |
| 116 | * |
| 117 | */ |
| 118 | public final class Telephony { |
| 119 | private static final String TAG = "Telephony"; |
| 120 | |
| 121 | /** |
| 122 | * Not instantiable. |
| 123 | * @hide |
| 124 | */ |
| 125 | private Telephony() { |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Base columns for tables that contain text-based SMSs. |
| 130 | */ |
| 131 | public interface TextBasedSmsColumns { |
| 132 | |
| 133 | /** Message type: all messages. */ |
| 134 | public static final int MESSAGE_TYPE_ALL = 0; |
| 135 | |
| 136 | /** Message type: inbox. */ |
| 137 | public static final int MESSAGE_TYPE_INBOX = 1; |
| 138 | |
| 139 | /** Message type: sent messages. */ |
| 140 | public static final int MESSAGE_TYPE_SENT = 2; |
| 141 | |
| 142 | /** Message type: drafts. */ |
| 143 | public static final int MESSAGE_TYPE_DRAFT = 3; |
| 144 | |
| 145 | /** Message type: outbox. */ |
| 146 | public static final int MESSAGE_TYPE_OUTBOX = 4; |
| 147 | |
| 148 | /** Message type: failed outgoing message. */ |
| 149 | public static final int MESSAGE_TYPE_FAILED = 5; |
| 150 | |
| 151 | /** Message type: queued to send later. */ |
| 152 | public static final int MESSAGE_TYPE_QUEUED = 6; |
| 153 | |
| 154 | /** |
| 155 | * The type of message. |
| 156 | * <P>Type: INTEGER</P> |
| 157 | */ |
| 158 | public static final String TYPE = "type"; |
| 159 | |
| 160 | /** |
| 161 | * The thread ID of the message. |
| 162 | * <P>Type: INTEGER</P> |
| 163 | */ |
| 164 | public static final String THREAD_ID = "thread_id"; |
| 165 | |
| 166 | /** |
| 167 | * The address of the other party. |
| 168 | * <P>Type: TEXT</P> |
| 169 | */ |
| 170 | public static final String ADDRESS = "address"; |
| 171 | |
| 172 | /** |
| 173 | * The date the message was received. |
| 174 | * <P>Type: INTEGER (long)</P> |
| 175 | */ |
| 176 | public static final String DATE = "date"; |
| 177 | |
| 178 | /** |
| 179 | * The date the message was sent. |
| 180 | * <P>Type: INTEGER (long)</P> |
| 181 | */ |
| 182 | public static final String DATE_SENT = "date_sent"; |
| 183 | |
| 184 | /** |
| 185 | * Has the message been read? |
| 186 | * <P>Type: INTEGER (boolean)</P> |
| 187 | */ |
| 188 | public static final String READ = "read"; |
| 189 | |
| 190 | /** |
| 191 | * Has the message been seen by the user? The "seen" flag determines |
| 192 | * whether we need to show a notification. |
| 193 | * <P>Type: INTEGER (boolean)</P> |
| 194 | */ |
| 195 | public static final String SEEN = "seen"; |
| 196 | |
| 197 | /** |
| 198 | * {@code TP-Status} value for the message, or -1 if no status has been received. |
| 199 | * <P>Type: INTEGER</P> |
| 200 | */ |
| 201 | public static final String STATUS = "status"; |
| 202 | |
| 203 | /** TP-Status: no status received. */ |
| 204 | public static final int STATUS_NONE = -1; |
| 205 | /** TP-Status: complete. */ |
| 206 | public static final int STATUS_COMPLETE = 0; |
| 207 | /** TP-Status: pending. */ |
| 208 | public static final int STATUS_PENDING = 32; |
| 209 | /** TP-Status: failed. */ |
| 210 | public static final int STATUS_FAILED = 64; |
| 211 | |
| 212 | /** |
| 213 | * The subject of the message, if present. |
| 214 | * <P>Type: TEXT</P> |
| 215 | */ |
| 216 | public static final String SUBJECT = "subject"; |
| 217 | |
| 218 | /** |
| 219 | * The body of the message. |
| 220 | * <P>Type: TEXT</P> |
| 221 | */ |
| 222 | public static final String BODY = "body"; |
| 223 | |
| 224 | /** |
| 225 | * The ID of the sender of the conversation, if present. |
| 226 | * <P>Type: INTEGER (reference to item in {@code content://contacts/people})</P> |
| 227 | */ |
| 228 | public static final String PERSON = "person"; |
| 229 | |
| 230 | /** |
| 231 | * The protocol identifier code. |
| 232 | * <P>Type: INTEGER</P> |
| 233 | */ |
| 234 | public static final String PROTOCOL = "protocol"; |
| 235 | |
| 236 | /** |
| 237 | * Is the {@code TP-Reply-Path} flag set? |
| 238 | * <P>Type: BOOLEAN</P> |
| 239 | */ |
| 240 | public static final String REPLY_PATH_PRESENT = "reply_path_present"; |
| 241 | |
| 242 | /** |
| 243 | * The service center (SC) through which to send the message, if present. |
| 244 | * <P>Type: TEXT</P> |
| 245 | */ |
| 246 | public static final String SERVICE_CENTER = "service_center"; |
| 247 | |
| 248 | /** |
| 249 | * Is the message locked? |
| 250 | * <P>Type: INTEGER (boolean)</P> |
| 251 | */ |
| 252 | public static final String LOCKED = "locked"; |
| 253 | |
| 254 | /** |
| 255 | * The subscription to which the message belongs to. Its value will be |
| 256 | * < 0 if the sub id cannot be determined. |
| 257 | * <p>Type: INTEGER (long) </p> |
| 258 | */ |
| 259 | public static final String SUBSCRIPTION_ID = "sub_id"; |
| 260 | |
| 261 | /** |
| 262 | * The MTU size of the mobile interface to which the APN connected |
| 263 | * @hide |
| 264 | */ |
| 265 | public static final String MTU = "mtu"; |
| 266 | |
| 267 | /** |
| 268 | * Error code associated with sending or receiving this message |
| 269 | * <P>Type: INTEGER</P> |
| 270 | */ |
| 271 | public static final String ERROR_CODE = "error_code"; |
| 272 | |
| 273 | /** |
| 274 | * The identity of the sender of a sent message. It is |
| 275 | * usually the package name of the app which sends the message. |
| 276 | * <p class="note"><strong>Note:</strong> |
| 277 | * This column is read-only. It is set by the provider and can not be changed by apps. |
| 278 | * <p>Type: TEXT</p> |
| 279 | */ |
| 280 | public static final String CREATOR = "creator"; |
| 281 | } |
| 282 | |
| 283 | /** |
Vasu Nori | 84db0f5 | 2018-02-14 15:14:32 -0800 | [diff] [blame] | 284 | * Columns in sms_changes table. |
| 285 | * @hide |
| 286 | */ |
| 287 | public interface TextBasedSmsChangesColumns { |
| 288 | /** |
| 289 | * The {@code content://} style URL for this table. |
| 290 | * @hide |
| 291 | */ |
| 292 | public static final Uri CONTENT_URI = Uri.parse("content://sms-changes"); |
| 293 | |
| 294 | /** |
| 295 | * Primary key. |
| 296 | * <P>Type: INTEGER (long)</P> |
| 297 | * @hide |
| 298 | */ |
| 299 | public static final String ID = "_id"; |
| 300 | |
| 301 | /** |
| 302 | * Triggers on sms table create a row in this table for each update/delete. |
| 303 | * This column is the "_id" of the row from sms table that was updated/deleted. |
| 304 | * <P>Type: INTEGER (long)</P> |
| 305 | * @hide |
| 306 | */ |
| 307 | public static final String ORIG_ROW_ID = "orig_rowid"; |
| 308 | |
| 309 | /** |
| 310 | * Triggers on sms table create a row in this table for each update/delete. |
| 311 | * This column is the "sub_id" of the row from sms table that was updated/deleted. |
| 312 | * @hide |
| 313 | * <P>Type: INTEGER (long)</P> |
| 314 | */ |
| 315 | public static final String SUB_ID = "sub_id"; |
| 316 | |
| 317 | /** |
| 318 | * The type of operation that created this row. |
| 319 | * {@link #TYPE_UPDATE} = update op |
| 320 | * {@link #TYPE_DELETE} = delete op |
| 321 | * @hide |
| 322 | * <P>Type: INTEGER (long)</P> |
| 323 | */ |
| 324 | public static final String TYPE = "type"; |
| 325 | |
| 326 | /** |
| 327 | * One of the possible values for the above column "type". Indicates it is an update op. |
| 328 | * @hide |
| 329 | */ |
| 330 | public static final int TYPE_UPDATE = 0; |
| 331 | |
| 332 | /** |
| 333 | * One of the possible values for the above column "type". Indicates it is a delete op. |
| 334 | * @hide |
| 335 | */ |
| 336 | public static final int TYPE_DELETE = 1; |
| 337 | |
| 338 | /** |
| 339 | * This column contains a non-null value only if the operation on sms table is an update op |
| 340 | * and the column "read" is changed by the update op. |
| 341 | * <P>Type: INTEGER (boolean)</P> |
| 342 | * @hide |
| 343 | */ |
| 344 | public static final String NEW_READ_STATUS = "new_read_status"; |
| 345 | } |
| 346 | |
| 347 | /** |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 348 | * Contains all text-based SMS messages. |
| 349 | */ |
| 350 | public static final class Sms implements BaseColumns, TextBasedSmsColumns { |
| 351 | |
| 352 | /** |
| 353 | * Not instantiable. |
| 354 | * @hide |
| 355 | */ |
| 356 | private Sms() { |
| 357 | } |
| 358 | |
| 359 | /** |
| 360 | * Used to determine the currently configured default SMS package. |
| 361 | * @param context context of the requesting application |
| 362 | * @return package name for the default SMS package or null |
| 363 | */ |
| 364 | public static String getDefaultSmsPackage(Context context) { |
| 365 | ComponentName component = SmsApplication.getDefaultSmsApplication(context, false); |
| 366 | if (component != null) { |
| 367 | return component.getPackageName(); |
| 368 | } |
| 369 | return null; |
| 370 | } |
| 371 | |
| 372 | /** |
| 373 | * Return cursor for table query. |
| 374 | * @hide |
| 375 | */ |
| 376 | public static Cursor query(ContentResolver cr, String[] projection) { |
| 377 | return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER); |
| 378 | } |
| 379 | |
| 380 | /** |
| 381 | * Return cursor for table query. |
| 382 | * @hide |
| 383 | */ |
Mathew Inwood | 8c854f8 | 2018-09-14 12:35:36 +0100 | [diff] [blame] | 384 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 385 | public static Cursor query(ContentResolver cr, String[] projection, |
| 386 | String where, String orderBy) { |
| 387 | return cr.query(CONTENT_URI, projection, where, |
| 388 | null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy); |
| 389 | } |
| 390 | |
| 391 | /** |
| 392 | * The {@code content://} style URL for this table. |
| 393 | */ |
| 394 | public static final Uri CONTENT_URI = Uri.parse("content://sms"); |
| 395 | |
| 396 | /** |
| 397 | * The default sort order for this table. |
| 398 | */ |
| 399 | public static final String DEFAULT_SORT_ORDER = "date DESC"; |
| 400 | |
| 401 | /** |
| 402 | * Add an SMS to the given URI. |
| 403 | * |
| 404 | * @param resolver the content resolver to use |
| 405 | * @param uri the URI to add the message to |
| 406 | * @param address the address of the sender |
| 407 | * @param body the body of the message |
| 408 | * @param subject the pseudo-subject of the message |
| 409 | * @param date the timestamp for the message |
| 410 | * @param read true if the message has been read, false if not |
| 411 | * @param deliveryReport true if a delivery report was requested, false if not |
| 412 | * @return the URI for the new message |
| 413 | * @hide |
| 414 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 415 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 416 | public static Uri addMessageToUri(ContentResolver resolver, |
| 417 | Uri uri, String address, String body, String subject, |
| 418 | Long date, boolean read, boolean deliveryReport) { |
| 419 | return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), |
| 420 | resolver, uri, address, body, subject, date, read, deliveryReport, -1L); |
| 421 | } |
| 422 | |
| 423 | /** |
| 424 | * Add an SMS to the given URI. |
| 425 | * |
| 426 | * @param resolver the content resolver to use |
| 427 | * @param uri the URI to add the message to |
| 428 | * @param address the address of the sender |
| 429 | * @param body the body of the message |
| 430 | * @param subject the psuedo-subject of the message |
| 431 | * @param date the timestamp for the message |
| 432 | * @param read true if the message has been read, false if not |
| 433 | * @param deliveryReport true if a delivery report was requested, false if not |
| 434 | * @param subId the subscription which the message belongs to |
| 435 | * @return the URI for the new message |
| 436 | * @hide |
| 437 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 438 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 439 | public static Uri addMessageToUri(int subId, ContentResolver resolver, |
| 440 | Uri uri, String address, String body, String subject, |
| 441 | Long date, boolean read, boolean deliveryReport) { |
| 442 | return addMessageToUri(subId, resolver, uri, address, body, subject, |
| 443 | date, read, deliveryReport, -1L); |
| 444 | } |
| 445 | |
| 446 | /** |
| 447 | * Add an SMS to the given URI with the specified thread ID. |
| 448 | * |
| 449 | * @param resolver the content resolver to use |
| 450 | * @param uri the URI to add the message to |
| 451 | * @param address the address of the sender |
| 452 | * @param body the body of the message |
| 453 | * @param subject the pseudo-subject of the message |
| 454 | * @param date the timestamp for the message |
| 455 | * @param read true if the message has been read, false if not |
| 456 | * @param deliveryReport true if a delivery report was requested, false if not |
| 457 | * @param threadId the thread_id of the message |
| 458 | * @return the URI for the new message |
| 459 | * @hide |
| 460 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 461 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 462 | public static Uri addMessageToUri(ContentResolver resolver, |
| 463 | Uri uri, String address, String body, String subject, |
| 464 | Long date, boolean read, boolean deliveryReport, long threadId) { |
| 465 | return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), |
| 466 | resolver, uri, address, body, subject, |
| 467 | date, read, deliveryReport, threadId); |
| 468 | } |
| 469 | |
| 470 | /** |
| 471 | * Add an SMS to the given URI with thread_id specified. |
| 472 | * |
| 473 | * @param resolver the content resolver to use |
| 474 | * @param uri the URI to add the message to |
| 475 | * @param address the address of the sender |
| 476 | * @param body the body of the message |
| 477 | * @param subject the psuedo-subject of the message |
| 478 | * @param date the timestamp for the message |
| 479 | * @param read true if the message has been read, false if not |
| 480 | * @param deliveryReport true if a delivery report was requested, false if not |
| 481 | * @param threadId the thread_id of the message |
| 482 | * @param subId the subscription which the message belongs to |
| 483 | * @return the URI for the new message |
| 484 | * @hide |
| 485 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 486 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 487 | public static Uri addMessageToUri(int subId, ContentResolver resolver, |
| 488 | Uri uri, String address, String body, String subject, |
| 489 | Long date, boolean read, boolean deliveryReport, long threadId) { |
| 490 | ContentValues values = new ContentValues(8); |
| 491 | Rlog.v(TAG,"Telephony addMessageToUri sub id: " + subId); |
| 492 | |
| 493 | values.put(SUBSCRIPTION_ID, subId); |
| 494 | values.put(ADDRESS, address); |
| 495 | if (date != null) { |
| 496 | values.put(DATE, date); |
| 497 | } |
| 498 | values.put(READ, read ? Integer.valueOf(1) : Integer.valueOf(0)); |
| 499 | values.put(SUBJECT, subject); |
| 500 | values.put(BODY, body); |
| 501 | if (deliveryReport) { |
| 502 | values.put(STATUS, STATUS_PENDING); |
| 503 | } |
| 504 | if (threadId != -1L) { |
| 505 | values.put(THREAD_ID, threadId); |
| 506 | } |
| 507 | return resolver.insert(uri, values); |
| 508 | } |
| 509 | |
| 510 | /** |
| 511 | * Move a message to the given folder. |
| 512 | * |
| 513 | * @param context the context to use |
| 514 | * @param uri the message to move |
| 515 | * @param folder the folder to move to |
| 516 | * @return true if the operation succeeded |
| 517 | * @hide |
| 518 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 519 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 520 | public static boolean moveMessageToFolder(Context context, |
| 521 | Uri uri, int folder, int error) { |
| 522 | if (uri == null) { |
| 523 | return false; |
| 524 | } |
| 525 | |
| 526 | boolean markAsUnread = false; |
| 527 | boolean markAsRead = false; |
| 528 | switch(folder) { |
| 529 | case MESSAGE_TYPE_INBOX: |
| 530 | case MESSAGE_TYPE_DRAFT: |
| 531 | break; |
| 532 | case MESSAGE_TYPE_OUTBOX: |
| 533 | case MESSAGE_TYPE_SENT: |
| 534 | markAsRead = true; |
| 535 | break; |
| 536 | case MESSAGE_TYPE_FAILED: |
| 537 | case MESSAGE_TYPE_QUEUED: |
| 538 | markAsUnread = true; |
| 539 | break; |
| 540 | default: |
| 541 | return false; |
| 542 | } |
| 543 | |
| 544 | ContentValues values = new ContentValues(3); |
| 545 | |
| 546 | values.put(TYPE, folder); |
| 547 | if (markAsUnread) { |
| 548 | values.put(READ, 0); |
| 549 | } else if (markAsRead) { |
| 550 | values.put(READ, 1); |
| 551 | } |
| 552 | values.put(ERROR_CODE, error); |
| 553 | |
| 554 | return 1 == SqliteWrapper.update(context, context.getContentResolver(), |
| 555 | uri, values, null, null); |
| 556 | } |
| 557 | |
| 558 | /** |
| 559 | * Returns true iff the folder (message type) identifies an |
| 560 | * outgoing message. |
| 561 | * @hide |
| 562 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 563 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 564 | public static boolean isOutgoingFolder(int messageType) { |
| 565 | return (messageType == MESSAGE_TYPE_FAILED) |
| 566 | || (messageType == MESSAGE_TYPE_OUTBOX) |
| 567 | || (messageType == MESSAGE_TYPE_SENT) |
| 568 | || (messageType == MESSAGE_TYPE_QUEUED); |
| 569 | } |
| 570 | |
| 571 | /** |
| 572 | * Contains all text-based SMS messages in the SMS app inbox. |
| 573 | */ |
| 574 | public static final class Inbox implements BaseColumns, TextBasedSmsColumns { |
| 575 | |
| 576 | /** |
| 577 | * Not instantiable. |
| 578 | * @hide |
| 579 | */ |
| 580 | private Inbox() { |
| 581 | } |
| 582 | |
| 583 | /** |
| 584 | * The {@code content://} style URL for this table. |
| 585 | */ |
| 586 | public static final Uri CONTENT_URI = Uri.parse("content://sms/inbox"); |
| 587 | |
| 588 | /** |
| 589 | * The default sort order for this table. |
| 590 | */ |
| 591 | public static final String DEFAULT_SORT_ORDER = "date DESC"; |
| 592 | |
| 593 | /** |
| 594 | * Add an SMS to the Draft box. |
| 595 | * |
| 596 | * @param resolver the content resolver to use |
| 597 | * @param address the address of the sender |
| 598 | * @param body the body of the message |
| 599 | * @param subject the pseudo-subject of the message |
| 600 | * @param date the timestamp for the message |
| 601 | * @param read true if the message has been read, false if not |
| 602 | * @return the URI for the new message |
| 603 | * @hide |
| 604 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 605 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 606 | public static Uri addMessage(ContentResolver resolver, |
| 607 | String address, String body, String subject, Long date, |
| 608 | boolean read) { |
| 609 | return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), |
| 610 | resolver, CONTENT_URI, address, body, subject, date, read, false); |
| 611 | } |
| 612 | |
| 613 | /** |
| 614 | * Add an SMS to the Draft box. |
| 615 | * |
| 616 | * @param resolver the content resolver to use |
| 617 | * @param address the address of the sender |
| 618 | * @param body the body of the message |
| 619 | * @param subject the psuedo-subject of the message |
| 620 | * @param date the timestamp for the message |
| 621 | * @param read true if the message has been read, false if not |
| 622 | * @param subId the subscription which the message belongs to |
| 623 | * @return the URI for the new message |
| 624 | * @hide |
| 625 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 626 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 627 | public static Uri addMessage(int subId, ContentResolver resolver, |
| 628 | String address, String body, String subject, Long date, boolean read) { |
| 629 | return addMessageToUri(subId, resolver, CONTENT_URI, address, body, |
| 630 | subject, date, read, false); |
| 631 | } |
| 632 | } |
| 633 | |
| 634 | /** |
| 635 | * Contains all sent text-based SMS messages in the SMS app. |
| 636 | */ |
| 637 | public static final class Sent implements BaseColumns, TextBasedSmsColumns { |
| 638 | |
| 639 | /** |
| 640 | * Not instantiable. |
| 641 | * @hide |
| 642 | */ |
| 643 | private Sent() { |
| 644 | } |
| 645 | |
| 646 | /** |
| 647 | * The {@code content://} style URL for this table. |
| 648 | */ |
| 649 | public static final Uri CONTENT_URI = Uri.parse("content://sms/sent"); |
| 650 | |
| 651 | /** |
| 652 | * The default sort order for this table. |
| 653 | */ |
| 654 | public static final String DEFAULT_SORT_ORDER = "date DESC"; |
| 655 | |
| 656 | /** |
| 657 | * Add an SMS to the Draft box. |
| 658 | * |
| 659 | * @param resolver the content resolver to use |
| 660 | * @param address the address of the sender |
| 661 | * @param body the body of the message |
| 662 | * @param subject the pseudo-subject of the message |
| 663 | * @param date the timestamp for the message |
| 664 | * @return the URI for the new message |
| 665 | * @hide |
| 666 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 667 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 668 | public static Uri addMessage(ContentResolver resolver, |
| 669 | String address, String body, String subject, Long date) { |
| 670 | return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), |
| 671 | resolver, CONTENT_URI, address, body, subject, date, true, false); |
| 672 | } |
| 673 | |
| 674 | /** |
| 675 | * Add an SMS to the Draft box. |
| 676 | * |
| 677 | * @param resolver the content resolver to use |
| 678 | * @param address the address of the sender |
| 679 | * @param body the body of the message |
| 680 | * @param subject the psuedo-subject of the message |
| 681 | * @param date the timestamp for the message |
| 682 | * @param subId the subscription which the message belongs to |
| 683 | * @return the URI for the new message |
| 684 | * @hide |
| 685 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 686 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 687 | public static Uri addMessage(int subId, ContentResolver resolver, |
| 688 | String address, String body, String subject, Long date) { |
| 689 | return addMessageToUri(subId, resolver, CONTENT_URI, address, body, |
| 690 | subject, date, true, false); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | /** |
| 695 | * Contains all sent text-based SMS messages in the SMS app. |
| 696 | */ |
| 697 | public static final class Draft implements BaseColumns, TextBasedSmsColumns { |
| 698 | |
| 699 | /** |
| 700 | * Not instantiable. |
| 701 | * @hide |
| 702 | */ |
| 703 | private Draft() { |
| 704 | } |
| 705 | |
| 706 | /** |
| 707 | * The {@code content://} style URL for this table. |
| 708 | */ |
| 709 | public static final Uri CONTENT_URI = Uri.parse("content://sms/draft"); |
| 710 | |
| 711 | /** |
| 712 | * @hide |
| 713 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 714 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 715 | public static Uri addMessage(ContentResolver resolver, |
| 716 | String address, String body, String subject, Long date) { |
| 717 | return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), |
| 718 | resolver, CONTENT_URI, address, body, subject, date, true, false); |
| 719 | } |
| 720 | |
| 721 | /** |
| 722 | * Add an SMS to the Draft box. |
| 723 | * |
| 724 | * @param resolver the content resolver to use |
| 725 | * @param address the address of the sender |
| 726 | * @param body the body of the message |
| 727 | * @param subject the psuedo-subject of the message |
| 728 | * @param date the timestamp for the message |
| 729 | * @param subId the subscription which the message belongs to |
| 730 | * @return the URI for the new message |
| 731 | * @hide |
| 732 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 733 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 734 | public static Uri addMessage(int subId, ContentResolver resolver, |
| 735 | String address, String body, String subject, Long date) { |
| 736 | return addMessageToUri(subId, resolver, CONTENT_URI, address, body, |
| 737 | subject, date, true, false); |
| 738 | } |
| 739 | |
| 740 | /** |
| 741 | * The default sort order for this table. |
| 742 | */ |
| 743 | public static final String DEFAULT_SORT_ORDER = "date DESC"; |
| 744 | } |
| 745 | |
| 746 | /** |
| 747 | * Contains all pending outgoing text-based SMS messages. |
| 748 | */ |
| 749 | public static final class Outbox implements BaseColumns, TextBasedSmsColumns { |
| 750 | |
| 751 | /** |
| 752 | * Not instantiable. |
| 753 | * @hide |
| 754 | */ |
| 755 | private Outbox() { |
| 756 | } |
| 757 | |
| 758 | /** |
| 759 | * The {@code content://} style URL for this table. |
| 760 | */ |
| 761 | public static final Uri CONTENT_URI = Uri.parse("content://sms/outbox"); |
| 762 | |
| 763 | /** |
| 764 | * The default sort order for this table. |
| 765 | */ |
| 766 | public static final String DEFAULT_SORT_ORDER = "date DESC"; |
| 767 | |
| 768 | /** |
| 769 | * Add an SMS to the outbox. |
| 770 | * |
| 771 | * @param resolver the content resolver to use |
| 772 | * @param address the address of the sender |
| 773 | * @param body the body of the message |
| 774 | * @param subject the pseudo-subject of the message |
| 775 | * @param date the timestamp for the message |
| 776 | * @param deliveryReport whether a delivery report was requested for the message |
| 777 | * @return the URI for the new message |
| 778 | * @hide |
| 779 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 780 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 781 | public static Uri addMessage(ContentResolver resolver, |
| 782 | String address, String body, String subject, Long date, |
| 783 | boolean deliveryReport, long threadId) { |
| 784 | return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), |
| 785 | resolver, CONTENT_URI, address, body, subject, date, |
| 786 | true, deliveryReport, threadId); |
| 787 | } |
| 788 | |
| 789 | /** |
| 790 | * Add an SMS to the Out box. |
| 791 | * |
| 792 | * @param resolver the content resolver to use |
| 793 | * @param address the address of the sender |
| 794 | * @param body the body of the message |
| 795 | * @param subject the psuedo-subject of the message |
| 796 | * @param date the timestamp for the message |
| 797 | * @param deliveryReport whether a delivery report was requested for the message |
| 798 | * @param subId the subscription which the message belongs to |
| 799 | * @return the URI for the new message |
| 800 | * @hide |
| 801 | */ |
| 802 | public static Uri addMessage(int subId, ContentResolver resolver, |
| 803 | String address, String body, String subject, Long date, |
| 804 | boolean deliveryReport, long threadId) { |
| 805 | return addMessageToUri(subId, resolver, CONTENT_URI, address, body, |
| 806 | subject, date, true, deliveryReport, threadId); |
| 807 | } |
| 808 | } |
| 809 | |
| 810 | /** |
| 811 | * Contains all sent text-based SMS messages in the SMS app. |
| 812 | */ |
| 813 | public static final class Conversations |
| 814 | implements BaseColumns, TextBasedSmsColumns { |
| 815 | |
| 816 | /** |
| 817 | * Not instantiable. |
| 818 | * @hide |
| 819 | */ |
| 820 | private Conversations() { |
| 821 | } |
| 822 | |
| 823 | /** |
| 824 | * The {@code content://} style URL for this table. |
| 825 | */ |
| 826 | public static final Uri CONTENT_URI = Uri.parse("content://sms/conversations"); |
| 827 | |
| 828 | /** |
| 829 | * The default sort order for this table. |
| 830 | */ |
| 831 | public static final String DEFAULT_SORT_ORDER = "date DESC"; |
| 832 | |
| 833 | /** |
| 834 | * The first 45 characters of the body of the message. |
| 835 | * <P>Type: TEXT</P> |
| 836 | */ |
| 837 | public static final String SNIPPET = "snippet"; |
| 838 | |
| 839 | /** |
| 840 | * The number of messages in the conversation. |
| 841 | * <P>Type: INTEGER</P> |
| 842 | */ |
| 843 | public static final String MESSAGE_COUNT = "msg_count"; |
| 844 | } |
| 845 | |
| 846 | /** |
| 847 | * Contains constants for SMS related Intents that are broadcast. |
| 848 | */ |
| 849 | public static final class Intents { |
| 850 | |
| 851 | /** |
| 852 | * Not instantiable. |
| 853 | * @hide |
| 854 | */ |
| 855 | private Intents() { |
| 856 | } |
| 857 | |
| 858 | /** |
| 859 | * Set by BroadcastReceiver to indicate that the message was handled |
| 860 | * successfully. |
| 861 | */ |
| 862 | public static final int RESULT_SMS_HANDLED = 1; |
| 863 | |
| 864 | /** |
| 865 | * Set by BroadcastReceiver to indicate a generic error while |
| 866 | * processing the message. |
| 867 | */ |
| 868 | public static final int RESULT_SMS_GENERIC_ERROR = 2; |
| 869 | |
| 870 | /** |
| 871 | * Set by BroadcastReceiver to indicate insufficient memory to store |
| 872 | * the message. |
| 873 | */ |
| 874 | public static final int RESULT_SMS_OUT_OF_MEMORY = 3; |
| 875 | |
| 876 | /** |
| 877 | * Set by BroadcastReceiver to indicate that the message, while |
| 878 | * possibly valid, is of a format or encoding that is not |
| 879 | * supported. |
| 880 | */ |
| 881 | public static final int RESULT_SMS_UNSUPPORTED = 4; |
| 882 | |
| 883 | /** |
| 884 | * Set by BroadcastReceiver to indicate a duplicate incoming message. |
| 885 | */ |
| 886 | public static final int RESULT_SMS_DUPLICATED = 5; |
| 887 | |
| 888 | /** |
| 889 | * Activity action: Ask the user to change the default |
| 890 | * SMS application. This will show a dialog that asks the |
| 891 | * user whether they want to replace the current default |
| 892 | * SMS application with the one specified in |
| 893 | * {@link #EXTRA_PACKAGE_NAME}. |
| 894 | */ |
| 895 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 896 | public static final String ACTION_CHANGE_DEFAULT = |
| 897 | "android.provider.Telephony.ACTION_CHANGE_DEFAULT"; |
| 898 | |
| 899 | /** |
| 900 | * The PackageName string passed in as an |
| 901 | * extra for {@link #ACTION_CHANGE_DEFAULT} |
| 902 | * |
| 903 | * @see #ACTION_CHANGE_DEFAULT |
| 904 | */ |
| 905 | public static final String EXTRA_PACKAGE_NAME = "package"; |
| 906 | |
| 907 | /** |
| 908 | * Broadcast Action: A new text-based SMS message has been received |
| 909 | * by the device. This intent will only be delivered to the default |
| 910 | * sms app. That app is responsible for writing the message and notifying |
| 911 | * the user. The intent will have the following extra values:</p> |
| 912 | * |
| 913 | * <ul> |
| 914 | * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs |
| 915 | * that make up the message.</li> |
| 916 | * <li><em>"format"</em> - A String describing the format of the PDUs. It can |
| 917 | * be either "3gpp" or "3gpp2".</li> |
| 918 | * <li><em>"subscription"</em> - An optional long value of the subscription id which |
| 919 | * received the message.</li> |
| 920 | * <li><em>"slot"</em> - An optional int value of the SIM slot containing the |
| 921 | * subscription.</li> |
| 922 | * <li><em>"phone"</em> - An optional int value of the phone id associated with the |
| 923 | * subscription.</li> |
| 924 | * <li><em>"errorCode"</em> - An optional int error code associated with receiving |
| 925 | * the message.</li> |
| 926 | * </ul> |
| 927 | * |
| 928 | * <p>The extra values can be extracted using |
| 929 | * {@link #getMessagesFromIntent(Intent)}.</p> |
| 930 | * |
| 931 | * <p>If a BroadcastReceiver encounters an error while processing |
| 932 | * this intent it should set the result code appropriately.</p> |
| 933 | * |
| 934 | * <p class="note"><strong>Note:</strong> |
| 935 | * The broadcast receiver that filters for this intent must declare |
| 936 | * {@link android.Manifest.permission#BROADCAST_SMS} as a required permission in |
| 937 | * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code |
| 938 | * <receiver>}</a> tag. |
| 939 | * |
| 940 | * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> |
| 941 | */ |
| 942 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 943 | public static final String SMS_DELIVER_ACTION = |
| 944 | "android.provider.Telephony.SMS_DELIVER"; |
| 945 | |
| 946 | /** |
| 947 | * Broadcast Action: A new text-based SMS message has been received |
| 948 | * by the device. This intent will be delivered to all registered |
| 949 | * receivers as a notification. These apps are not expected to write the |
| 950 | * message or notify the user. The intent will have the following extra |
| 951 | * values:</p> |
| 952 | * |
| 953 | * <ul> |
| 954 | * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs |
| 955 | * that make up the message.</li> |
| 956 | * </ul> |
| 957 | * |
| 958 | * <p>The extra values can be extracted using |
| 959 | * {@link #getMessagesFromIntent(Intent)}.</p> |
| 960 | * |
| 961 | * <p>If a BroadcastReceiver encounters an error while processing |
| 962 | * this intent it should set the result code appropriately.</p> |
| 963 | * |
| 964 | * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> |
| 965 | */ |
| 966 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 967 | public static final String SMS_RECEIVED_ACTION = |
| 968 | "android.provider.Telephony.SMS_RECEIVED"; |
| 969 | |
| 970 | /** |
| 971 | * Broadcast Action: A new data based SMS message has been received |
| 972 | * by the device. This intent will be delivered to all registered |
| 973 | * receivers as a notification. The intent will have the following extra |
| 974 | * values:</p> |
| 975 | * |
| 976 | * <ul> |
| 977 | * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs |
| 978 | * that make up the message.</li> |
| 979 | * </ul> |
| 980 | * |
| 981 | * <p>The extra values can be extracted using |
| 982 | * {@link #getMessagesFromIntent(Intent)}.</p> |
| 983 | * |
| 984 | * <p>If a BroadcastReceiver encounters an error while processing |
| 985 | * this intent it should set the result code appropriately.</p> |
| 986 | * |
| 987 | * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> |
| 988 | */ |
| 989 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 990 | public static final String DATA_SMS_RECEIVED_ACTION = |
| 991 | "android.intent.action.DATA_SMS_RECEIVED"; |
| 992 | |
| 993 | /** |
| 994 | * Broadcast Action: A new WAP PUSH message has been received by the |
| 995 | * device. This intent will only be delivered to the default |
| 996 | * sms app. That app is responsible for writing the message and notifying |
| 997 | * the user. The intent will have the following extra values:</p> |
| 998 | * |
| 999 | * <ul> |
| 1000 | * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li> |
| 1001 | * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li> |
| 1002 | * <li><em>"header"</em> - (byte[]) The header of the message</li> |
| 1003 | * <li><em>"data"</em> - (byte[]) The data payload of the message</li> |
| 1004 | * <li><em>"contentTypeParameters" </em> |
| 1005 | * -(HashMap<String,String>) Any parameters associated with the content type |
| 1006 | * (decoded from the WSP Content-Type header)</li> |
| 1007 | * <li><em>"subscription"</em> - An optional long value of the subscription id which |
| 1008 | * received the message.</li> |
| 1009 | * <li><em>"slot"</em> - An optional int value of the SIM slot containing the |
| 1010 | * subscription.</li> |
| 1011 | * <li><em>"phone"</em> - An optional int value of the phone id associated with the |
| 1012 | * subscription.</li> |
| 1013 | * </ul> |
| 1014 | * |
| 1015 | * <p>If a BroadcastReceiver encounters an error while processing |
| 1016 | * this intent it should set the result code appropriately.</p> |
| 1017 | * |
| 1018 | * <p>The contentTypeParameters extra value is map of content parameters keyed by |
| 1019 | * their names.</p> |
| 1020 | * |
| 1021 | * <p>If any unassigned well-known parameters are encountered, the key of the map will |
| 1022 | * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If |
| 1023 | * a parameter has No-Value the value in the map will be null.</p> |
| 1024 | * |
| 1025 | * <p>Requires {@link android.Manifest.permission#RECEIVE_MMS} or |
| 1026 | * {@link android.Manifest.permission#RECEIVE_WAP_PUSH} (depending on WAP PUSH type) to |
| 1027 | * receive.</p> |
| 1028 | * |
| 1029 | * <p class="note"><strong>Note:</strong> |
| 1030 | * The broadcast receiver that filters for this intent must declare |
| 1031 | * {@link android.Manifest.permission#BROADCAST_WAP_PUSH} as a required permission in |
| 1032 | * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code |
| 1033 | * <receiver>}</a> tag. |
| 1034 | */ |
| 1035 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1036 | public static final String WAP_PUSH_DELIVER_ACTION = |
| 1037 | "android.provider.Telephony.WAP_PUSH_DELIVER"; |
| 1038 | |
| 1039 | /** |
| 1040 | * Broadcast Action: A new WAP PUSH message has been received by the |
| 1041 | * device. This intent will be delivered to all registered |
| 1042 | * receivers as a notification. These apps are not expected to write the |
| 1043 | * message or notify the user. The intent will have the following extra |
| 1044 | * values:</p> |
| 1045 | * |
| 1046 | * <ul> |
| 1047 | * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li> |
| 1048 | * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li> |
| 1049 | * <li><em>"header"</em> - (byte[]) The header of the message</li> |
| 1050 | * <li><em>"data"</em> - (byte[]) The data payload of the message</li> |
| 1051 | * <li><em>"contentTypeParameters"</em> |
| 1052 | * - (HashMap<String,String>) Any parameters associated with the content type |
| 1053 | * (decoded from the WSP Content-Type header)</li> |
| 1054 | * </ul> |
| 1055 | * |
| 1056 | * <p>If a BroadcastReceiver encounters an error while processing |
| 1057 | * this intent it should set the result code appropriately.</p> |
| 1058 | * |
| 1059 | * <p>The contentTypeParameters extra value is map of content parameters keyed by |
| 1060 | * their names.</p> |
| 1061 | * |
| 1062 | * <p>If any unassigned well-known parameters are encountered, the key of the map will |
| 1063 | * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If |
| 1064 | * a parameter has No-Value the value in the map will be null.</p> |
| 1065 | * |
| 1066 | * <p>Requires {@link android.Manifest.permission#RECEIVE_MMS} or |
| 1067 | * {@link android.Manifest.permission#RECEIVE_WAP_PUSH} (depending on WAP PUSH type) to |
| 1068 | * receive.</p> |
| 1069 | */ |
| 1070 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1071 | public static final String WAP_PUSH_RECEIVED_ACTION = |
| 1072 | "android.provider.Telephony.WAP_PUSH_RECEIVED"; |
| 1073 | |
| 1074 | /** |
| 1075 | * Broadcast Action: A new Cell Broadcast message has been received |
| 1076 | * by the device. The intent will have the following extra |
| 1077 | * values:</p> |
| 1078 | * |
| 1079 | * <ul> |
| 1080 | * <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message |
| 1081 | * data. This is not an emergency alert, so ETWS and CMAS data will be null.</li> |
| 1082 | * </ul> |
| 1083 | * |
| 1084 | * <p>The extra values can be extracted using |
| 1085 | * {@link #getMessagesFromIntent(Intent)}.</p> |
| 1086 | * |
| 1087 | * <p>If a BroadcastReceiver encounters an error while processing |
| 1088 | * this intent it should set the result code appropriately.</p> |
| 1089 | * |
| 1090 | * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> |
| 1091 | */ |
| 1092 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1093 | public static final String SMS_CB_RECEIVED_ACTION = |
| 1094 | "android.provider.Telephony.SMS_CB_RECEIVED"; |
| 1095 | |
| 1096 | /** |
| 1097 | * Action: A SMS based carrier provision intent. Used to identify default |
| 1098 | * carrier provisioning app on the device. |
| 1099 | * @hide |
| 1100 | */ |
| 1101 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1102 | @TestApi |
| 1103 | public static final String SMS_CARRIER_PROVISION_ACTION = |
| 1104 | "android.provider.Telephony.SMS_CARRIER_PROVISION"; |
| 1105 | |
| 1106 | /** |
| 1107 | * Broadcast Action: A new Emergency Broadcast message has been received |
| 1108 | * by the device. The intent will have the following extra |
| 1109 | * values:</p> |
| 1110 | * |
| 1111 | * <ul> |
| 1112 | * <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message |
| 1113 | * data, including ETWS or CMAS warning notification info if present.</li> |
| 1114 | * </ul> |
| 1115 | * |
| 1116 | * <p>The extra values can be extracted using |
| 1117 | * {@link #getMessagesFromIntent(Intent)}.</p> |
| 1118 | * |
| 1119 | * <p>If a BroadcastReceiver encounters an error while processing |
| 1120 | * this intent it should set the result code appropriately.</p> |
| 1121 | * |
| 1122 | * <p>Requires {@link android.Manifest.permission#RECEIVE_EMERGENCY_BROADCAST} to |
| 1123 | * receive.</p> |
| 1124 | * @removed |
| 1125 | */ |
| 1126 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1127 | public static final String SMS_EMERGENCY_CB_RECEIVED_ACTION = |
| 1128 | "android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED"; |
| 1129 | |
| 1130 | /** |
| 1131 | * Broadcast Action: A new CDMA SMS has been received containing Service Category |
| 1132 | * Program Data (updates the list of enabled broadcast channels). The intent will |
| 1133 | * have the following extra values:</p> |
| 1134 | * |
| 1135 | * <ul> |
| 1136 | * <li><em>"operations"</em> - An array of CdmaSmsCbProgramData objects containing |
| 1137 | * the service category operations (add/delete/clear) to perform.</li> |
| 1138 | * </ul> |
| 1139 | * |
| 1140 | * <p>The extra values can be extracted using |
| 1141 | * {@link #getMessagesFromIntent(Intent)}.</p> |
| 1142 | * |
| 1143 | * <p>If a BroadcastReceiver encounters an error while processing |
| 1144 | * this intent it should set the result code appropriately.</p> |
| 1145 | * |
| 1146 | * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> |
| 1147 | */ |
| 1148 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1149 | public static final String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION = |
| 1150 | "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED"; |
| 1151 | |
| 1152 | /** |
| 1153 | * Broadcast Action: The SIM storage for SMS messages is full. If |
| 1154 | * space is not freed, messages targeted for the SIM (class 2) may |
| 1155 | * not be saved. |
| 1156 | * |
| 1157 | * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> |
| 1158 | */ |
| 1159 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1160 | public static final String SIM_FULL_ACTION = |
| 1161 | "android.provider.Telephony.SIM_FULL"; |
| 1162 | |
| 1163 | /** |
| 1164 | * Broadcast Action: An incoming SMS has been rejected by the |
| 1165 | * telephony framework. This intent is sent in lieu of any |
| 1166 | * of the RECEIVED_ACTION intents. The intent will have the |
| 1167 | * following extra value:</p> |
| 1168 | * |
| 1169 | * <ul> |
| 1170 | * <li><em>"result"</em> - An int result code, e.g. {@link #RESULT_SMS_OUT_OF_MEMORY} |
| 1171 | * indicating the error returned to the network.</li> |
| 1172 | * </ul> |
| 1173 | * |
| 1174 | * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> |
| 1175 | */ |
| 1176 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1177 | public static final String SMS_REJECTED_ACTION = |
| 1178 | "android.provider.Telephony.SMS_REJECTED"; |
| 1179 | |
| 1180 | /** |
| 1181 | * Broadcast Action: An incoming MMS has been downloaded. The intent is sent to all |
| 1182 | * users, except for secondary users where SMS has been disabled and to managed |
| 1183 | * profiles. |
| 1184 | * @hide |
| 1185 | */ |
| 1186 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1187 | public static final String MMS_DOWNLOADED_ACTION = |
| 1188 | "android.provider.Telephony.MMS_DOWNLOADED"; |
| 1189 | |
| 1190 | /** |
Cassie | 5b97cf1 | 2018-02-22 09:58:33 -0800 | [diff] [blame] | 1191 | * Broadcast Action: A debug code has been entered in the dialer. This intent is |
| 1192 | * broadcast by the system and OEM telephony apps may need to receive these broadcasts. |
| 1193 | * These "secret codes" are used to activate developer menus by dialing certain codes. |
Alan Stokes | a9b5b2a | 2019-02-28 16:45:47 +0000 | [diff] [blame] | 1194 | * And they are of the form {@code *#*#<code>#*#*}. The intent will have the data |
| 1195 | * URI: {@code android_secret_code://<code>}. It is possible that a manifest |
Cassie | 5b97cf1 | 2018-02-22 09:58:33 -0800 | [diff] [blame] | 1196 | * receiver would be woken up even if it is not currently running. |
| 1197 | * |
| 1198 | * <p>Requires {@code android.Manifest.permission#CONTROL_INCALL_EXPERIENCE} to |
| 1199 | * send and receive.</p> |
Cassie | 6d0a571 | 2018-08-21 13:38:39 -0700 | [diff] [blame] | 1200 | * @deprecated it is no longer supported, use {@link |
| 1201 | * TelephonyManager#ACTION_SECRET_CODE} instead |
Cassie | 866f494 | 2018-01-19 17:23:36 -0800 | [diff] [blame] | 1202 | */ |
Cassie | 6d0a571 | 2018-08-21 13:38:39 -0700 | [diff] [blame] | 1203 | @Deprecated |
Cassie | 866f494 | 2018-01-19 17:23:36 -0800 | [diff] [blame] | 1204 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1205 | public static final String SECRET_CODE_ACTION = |
| 1206 | "android.provider.Telephony.SECRET_CODE"; |
| 1207 | |
| 1208 | /** |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 1209 | * Broadcast action: When the default SMS package changes, |
| 1210 | * the previous default SMS package and the new default SMS |
| 1211 | * package are sent this broadcast to notify them of the change. |
| 1212 | * A boolean is specified in {@link #EXTRA_IS_DEFAULT_SMS_APP} to |
| 1213 | * indicate whether the package is the new default SMS package. |
| 1214 | */ |
| 1215 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1216 | public static final String ACTION_DEFAULT_SMS_PACKAGE_CHANGED = |
| 1217 | "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED"; |
| 1218 | |
| 1219 | /** |
| 1220 | * The IsDefaultSmsApp boolean passed as an |
| 1221 | * extra for {@link #ACTION_DEFAULT_SMS_PACKAGE_CHANGED} to indicate whether the |
| 1222 | * SMS app is becoming the default SMS app or is no longer the default. |
| 1223 | * |
| 1224 | * @see #ACTION_DEFAULT_SMS_PACKAGE_CHANGED |
| 1225 | */ |
| 1226 | public static final String EXTRA_IS_DEFAULT_SMS_APP = |
| 1227 | "android.provider.extra.IS_DEFAULT_SMS_APP"; |
| 1228 | |
| 1229 | /** |
| 1230 | * Broadcast action: When a change is made to the SmsProvider or |
| 1231 | * MmsProvider by a process other than the default SMS application, |
| 1232 | * this intent is broadcast to the default SMS application so it can |
| 1233 | * re-sync or update the change. The uri that was used to call the provider |
| 1234 | * can be retrieved from the intent with getData(). The actual affected uris |
| 1235 | * (which would depend on the selection specified) are not included. |
| 1236 | */ |
| 1237 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1238 | public static final String ACTION_EXTERNAL_PROVIDER_CHANGE = |
| 1239 | "android.provider.action.EXTERNAL_PROVIDER_CHANGE"; |
| 1240 | |
| 1241 | /** |
Makoto Onuki | a042aaa | 2018-09-18 16:14:12 -0700 | [diff] [blame] | 1242 | * Same as {@link #ACTION_DEFAULT_SMS_PACKAGE_CHANGED} but it's implicit (e.g. sent to |
| 1243 | * all apps) and requires |
| 1244 | * {@link android.Manifest.permission#MONITOR_DEFAULT_SMS_PACKAGE} to receive. |
| 1245 | * |
| 1246 | * @hide |
| 1247 | */ |
| 1248 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1249 | public static final String ACTION_DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL = |
| 1250 | "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL"; |
| 1251 | |
| 1252 | /** |
Amit Mahajan | 8c1c45a | 2018-10-22 10:43:34 -0700 | [diff] [blame] | 1253 | * Broadcast action: When SMS-MMS db is being created. If file-based encryption is |
| 1254 | * supported, this broadcast indicates creation of the db in credential-encrypted |
| 1255 | * storage. A boolean is specified in {@link #EXTRA_IS_INITIAL_CREATE} to indicate if |
| 1256 | * this is the initial create of the db. Requires |
| 1257 | * {@link android.Manifest.permission#READ_SMS} to receive. |
| 1258 | * |
| 1259 | * @see #EXTRA_IS_INITIAL_CREATE |
| 1260 | * |
| 1261 | * @hide |
| 1262 | */ |
| 1263 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1264 | public static final String ACTION_SMS_MMS_DB_CREATED = |
| 1265 | "android.provider.action.SMS_MMS_DB_CREATED"; |
| 1266 | |
| 1267 | /** |
| 1268 | * Boolean flag passed as an extra with {@link #ACTION_SMS_MMS_DB_CREATED} to indicate |
| 1269 | * whether the DB creation is the initial creation on the device, that is it is after a |
| 1270 | * factory-data reset or a new device. Any subsequent creations of the DB (which |
| 1271 | * happens only in error scenarios) will have this flag set to false. |
| 1272 | * |
| 1273 | * @see #ACTION_SMS_MMS_DB_CREATED |
| 1274 | * |
| 1275 | * @hide |
| 1276 | */ |
| 1277 | public static final String EXTRA_IS_INITIAL_CREATE = |
| 1278 | "android.provider.extra.IS_INITIAL_CREATE"; |
Jayachandran C | 349b9ba | 2018-10-30 15:09:06 -0700 | [diff] [blame] | 1279 | |
| 1280 | /** |
| 1281 | * Broadcast intent action indicating that the telephony provider SMS MMS database is |
| 1282 | * corrupted. A boolean is specified in {@link #EXTRA_IS_CORRUPTED} to indicate if the |
| 1283 | * database is corrupted. Requires the |
| 1284 | * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE permission. |
| 1285 | * |
| 1286 | * @hide |
| 1287 | */ |
| 1288 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1289 | @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) |
| 1290 | public static final String ACTION_SMS_MMS_DB_LOST = |
| 1291 | "android.provider.action.SMS_MMS_DB_LOST"; |
| 1292 | |
| 1293 | /** |
| 1294 | * Boolean flag passed as an extra with {@link #ACTION_SMS_MMS_DB_LOST} to indicate |
| 1295 | * whether the DB got corrupted or not. |
| 1296 | * |
| 1297 | * @see #ACTION_SMS_MMS_DB_LOST |
| 1298 | * |
| 1299 | * @hide |
| 1300 | */ |
| 1301 | public static final String EXTRA_IS_CORRUPTED = |
| 1302 | "android.provider.extra.IS_CORRUPTED"; |
| 1303 | |
Amit Mahajan | 8c1c45a | 2018-10-22 10:43:34 -0700 | [diff] [blame] | 1304 | /** |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 1305 | * Read the PDUs out of an {@link #SMS_RECEIVED_ACTION} or a |
| 1306 | * {@link #DATA_SMS_RECEIVED_ACTION} intent. |
| 1307 | * |
| 1308 | * @param intent the intent to read from |
| 1309 | * @return an array of SmsMessages for the PDUs |
| 1310 | */ |
| 1311 | public static SmsMessage[] getMessagesFromIntent(Intent intent) { |
| 1312 | Object[] messages; |
| 1313 | try { |
| 1314 | messages = (Object[]) intent.getSerializableExtra("pdus"); |
| 1315 | } |
| 1316 | catch (ClassCastException e) { |
| 1317 | Rlog.e(TAG, "getMessagesFromIntent: " + e); |
| 1318 | return null; |
| 1319 | } |
| 1320 | |
| 1321 | if (messages == null) { |
| 1322 | Rlog.e(TAG, "pdus does not exist in the intent"); |
| 1323 | return null; |
| 1324 | } |
| 1325 | |
| 1326 | String format = intent.getStringExtra("format"); |
| 1327 | int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, |
| 1328 | SubscriptionManager.getDefaultSmsSubscriptionId()); |
| 1329 | |
| 1330 | Rlog.v(TAG, " getMessagesFromIntent sub_id : " + subId); |
| 1331 | |
| 1332 | int pduCount = messages.length; |
| 1333 | SmsMessage[] msgs = new SmsMessage[pduCount]; |
| 1334 | |
| 1335 | for (int i = 0; i < pduCount; i++) { |
| 1336 | byte[] pdu = (byte[]) messages[i]; |
| 1337 | msgs[i] = SmsMessage.createFromPdu(pdu, format); |
| 1338 | if (msgs[i] != null) msgs[i].setSubId(subId); |
| 1339 | } |
| 1340 | return msgs; |
| 1341 | } |
| 1342 | } |
| 1343 | } |
| 1344 | |
| 1345 | /** |
pkanwar | 16b8a0d | 2017-06-07 10:59:41 -0700 | [diff] [blame] | 1346 | * Base column for the table that contain Carrier Public key. |
| 1347 | * @hide |
| 1348 | */ |
| 1349 | public interface CarrierColumns extends BaseColumns { |
| 1350 | |
| 1351 | public static final String MCC = "mcc"; |
| 1352 | public static final String MNC = "mnc"; |
| 1353 | public static final String KEY_TYPE = "key_type"; |
| 1354 | public static final String MVNO_TYPE = "mvno_type"; |
| 1355 | public static final String MVNO_MATCH_DATA = "mvno_match_data"; |
| 1356 | public static final String PUBLIC_KEY = "public_key"; |
| 1357 | public static final String KEY_IDENTIFIER = "key_identifier"; |
| 1358 | public static final String EXPIRATION_TIME = "expiration_time"; |
| 1359 | public static final String LAST_MODIFIED = "last_modified"; |
| 1360 | |
| 1361 | /** |
| 1362 | * The {@code content://} style URL for this table. |
| 1363 | * @hide |
| 1364 | */ |
| 1365 | public static final Uri CONTENT_URI = Uri.parse("content://carrier_information/carrier"); |
| 1366 | } |
| 1367 | |
| 1368 | /** |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 1369 | * Base columns for tables that contain MMSs. |
| 1370 | */ |
| 1371 | public interface BaseMmsColumns extends BaseColumns { |
| 1372 | |
| 1373 | /** Message box: all messages. */ |
| 1374 | public static final int MESSAGE_BOX_ALL = 0; |
| 1375 | /** Message box: inbox. */ |
| 1376 | public static final int MESSAGE_BOX_INBOX = 1; |
| 1377 | /** Message box: sent messages. */ |
| 1378 | public static final int MESSAGE_BOX_SENT = 2; |
| 1379 | /** Message box: drafts. */ |
| 1380 | public static final int MESSAGE_BOX_DRAFTS = 3; |
| 1381 | /** Message box: outbox. */ |
| 1382 | public static final int MESSAGE_BOX_OUTBOX = 4; |
| 1383 | /** Message box: failed. */ |
| 1384 | public static final int MESSAGE_BOX_FAILED = 5; |
| 1385 | |
| 1386 | /** |
| 1387 | * The thread ID of the message. |
| 1388 | * <P>Type: INTEGER (long)</P> |
| 1389 | */ |
| 1390 | public static final String THREAD_ID = "thread_id"; |
| 1391 | |
| 1392 | /** |
| 1393 | * The date the message was received. |
| 1394 | * <P>Type: INTEGER (long)</P> |
| 1395 | */ |
| 1396 | public static final String DATE = "date"; |
| 1397 | |
| 1398 | /** |
| 1399 | * The date the message was sent. |
| 1400 | * <P>Type: INTEGER (long)</P> |
| 1401 | */ |
| 1402 | public static final String DATE_SENT = "date_sent"; |
| 1403 | |
| 1404 | /** |
| 1405 | * The box which the message belongs to, e.g. {@link #MESSAGE_BOX_INBOX}. |
| 1406 | * <P>Type: INTEGER</P> |
| 1407 | */ |
| 1408 | public static final String MESSAGE_BOX = "msg_box"; |
| 1409 | |
| 1410 | /** |
| 1411 | * Has the message been read? |
| 1412 | * <P>Type: INTEGER (boolean)</P> |
| 1413 | */ |
| 1414 | public static final String READ = "read"; |
| 1415 | |
| 1416 | /** |
| 1417 | * Has the message been seen by the user? The "seen" flag determines |
| 1418 | * whether we need to show a new message notification. |
| 1419 | * <P>Type: INTEGER (boolean)</P> |
| 1420 | */ |
| 1421 | public static final String SEEN = "seen"; |
| 1422 | |
| 1423 | /** |
| 1424 | * Does the message have only a text part (can also have a subject) with |
| 1425 | * no picture, slideshow, sound, etc. parts? |
| 1426 | * <P>Type: INTEGER (boolean)</P> |
| 1427 | */ |
| 1428 | public static final String TEXT_ONLY = "text_only"; |
| 1429 | |
| 1430 | /** |
| 1431 | * The {@code Message-ID} of the message. |
| 1432 | * <P>Type: TEXT</P> |
| 1433 | */ |
| 1434 | public static final String MESSAGE_ID = "m_id"; |
| 1435 | |
| 1436 | /** |
| 1437 | * The subject of the message, if present. |
| 1438 | * <P>Type: TEXT</P> |
| 1439 | */ |
| 1440 | public static final String SUBJECT = "sub"; |
| 1441 | |
| 1442 | /** |
| 1443 | * The character set of the subject, if present. |
| 1444 | * <P>Type: INTEGER</P> |
| 1445 | */ |
| 1446 | public static final String SUBJECT_CHARSET = "sub_cs"; |
| 1447 | |
| 1448 | /** |
| 1449 | * The {@code Content-Type} of the message. |
| 1450 | * <P>Type: TEXT</P> |
| 1451 | */ |
| 1452 | public static final String CONTENT_TYPE = "ct_t"; |
| 1453 | |
| 1454 | /** |
| 1455 | * The {@code Content-Location} of the message. |
| 1456 | * <P>Type: TEXT</P> |
| 1457 | */ |
| 1458 | public static final String CONTENT_LOCATION = "ct_l"; |
| 1459 | |
| 1460 | /** |
| 1461 | * The expiry time of the message. |
| 1462 | * <P>Type: INTEGER (long)</P> |
| 1463 | */ |
| 1464 | public static final String EXPIRY = "exp"; |
| 1465 | |
| 1466 | /** |
| 1467 | * The class of the message. |
| 1468 | * <P>Type: TEXT</P> |
| 1469 | */ |
| 1470 | public static final String MESSAGE_CLASS = "m_cls"; |
| 1471 | |
| 1472 | /** |
| 1473 | * The type of the message defined by MMS spec. |
| 1474 | * <P>Type: INTEGER</P> |
| 1475 | */ |
| 1476 | public static final String MESSAGE_TYPE = "m_type"; |
| 1477 | |
| 1478 | /** |
| 1479 | * The version of the specification that this message conforms to. |
| 1480 | * <P>Type: INTEGER</P> |
| 1481 | */ |
| 1482 | public static final String MMS_VERSION = "v"; |
| 1483 | |
| 1484 | /** |
| 1485 | * The size of the message. |
| 1486 | * <P>Type: INTEGER</P> |
| 1487 | */ |
| 1488 | public static final String MESSAGE_SIZE = "m_size"; |
| 1489 | |
| 1490 | /** |
| 1491 | * The priority of the message. |
| 1492 | * <P>Type: INTEGER</P> |
| 1493 | */ |
| 1494 | public static final String PRIORITY = "pri"; |
| 1495 | |
| 1496 | /** |
| 1497 | * The {@code read-report} of the message. |
| 1498 | * <P>Type: INTEGER (boolean)</P> |
| 1499 | */ |
| 1500 | public static final String READ_REPORT = "rr"; |
| 1501 | |
| 1502 | /** |
| 1503 | * Is read report allowed? |
| 1504 | * <P>Type: INTEGER (boolean)</P> |
| 1505 | */ |
| 1506 | public static final String REPORT_ALLOWED = "rpt_a"; |
| 1507 | |
| 1508 | /** |
| 1509 | * The {@code response-status} of the message. |
| 1510 | * <P>Type: INTEGER</P> |
| 1511 | */ |
| 1512 | public static final String RESPONSE_STATUS = "resp_st"; |
| 1513 | |
| 1514 | /** |
| 1515 | * The {@code status} of the message. |
| 1516 | * <P>Type: INTEGER</P> |
| 1517 | */ |
| 1518 | public static final String STATUS = "st"; |
| 1519 | |
| 1520 | /** |
| 1521 | * The {@code transaction-id} of the message. |
| 1522 | * <P>Type: TEXT</P> |
| 1523 | */ |
| 1524 | public static final String TRANSACTION_ID = "tr_id"; |
| 1525 | |
| 1526 | /** |
| 1527 | * The {@code retrieve-status} of the message. |
| 1528 | * <P>Type: INTEGER</P> |
| 1529 | */ |
| 1530 | public static final String RETRIEVE_STATUS = "retr_st"; |
| 1531 | |
| 1532 | /** |
| 1533 | * The {@code retrieve-text} of the message. |
| 1534 | * <P>Type: TEXT</P> |
| 1535 | */ |
| 1536 | public static final String RETRIEVE_TEXT = "retr_txt"; |
| 1537 | |
| 1538 | /** |
| 1539 | * The character set of the retrieve-text. |
| 1540 | * <P>Type: INTEGER</P> |
| 1541 | */ |
| 1542 | public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs"; |
| 1543 | |
| 1544 | /** |
| 1545 | * The {@code read-status} of the message. |
| 1546 | * <P>Type: INTEGER</P> |
| 1547 | */ |
| 1548 | public static final String READ_STATUS = "read_status"; |
| 1549 | |
| 1550 | /** |
| 1551 | * The {@code content-class} of the message. |
| 1552 | * <P>Type: INTEGER</P> |
| 1553 | */ |
| 1554 | public static final String CONTENT_CLASS = "ct_cls"; |
| 1555 | |
| 1556 | /** |
| 1557 | * The {@code delivery-report} of the message. |
| 1558 | * <P>Type: INTEGER</P> |
| 1559 | */ |
| 1560 | public static final String DELIVERY_REPORT = "d_rpt"; |
| 1561 | |
| 1562 | /** |
| 1563 | * The {@code delivery-time-token} of the message. |
| 1564 | * <P>Type: INTEGER</P> |
| 1565 | * @deprecated this column is no longer supported. |
| 1566 | * @hide |
| 1567 | */ |
| 1568 | @Deprecated |
| 1569 | public static final String DELIVERY_TIME_TOKEN = "d_tm_tok"; |
| 1570 | |
| 1571 | /** |
| 1572 | * The {@code delivery-time} of the message. |
| 1573 | * <P>Type: INTEGER</P> |
| 1574 | */ |
| 1575 | public static final String DELIVERY_TIME = "d_tm"; |
| 1576 | |
| 1577 | /** |
| 1578 | * The {@code response-text} of the message. |
| 1579 | * <P>Type: TEXT</P> |
| 1580 | */ |
| 1581 | public static final String RESPONSE_TEXT = "resp_txt"; |
| 1582 | |
| 1583 | /** |
| 1584 | * The {@code sender-visibility} of the message. |
| 1585 | * <P>Type: TEXT</P> |
| 1586 | * @deprecated this column is no longer supported. |
| 1587 | * @hide |
| 1588 | */ |
| 1589 | @Deprecated |
| 1590 | public static final String SENDER_VISIBILITY = "s_vis"; |
| 1591 | |
| 1592 | /** |
| 1593 | * The {@code reply-charging} of the message. |
| 1594 | * <P>Type: INTEGER</P> |
| 1595 | * @deprecated this column is no longer supported. |
| 1596 | * @hide |
| 1597 | */ |
| 1598 | @Deprecated |
| 1599 | public static final String REPLY_CHARGING = "r_chg"; |
| 1600 | |
| 1601 | /** |
| 1602 | * The {@code reply-charging-deadline-token} of the message. |
| 1603 | * <P>Type: INTEGER</P> |
| 1604 | * @deprecated this column is no longer supported. |
| 1605 | * @hide |
| 1606 | */ |
| 1607 | @Deprecated |
| 1608 | public static final String REPLY_CHARGING_DEADLINE_TOKEN = "r_chg_dl_tok"; |
| 1609 | |
| 1610 | /** |
| 1611 | * The {@code reply-charging-deadline} of the message. |
| 1612 | * <P>Type: INTEGER</P> |
| 1613 | * @deprecated this column is no longer supported. |
| 1614 | * @hide |
| 1615 | */ |
| 1616 | @Deprecated |
| 1617 | public static final String REPLY_CHARGING_DEADLINE = "r_chg_dl"; |
| 1618 | |
| 1619 | /** |
| 1620 | * The {@code reply-charging-id} of the message. |
| 1621 | * <P>Type: TEXT</P> |
| 1622 | * @deprecated this column is no longer supported. |
| 1623 | * @hide |
| 1624 | */ |
| 1625 | @Deprecated |
| 1626 | public static final String REPLY_CHARGING_ID = "r_chg_id"; |
| 1627 | |
| 1628 | /** |
| 1629 | * The {@code reply-charging-size} of the message. |
| 1630 | * <P>Type: INTEGER</P> |
| 1631 | * @deprecated this column is no longer supported. |
| 1632 | * @hide |
| 1633 | */ |
| 1634 | @Deprecated |
| 1635 | public static final String REPLY_CHARGING_SIZE = "r_chg_sz"; |
| 1636 | |
| 1637 | /** |
| 1638 | * The {@code previously-sent-by} of the message. |
| 1639 | * <P>Type: TEXT</P> |
| 1640 | * @deprecated this column is no longer supported. |
| 1641 | * @hide |
| 1642 | */ |
| 1643 | @Deprecated |
| 1644 | public static final String PREVIOUSLY_SENT_BY = "p_s_by"; |
| 1645 | |
| 1646 | /** |
| 1647 | * The {@code previously-sent-date} of the message. |
| 1648 | * <P>Type: INTEGER</P> |
| 1649 | * @deprecated this column is no longer supported. |
| 1650 | * @hide |
| 1651 | */ |
| 1652 | @Deprecated |
| 1653 | public static final String PREVIOUSLY_SENT_DATE = "p_s_d"; |
| 1654 | |
| 1655 | /** |
| 1656 | * The {@code store} of the message. |
| 1657 | * <P>Type: TEXT</P> |
| 1658 | * @deprecated this column is no longer supported. |
| 1659 | * @hide |
| 1660 | */ |
| 1661 | @Deprecated |
| 1662 | public static final String STORE = "store"; |
| 1663 | |
| 1664 | /** |
| 1665 | * The {@code mm-state} of the message. |
| 1666 | * <P>Type: INTEGER</P> |
| 1667 | * @deprecated this column is no longer supported. |
| 1668 | * @hide |
| 1669 | */ |
| 1670 | @Deprecated |
| 1671 | public static final String MM_STATE = "mm_st"; |
| 1672 | |
| 1673 | /** |
| 1674 | * The {@code mm-flags-token} of the message. |
| 1675 | * <P>Type: INTEGER</P> |
| 1676 | * @deprecated this column is no longer supported. |
| 1677 | * @hide |
| 1678 | */ |
| 1679 | @Deprecated |
| 1680 | public static final String MM_FLAGS_TOKEN = "mm_flg_tok"; |
| 1681 | |
| 1682 | /** |
| 1683 | * The {@code mm-flags} of the message. |
| 1684 | * <P>Type: TEXT</P> |
| 1685 | * @deprecated this column is no longer supported. |
| 1686 | * @hide |
| 1687 | */ |
| 1688 | @Deprecated |
| 1689 | public static final String MM_FLAGS = "mm_flg"; |
| 1690 | |
| 1691 | /** |
| 1692 | * The {@code store-status} of the message. |
| 1693 | * <P>Type: TEXT</P> |
| 1694 | * @deprecated this column is no longer supported. |
| 1695 | * @hide |
| 1696 | */ |
| 1697 | @Deprecated |
| 1698 | public static final String STORE_STATUS = "store_st"; |
| 1699 | |
| 1700 | /** |
| 1701 | * The {@code store-status-text} of the message. |
| 1702 | * <P>Type: TEXT</P> |
| 1703 | * @deprecated this column is no longer supported. |
| 1704 | * @hide |
| 1705 | */ |
| 1706 | @Deprecated |
| 1707 | public static final String STORE_STATUS_TEXT = "store_st_txt"; |
| 1708 | |
| 1709 | /** |
| 1710 | * The {@code stored} of the message. |
| 1711 | * <P>Type: TEXT</P> |
| 1712 | * @deprecated this column is no longer supported. |
| 1713 | * @hide |
| 1714 | */ |
| 1715 | @Deprecated |
| 1716 | public static final String STORED = "stored"; |
| 1717 | |
| 1718 | /** |
| 1719 | * The {@code totals} of the message. |
| 1720 | * <P>Type: TEXT</P> |
| 1721 | * @deprecated this column is no longer supported. |
| 1722 | * @hide |
| 1723 | */ |
| 1724 | @Deprecated |
| 1725 | public static final String TOTALS = "totals"; |
| 1726 | |
| 1727 | /** |
| 1728 | * The {@code mbox-totals} of the message. |
| 1729 | * <P>Type: TEXT</P> |
| 1730 | * @deprecated this column is no longer supported. |
| 1731 | * @hide |
| 1732 | */ |
| 1733 | @Deprecated |
| 1734 | public static final String MBOX_TOTALS = "mb_t"; |
| 1735 | |
| 1736 | /** |
| 1737 | * The {@code mbox-totals-token} of the message. |
| 1738 | * <P>Type: INTEGER</P> |
| 1739 | * @deprecated this column is no longer supported. |
| 1740 | * @hide |
| 1741 | */ |
| 1742 | @Deprecated |
| 1743 | public static final String MBOX_TOTALS_TOKEN = "mb_t_tok"; |
| 1744 | |
| 1745 | /** |
| 1746 | * The {@code quotas} of the message. |
| 1747 | * <P>Type: TEXT</P> |
| 1748 | * @deprecated this column is no longer supported. |
| 1749 | * @hide |
| 1750 | */ |
| 1751 | @Deprecated |
| 1752 | public static final String QUOTAS = "qt"; |
| 1753 | |
| 1754 | /** |
| 1755 | * The {@code mbox-quotas} of the message. |
| 1756 | * <P>Type: TEXT</P> |
| 1757 | * @deprecated this column is no longer supported. |
| 1758 | * @hide |
| 1759 | */ |
| 1760 | @Deprecated |
| 1761 | public static final String MBOX_QUOTAS = "mb_qt"; |
| 1762 | |
| 1763 | /** |
| 1764 | * The {@code mbox-quotas-token} of the message. |
| 1765 | * <P>Type: INTEGER</P> |
| 1766 | * @deprecated this column is no longer supported. |
| 1767 | * @hide |
| 1768 | */ |
| 1769 | @Deprecated |
| 1770 | public static final String MBOX_QUOTAS_TOKEN = "mb_qt_tok"; |
| 1771 | |
| 1772 | /** |
| 1773 | * The {@code message-count} of the message. |
| 1774 | * <P>Type: INTEGER</P> |
| 1775 | * @deprecated this column is no longer supported. |
| 1776 | * @hide |
| 1777 | */ |
| 1778 | @Deprecated |
| 1779 | public static final String MESSAGE_COUNT = "m_cnt"; |
| 1780 | |
| 1781 | /** |
| 1782 | * The {@code start} of the message. |
| 1783 | * <P>Type: INTEGER</P> |
| 1784 | * @deprecated this column is no longer supported. |
| 1785 | * @hide |
| 1786 | */ |
| 1787 | @Deprecated |
| 1788 | public static final String START = "start"; |
| 1789 | |
| 1790 | /** |
| 1791 | * The {@code distribution-indicator} of the message. |
| 1792 | * <P>Type: TEXT</P> |
| 1793 | * @deprecated this column is no longer supported. |
| 1794 | * @hide |
| 1795 | */ |
| 1796 | @Deprecated |
| 1797 | public static final String DISTRIBUTION_INDICATOR = "d_ind"; |
| 1798 | |
| 1799 | /** |
| 1800 | * The {@code element-descriptor} of the message. |
| 1801 | * <P>Type: TEXT</P> |
| 1802 | * @deprecated this column is no longer supported. |
| 1803 | * @hide |
| 1804 | */ |
| 1805 | @Deprecated |
| 1806 | public static final String ELEMENT_DESCRIPTOR = "e_des"; |
| 1807 | |
| 1808 | /** |
| 1809 | * The {@code limit} of the message. |
| 1810 | * <P>Type: INTEGER</P> |
| 1811 | * @deprecated this column is no longer supported. |
| 1812 | * @hide |
| 1813 | */ |
| 1814 | @Deprecated |
| 1815 | public static final String LIMIT = "limit"; |
| 1816 | |
| 1817 | /** |
| 1818 | * The {@code recommended-retrieval-mode} of the message. |
| 1819 | * <P>Type: INTEGER</P> |
| 1820 | * @deprecated this column is no longer supported. |
| 1821 | * @hide |
| 1822 | */ |
| 1823 | @Deprecated |
| 1824 | public static final String RECOMMENDED_RETRIEVAL_MODE = "r_r_mod"; |
| 1825 | |
| 1826 | /** |
| 1827 | * The {@code recommended-retrieval-mode-text} of the message. |
| 1828 | * <P>Type: TEXT</P> |
| 1829 | * @deprecated this column is no longer supported. |
| 1830 | * @hide |
| 1831 | */ |
| 1832 | @Deprecated |
| 1833 | public static final String RECOMMENDED_RETRIEVAL_MODE_TEXT = "r_r_mod_txt"; |
| 1834 | |
| 1835 | /** |
| 1836 | * The {@code status-text} of the message. |
| 1837 | * <P>Type: TEXT</P> |
| 1838 | * @deprecated this column is no longer supported. |
| 1839 | * @hide |
| 1840 | */ |
| 1841 | @Deprecated |
| 1842 | public static final String STATUS_TEXT = "st_txt"; |
| 1843 | |
| 1844 | /** |
| 1845 | * The {@code applic-id} of the message. |
| 1846 | * <P>Type: TEXT</P> |
| 1847 | * @deprecated this column is no longer supported. |
| 1848 | * @hide |
| 1849 | */ |
| 1850 | @Deprecated |
| 1851 | public static final String APPLIC_ID = "apl_id"; |
| 1852 | |
| 1853 | /** |
| 1854 | * The {@code reply-applic-id} of the message. |
| 1855 | * <P>Type: TEXT</P> |
| 1856 | * @deprecated this column is no longer supported. |
| 1857 | * @hide |
| 1858 | */ |
| 1859 | @Deprecated |
| 1860 | public static final String REPLY_APPLIC_ID = "r_apl_id"; |
| 1861 | |
| 1862 | /** |
| 1863 | * The {@code aux-applic-id} of the message. |
| 1864 | * <P>Type: TEXT</P> |
| 1865 | * @deprecated this column is no longer supported. |
| 1866 | * @hide |
| 1867 | */ |
| 1868 | @Deprecated |
| 1869 | public static final String AUX_APPLIC_ID = "aux_apl_id"; |
| 1870 | |
| 1871 | /** |
| 1872 | * The {@code drm-content} of the message. |
| 1873 | * <P>Type: TEXT</P> |
| 1874 | * @deprecated this column is no longer supported. |
| 1875 | * @hide |
| 1876 | */ |
| 1877 | @Deprecated |
| 1878 | public static final String DRM_CONTENT = "drm_c"; |
| 1879 | |
| 1880 | /** |
| 1881 | * The {@code adaptation-allowed} of the message. |
| 1882 | * <P>Type: TEXT</P> |
| 1883 | * @deprecated this column is no longer supported. |
| 1884 | * @hide |
| 1885 | */ |
| 1886 | @Deprecated |
| 1887 | public static final String ADAPTATION_ALLOWED = "adp_a"; |
| 1888 | |
| 1889 | /** |
| 1890 | * The {@code replace-id} of the message. |
| 1891 | * <P>Type: TEXT</P> |
| 1892 | * @deprecated this column is no longer supported. |
| 1893 | * @hide |
| 1894 | */ |
| 1895 | @Deprecated |
| 1896 | public static final String REPLACE_ID = "repl_id"; |
| 1897 | |
| 1898 | /** |
| 1899 | * The {@code cancel-id} of the message. |
| 1900 | * <P>Type: TEXT</P> |
| 1901 | * @deprecated this column is no longer supported. |
| 1902 | * @hide |
| 1903 | */ |
| 1904 | @Deprecated |
| 1905 | public static final String CANCEL_ID = "cl_id"; |
| 1906 | |
| 1907 | /** |
| 1908 | * The {@code cancel-status} of the message. |
| 1909 | * <P>Type: INTEGER</P> |
| 1910 | * @deprecated this column is no longer supported. |
| 1911 | * @hide |
| 1912 | */ |
| 1913 | @Deprecated |
| 1914 | public static final String CANCEL_STATUS = "cl_st"; |
| 1915 | |
| 1916 | /** |
| 1917 | * Is the message locked? |
| 1918 | * <P>Type: INTEGER (boolean)</P> |
| 1919 | */ |
| 1920 | public static final String LOCKED = "locked"; |
| 1921 | |
| 1922 | /** |
| 1923 | * The subscription to which the message belongs to. Its value will be |
| 1924 | * < 0 if the sub id cannot be determined. |
| 1925 | * <p>Type: INTEGER (long)</p> |
| 1926 | */ |
| 1927 | public static final String SUBSCRIPTION_ID = "sub_id"; |
| 1928 | |
| 1929 | /** |
| 1930 | * The identity of the sender of a sent message. It is |
| 1931 | * usually the package name of the app which sends the message. |
| 1932 | * <p class="note"><strong>Note:</strong> |
| 1933 | * This column is read-only. It is set by the provider and can not be changed by apps. |
| 1934 | * <p>Type: TEXT</p> |
| 1935 | */ |
| 1936 | public static final String CREATOR = "creator"; |
| 1937 | } |
| 1938 | |
| 1939 | /** |
| 1940 | * Columns for the "canonical_addresses" table used by MMS and SMS. |
| 1941 | */ |
| 1942 | public interface CanonicalAddressesColumns extends BaseColumns { |
| 1943 | /** |
| 1944 | * An address used in MMS or SMS. Email addresses are |
| 1945 | * converted to lower case and are compared by string |
| 1946 | * equality. Other addresses are compared using |
| 1947 | * PHONE_NUMBERS_EQUAL. |
| 1948 | * <P>Type: TEXT</P> |
| 1949 | */ |
| 1950 | public static final String ADDRESS = "address"; |
| 1951 | } |
| 1952 | |
| 1953 | /** |
| 1954 | * Columns for the "threads" table used by MMS and SMS. |
| 1955 | */ |
| 1956 | public interface ThreadsColumns extends BaseColumns { |
| 1957 | |
| 1958 | /** |
| 1959 | * The date at which the thread was created. |
| 1960 | * <P>Type: INTEGER (long)</P> |
| 1961 | */ |
| 1962 | public static final String DATE = "date"; |
| 1963 | |
| 1964 | /** |
| 1965 | * A string encoding of the recipient IDs of the recipients of |
| 1966 | * the message, in numerical order and separated by spaces. |
| 1967 | * <P>Type: TEXT</P> |
| 1968 | */ |
| 1969 | public static final String RECIPIENT_IDS = "recipient_ids"; |
| 1970 | |
| 1971 | /** |
| 1972 | * The message count of the thread. |
| 1973 | * <P>Type: INTEGER</P> |
| 1974 | */ |
| 1975 | public static final String MESSAGE_COUNT = "message_count"; |
| 1976 | |
| 1977 | /** |
| 1978 | * Indicates whether all messages of the thread have been read. |
| 1979 | * <P>Type: INTEGER</P> |
| 1980 | */ |
| 1981 | public static final String READ = "read"; |
| 1982 | |
| 1983 | /** |
| 1984 | * The snippet of the latest message in the thread. |
| 1985 | * <P>Type: TEXT</P> |
| 1986 | */ |
| 1987 | public static final String SNIPPET = "snippet"; |
| 1988 | |
| 1989 | /** |
| 1990 | * The charset of the snippet. |
| 1991 | * <P>Type: INTEGER</P> |
| 1992 | */ |
| 1993 | public static final String SNIPPET_CHARSET = "snippet_cs"; |
| 1994 | |
| 1995 | /** |
| 1996 | * Type of the thread, either {@link Threads#COMMON_THREAD} or |
| 1997 | * {@link Threads#BROADCAST_THREAD}. |
| 1998 | * <P>Type: INTEGER</P> |
| 1999 | */ |
| 2000 | public static final String TYPE = "type"; |
| 2001 | |
| 2002 | /** |
| 2003 | * Indicates whether there is a transmission error in the thread. |
| 2004 | * <P>Type: INTEGER</P> |
| 2005 | */ |
| 2006 | public static final String ERROR = "error"; |
| 2007 | |
| 2008 | /** |
| 2009 | * Indicates whether this thread contains any attachments. |
| 2010 | * <P>Type: INTEGER</P> |
| 2011 | */ |
| 2012 | public static final String HAS_ATTACHMENT = "has_attachment"; |
| 2013 | |
| 2014 | /** |
| 2015 | * If the thread is archived |
| 2016 | * <P>Type: INTEGER (boolean)</P> |
| 2017 | */ |
| 2018 | public static final String ARCHIVED = "archived"; |
| 2019 | } |
| 2020 | |
| 2021 | /** |
| 2022 | * Helper functions for the "threads" table used by MMS and SMS. |
Leland Miller | c445b2b | 2019-01-09 17:00:09 -0800 | [diff] [blame] | 2023 | * |
| 2024 | * Thread IDs are determined by the participants in a conversation and can be used to match |
| 2025 | * both SMS and MMS messages. |
| 2026 | * |
| 2027 | * To avoid issues where applications might cache a thread ID, the thread ID of a deleted thread |
| 2028 | * must not be reused to point at a new thread. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 2029 | */ |
| 2030 | public static final class Threads implements ThreadsColumns { |
| 2031 | |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 2032 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 2033 | private static final String[] ID_PROJECTION = { BaseColumns._ID }; |
| 2034 | |
| 2035 | /** |
| 2036 | * Private {@code content://} style URL for this table. Used by |
| 2037 | * {@link #getOrCreateThreadId(android.content.Context, java.util.Set)}. |
| 2038 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 2039 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 2040 | private static final Uri THREAD_ID_CONTENT_URI = Uri.parse( |
| 2041 | "content://mms-sms/threadID"); |
| 2042 | |
| 2043 | /** |
| 2044 | * The {@code content://} style URL for this table, by conversation. |
| 2045 | */ |
| 2046 | public static final Uri CONTENT_URI = Uri.withAppendedPath( |
| 2047 | MmsSms.CONTENT_URI, "conversations"); |
| 2048 | |
| 2049 | /** |
| 2050 | * The {@code content://} style URL for this table, for obsolete threads. |
| 2051 | */ |
| 2052 | public static final Uri OBSOLETE_THREADS_URI = Uri.withAppendedPath( |
| 2053 | CONTENT_URI, "obsolete"); |
| 2054 | |
| 2055 | /** Thread type: common thread. */ |
| 2056 | public static final int COMMON_THREAD = 0; |
| 2057 | |
| 2058 | /** Thread type: broadcast thread. */ |
| 2059 | public static final int BROADCAST_THREAD = 1; |
| 2060 | |
| 2061 | /** |
| 2062 | * Not instantiable. |
| 2063 | * @hide |
| 2064 | */ |
| 2065 | private Threads() { |
| 2066 | } |
| 2067 | |
| 2068 | /** |
| 2069 | * This is a single-recipient version of {@code getOrCreateThreadId}. |
| 2070 | * It's convenient for use with SMS messages. |
| 2071 | * @param context the context object to use. |
| 2072 | * @param recipient the recipient to send to. |
| 2073 | */ |
| 2074 | public static long getOrCreateThreadId(Context context, String recipient) { |
| 2075 | Set<String> recipients = new HashSet<String>(); |
| 2076 | |
| 2077 | recipients.add(recipient); |
| 2078 | return getOrCreateThreadId(context, recipients); |
| 2079 | } |
| 2080 | |
| 2081 | /** |
Leland Miller | c445b2b | 2019-01-09 17:00:09 -0800 | [diff] [blame] | 2082 | * Given a set of recipients return its thread ID. |
| 2083 | * <p> |
| 2084 | * If a thread exists containing the provided participants, return its thread ID. Otherwise, |
| 2085 | * this will create a new thread containing the provided participants and return its ID. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 2086 | */ |
| 2087 | public static long getOrCreateThreadId( |
| 2088 | Context context, Set<String> recipients) { |
| 2089 | Uri.Builder uriBuilder = THREAD_ID_CONTENT_URI.buildUpon(); |
| 2090 | |
| 2091 | for (String recipient : recipients) { |
| 2092 | if (Mms.isEmailAddress(recipient)) { |
| 2093 | recipient = Mms.extractAddrSpec(recipient); |
| 2094 | } |
| 2095 | |
| 2096 | uriBuilder.appendQueryParameter("recipient", recipient); |
| 2097 | } |
| 2098 | |
| 2099 | Uri uri = uriBuilder.build(); |
| 2100 | //if (DEBUG) Rlog.v(TAG, "getOrCreateThreadId uri: " + uri); |
| 2101 | |
| 2102 | Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), |
| 2103 | uri, ID_PROJECTION, null, null, null); |
| 2104 | if (cursor != null) { |
| 2105 | try { |
| 2106 | if (cursor.moveToFirst()) { |
| 2107 | return cursor.getLong(0); |
| 2108 | } else { |
| 2109 | Rlog.e(TAG, "getOrCreateThreadId returned no rows!"); |
| 2110 | } |
| 2111 | } finally { |
| 2112 | cursor.close(); |
| 2113 | } |
| 2114 | } |
| 2115 | |
| 2116 | Rlog.e(TAG, "getOrCreateThreadId failed with " + recipients.size() + " recipients"); |
| 2117 | throw new IllegalArgumentException("Unable to find or allocate a thread ID."); |
| 2118 | } |
| 2119 | } |
| 2120 | |
| 2121 | /** |
Sahin Caliskan | f00a876 | 2019-01-24 14:32:12 -0800 | [diff] [blame] | 2122 | * Columns for the "rcs_*" tables used by {@link android.telephony.ims.RcsMessageStore} classes. |
| 2123 | * |
| 2124 | * @hide - not meant for public use |
| 2125 | */ |
| 2126 | public interface RcsColumns { |
Leland Miller | bd7959d | 2019-02-13 10:31:31 -0800 | [diff] [blame] | 2127 | // TODO(sahinc): Turn this to true once the schema finalizes, so that people can update |
| 2128 | // their messaging databases. NOTE: move the switch/case update in MmsSmsDatabaseHelper to |
| 2129 | // the latest version of the database before turning this flag to true. |
| 2130 | boolean IS_RCS_TABLE_SCHEMA_CODE_COMPLETE = false; |
| 2131 | |
Sahin Caliskan | f00a876 | 2019-01-24 14:32:12 -0800 | [diff] [blame] | 2132 | /** |
| 2133 | * The authority for the content provider |
| 2134 | */ |
| 2135 | String AUTHORITY = "rcs"; |
| 2136 | |
| 2137 | /** |
| 2138 | * The URI to start building upon to use {@link com.android.providers.telephony.RcsProvider} |
| 2139 | */ |
| 2140 | Uri CONTENT_AND_AUTHORITY = Uri.parse("content://" + AUTHORITY); |
| 2141 | |
| 2142 | /** |
| 2143 | * The value to be used whenever a transaction that expects an integer to be returned |
| 2144 | * failed. |
| 2145 | */ |
| 2146 | int TRANSACTION_FAILED = Integer.MIN_VALUE; |
| 2147 | |
| 2148 | /** |
| 2149 | * The value that denotes a timestamp was not set before (e.g. a message that is not |
| 2150 | * delivered yet will not have a DELIVERED_TIMESTAMP) |
| 2151 | */ |
| 2152 | long TIMESTAMP_NOT_SET = 0; |
| 2153 | |
| 2154 | /** |
| 2155 | * The table that {@link android.telephony.ims.RcsThread} gets persisted to |
| 2156 | */ |
| 2157 | interface RcsThreadColumns { |
| 2158 | /** |
| 2159 | * The path that should be used for referring to |
| 2160 | * {@link android.telephony.ims.RcsThread}s in |
| 2161 | * {@link com.android.providers.telephony.RcsProvider} URIs. |
| 2162 | */ |
| 2163 | String RCS_THREAD_URI_PART = "thread"; |
| 2164 | |
| 2165 | /** |
| 2166 | * The URI to query or modify {@link android.telephony.ims.RcsThread} via the content |
| 2167 | * provider. |
| 2168 | */ |
| 2169 | Uri RCS_THREAD_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY, RCS_THREAD_URI_PART); |
| 2170 | |
| 2171 | /** |
| 2172 | * The unique identifier of an {@link android.telephony.ims.RcsThread} |
| 2173 | */ |
| 2174 | String RCS_THREAD_ID_COLUMN = "rcs_thread_id"; |
| 2175 | } |
| 2176 | |
| 2177 | /** |
| 2178 | * The table that {@link android.telephony.ims.Rcs1To1Thread} gets persisted to |
| 2179 | */ |
| 2180 | interface Rcs1To1ThreadColumns extends RcsThreadColumns { |
| 2181 | /** |
| 2182 | * The path that should be used for referring to |
| 2183 | * {@link android.telephony.ims.Rcs1To1Thread}s in |
| 2184 | * {@link com.android.providers.telephony.RcsProvider} URIs. |
| 2185 | */ |
| 2186 | String RCS_1_TO_1_THREAD_URI_PART = "p2p_thread"; |
| 2187 | |
| 2188 | /** |
| 2189 | * The URI to query or modify {@link android.telephony.ims.Rcs1To1Thread}s via the |
Leland Miller | db2337f | 2019-02-20 07:53:49 -0800 | [diff] [blame] | 2190 | * content provider. Can also insert to this URI to create a new 1-to-1 thread. When |
| 2191 | * performing an insert, ensure that the provided content values contain the other |
| 2192 | * participant's ID under the key |
| 2193 | * {@link RcsParticipantColumns.RCS_PARTICIPANT_ID_COLUMN} |
Sahin Caliskan | f00a876 | 2019-01-24 14:32:12 -0800 | [diff] [blame] | 2194 | */ |
| 2195 | Uri RCS_1_TO_1_THREAD_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY, |
| 2196 | RCS_1_TO_1_THREAD_URI_PART); |
| 2197 | |
| 2198 | /** |
| 2199 | * The SMS/MMS thread to fallback to in case of an RCS outage |
| 2200 | */ |
| 2201 | String FALLBACK_THREAD_ID_COLUMN = "rcs_fallback_thread_id"; |
| 2202 | } |
| 2203 | |
| 2204 | /** |
| 2205 | * The table that {@link android.telephony.ims.RcsGroupThread} gets persisted to |
| 2206 | */ |
| 2207 | interface RcsGroupThreadColumns extends RcsThreadColumns { |
| 2208 | /** |
| 2209 | * The path that should be used for referring to |
| 2210 | * {@link android.telephony.ims.RcsGroupThread}s in |
| 2211 | * {@link com.android.providers.telephony.RcsProvider} URIs. |
| 2212 | */ |
| 2213 | String RCS_GROUP_THREAD_URI_PART = "group_thread"; |
| 2214 | |
| 2215 | /** |
| 2216 | * The URI to query or modify {@link android.telephony.ims.RcsGroupThread}s via the |
| 2217 | * content provider |
| 2218 | */ |
| 2219 | Uri RCS_GROUP_THREAD_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY, |
| 2220 | RCS_GROUP_THREAD_URI_PART); |
| 2221 | |
| 2222 | /** |
| 2223 | * The owner/admin of the {@link android.telephony.ims.RcsGroupThread} |
| 2224 | */ |
| 2225 | String OWNER_PARTICIPANT_COLUMN = "owner_participant"; |
| 2226 | |
| 2227 | /** |
| 2228 | * The user visible name of the group |
| 2229 | */ |
| 2230 | String GROUP_NAME_COLUMN = "group_name"; |
| 2231 | |
| 2232 | /** |
| 2233 | * The user visible icon of the group |
| 2234 | */ |
| 2235 | String GROUP_ICON_COLUMN = "group_icon"; |
| 2236 | |
| 2237 | /** |
| 2238 | * The RCS conference URI for this group |
| 2239 | */ |
| 2240 | String CONFERENCE_URI_COLUMN = "conference_uri"; |
| 2241 | } |
| 2242 | |
| 2243 | /** |
| 2244 | * The view that enables polling from all types of RCS threads at once |
| 2245 | */ |
| 2246 | interface RcsUnifiedThreadColumns extends RcsThreadColumns, Rcs1To1ThreadColumns, |
| 2247 | RcsGroupThreadColumns { |
| 2248 | /** |
| 2249 | * The type of this {@link android.telephony.ims.RcsThread} |
| 2250 | */ |
| 2251 | String THREAD_TYPE_COLUMN = "thread_type"; |
| 2252 | |
| 2253 | /** |
| 2254 | * Integer returned as a result from a database query that denotes the thread is 1 to 1 |
| 2255 | */ |
| 2256 | int THREAD_TYPE_1_TO_1 = 0; |
| 2257 | |
| 2258 | /** |
| 2259 | * Integer returned as a result from a database query that denotes the thread is 1 to 1 |
| 2260 | */ |
| 2261 | int THREAD_TYPE_GROUP = 1; |
| 2262 | } |
| 2263 | |
| 2264 | /** |
| 2265 | * The table that {@link android.telephony.ims.RcsParticipant} gets persisted to |
| 2266 | */ |
| 2267 | interface RcsParticipantColumns { |
| 2268 | /** |
| 2269 | * The path that should be used for referring to |
| 2270 | * {@link android.telephony.ims.RcsParticipant}s in |
| 2271 | * {@link com.android.providers.telephony.RcsProvider} URIs. |
| 2272 | */ |
| 2273 | String RCS_PARTICIPANT_URI_PART = "participant"; |
| 2274 | |
| 2275 | /** |
| 2276 | * The URI to query or modify {@link android.telephony.ims.RcsParticipant}s via the |
| 2277 | * content provider |
| 2278 | */ |
| 2279 | Uri RCS_PARTICIPANT_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY, |
| 2280 | RCS_PARTICIPANT_URI_PART); |
| 2281 | |
| 2282 | /** |
| 2283 | * The unique identifier of the entry in the database |
| 2284 | */ |
| 2285 | String RCS_PARTICIPANT_ID_COLUMN = "rcs_participant_id"; |
| 2286 | |
| 2287 | /** |
| 2288 | * A foreign key on canonical_address table, also used by SMS/MMS |
| 2289 | */ |
| 2290 | String CANONICAL_ADDRESS_ID_COLUMN = "canonical_address_id"; |
| 2291 | |
| 2292 | /** |
| 2293 | * The user visible RCS alias for this participant. |
| 2294 | */ |
| 2295 | String RCS_ALIAS_COLUMN = "rcs_alias"; |
| 2296 | } |
| 2297 | |
| 2298 | /** |
| 2299 | * Additional constants to enable access to {@link android.telephony.ims.RcsParticipant} |
| 2300 | * related data |
| 2301 | */ |
| 2302 | interface RcsParticipantHelpers extends RcsParticipantColumns { |
| 2303 | /** |
| 2304 | * The view that unifies "rcs_participant" and "canonical_addresses" tables for easy |
| 2305 | * access to participant address. |
| 2306 | */ |
| 2307 | String RCS_PARTICIPANT_WITH_ADDRESS_VIEW = "rcs_participant_with_address_view"; |
| 2308 | |
| 2309 | /** |
| 2310 | * The view that unifies "rcs_participant", "canonical_addresses" and |
| 2311 | * "rcs_thread_participant" junction table to get full information on participants that |
| 2312 | * contribute to threads. |
| 2313 | */ |
| 2314 | String RCS_PARTICIPANT_WITH_THREAD_VIEW = "rcs_participant_with_thread_view"; |
| 2315 | } |
| 2316 | |
| 2317 | /** |
| 2318 | * The table that {@link android.telephony.ims.RcsMessage} gets persisted to |
| 2319 | */ |
| 2320 | interface RcsMessageColumns { |
| 2321 | /** |
| 2322 | * Denotes the type of this message (i.e. |
| 2323 | * {@link android.telephony.ims.RcsIncomingMessage} or |
| 2324 | * {@link android.telephony.ims.RcsOutgoingMessage} |
| 2325 | */ |
| 2326 | String MESSAGE_TYPE_COLUMN = "rcs_message_type"; |
| 2327 | |
| 2328 | /** |
| 2329 | * The unique identifier for the message in the database - i.e. the primary key. |
| 2330 | */ |
| 2331 | String MESSAGE_ID_COLUMN = "rcs_message_row_id"; |
| 2332 | |
| 2333 | /** |
| 2334 | * The globally unique RCS identifier for the message. Please see 4.4.5.2 - GSMA |
| 2335 | * RCC.53 (RCS Device API 1.6 Specification) |
| 2336 | */ |
| 2337 | String GLOBAL_ID_COLUMN = "rcs_message_global_id"; |
| 2338 | |
| 2339 | /** |
| 2340 | * The subscription where this message was sent from/to. |
| 2341 | */ |
| 2342 | String SUB_ID_COLUMN = "sub_id"; |
| 2343 | |
| 2344 | /** |
| 2345 | * The sending status of the message. |
| 2346 | * @see android.telephony.ims.RcsMessage.RcsMessageStatus |
| 2347 | */ |
| 2348 | String STATUS_COLUMN = "status"; |
| 2349 | |
| 2350 | /** |
| 2351 | * The creation timestamp of the message. |
| 2352 | */ |
| 2353 | String ORIGINATION_TIMESTAMP_COLUMN = "origination_timestamp"; |
| 2354 | |
| 2355 | /** |
| 2356 | * The text content of the message. |
| 2357 | */ |
| 2358 | String MESSAGE_TEXT_COLUMN = "rcs_text"; |
| 2359 | |
| 2360 | /** |
| 2361 | * The latitude content of the message, if it contains a location. |
| 2362 | */ |
| 2363 | String LATITUDE_COLUMN = "latitude"; |
| 2364 | |
| 2365 | /** |
| 2366 | * The longitude content of the message, if it contains a location. |
| 2367 | */ |
| 2368 | String LONGITUDE_COLUMN = "longitude"; |
| 2369 | } |
| 2370 | |
| 2371 | /** |
| 2372 | * The table that additional information of {@link android.telephony.ims.RcsIncomingMessage} |
| 2373 | * gets persisted to. |
| 2374 | */ |
| 2375 | interface RcsIncomingMessageColumns extends RcsMessageColumns { |
| 2376 | /** |
| 2377 | The path that should be used for referring to |
| 2378 | * {@link android.telephony.ims.RcsIncomingMessage}s in |
| 2379 | * {@link com.android.providers.telephony.RcsProvider} URIs. |
| 2380 | */ |
| 2381 | String INCOMING_MESSAGE_URI_PART = "incoming_message"; |
| 2382 | |
| 2383 | /** |
| 2384 | * The URI to query incoming messages through |
| 2385 | * {@link com.android.providers.telephony.RcsProvider} |
| 2386 | */ |
| 2387 | Uri INCOMING_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY, |
| 2388 | INCOMING_MESSAGE_URI_PART); |
| 2389 | |
| 2390 | /** |
| 2391 | * The ID of the {@link android.telephony.ims.RcsParticipant} that sent this message |
| 2392 | */ |
| 2393 | String SENDER_PARTICIPANT_ID_COLUMN = "sender_participant"; |
| 2394 | |
| 2395 | /** |
| 2396 | * The timestamp of arrival for this message. |
| 2397 | */ |
| 2398 | String ARRIVAL_TIMESTAMP_COLUMN = "arrival_timestamp"; |
| 2399 | |
| 2400 | /** |
| 2401 | * The time when the recipient has read this message. |
| 2402 | */ |
| 2403 | String SEEN_TIMESTAMP_COLUMN = "seen_timestamp"; |
| 2404 | } |
| 2405 | |
| 2406 | /** |
| 2407 | * The table that additional information of {@link android.telephony.ims.RcsOutgoingMessage} |
| 2408 | * gets persisted to. |
| 2409 | */ |
| 2410 | interface RcsOutgoingMessageColumns extends RcsMessageColumns { |
| 2411 | /** |
| 2412 | * The path that should be used for referring to |
| 2413 | * {@link android.telephony.ims.RcsOutgoingMessage}s in |
| 2414 | * {@link com.android.providers.telephony.RcsProvider} URIs. |
| 2415 | */ |
| 2416 | String OUTGOING_MESSAGE_URI_PART = "outgoing_message"; |
| 2417 | |
| 2418 | /** |
| 2419 | * The URI to query or modify {@link android.telephony.ims.RcsOutgoingMessage}s via the |
| 2420 | * content provider |
| 2421 | */ |
| 2422 | Uri OUTGOING_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY, |
| 2423 | OUTGOING_MESSAGE_URI_PART); |
| 2424 | } |
| 2425 | |
| 2426 | /** |
| 2427 | * The delivery information of an {@link android.telephony.ims.RcsOutgoingMessage} |
| 2428 | */ |
| 2429 | interface RcsMessageDeliveryColumns extends RcsOutgoingMessageColumns { |
| 2430 | /** |
| 2431 | * The path that should be used for referring to |
| 2432 | * {@link android.telephony.ims.RcsOutgoingMessageDelivery}s in |
| 2433 | * {@link com.android.providers.telephony.RcsProvider} URIs. |
| 2434 | */ |
| 2435 | String DELIVERY_URI_PART = "delivery"; |
| 2436 | |
| 2437 | /** |
| 2438 | * The timestamp of delivery of this message. |
| 2439 | */ |
| 2440 | String DELIVERED_TIMESTAMP_COLUMN = "delivered_timestamp"; |
| 2441 | |
| 2442 | /** |
| 2443 | * The time when the recipient has read this message. |
| 2444 | */ |
| 2445 | String SEEN_TIMESTAMP_COLUMN = "seen_timestamp"; |
| 2446 | } |
| 2447 | |
| 2448 | /** |
| 2449 | * The views that allow querying {@link android.telephony.ims.RcsIncomingMessage} and |
| 2450 | * {@link android.telephony.ims.RcsOutgoingMessage} at the same time. |
| 2451 | */ |
| 2452 | interface RcsUnifiedMessageColumns extends RcsIncomingMessageColumns, |
| 2453 | RcsOutgoingMessageColumns { |
| 2454 | /** |
| 2455 | * The path that is used to query all {@link android.telephony.ims.RcsMessage} in |
| 2456 | * {@link com.android.providers.telephony.RcsProvider} URIs. |
| 2457 | */ |
| 2458 | String UNIFIED_MESSAGE_URI_PART = "message"; |
| 2459 | |
| 2460 | /** |
| 2461 | * The URI to query all types of {@link android.telephony.ims.RcsMessage}s |
| 2462 | */ |
| 2463 | Uri UNIFIED_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY, |
| 2464 | UNIFIED_MESSAGE_URI_PART); |
| 2465 | |
| 2466 | /** |
| 2467 | * The name of the view that unites rcs_message and rcs_incoming_message tables. |
| 2468 | */ |
| 2469 | String UNIFIED_INCOMING_MESSAGE_VIEW = "unified_incoming_message_view"; |
| 2470 | |
| 2471 | /** |
| 2472 | * The name of the view that unites rcs_message and rcs_outgoing_message tables. |
| 2473 | */ |
| 2474 | String UNIFIED_OUTGOING_MESSAGE_VIEW = "unified_outgoing_message_view"; |
| 2475 | |
| 2476 | /** |
| 2477 | * The column that shows from which table the message entry came from. |
| 2478 | */ |
| 2479 | String MESSAGE_TYPE_COLUMN = "message_type"; |
| 2480 | |
| 2481 | /** |
| 2482 | * Integer returned as a result from a database query that denotes that the message is |
| 2483 | * an incoming message |
| 2484 | */ |
| 2485 | int MESSAGE_TYPE_INCOMING = 1; |
| 2486 | |
| 2487 | /** |
| 2488 | * Integer returned as a result from a database query that denotes that the message is |
| 2489 | * an outgoing message |
| 2490 | */ |
| 2491 | int MESSAGE_TYPE_OUTGOING = 0; |
| 2492 | } |
| 2493 | |
| 2494 | /** |
| 2495 | * The table that {@link android.telephony.ims.RcsFileTransferPart} gets persisted to. |
| 2496 | */ |
| 2497 | interface RcsFileTransferColumns { |
| 2498 | /** |
| 2499 | * The path that should be used for referring to |
| 2500 | * {@link android.telephony.ims.RcsFileTransferPart}s in |
| 2501 | * {@link com.android.providers.telephony.RcsProvider} URIs. |
| 2502 | */ |
| 2503 | String FILE_TRANSFER_URI_PART = "file_transfer"; |
| 2504 | |
| 2505 | /** |
| 2506 | * The URI to query or modify {@link android.telephony.ims.RcsFileTransferPart}s via the |
| 2507 | * content provider |
| 2508 | */ |
| 2509 | Uri FILE_TRANSFER_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY, |
| 2510 | FILE_TRANSFER_URI_PART); |
| 2511 | |
| 2512 | /** |
| 2513 | * The globally unique file transfer ID for this RCS file transfer. |
| 2514 | */ |
| 2515 | String FILE_TRANSFER_ID_COLUMN = "rcs_file_transfer_id"; |
| 2516 | |
| 2517 | /** |
| 2518 | * The RCS session ID for this file transfer. The ID is implementation dependent but |
| 2519 | * should be unique. |
| 2520 | */ |
| 2521 | String SESSION_ID_COLUMN = "session_id"; |
| 2522 | |
| 2523 | /** |
| 2524 | * The URI that points to the content of this file transfer |
| 2525 | */ |
| 2526 | String CONTENT_URI_COLUMN = "content_uri"; |
| 2527 | |
| 2528 | /** |
| 2529 | * The file type of this file transfer in bytes. The validity of types is not enforced |
| 2530 | * in {@link android.telephony.ims.RcsMessageStore} APIs. |
| 2531 | */ |
| 2532 | String CONTENT_TYPE_COLUMN = "content_type"; |
| 2533 | |
| 2534 | /** |
| 2535 | * The size of the file transfer in bytes. |
| 2536 | */ |
| 2537 | String FILE_SIZE_COLUMN = "file_size"; |
| 2538 | |
| 2539 | /** |
| 2540 | * Number of bytes that was successfully transmitted for this file transfer |
| 2541 | */ |
| 2542 | String SUCCESSFULLY_TRANSFERRED_BYTES = "transfer_offset"; |
| 2543 | |
| 2544 | /** |
| 2545 | * The status of this file transfer |
| 2546 | * @see android.telephony.ims.RcsFileTransferPart.RcsFileTransferStatus |
| 2547 | */ |
| 2548 | String TRANSFER_STATUS_COLUMN = "transfer_status"; |
| 2549 | |
| 2550 | /** |
| 2551 | * The on-screen width of the file transfer, if it contains multi-media |
| 2552 | */ |
| 2553 | String WIDTH_COLUMN = "width"; |
| 2554 | |
| 2555 | /** |
| 2556 | * The on-screen height of the file transfer, if it contains multi-media |
| 2557 | */ |
| 2558 | String HEIGHT_COLUMN = "height"; |
| 2559 | |
| 2560 | /** |
| 2561 | * The duration of the content in milliseconds if this file transfer contains |
| 2562 | * multi-media |
| 2563 | */ |
| 2564 | String DURATION_MILLIS_COLUMN = "duration"; |
| 2565 | |
| 2566 | /** |
| 2567 | * The URI to the preview of the content of this file transfer |
| 2568 | */ |
| 2569 | String PREVIEW_URI_COLUMN = "preview_uri"; |
| 2570 | |
| 2571 | /** |
| 2572 | * The type of the preview of the content of this file transfer. The validity of types |
| 2573 | * is not enforced in {@link android.telephony.ims.RcsMessageStore} APIs. |
| 2574 | */ |
| 2575 | String PREVIEW_TYPE_COLUMN = "preview_type"; |
| 2576 | } |
| 2577 | |
| 2578 | /** |
| 2579 | * The table that holds the information for |
| 2580 | * {@link android.telephony.ims.RcsGroupThreadEvent} and its subclasses. |
| 2581 | */ |
| 2582 | interface RcsThreadEventColumns { |
| 2583 | /** |
| 2584 | * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to |
| 2585 | * refer to participant joined events (example URI: |
| 2586 | * {@code content://rcs/group_thread/3/participant_joined_event}) |
| 2587 | */ |
| 2588 | String PARTICIPANT_JOINED_URI_PART = "participant_joined_event"; |
| 2589 | |
| 2590 | /** |
| 2591 | * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to |
| 2592 | * refer to participant left events. (example URI: |
| 2593 | * {@code content://rcs/group_thread/3/participant_left_event/4}) |
| 2594 | */ |
| 2595 | String PARTICIPANT_LEFT_URI_PART = "participant_left_event"; |
| 2596 | |
| 2597 | /** |
| 2598 | * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to |
| 2599 | * refer to name changed events. (example URI: |
| 2600 | * {@code content://rcs/group_thread/3/name_changed_event}) |
| 2601 | */ |
| 2602 | String NAME_CHANGED_URI_PART = "name_changed_event"; |
| 2603 | |
| 2604 | /** |
| 2605 | * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to |
| 2606 | * refer to icon changed events. (example URI: |
| 2607 | * {@code content://rcs/group_thread/3/icon_changed_event}) |
| 2608 | */ |
| 2609 | String ICON_CHANGED_URI_PART = "icon_changed_event"; |
| 2610 | |
| 2611 | /** |
| 2612 | * The unique ID of this event in the database, i.e. the primary key |
| 2613 | */ |
| 2614 | String EVENT_ID_COLUMN = "event_id"; |
| 2615 | |
| 2616 | /** |
| 2617 | * The type of this event |
| 2618 | * |
| 2619 | * @see RcsEventTypes |
| 2620 | */ |
| 2621 | String EVENT_TYPE_COLUMN = "event_type"; |
| 2622 | |
| 2623 | /** |
| 2624 | * The timestamp in milliseconds of when this event happened |
| 2625 | */ |
| 2626 | String TIMESTAMP_COLUMN = "origination_timestamp"; |
| 2627 | |
| 2628 | /** |
| 2629 | * The participant that generated this event |
| 2630 | */ |
| 2631 | String SOURCE_PARTICIPANT_ID_COLUMN = "source_participant"; |
| 2632 | |
| 2633 | /** |
| 2634 | * The receiving participant of this event if this was an |
| 2635 | * {@link android.telephony.ims.RcsGroupThreadParticipantJoinedEvent} or |
| 2636 | * {@link android.telephony.ims.RcsGroupThreadParticipantLeftEvent} |
| 2637 | */ |
| 2638 | String DESTINATION_PARTICIPANT_ID_COLUMN = "destination_participant"; |
| 2639 | |
| 2640 | /** |
| 2641 | * The URI for the new icon of the group thread if this was an |
| 2642 | * {@link android.telephony.ims.RcsGroupThreadIconChangedEvent} |
| 2643 | */ |
| 2644 | String NEW_ICON_URI_COLUMN = "new_icon_uri"; |
| 2645 | |
| 2646 | /** |
| 2647 | * The URI for the new name of the group thread if this was an |
| 2648 | * {@link android.telephony.ims.RcsGroupThreadNameChangedEvent} |
| 2649 | */ |
| 2650 | String NEW_NAME_COLUMN = "new_name"; |
| 2651 | } |
| 2652 | |
| 2653 | /** |
| 2654 | * The table that {@link android.telephony.ims.RcsParticipantAliasChangedEvent} gets |
| 2655 | * persisted to |
| 2656 | */ |
| 2657 | interface RcsParticipantEventColumns { |
| 2658 | /** |
| 2659 | * The path that should be used for referring to |
| 2660 | * {@link android.telephony.ims.RcsParticipantAliasChangedEvent}s in |
| 2661 | * {@link com.android.providers.telephony.RcsProvider} URIs. |
| 2662 | */ |
| 2663 | String ALIAS_CHANGE_EVENT_URI_PART = "alias_change_event"; |
| 2664 | |
| 2665 | /** |
| 2666 | * The new alias of the participant |
| 2667 | */ |
| 2668 | String NEW_ALIAS_COLUMN = "new_alias"; |
| 2669 | } |
| 2670 | |
| 2671 | /** |
| 2672 | * These values are used in {@link com.android.providers.telephony.RcsProvider} to determine |
| 2673 | * what kind of event is present in the storage. |
| 2674 | */ |
| 2675 | interface RcsEventTypes { |
| 2676 | /** |
| 2677 | * Integer constant that is stored in the |
| 2678 | * {@link com.android.providers.telephony.RcsProvider} database that denotes the event |
| 2679 | * is of type {@link android.telephony.ims.RcsParticipantAliasChangedEvent} |
| 2680 | */ |
| 2681 | int PARTICIPANT_ALIAS_CHANGED_EVENT_TYPE = 1; |
| 2682 | |
| 2683 | /** |
| 2684 | * Integer constant that is stored in the |
| 2685 | * {@link com.android.providers.telephony.RcsProvider} database that denotes the event |
| 2686 | * is of type {@link android.telephony.ims.RcsGroupThreadParticipantJoinedEvent} |
| 2687 | */ |
| 2688 | int PARTICIPANT_JOINED_EVENT_TYPE = 2; |
| 2689 | |
| 2690 | /** |
| 2691 | * Integer constant that is stored in the |
| 2692 | * {@link com.android.providers.telephony.RcsProvider} database that denotes the event |
| 2693 | * is of type {@link android.telephony.ims.RcsGroupThreadParticipantLeftEvent} |
| 2694 | */ |
| 2695 | int PARTICIPANT_LEFT_EVENT_TYPE = 4; |
| 2696 | |
| 2697 | /** |
| 2698 | * Integer constant that is stored in the |
| 2699 | * {@link com.android.providers.telephony.RcsProvider} database that denotes the event |
| 2700 | * is of type {@link android.telephony.ims.RcsGroupThreadIconChangedEvent} |
| 2701 | */ |
| 2702 | int ICON_CHANGED_EVENT_TYPE = 8; |
| 2703 | |
| 2704 | /** |
| 2705 | * Integer constant that is stored in the |
| 2706 | * {@link com.android.providers.telephony.RcsProvider} database that denotes the event |
| 2707 | * is of type {@link android.telephony.ims.RcsGroupThreadNameChangedEvent} |
| 2708 | */ |
| 2709 | int NAME_CHANGED_EVENT_TYPE = 16; |
| 2710 | } |
| 2711 | |
| 2712 | /** |
| 2713 | * The view that allows unified querying across all events |
| 2714 | */ |
| 2715 | interface RcsUnifiedEventHelper extends RcsParticipantEventColumns, RcsThreadEventColumns { |
| 2716 | /** |
| 2717 | * The path that should be used for referring to |
| 2718 | * {@link android.telephony.ims.RcsEvent}s in |
| 2719 | * {@link com.android.providers.telephony.RcsProvider} URIs. |
| 2720 | */ |
| 2721 | String RCS_EVENT_QUERY_URI_PATH = "event"; |
| 2722 | |
| 2723 | /** |
| 2724 | * The URI to query {@link android.telephony.ims.RcsEvent}s via the content provider. |
| 2725 | */ |
| 2726 | Uri RCS_EVENT_QUERY_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY, |
| 2727 | RCS_EVENT_QUERY_URI_PATH); |
| 2728 | } |
Leland Miller | 7b378ab | 2019-01-24 16:09:10 -0800 | [diff] [blame] | 2729 | |
| 2730 | /** |
| 2731 | * Allows RCS specific canonical address handling. |
| 2732 | */ |
| 2733 | interface RcsCanonicalAddressHelper { |
| 2734 | /** |
| 2735 | * Returns the canonical address ID for a canonical address, if now row exists, this |
| 2736 | * will add a row and return its ID. This helper works against the same table used by |
| 2737 | * the SMS and MMS threads, but is accessible only by the phone process for use by RCS |
| 2738 | * message storage. |
| 2739 | * |
| 2740 | * @throws IllegalArgumentException if unable to retrieve or create the canonical |
| 2741 | * address entry. |
| 2742 | */ |
| 2743 | static long getOrCreateCanonicalAddressId( |
| 2744 | ContentResolver contentResolver, String canonicalAddress) { |
| 2745 | |
| 2746 | Uri.Builder uriBuilder = CONTENT_AND_AUTHORITY.buildUpon(); |
| 2747 | uriBuilder.appendPath("canonical-address"); |
| 2748 | uriBuilder.appendQueryParameter("address", canonicalAddress); |
| 2749 | Uri uri = uriBuilder.build(); |
| 2750 | |
| 2751 | try (Cursor cursor = contentResolver.query(uri, null, null, null)) { |
| 2752 | if (cursor != null && cursor.moveToFirst()) { |
| 2753 | return cursor.getLong(cursor.getColumnIndex(CanonicalAddressesColumns._ID)); |
| 2754 | } else { |
| 2755 | Rlog.e(TAG, "getOrCreateCanonicalAddressId returned no rows"); |
| 2756 | } |
| 2757 | } |
| 2758 | |
| 2759 | Rlog.e(TAG, "getOrCreateCanonicalAddressId failed"); |
| 2760 | throw new IllegalArgumentException( |
| 2761 | "Unable to find or allocate a canonical address ID"); |
| 2762 | } |
| 2763 | } |
Sahin Caliskan | f00a876 | 2019-01-24 14:32:12 -0800 | [diff] [blame] | 2764 | } |
| 2765 | |
| 2766 | /** |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 2767 | * Contains all MMS messages. |
| 2768 | */ |
| 2769 | public static final class Mms implements BaseMmsColumns { |
| 2770 | |
| 2771 | /** |
| 2772 | * Not instantiable. |
| 2773 | * @hide |
| 2774 | */ |
| 2775 | private Mms() { |
| 2776 | } |
| 2777 | |
| 2778 | /** |
| 2779 | * The {@code content://} URI for this table. |
| 2780 | */ |
| 2781 | public static final Uri CONTENT_URI = Uri.parse("content://mms"); |
| 2782 | |
| 2783 | /** |
| 2784 | * Content URI for getting MMS report requests. |
| 2785 | */ |
| 2786 | public static final Uri REPORT_REQUEST_URI = Uri.withAppendedPath( |
| 2787 | CONTENT_URI, "report-request"); |
| 2788 | |
| 2789 | /** |
| 2790 | * Content URI for getting MMS report status. |
| 2791 | */ |
| 2792 | public static final Uri REPORT_STATUS_URI = Uri.withAppendedPath( |
| 2793 | CONTENT_URI, "report-status"); |
| 2794 | |
| 2795 | /** |
| 2796 | * The default sort order for this table. |
| 2797 | */ |
| 2798 | public static final String DEFAULT_SORT_ORDER = "date DESC"; |
| 2799 | |
| 2800 | /** |
| 2801 | * Regex pattern for names and email addresses. |
| 2802 | * <ul> |
| 2803 | * <li><em>mailbox</em> = {@code name-addr}</li> |
| 2804 | * <li><em>name-addr</em> = {@code [display-name] angle-addr}</li> |
| 2805 | * <li><em>angle-addr</em> = {@code [CFWS] "<" addr-spec ">" [CFWS]}</li> |
| 2806 | * </ul> |
| 2807 | * @hide |
| 2808 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 2809 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 2810 | public static final Pattern NAME_ADDR_EMAIL_PATTERN = |
| 2811 | Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*"); |
| 2812 | |
| 2813 | /** |
| 2814 | * Helper method to query this table. |
| 2815 | * @hide |
| 2816 | */ |
| 2817 | public static Cursor query( |
| 2818 | ContentResolver cr, String[] projection) { |
| 2819 | return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER); |
| 2820 | } |
| 2821 | |
| 2822 | /** |
| 2823 | * Helper method to query this table. |
| 2824 | * @hide |
| 2825 | */ |
| 2826 | public static Cursor query( |
| 2827 | ContentResolver cr, String[] projection, |
| 2828 | String where, String orderBy) { |
| 2829 | return cr.query(CONTENT_URI, projection, |
| 2830 | where, null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy); |
| 2831 | } |
| 2832 | |
| 2833 | /** |
| 2834 | * Helper method to extract email address from address string. |
| 2835 | * @hide |
| 2836 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 2837 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 2838 | public static String extractAddrSpec(String address) { |
| 2839 | Matcher match = NAME_ADDR_EMAIL_PATTERN.matcher(address); |
| 2840 | |
| 2841 | if (match.matches()) { |
| 2842 | return match.group(2); |
| 2843 | } |
| 2844 | return address; |
| 2845 | } |
| 2846 | |
| 2847 | /** |
| 2848 | * Is the specified address an email address? |
| 2849 | * |
| 2850 | * @param address the input address to test |
| 2851 | * @return true if address is an email address; false otherwise. |
| 2852 | * @hide |
| 2853 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 2854 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 2855 | public static boolean isEmailAddress(String address) { |
| 2856 | if (TextUtils.isEmpty(address)) { |
| 2857 | return false; |
| 2858 | } |
| 2859 | |
| 2860 | String s = extractAddrSpec(address); |
| 2861 | Matcher match = Patterns.EMAIL_ADDRESS.matcher(s); |
| 2862 | return match.matches(); |
| 2863 | } |
| 2864 | |
| 2865 | /** |
| 2866 | * Is the specified number a phone number? |
| 2867 | * |
| 2868 | * @param number the input number to test |
| 2869 | * @return true if number is a phone number; false otherwise. |
| 2870 | * @hide |
| 2871 | */ |
Mathew Inwood | 6750f2e | 2018-08-10 09:29:25 +0100 | [diff] [blame] | 2872 | @UnsupportedAppUsage |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 2873 | public static boolean isPhoneNumber(String number) { |
| 2874 | if (TextUtils.isEmpty(number)) { |
| 2875 | return false; |
| 2876 | } |
| 2877 | |
| 2878 | Matcher match = Patterns.PHONE.matcher(number); |
| 2879 | return match.matches(); |
| 2880 | } |
| 2881 | |
| 2882 | /** |
| 2883 | * Contains all MMS messages in the MMS app inbox. |
| 2884 | */ |
| 2885 | public static final class Inbox implements BaseMmsColumns { |
| 2886 | |
| 2887 | /** |
| 2888 | * Not instantiable. |
| 2889 | * @hide |
| 2890 | */ |
| 2891 | private Inbox() { |
| 2892 | } |
| 2893 | |
| 2894 | /** |
| 2895 | * The {@code content://} style URL for this table. |
| 2896 | */ |
| 2897 | public static final Uri |
| 2898 | CONTENT_URI = Uri.parse("content://mms/inbox"); |
| 2899 | |
| 2900 | /** |
| 2901 | * The default sort order for this table. |
| 2902 | */ |
| 2903 | public static final String DEFAULT_SORT_ORDER = "date DESC"; |
| 2904 | } |
| 2905 | |
| 2906 | /** |
| 2907 | * Contains all MMS messages in the MMS app sent folder. |
| 2908 | */ |
| 2909 | public static final class Sent implements BaseMmsColumns { |
| 2910 | |
| 2911 | /** |
| 2912 | * Not instantiable. |
| 2913 | * @hide |
| 2914 | */ |
| 2915 | private Sent() { |
| 2916 | } |
| 2917 | |
| 2918 | /** |
| 2919 | * The {@code content://} style URL for this table. |
| 2920 | */ |
| 2921 | public static final Uri |
| 2922 | CONTENT_URI = Uri.parse("content://mms/sent"); |
| 2923 | |
| 2924 | /** |
| 2925 | * The default sort order for this table. |
| 2926 | */ |
| 2927 | public static final String DEFAULT_SORT_ORDER = "date DESC"; |
| 2928 | } |
| 2929 | |
| 2930 | /** |
| 2931 | * Contains all MMS messages in the MMS app drafts folder. |
| 2932 | */ |
| 2933 | public static final class Draft implements BaseMmsColumns { |
| 2934 | |
| 2935 | /** |
| 2936 | * Not instantiable. |
| 2937 | * @hide |
| 2938 | */ |
| 2939 | private Draft() { |
| 2940 | } |
| 2941 | |
| 2942 | /** |
| 2943 | * The {@code content://} style URL for this table. |
| 2944 | */ |
| 2945 | public static final Uri |
| 2946 | CONTENT_URI = Uri.parse("content://mms/drafts"); |
| 2947 | |
| 2948 | /** |
| 2949 | * The default sort order for this table. |
| 2950 | */ |
| 2951 | public static final String DEFAULT_SORT_ORDER = "date DESC"; |
| 2952 | } |
| 2953 | |
| 2954 | /** |
| 2955 | * Contains all MMS messages in the MMS app outbox. |
| 2956 | */ |
| 2957 | public static final class Outbox implements BaseMmsColumns { |
| 2958 | |
| 2959 | /** |
| 2960 | * Not instantiable. |
| 2961 | * @hide |
| 2962 | */ |
| 2963 | private Outbox() { |
| 2964 | } |
| 2965 | |
| 2966 | /** |
| 2967 | * The {@code content://} style URL for this table. |
| 2968 | */ |
| 2969 | public static final Uri |
| 2970 | CONTENT_URI = Uri.parse("content://mms/outbox"); |
| 2971 | |
| 2972 | /** |
| 2973 | * The default sort order for this table. |
| 2974 | */ |
| 2975 | public static final String DEFAULT_SORT_ORDER = "date DESC"; |
| 2976 | } |
| 2977 | |
| 2978 | /** |
| 2979 | * Contains address information for an MMS message. |
| 2980 | */ |
| 2981 | public static final class Addr implements BaseColumns { |
| 2982 | |
| 2983 | /** |
| 2984 | * Not instantiable. |
| 2985 | * @hide |
| 2986 | */ |
| 2987 | private Addr() { |
| 2988 | } |
| 2989 | |
| 2990 | /** |
| 2991 | * The ID of MM which this address entry belongs to. |
| 2992 | * <P>Type: INTEGER (long)</P> |
| 2993 | */ |
| 2994 | public static final String MSG_ID = "msg_id"; |
| 2995 | |
| 2996 | /** |
| 2997 | * The ID of contact entry in Phone Book. |
| 2998 | * <P>Type: INTEGER (long)</P> |
| 2999 | */ |
| 3000 | public static final String CONTACT_ID = "contact_id"; |
| 3001 | |
| 3002 | /** |
| 3003 | * The address text. |
| 3004 | * <P>Type: TEXT</P> |
| 3005 | */ |
| 3006 | public static final String ADDRESS = "address"; |
| 3007 | |
| 3008 | /** |
| 3009 | * Type of address: must be one of {@code PduHeaders.BCC}, |
| 3010 | * {@code PduHeaders.CC}, {@code PduHeaders.FROM}, {@code PduHeaders.TO}. |
| 3011 | * <P>Type: INTEGER</P> |
| 3012 | */ |
| 3013 | public static final String TYPE = "type"; |
| 3014 | |
| 3015 | /** |
| 3016 | * Character set of this entry (MMS charset value). |
| 3017 | * <P>Type: INTEGER</P> |
| 3018 | */ |
| 3019 | public static final String CHARSET = "charset"; |
| 3020 | } |
| 3021 | |
| 3022 | /** |
| 3023 | * Contains message parts. |
Leland Miller | 6c75355 | 2019-01-22 17:28:55 -0800 | [diff] [blame] | 3024 | * |
| 3025 | * To avoid issues where applications might cache a part ID, the ID of a deleted part must |
| 3026 | * not be reused to point at a new part. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3027 | */ |
| 3028 | public static final class Part implements BaseColumns { |
| 3029 | |
| 3030 | /** |
| 3031 | * Not instantiable. |
| 3032 | * @hide |
| 3033 | */ |
| 3034 | private Part() { |
| 3035 | } |
| 3036 | |
| 3037 | /** |
Leland Miller | 6c75355 | 2019-01-22 17:28:55 -0800 | [diff] [blame] | 3038 | * The {@code content://} style URL for this table. Can be appended with a part ID to |
| 3039 | * address individual parts. |
| 3040 | */ |
| 3041 | public static final Uri CONTENT_URI = Uri.withAppendedPath(Mms.CONTENT_URI, "part"); |
| 3042 | |
| 3043 | /** |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3044 | * The identifier of the message which this part belongs to. |
| 3045 | * <P>Type: INTEGER</P> |
| 3046 | */ |
| 3047 | public static final String MSG_ID = "mid"; |
| 3048 | |
| 3049 | /** |
| 3050 | * The order of the part. |
| 3051 | * <P>Type: INTEGER</P> |
| 3052 | */ |
| 3053 | public static final String SEQ = "seq"; |
| 3054 | |
| 3055 | /** |
| 3056 | * The content type of the part. |
| 3057 | * <P>Type: TEXT</P> |
| 3058 | */ |
| 3059 | public static final String CONTENT_TYPE = "ct"; |
| 3060 | |
| 3061 | /** |
| 3062 | * The name of the part. |
| 3063 | * <P>Type: TEXT</P> |
| 3064 | */ |
| 3065 | public static final String NAME = "name"; |
| 3066 | |
| 3067 | /** |
| 3068 | * The charset of the part. |
| 3069 | * <P>Type: TEXT</P> |
| 3070 | */ |
| 3071 | public static final String CHARSET = "chset"; |
| 3072 | |
| 3073 | /** |
| 3074 | * The file name of the part. |
| 3075 | * <P>Type: TEXT</P> |
| 3076 | */ |
| 3077 | public static final String FILENAME = "fn"; |
| 3078 | |
| 3079 | /** |
| 3080 | * The content disposition of the part. |
| 3081 | * <P>Type: TEXT</P> |
| 3082 | */ |
| 3083 | public static final String CONTENT_DISPOSITION = "cd"; |
| 3084 | |
| 3085 | /** |
| 3086 | * The content ID of the part. |
| 3087 | * <P>Type: INTEGER</P> |
| 3088 | */ |
| 3089 | public static final String CONTENT_ID = "cid"; |
| 3090 | |
| 3091 | /** |
| 3092 | * The content location of the part. |
| 3093 | * <P>Type: INTEGER</P> |
| 3094 | */ |
| 3095 | public static final String CONTENT_LOCATION = "cl"; |
| 3096 | |
| 3097 | /** |
| 3098 | * The start of content-type of the message. |
| 3099 | * <P>Type: INTEGER</P> |
| 3100 | */ |
| 3101 | public static final String CT_START = "ctt_s"; |
| 3102 | |
| 3103 | /** |
| 3104 | * The type of content-type of the message. |
| 3105 | * <P>Type: TEXT</P> |
| 3106 | */ |
| 3107 | public static final String CT_TYPE = "ctt_t"; |
| 3108 | |
| 3109 | /** |
| 3110 | * The location (on filesystem) of the binary data of the part. |
| 3111 | * <P>Type: INTEGER</P> |
| 3112 | */ |
| 3113 | public static final String _DATA = "_data"; |
| 3114 | |
| 3115 | /** |
| 3116 | * The message text. |
| 3117 | * <P>Type: TEXT</P> |
| 3118 | */ |
| 3119 | public static final String TEXT = "text"; |
| 3120 | } |
| 3121 | |
| 3122 | /** |
| 3123 | * Message send rate table. |
| 3124 | */ |
| 3125 | public static final class Rate { |
| 3126 | |
| 3127 | /** |
| 3128 | * Not instantiable. |
| 3129 | * @hide |
| 3130 | */ |
| 3131 | private Rate() { |
| 3132 | } |
| 3133 | |
| 3134 | /** |
| 3135 | * The {@code content://} style URL for this table. |
| 3136 | */ |
| 3137 | public static final Uri CONTENT_URI = Uri.withAppendedPath( |
| 3138 | Mms.CONTENT_URI, "rate"); |
| 3139 | |
| 3140 | /** |
| 3141 | * When a message was successfully sent. |
| 3142 | * <P>Type: INTEGER (long)</P> |
| 3143 | */ |
| 3144 | public static final String SENT_TIME = "sent_time"; |
| 3145 | } |
| 3146 | |
| 3147 | /** |
| 3148 | * Intents class. |
| 3149 | */ |
| 3150 | public static final class Intents { |
| 3151 | |
| 3152 | /** |
| 3153 | * Not instantiable. |
| 3154 | * @hide |
| 3155 | */ |
| 3156 | private Intents() { |
| 3157 | } |
| 3158 | |
| 3159 | /** |
| 3160 | * Indicates that the contents of specified URIs were changed. |
| 3161 | * The application which is showing or caching these contents |
| 3162 | * should be updated. |
| 3163 | */ |
| 3164 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3165 | public static final String CONTENT_CHANGED_ACTION |
| 3166 | = "android.intent.action.CONTENT_CHANGED"; |
| 3167 | |
| 3168 | /** |
| 3169 | * An extra field which stores the URI of deleted contents. |
| 3170 | */ |
| 3171 | public static final String DELETED_CONTENTS = "deleted_contents"; |
| 3172 | } |
| 3173 | } |
| 3174 | |
| 3175 | /** |
| 3176 | * Contains all MMS and SMS messages. |
| 3177 | */ |
| 3178 | public static final class MmsSms implements BaseColumns { |
| 3179 | |
| 3180 | /** |
| 3181 | * Not instantiable. |
| 3182 | * @hide |
| 3183 | */ |
| 3184 | private MmsSms() { |
| 3185 | } |
| 3186 | |
| 3187 | /** |
| 3188 | * The column to distinguish SMS and MMS messages in query results. |
| 3189 | */ |
| 3190 | public static final String TYPE_DISCRIMINATOR_COLUMN = |
| 3191 | "transport_type"; |
| 3192 | |
| 3193 | /** |
| 3194 | * The {@code content://} style URL for this table. |
| 3195 | */ |
| 3196 | public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/"); |
| 3197 | |
| 3198 | /** |
| 3199 | * The {@code content://} style URL for this table, by conversation. |
| 3200 | */ |
| 3201 | public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse( |
| 3202 | "content://mms-sms/conversations"); |
| 3203 | |
| 3204 | /** |
| 3205 | * The {@code content://} style URL for this table, by phone number. |
| 3206 | */ |
| 3207 | public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse( |
| 3208 | "content://mms-sms/messages/byphone"); |
| 3209 | |
| 3210 | /** |
| 3211 | * The {@code content://} style URL for undelivered messages in this table. |
| 3212 | */ |
| 3213 | public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse( |
| 3214 | "content://mms-sms/undelivered"); |
| 3215 | |
| 3216 | /** |
| 3217 | * The {@code content://} style URL for draft messages in this table. |
| 3218 | */ |
| 3219 | public static final Uri CONTENT_DRAFT_URI = Uri.parse( |
| 3220 | "content://mms-sms/draft"); |
| 3221 | |
| 3222 | /** |
| 3223 | * The {@code content://} style URL for locked messages in this table. |
| 3224 | */ |
| 3225 | public static final Uri CONTENT_LOCKED_URI = Uri.parse( |
| 3226 | "content://mms-sms/locked"); |
| 3227 | |
| 3228 | /** |
| 3229 | * Pass in a query parameter called "pattern" which is the text to search for. |
| 3230 | * The sort order is fixed to be: {@code thread_id ASC, date DESC}. |
| 3231 | */ |
| 3232 | public static final Uri SEARCH_URI = Uri.parse( |
| 3233 | "content://mms-sms/search"); |
| 3234 | |
| 3235 | // Constants for message protocol types. |
| 3236 | |
| 3237 | /** SMS protocol type. */ |
| 3238 | public static final int SMS_PROTO = 0; |
| 3239 | |
| 3240 | /** MMS protocol type. */ |
| 3241 | public static final int MMS_PROTO = 1; |
| 3242 | |
| 3243 | // Constants for error types of pending messages. |
| 3244 | |
| 3245 | /** Error type: no error. */ |
| 3246 | public static final int NO_ERROR = 0; |
| 3247 | |
| 3248 | /** Error type: generic transient error. */ |
| 3249 | public static final int ERR_TYPE_GENERIC = 1; |
| 3250 | |
| 3251 | /** Error type: SMS protocol transient error. */ |
| 3252 | public static final int ERR_TYPE_SMS_PROTO_TRANSIENT = 2; |
| 3253 | |
| 3254 | /** Error type: MMS protocol transient error. */ |
| 3255 | public static final int ERR_TYPE_MMS_PROTO_TRANSIENT = 3; |
| 3256 | |
| 3257 | /** Error type: transport failure. */ |
| 3258 | public static final int ERR_TYPE_TRANSPORT_FAILURE = 4; |
| 3259 | |
| 3260 | /** Error type: permanent error (along with all higher error values). */ |
| 3261 | public static final int ERR_TYPE_GENERIC_PERMANENT = 10; |
| 3262 | |
| 3263 | /** Error type: SMS protocol permanent error. */ |
| 3264 | public static final int ERR_TYPE_SMS_PROTO_PERMANENT = 11; |
| 3265 | |
| 3266 | /** Error type: MMS protocol permanent error. */ |
| 3267 | public static final int ERR_TYPE_MMS_PROTO_PERMANENT = 12; |
| 3268 | |
| 3269 | /** |
| 3270 | * Contains pending messages info. |
| 3271 | */ |
| 3272 | public static final class PendingMessages implements BaseColumns { |
| 3273 | |
| 3274 | /** |
| 3275 | * Not instantiable. |
| 3276 | * @hide |
| 3277 | */ |
| 3278 | private PendingMessages() { |
| 3279 | } |
| 3280 | |
| 3281 | public static final Uri CONTENT_URI = Uri.withAppendedPath( |
| 3282 | MmsSms.CONTENT_URI, "pending"); |
| 3283 | |
| 3284 | /** |
| 3285 | * The type of transport protocol (MMS or SMS). |
| 3286 | * <P>Type: INTEGER</P> |
| 3287 | */ |
| 3288 | public static final String PROTO_TYPE = "proto_type"; |
| 3289 | |
| 3290 | /** |
| 3291 | * The ID of the message to be sent or downloaded. |
| 3292 | * <P>Type: INTEGER (long)</P> |
| 3293 | */ |
| 3294 | public static final String MSG_ID = "msg_id"; |
| 3295 | |
| 3296 | /** |
| 3297 | * The type of the message to be sent or downloaded. |
| 3298 | * This field is only valid for MM. For SM, its value is always set to 0. |
| 3299 | * <P>Type: INTEGER</P> |
| 3300 | */ |
| 3301 | public static final String MSG_TYPE = "msg_type"; |
| 3302 | |
| 3303 | /** |
| 3304 | * The type of the error code. |
| 3305 | * <P>Type: INTEGER</P> |
| 3306 | */ |
| 3307 | public static final String ERROR_TYPE = "err_type"; |
| 3308 | |
| 3309 | /** |
| 3310 | * The error code of sending/retrieving process. |
| 3311 | * <P>Type: INTEGER</P> |
| 3312 | */ |
| 3313 | public static final String ERROR_CODE = "err_code"; |
| 3314 | |
| 3315 | /** |
| 3316 | * How many times we tried to send or download the message. |
| 3317 | * <P>Type: INTEGER</P> |
| 3318 | */ |
| 3319 | public static final String RETRY_INDEX = "retry_index"; |
| 3320 | |
| 3321 | /** |
| 3322 | * The time to do next retry. |
| 3323 | * <P>Type: INTEGER (long)</P> |
| 3324 | */ |
| 3325 | public static final String DUE_TIME = "due_time"; |
| 3326 | |
| 3327 | /** |
| 3328 | * The time we last tried to send or download the message. |
| 3329 | * <P>Type: INTEGER (long)</P> |
| 3330 | */ |
| 3331 | public static final String LAST_TRY = "last_try"; |
| 3332 | |
| 3333 | /** |
| 3334 | * The subscription to which the message belongs to. Its value will be |
| 3335 | * < 0 if the sub id cannot be determined. |
| 3336 | * <p>Type: INTEGER (long) </p> |
| 3337 | */ |
| 3338 | public static final String SUBSCRIPTION_ID = "pending_sub_id"; |
| 3339 | } |
| 3340 | |
| 3341 | /** |
| 3342 | * Words table used by provider for full-text searches. |
| 3343 | * @hide |
| 3344 | */ |
| 3345 | public static final class WordsTable { |
| 3346 | |
| 3347 | /** |
| 3348 | * Not instantiable. |
| 3349 | * @hide |
| 3350 | */ |
| 3351 | private WordsTable() {} |
| 3352 | |
| 3353 | /** |
| 3354 | * Primary key. |
| 3355 | * <P>Type: INTEGER (long)</P> |
| 3356 | */ |
| 3357 | public static final String ID = "_id"; |
| 3358 | |
| 3359 | /** |
| 3360 | * Source row ID. |
| 3361 | * <P>Type: INTEGER (long)</P> |
| 3362 | */ |
| 3363 | public static final String SOURCE_ROW_ID = "source_id"; |
| 3364 | |
| 3365 | /** |
| 3366 | * Table ID (either 1 or 2). |
| 3367 | * <P>Type: INTEGER</P> |
| 3368 | */ |
| 3369 | public static final String TABLE_ID = "table_to_use"; |
| 3370 | |
| 3371 | /** |
| 3372 | * The words to index. |
| 3373 | * <P>Type: TEXT</P> |
| 3374 | */ |
| 3375 | public static final String INDEXED_TEXT = "index_text"; |
| 3376 | } |
| 3377 | } |
| 3378 | |
| 3379 | /** |
| 3380 | * Carriers class contains information about APNs, including MMSC information. |
| 3381 | */ |
| 3382 | public static final class Carriers implements BaseColumns { |
| 3383 | |
| 3384 | /** |
| 3385 | * Not instantiable. |
| 3386 | * @hide |
| 3387 | */ |
| 3388 | private Carriers() {} |
| 3389 | |
| 3390 | /** |
| 3391 | * The {@code content://} style URL for this table. |
calvinpan | 5e27237 | 2018-12-07 20:03:48 +0800 | [diff] [blame] | 3392 | * For MSIM, this will return APNs for the default subscription |
| 3393 | * {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId for MSIM, |
| 3394 | * use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3395 | */ |
| 3396 | public static final Uri CONTENT_URI = Uri.parse("content://telephony/carriers"); |
| 3397 | |
| 3398 | /** |
calvinpan | 5e27237 | 2018-12-07 20:03:48 +0800 | [diff] [blame] | 3399 | * The {@code content://} style URL for this table. Used for APN query based on current |
| 3400 | * subscription. Instead of specifying carrier matching information in the selection, |
| 3401 | * this API will return all matching APNs from current subscription carrier and queries |
| 3402 | * will be applied on top of that. If there is no match for MVNO (Mobile Virtual Network |
| 3403 | * Operator) APNs, return APNs from its MNO (based on mccmnc) instead. For MSIM, this will |
| 3404 | * return APNs for the default subscription |
| 3405 | * {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId for MSIM, |
| 3406 | * use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id. |
| 3407 | */ |
| 3408 | public static final Uri SIM_APN_URI = Uri.parse( |
| 3409 | "content://telephony/carriers/sim_apn_list"); |
| 3410 | |
| 3411 | /** |
yuemingw | 4c0065f | 2018-01-16 19:48:10 +0000 | [diff] [blame] | 3412 | * The {@code content://} style URL to be called from DevicePolicyManagerService, |
| 3413 | * can manage DPC-owned APNs. |
| 3414 | * @hide |
| 3415 | */ |
| 3416 | public static final Uri DPC_URI = Uri.parse("content://telephony/carriers/dpc"); |
| 3417 | |
| 3418 | /** |
| 3419 | * The {@code content://} style URL to be called from Telephony to query APNs. |
| 3420 | * When DPC-owned APNs are enforced, only DPC-owned APNs are returned, otherwise only |
calvinpan | 5e27237 | 2018-12-07 20:03:48 +0800 | [diff] [blame] | 3421 | * non-DPC-owned APNs are returned. For MSIM, this will return APNs for the default |
| 3422 | * subscription {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId |
| 3423 | * for MSIM, use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id. |
yuemingw | 4c0065f | 2018-01-16 19:48:10 +0000 | [diff] [blame] | 3424 | * @hide |
| 3425 | */ |
| 3426 | public static final Uri FILTERED_URI = Uri.parse("content://telephony/carriers/filtered"); |
| 3427 | |
| 3428 | /** |
| 3429 | * The {@code content://} style URL to be called from DevicePolicyManagerService |
| 3430 | * or Telephony to manage whether DPC-owned APNs are enforced. |
| 3431 | * @hide |
| 3432 | */ |
| 3433 | public static final Uri ENFORCE_MANAGED_URI = Uri.parse( |
| 3434 | "content://telephony/carriers/enforce_managed"); |
| 3435 | |
| 3436 | /** |
| 3437 | * The column name for ENFORCE_MANAGED_URI, indicates whether DPC-owned APNs are enforced. |
| 3438 | * @hide |
| 3439 | */ |
| 3440 | public static final String ENFORCE_KEY = "enforced"; |
| 3441 | |
| 3442 | /** |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3443 | * The default sort order for this table. |
| 3444 | */ |
| 3445 | public static final String DEFAULT_SORT_ORDER = "name ASC"; |
| 3446 | |
| 3447 | /** |
| 3448 | * Entry name. |
| 3449 | * <P>Type: TEXT</P> |
| 3450 | */ |
| 3451 | public static final String NAME = "name"; |
| 3452 | |
| 3453 | /** |
| 3454 | * APN name. |
| 3455 | * <P>Type: TEXT</P> |
| 3456 | */ |
| 3457 | public static final String APN = "apn"; |
| 3458 | |
| 3459 | /** |
| 3460 | * Proxy address. |
| 3461 | * <P>Type: TEXT</P> |
| 3462 | */ |
| 3463 | public static final String PROXY = "proxy"; |
| 3464 | |
| 3465 | /** |
| 3466 | * Proxy port. |
| 3467 | * <P>Type: TEXT</P> |
| 3468 | */ |
| 3469 | public static final String PORT = "port"; |
| 3470 | |
| 3471 | /** |
| 3472 | * MMS proxy address. |
| 3473 | * <P>Type: TEXT</P> |
| 3474 | */ |
| 3475 | public static final String MMSPROXY = "mmsproxy"; |
| 3476 | |
| 3477 | /** |
| 3478 | * MMS proxy port. |
| 3479 | * <P>Type: TEXT</P> |
| 3480 | */ |
| 3481 | public static final String MMSPORT = "mmsport"; |
| 3482 | |
| 3483 | /** |
| 3484 | * Server address. |
| 3485 | * <P>Type: TEXT</P> |
| 3486 | */ |
| 3487 | public static final String SERVER = "server"; |
| 3488 | |
| 3489 | /** |
| 3490 | * APN username. |
| 3491 | * <P>Type: TEXT</P> |
| 3492 | */ |
| 3493 | public static final String USER = "user"; |
| 3494 | |
| 3495 | /** |
| 3496 | * APN password. |
| 3497 | * <P>Type: TEXT</P> |
| 3498 | */ |
| 3499 | public static final String PASSWORD = "password"; |
| 3500 | |
| 3501 | /** |
| 3502 | * MMSC URL. |
| 3503 | * <P>Type: TEXT</P> |
| 3504 | */ |
| 3505 | public static final String MMSC = "mmsc"; |
| 3506 | |
| 3507 | /** |
| 3508 | * Mobile Country Code (MCC). |
| 3509 | * <P>Type: TEXT</P> |
calvinpan | 5e27237 | 2018-12-07 20:03:48 +0800 | [diff] [blame] | 3510 | * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return |
| 3511 | * matching APNs based on current subscription carrier, thus no need to specify MCC and |
| 3512 | * other carrier matching information. In the future, Android will not support MCC for |
| 3513 | * APN query. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3514 | */ |
| 3515 | public static final String MCC = "mcc"; |
| 3516 | |
| 3517 | /** |
| 3518 | * Mobile Network Code (MNC). |
| 3519 | * <P>Type: TEXT</P> |
calvinpan | 5e27237 | 2018-12-07 20:03:48 +0800 | [diff] [blame] | 3520 | * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return |
| 3521 | * matching APNs based on current subscription carrier, thus no need to specify MNC and |
| 3522 | * other carrier matching information. In the future, Android will not support MNC for |
| 3523 | * APN query. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3524 | */ |
| 3525 | public static final String MNC = "mnc"; |
| 3526 | |
| 3527 | /** |
| 3528 | * Numeric operator ID (as String). Usually {@code MCC + MNC}. |
| 3529 | * <P>Type: TEXT</P> |
calvinpan | 5e27237 | 2018-12-07 20:03:48 +0800 | [diff] [blame] | 3530 | * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return |
| 3531 | * matching APNs based on current subscription carrier, thus no need to specify Numeric |
| 3532 | * and other carrier matching information. In the future, Android will not support Numeric |
| 3533 | * for APN query. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3534 | */ |
| 3535 | public static final String NUMERIC = "numeric"; |
| 3536 | |
| 3537 | /** |
| 3538 | * Authentication type. |
| 3539 | * <P>Type: INTEGER</P> |
| 3540 | */ |
| 3541 | public static final String AUTH_TYPE = "authtype"; |
| 3542 | |
| 3543 | /** |
| 3544 | * Comma-delimited list of APN types. |
| 3545 | * <P>Type: TEXT</P> |
| 3546 | */ |
| 3547 | public static final String TYPE = "type"; |
| 3548 | |
| 3549 | /** |
| 3550 | * The protocol to use to connect to this APN. |
| 3551 | * |
| 3552 | * One of the {@code PDP_type} values in TS 27.007 section 10.1.1. |
| 3553 | * For example: {@code IP}, {@code IPV6}, {@code IPV4V6}, or {@code PPP}. |
| 3554 | * <P>Type: TEXT</P> |
| 3555 | */ |
| 3556 | public static final String PROTOCOL = "protocol"; |
| 3557 | |
| 3558 | /** |
| 3559 | * The protocol to use to connect to this APN when roaming. |
| 3560 | * The syntax is the same as protocol. |
| 3561 | * <P>Type: TEXT</P> |
| 3562 | */ |
| 3563 | public static final String ROAMING_PROTOCOL = "roaming_protocol"; |
| 3564 | |
| 3565 | /** |
| 3566 | * Is this the current APN? |
| 3567 | * <P>Type: INTEGER (boolean)</P> |
| 3568 | */ |
| 3569 | public static final String CURRENT = "current"; |
| 3570 | |
| 3571 | /** |
| 3572 | * Is this APN enabled? |
| 3573 | * <P>Type: INTEGER (boolean)</P> |
| 3574 | */ |
| 3575 | public static final String CARRIER_ENABLED = "carrier_enabled"; |
| 3576 | |
| 3577 | /** |
| 3578 | * Radio Access Technology info. |
| 3579 | * To check what values are allowed, refer to {@link android.telephony.ServiceState}. |
| 3580 | * This should be spread to other technologies, |
| 3581 | * but is currently only used for LTE (14) and eHRPD (13). |
| 3582 | * <P>Type: INTEGER</P> |
Cassie | e1c8802 | 2018-02-22 08:51:03 -0800 | [diff] [blame] | 3583 | * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3584 | */ |
Cassie | d53df96 | 2017-12-05 13:34:33 -0800 | [diff] [blame] | 3585 | @Deprecated |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3586 | public static final String BEARER = "bearer"; |
| 3587 | |
| 3588 | /** |
| 3589 | * Radio Access Technology bitmask. |
| 3590 | * To check what values can be contained, refer to {@link android.telephony.ServiceState}. |
| 3591 | * 0 indicates all techs otherwise first bit refers to RAT/bearer 1, second bit refers to |
| 3592 | * RAT/bearer 2 and so on. |
| 3593 | * Bitmask for a radio tech R is (1 << (R - 1)) |
| 3594 | * <P>Type: INTEGER</P> |
| 3595 | * @hide |
Cassie | e1c8802 | 2018-02-22 08:51:03 -0800 | [diff] [blame] | 3596 | * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3597 | */ |
Cassie | d53df96 | 2017-12-05 13:34:33 -0800 | [diff] [blame] | 3598 | @Deprecated |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3599 | public static final String BEARER_BITMASK = "bearer_bitmask"; |
| 3600 | |
| 3601 | /** |
Cassie | d53df96 | 2017-12-05 13:34:33 -0800 | [diff] [blame] | 3602 | * Radio technology (network type) bitmask. |
Cassie | e1c8802 | 2018-02-22 08:51:03 -0800 | [diff] [blame] | 3603 | * To check what values can be contained, refer to the NETWORK_TYPE_ constants in |
Cassie | d53df96 | 2017-12-05 13:34:33 -0800 | [diff] [blame] | 3604 | * {@link android.telephony.TelephonyManager}. |
| 3605 | * Bitmask for a radio tech R is (1 << (R - 1)) |
| 3606 | * <P>Type: INTEGER</P> |
| 3607 | */ |
| 3608 | public static final String NETWORK_TYPE_BITMASK = "network_type_bitmask"; |
| 3609 | |
| 3610 | /** |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3611 | * MVNO type: |
| 3612 | * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}. |
| 3613 | * <P>Type: TEXT</P> |
calvinpan | 5e27237 | 2018-12-07 20:03:48 +0800 | [diff] [blame] | 3614 | * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return |
| 3615 | * matching APNs based on current subscription carrier, thus no need to specify MVNO_TYPE |
| 3616 | * and other carrier matching information. In the future, Android will not support MVNO_TYPE |
| 3617 | * for APN query. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3618 | */ |
| 3619 | public static final String MVNO_TYPE = "mvno_type"; |
| 3620 | |
| 3621 | /** |
| 3622 | * MVNO data. |
| 3623 | * Use the following examples. |
| 3624 | * <ul> |
| 3625 | * <li>SPN: A MOBILE, BEN NL, ...</li> |
| 3626 | * <li>IMSI: 302720x94, 2060188, ...</li> |
| 3627 | * <li>GID: 4E, 33, ...</li> |
| 3628 | * </ul> |
| 3629 | * <P>Type: TEXT</P> |
calvinpan | 5e27237 | 2018-12-07 20:03:48 +0800 | [diff] [blame] | 3630 | * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return |
| 3631 | * matching APNs based on current subscription carrier, thus no need to specify |
| 3632 | * MVNO_MATCH_DATA and other carrier matching information. In the future, Android will not |
| 3633 | * support MVNO_MATCH_DATA for APN query. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3634 | */ |
| 3635 | public static final String MVNO_MATCH_DATA = "mvno_match_data"; |
| 3636 | |
| 3637 | /** |
| 3638 | * The subscription to which the APN belongs to |
| 3639 | * <p>Type: INTEGER (long) </p> |
| 3640 | */ |
| 3641 | public static final String SUBSCRIPTION_ID = "sub_id"; |
| 3642 | |
| 3643 | /** |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3644 | * The profile_id to which the APN saved in modem. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3645 | * <p>Type: INTEGER</p> |
| 3646 | *@hide |
| 3647 | */ |
| 3648 | public static final String PROFILE_ID = "profile_id"; |
| 3649 | |
| 3650 | /** |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3651 | * If set to {@code true}, then the APN setting will persist to the modem. |
| 3652 | * <p>Type: INTEGER (boolean)</p> |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3653 | *@hide |
| 3654 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3655 | @SystemApi |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3656 | public static final String MODEM_PERSIST = "modem_cognitive"; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3657 | |
| 3658 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3659 | * The max number of connections of this APN. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3660 | * <p>Type: INTEGER</p> |
| 3661 | *@hide |
| 3662 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3663 | @SystemApi |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3664 | public static final String MAX_CONNECTIONS = "max_conns"; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3665 | |
| 3666 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3667 | * The wait time for retrying the APN, in milliseconds. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3668 | * <p>Type: INTEGER</p> |
| 3669 | *@hide |
| 3670 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3671 | @SystemApi |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3672 | public static final String WAIT_TIME_RETRY = "wait_time"; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3673 | |
| 3674 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3675 | * The max number of seconds this APN will support its maximum number of connections |
| 3676 | * as defined in {@link #MAX_CONNECTIONS}. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3677 | * <p>Type: INTEGER</p> |
| 3678 | *@hide |
| 3679 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3680 | @SystemApi |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3681 | public static final String TIME_LIMIT_FOR_MAX_CONNECTIONS = "max_conns_time"; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3682 | |
| 3683 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3684 | * The MTU (maximum transmit unit) size of the mobile interface to which the APN is |
| 3685 | * connected, in bytes. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3686 | * <p>Type: INTEGER </p> |
| 3687 | * @hide |
| 3688 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3689 | @SystemApi |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3690 | public static final String MTU = "mtu"; |
| 3691 | |
| 3692 | /** |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3693 | * APN edit status. APN could be added/edited/deleted by a user or carrier. |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3694 | * see all possible returned APN edit status. |
| 3695 | * <ul> |
| 3696 | * <li>{@link #UNEDITED}</li> |
| 3697 | * <li>{@link #USER_EDITED}</li> |
| 3698 | * <li>{@link #USER_DELETED}</li> |
| 3699 | * <li>{@link #CARRIER_EDITED}</li> |
| 3700 | * <li>{@link #CARRIER_DELETED}</li> |
| 3701 | * </ul> |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3702 | * <p>Type: INTEGER </p> |
| 3703 | * @hide |
| 3704 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3705 | @SystemApi |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3706 | public static final String EDITED_STATUS = "edited"; |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3707 | |
| 3708 | /** |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3709 | * {@code true} if this APN visible to the user, {@code false} otherwise. |
| 3710 | * <p>Type: INTEGER (boolean)</p> |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3711 | * @hide |
| 3712 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3713 | @SystemApi |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3714 | public static final String USER_VISIBLE = "user_visible"; |
| 3715 | |
| 3716 | /** |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3717 | * {@code true} if the user allowed to edit this APN, {@code false} otherwise. |
| 3718 | * <p>Type: INTEGER (boolean)</p> |
Amit Mahajan | d497794 | 2017-07-17 14:46:39 -0700 | [diff] [blame] | 3719 | * @hide |
| 3720 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3721 | @SystemApi |
Amit Mahajan | d497794 | 2017-07-17 14:46:39 -0700 | [diff] [blame] | 3722 | public static final String USER_EDITABLE = "user_editable"; |
| 3723 | |
| 3724 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3725 | * {@link #EDITED_STATUS APN edit status} indicates that this APN has not been edited or |
| 3726 | * fails to edit. |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3727 | * <p>Type: INTEGER </p> |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3728 | * @hide |
| 3729 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3730 | @SystemApi |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3731 | public static final @EditStatus int UNEDITED = 0; |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3732 | |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3733 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3734 | * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by users. |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3735 | * <p>Type: INTEGER </p> |
| 3736 | * @hide |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3737 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3738 | @SystemApi |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3739 | public static final @EditStatus int USER_EDITED = 1; |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3740 | |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3741 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3742 | * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by users. |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3743 | * <p>Type: INTEGER </p> |
| 3744 | * @hide |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3745 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3746 | @SystemApi |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3747 | public static final @EditStatus int USER_DELETED = 2; |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3748 | |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3749 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3750 | * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an |
| 3751 | * entry deleted by the user is still present in the new APN database and therefore must |
| 3752 | * remain tagged as user deleted rather than completely removed from the database. |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3753 | * @hide |
| 3754 | */ |
| 3755 | public static final int USER_DELETED_BUT_PRESENT_IN_XML = 3; |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3756 | |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3757 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3758 | * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by |
| 3759 | * carriers. |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3760 | * <p>Type: INTEGER </p> |
| 3761 | * @hide |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3762 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3763 | @SystemApi |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3764 | public static final @EditStatus int CARRIER_EDITED = 4; |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3765 | |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3766 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3767 | * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by |
| 3768 | * carriers. CARRIER_DELETED values are currently not used as there is no use case. |
| 3769 | * If they are used, delete() will have to change accordingly. Currently it is hardcoded to |
| 3770 | * USER_DELETED. |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3771 | * <p>Type: INTEGER </p> |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3772 | * @hide |
| 3773 | */ |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3774 | public static final @EditStatus int CARRIER_DELETED = 5; |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3775 | |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3776 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3777 | * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an |
| 3778 | * entry deleted by the carrier is still present in the new APN database and therefore must |
| 3779 | * remain tagged as user deleted rather than completely removed from the database. |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3780 | * @hide |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3781 | */ |
| 3782 | public static final int CARRIER_DELETED_BUT_PRESENT_IN_XML = 6; |
yuemingw | cf263eb | 2017-11-08 13:12:18 +0000 | [diff] [blame] | 3783 | |
| 3784 | /** |
| 3785 | * The owner of the APN. |
| 3786 | * <p>Type: INTEGER</p> |
| 3787 | * @hide |
| 3788 | */ |
| 3789 | public static final String OWNED_BY = "owned_by"; |
| 3790 | |
| 3791 | /** |
| 3792 | * Possible value for the OWNED_BY field. |
| 3793 | * APN is owned by DPC. |
| 3794 | * @hide |
| 3795 | */ |
| 3796 | public static final int OWNED_BY_DPC = 0; |
Jordan Liu | 4061715 | 2018-04-06 11:10:12 -0700 | [diff] [blame] | 3797 | |
yuemingw | cf263eb | 2017-11-08 13:12:18 +0000 | [diff] [blame] | 3798 | /** |
| 3799 | * Possible value for the OWNED_BY field. |
| 3800 | * APN is owned by other sources. |
| 3801 | * @hide |
| 3802 | */ |
| 3803 | public static final int OWNED_BY_OTHERS = 1; |
Jordan Liu | 4061715 | 2018-04-06 11:10:12 -0700 | [diff] [blame] | 3804 | |
| 3805 | /** |
| 3806 | * The APN set id. When the user manually selects an APN or the framework sets an APN as |
| 3807 | * preferred, all APNs with the same set id as the selected APN should be prioritized over |
| 3808 | * APNs in other sets. |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3809 | * <p>Type: INTEGER</p> |
Jordan Liu | 4061715 | 2018-04-06 11:10:12 -0700 | [diff] [blame] | 3810 | * @hide |
| 3811 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3812 | @SystemApi |
Jordan Liu | 4061715 | 2018-04-06 11:10:12 -0700 | [diff] [blame] | 3813 | public static final String APN_SET_ID = "apn_set_id"; |
| 3814 | |
| 3815 | /** |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3816 | * Possible value for the {@link #APN_SET_ID} field. By default APNs will not belong to a |
| 3817 | * set. If the user manually selects an APN without apn set id, there is no need to |
| 3818 | * prioritize any specific APN set ids. |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3819 | * <p>Type: INTEGER</p> |
Jordan Liu | 4061715 | 2018-04-06 11:10:12 -0700 | [diff] [blame] | 3820 | * @hide |
| 3821 | */ |
chen xu | 8510048 | 2018-10-12 15:30:34 -0700 | [diff] [blame] | 3822 | @SystemApi |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3823 | public static final int NO_APN_SET_ID = 0; |
Jordan Liu | 4061715 | 2018-04-06 11:10:12 -0700 | [diff] [blame] | 3824 | |
calvinpan | beb6cb3 | 2018-10-19 15:11:22 +0800 | [diff] [blame] | 3825 | /** |
| 3826 | * A unique carrier id associated with this APN |
| 3827 | * {@see TelephonyManager#getSimCarrierId()} |
| 3828 | * <p>Type: STRING</p> |
| 3829 | */ |
| 3830 | public static final String CARRIER_ID = "carrier_id"; |
| 3831 | |
Yuuki Habu | aaea4a5 | 2019-02-22 11:29:26 +0900 | [diff] [blame] | 3832 | /** |
| 3833 | * The skip 464xlat flag. Flag works as follows. |
| 3834 | * {@link #SKIP_464XLAT_DEFAULT}: the APN will skip only APN is IMS and no internet. |
| 3835 | * {@link #SKIP_464XLAT_DISABLE}: the APN will NOT skip 464xlat |
| 3836 | * {@link #SKIP_464XLAT_ENABLE}: the APN will skip 464xlat |
| 3837 | * <p>Type: INTEGER</p> |
| 3838 | * |
| 3839 | * @hide |
| 3840 | */ |
| 3841 | public static final String SKIP_464XLAT = "skip_464xlat"; |
| 3842 | |
| 3843 | /** |
| 3844 | * Possible value for the {@link #SKIP_464XLAT} field. |
| 3845 | * <p>Type: INTEGER</p> |
| 3846 | * |
| 3847 | * @hide |
| 3848 | */ |
| 3849 | public static final int SKIP_464XLAT_DEFAULT = -1; |
| 3850 | |
| 3851 | /** |
| 3852 | * Possible value for the {@link #SKIP_464XLAT} field. |
| 3853 | * <p>Type: INTEGER</p> |
| 3854 | * |
| 3855 | * @hide |
| 3856 | */ |
| 3857 | public static final int SKIP_464XLAT_DISABLE = 0; |
| 3858 | |
| 3859 | /** |
| 3860 | * Possible value for the {@link #SKIP_464XLAT} field. |
| 3861 | * <p>Type: INTEGER</p> |
| 3862 | * |
| 3863 | * @hide |
| 3864 | */ |
| 3865 | public static final int SKIP_464XLAT_ENABLE = 1; |
| 3866 | |
| 3867 | |
chen xu | 5caa18c | 2018-11-28 00:21:50 -0800 | [diff] [blame] | 3868 | /** @hide */ |
| 3869 | @IntDef({ |
| 3870 | UNEDITED, |
| 3871 | USER_EDITED, |
| 3872 | USER_DELETED, |
| 3873 | CARRIER_DELETED, |
| 3874 | CARRIER_EDITED, |
| 3875 | }) |
| 3876 | @Retention(RetentionPolicy.SOURCE) |
| 3877 | public @interface EditStatus {} |
Yuuki Habu | aaea4a5 | 2019-02-22 11:29:26 +0900 | [diff] [blame] | 3878 | |
| 3879 | /** @hide */ |
| 3880 | @IntDef({ |
| 3881 | SKIP_464XLAT_DEFAULT, |
| 3882 | SKIP_464XLAT_DISABLE, |
| 3883 | SKIP_464XLAT_ENABLE, |
| 3884 | }) |
| 3885 | @Retention(RetentionPolicy.SOURCE) |
| 3886 | public @interface Skip464XlatStatus {} |
| 3887 | |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 3888 | } |
| 3889 | |
| 3890 | /** |
| 3891 | * Contains received SMS cell broadcast messages. |
| 3892 | * @hide |
| 3893 | */ |
| 3894 | public static final class CellBroadcasts implements BaseColumns { |
| 3895 | |
| 3896 | /** |
| 3897 | * Not instantiable. |
| 3898 | * @hide |
| 3899 | */ |
| 3900 | private CellBroadcasts() {} |
| 3901 | |
| 3902 | /** |
| 3903 | * The {@code content://} URI for this table. |
| 3904 | */ |
| 3905 | public static final Uri CONTENT_URI = Uri.parse("content://cellbroadcasts"); |
| 3906 | |
| 3907 | /** |
| 3908 | * Message geographical scope. |
| 3909 | * <P>Type: INTEGER</P> |
| 3910 | */ |
| 3911 | public static final String GEOGRAPHICAL_SCOPE = "geo_scope"; |
| 3912 | |
| 3913 | /** |
| 3914 | * Message serial number. |
| 3915 | * <P>Type: INTEGER</P> |
| 3916 | */ |
| 3917 | public static final String SERIAL_NUMBER = "serial_number"; |
| 3918 | |
| 3919 | /** |
| 3920 | * PLMN of broadcast sender. {@code SERIAL_NUMBER + PLMN + LAC + CID} uniquely identifies |
| 3921 | * a broadcast for duplicate detection purposes. |
| 3922 | * <P>Type: TEXT</P> |
| 3923 | */ |
| 3924 | public static final String PLMN = "plmn"; |
| 3925 | |
| 3926 | /** |
| 3927 | * Location Area (GSM) or Service Area (UMTS) of broadcast sender. Unused for CDMA. |
| 3928 | * Only included if Geographical Scope of message is not PLMN wide (01). |
| 3929 | * <P>Type: INTEGER</P> |
| 3930 | */ |
| 3931 | public static final String LAC = "lac"; |
| 3932 | |
| 3933 | /** |
| 3934 | * Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the |
| 3935 | * Geographical Scope of message is cell wide (00 or 11). |
| 3936 | * <P>Type: INTEGER</P> |
| 3937 | */ |
| 3938 | public static final String CID = "cid"; |
| 3939 | |
| 3940 | /** |
| 3941 | * Message code. <em>OBSOLETE: merged into SERIAL_NUMBER.</em> |
| 3942 | * <P>Type: INTEGER</P> |
| 3943 | */ |
| 3944 | public static final String V1_MESSAGE_CODE = "message_code"; |
| 3945 | |
| 3946 | /** |
| 3947 | * Message identifier. <em>OBSOLETE: renamed to SERVICE_CATEGORY.</em> |
| 3948 | * <P>Type: INTEGER</P> |
| 3949 | */ |
| 3950 | public static final String V1_MESSAGE_IDENTIFIER = "message_id"; |
| 3951 | |
| 3952 | /** |
| 3953 | * Service category (GSM/UMTS: message identifier; CDMA: service category). |
| 3954 | * <P>Type: INTEGER</P> |
| 3955 | */ |
| 3956 | public static final String SERVICE_CATEGORY = "service_category"; |
| 3957 | |
| 3958 | /** |
| 3959 | * Message language code. |
| 3960 | * <P>Type: TEXT</P> |
| 3961 | */ |
| 3962 | public static final String LANGUAGE_CODE = "language"; |
| 3963 | |
| 3964 | /** |
| 3965 | * Message body. |
| 3966 | * <P>Type: TEXT</P> |
| 3967 | */ |
| 3968 | public static final String MESSAGE_BODY = "body"; |
| 3969 | |
| 3970 | /** |
| 3971 | * Message delivery time. |
| 3972 | * <P>Type: INTEGER (long)</P> |
| 3973 | */ |
| 3974 | public static final String DELIVERY_TIME = "date"; |
| 3975 | |
| 3976 | /** |
| 3977 | * Has the message been viewed? |
| 3978 | * <P>Type: INTEGER (boolean)</P> |
| 3979 | */ |
| 3980 | public static final String MESSAGE_READ = "read"; |
| 3981 | |
| 3982 | /** |
| 3983 | * Message format (3GPP or 3GPP2). |
| 3984 | * <P>Type: INTEGER</P> |
| 3985 | */ |
| 3986 | public static final String MESSAGE_FORMAT = "format"; |
| 3987 | |
| 3988 | /** |
| 3989 | * Message priority (including emergency). |
| 3990 | * <P>Type: INTEGER</P> |
| 3991 | */ |
| 3992 | public static final String MESSAGE_PRIORITY = "priority"; |
| 3993 | |
| 3994 | /** |
| 3995 | * ETWS warning type (ETWS alerts only). |
| 3996 | * <P>Type: INTEGER</P> |
| 3997 | */ |
| 3998 | public static final String ETWS_WARNING_TYPE = "etws_warning_type"; |
| 3999 | |
| 4000 | /** |
| 4001 | * CMAS message class (CMAS alerts only). |
| 4002 | * <P>Type: INTEGER</P> |
| 4003 | */ |
| 4004 | public static final String CMAS_MESSAGE_CLASS = "cmas_message_class"; |
| 4005 | |
| 4006 | /** |
| 4007 | * CMAS category (CMAS alerts only). |
| 4008 | * <P>Type: INTEGER</P> |
| 4009 | */ |
| 4010 | public static final String CMAS_CATEGORY = "cmas_category"; |
| 4011 | |
| 4012 | /** |
| 4013 | * CMAS response type (CMAS alerts only). |
| 4014 | * <P>Type: INTEGER</P> |
| 4015 | */ |
| 4016 | public static final String CMAS_RESPONSE_TYPE = "cmas_response_type"; |
| 4017 | |
| 4018 | /** |
| 4019 | * CMAS severity (CMAS alerts only). |
| 4020 | * <P>Type: INTEGER</P> |
| 4021 | */ |
| 4022 | public static final String CMAS_SEVERITY = "cmas_severity"; |
| 4023 | |
| 4024 | /** |
| 4025 | * CMAS urgency (CMAS alerts only). |
| 4026 | * <P>Type: INTEGER</P> |
| 4027 | */ |
| 4028 | public static final String CMAS_URGENCY = "cmas_urgency"; |
| 4029 | |
| 4030 | /** |
| 4031 | * CMAS certainty (CMAS alerts only). |
| 4032 | * <P>Type: INTEGER</P> |
| 4033 | */ |
| 4034 | public static final String CMAS_CERTAINTY = "cmas_certainty"; |
| 4035 | |
| 4036 | /** The default sort order for this table. */ |
| 4037 | public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC"; |
| 4038 | |
| 4039 | /** |
| 4040 | * Query columns for instantiating {@link android.telephony.CellBroadcastMessage} objects. |
| 4041 | */ |
| 4042 | public static final String[] QUERY_COLUMNS = { |
| 4043 | _ID, |
| 4044 | GEOGRAPHICAL_SCOPE, |
| 4045 | PLMN, |
| 4046 | LAC, |
| 4047 | CID, |
| 4048 | SERIAL_NUMBER, |
| 4049 | SERVICE_CATEGORY, |
| 4050 | LANGUAGE_CODE, |
| 4051 | MESSAGE_BODY, |
| 4052 | DELIVERY_TIME, |
| 4053 | MESSAGE_READ, |
| 4054 | MESSAGE_FORMAT, |
| 4055 | MESSAGE_PRIORITY, |
| 4056 | ETWS_WARNING_TYPE, |
| 4057 | CMAS_MESSAGE_CLASS, |
| 4058 | CMAS_CATEGORY, |
| 4059 | CMAS_RESPONSE_TYPE, |
| 4060 | CMAS_SEVERITY, |
| 4061 | CMAS_URGENCY, |
| 4062 | CMAS_CERTAINTY |
| 4063 | }; |
| 4064 | } |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 4065 | |
| 4066 | /** |
| 4067 | * Constants for interfacing with the ServiceStateProvider and the different fields of the |
| 4068 | * {@link ServiceState} class accessible through the provider. |
| 4069 | */ |
| 4070 | public static final class ServiceStateTable { |
| 4071 | |
| 4072 | /** |
| 4073 | * Not instantiable. |
| 4074 | * @hide |
| 4075 | */ |
| 4076 | private ServiceStateTable() {} |
| 4077 | |
| 4078 | /** |
| 4079 | * The authority string for the ServiceStateProvider |
| 4080 | */ |
| 4081 | public static final String AUTHORITY = "service-state"; |
| 4082 | |
| 4083 | /** |
| 4084 | * The {@code content://} style URL for the ServiceStateProvider |
| 4085 | */ |
| 4086 | public static final Uri CONTENT_URI = Uri.parse("content://service-state/"); |
| 4087 | |
| 4088 | /** |
| 4089 | * Generates a content {@link Uri} used to receive updates on a specific field in the |
| 4090 | * ServiceState provider. |
| 4091 | * <p> |
| 4092 | * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the |
| 4093 | * {@link ServiceState} while your app is running. You can also use a {@link JobService} to |
| 4094 | * ensure your app is notified of changes to the {@link Uri} even when it is not running. |
| 4095 | * Note, however, that using a {@link JobService} does not guarantee timely delivery of |
| 4096 | * updates to the {@link Uri}. |
| 4097 | * |
Jordan Liu | 0f33252 | 2017-04-19 14:25:29 -0700 | [diff] [blame] | 4098 | * @param subscriptionId the subscriptionId to receive updates on |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 4099 | * @param field the ServiceState field to receive updates on |
| 4100 | * @return the Uri used to observe {@link ServiceState} changes |
| 4101 | */ |
Jordan Liu | 0f33252 | 2017-04-19 14:25:29 -0700 | [diff] [blame] | 4102 | public static Uri getUriForSubscriptionIdAndField(int subscriptionId, String field) { |
| 4103 | return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId)) |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 4104 | .appendEncodedPath(field).build(); |
| 4105 | } |
| 4106 | |
| 4107 | /** |
| 4108 | * Generates a content {@link Uri} used to receive updates on every field in the |
| 4109 | * ServiceState provider. |
| 4110 | * <p> |
| 4111 | * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the |
| 4112 | * {@link ServiceState} while your app is running. You can also use a {@link JobService} to |
| 4113 | * ensure your app is notified of changes to the {@link Uri} even when it is not running. |
| 4114 | * Note, however, that using a {@link JobService} does not guarantee timely delivery of |
| 4115 | * updates to the {@link Uri}. |
| 4116 | * |
Jordan Liu | 0f33252 | 2017-04-19 14:25:29 -0700 | [diff] [blame] | 4117 | * @param subscriptionId the subscriptionId to receive updates on |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 4118 | * @return the Uri used to observe {@link ServiceState} changes |
| 4119 | */ |
Jordan Liu | 0f33252 | 2017-04-19 14:25:29 -0700 | [diff] [blame] | 4120 | public static Uri getUriForSubscriptionId(int subscriptionId) { |
| 4121 | return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId)).build(); |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 4122 | } |
| 4123 | |
| 4124 | /** |
| 4125 | * Used to insert a ServiceState into the ServiceStateProvider as a ContentValues instance. |
| 4126 | * |
| 4127 | * @param state the ServiceState to convert into ContentValues |
| 4128 | * @return the convertedContentValues instance |
| 4129 | * @hide |
| 4130 | */ |
| 4131 | public static ContentValues getContentValuesForServiceState(ServiceState state) { |
| 4132 | ContentValues values = new ContentValues(); |
| 4133 | values.put(VOICE_REG_STATE, state.getVoiceRegState()); |
| 4134 | values.put(DATA_REG_STATE, state.getDataRegState()); |
| 4135 | values.put(VOICE_ROAMING_TYPE, state.getVoiceRoamingType()); |
| 4136 | values.put(DATA_ROAMING_TYPE, state.getDataRoamingType()); |
| 4137 | values.put(VOICE_OPERATOR_ALPHA_LONG, state.getVoiceOperatorAlphaLong()); |
| 4138 | values.put(VOICE_OPERATOR_ALPHA_SHORT, state.getVoiceOperatorAlphaShort()); |
| 4139 | values.put(VOICE_OPERATOR_NUMERIC, state.getVoiceOperatorNumeric()); |
| 4140 | values.put(DATA_OPERATOR_ALPHA_LONG, state.getDataOperatorAlphaLong()); |
| 4141 | values.put(DATA_OPERATOR_ALPHA_SHORT, state.getDataOperatorAlphaShort()); |
| 4142 | values.put(DATA_OPERATOR_NUMERIC, state.getDataOperatorNumeric()); |
| 4143 | values.put(IS_MANUAL_NETWORK_SELECTION, state.getIsManualSelection()); |
| 4144 | values.put(RIL_VOICE_RADIO_TECHNOLOGY, state.getRilVoiceRadioTechnology()); |
| 4145 | values.put(RIL_DATA_RADIO_TECHNOLOGY, state.getRilDataRadioTechnology()); |
| 4146 | values.put(CSS_INDICATOR, state.getCssIndicator()); |
Jack Yu | 2661fac | 2018-03-15 13:51:05 -0700 | [diff] [blame] | 4147 | values.put(NETWORK_ID, state.getCdmaNetworkId()); |
| 4148 | values.put(SYSTEM_ID, state.getCdmaSystemId()); |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 4149 | values.put(CDMA_ROAMING_INDICATOR, state.getCdmaRoamingIndicator()); |
| 4150 | values.put(CDMA_DEFAULT_ROAMING_INDICATOR, state.getCdmaDefaultRoamingIndicator()); |
| 4151 | values.put(CDMA_ERI_ICON_INDEX, state.getCdmaEriIconIndex()); |
| 4152 | values.put(CDMA_ERI_ICON_MODE, state.getCdmaEriIconMode()); |
| 4153 | values.put(IS_EMERGENCY_ONLY, state.isEmergencyOnly()); |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 4154 | values.put(IS_USING_CARRIER_AGGREGATION, state.isUsingCarrierAggregation()); |
| 4155 | return values; |
| 4156 | } |
| 4157 | |
| 4158 | /** |
| 4159 | * An integer value indicating the current voice service state. |
| 4160 | * <p> |
| 4161 | * Valid values: {@link ServiceState#STATE_IN_SERVICE}, |
| 4162 | * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY}, |
| 4163 | * {@link ServiceState#STATE_POWER_OFF}. |
| 4164 | * <p> |
| 4165 | * This is the same as {@link ServiceState#getState()}. |
| 4166 | */ |
| 4167 | public static final String VOICE_REG_STATE = "voice_reg_state"; |
| 4168 | |
| 4169 | /** |
| 4170 | * An integer value indicating the current data service state. |
| 4171 | * <p> |
| 4172 | * Valid values: {@link ServiceState#STATE_IN_SERVICE}, |
| 4173 | * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY}, |
| 4174 | * {@link ServiceState#STATE_POWER_OFF}. |
| 4175 | * <p> |
| 4176 | * This is the same as {@link ServiceState#getDataRegState()}. |
| 4177 | * @hide |
| 4178 | */ |
| 4179 | public static final String DATA_REG_STATE = "data_reg_state"; |
| 4180 | |
| 4181 | /** |
| 4182 | * An integer value indicating the current voice roaming type. |
| 4183 | * <p> |
| 4184 | * This is the same as {@link ServiceState#getVoiceRoamingType()}. |
| 4185 | * @hide |
| 4186 | */ |
| 4187 | public static final String VOICE_ROAMING_TYPE = "voice_roaming_type"; |
| 4188 | |
| 4189 | /** |
| 4190 | * An integer value indicating the current data roaming type. |
| 4191 | * <p> |
| 4192 | * This is the same as {@link ServiceState#getDataRoamingType()}. |
| 4193 | * @hide |
| 4194 | */ |
| 4195 | public static final String DATA_ROAMING_TYPE = "data_roaming_type"; |
| 4196 | |
| 4197 | /** |
| 4198 | * The current registered voice network operator name in long alphanumeric format. |
| 4199 | * <p> |
| 4200 | * This is the same as {@link ServiceState#getVoiceOperatorAlphaLong()}. |
| 4201 | * @hide |
| 4202 | */ |
| 4203 | public static final String VOICE_OPERATOR_ALPHA_LONG = "voice_operator_alpha_long"; |
| 4204 | |
| 4205 | /** |
| 4206 | * The current registered operator name in short alphanumeric format. |
| 4207 | * <p> |
| 4208 | * In GSM/UMTS, short format can be up to 8 characters long. The current registered voice |
| 4209 | * network operator name in long alphanumeric format. |
| 4210 | * <p> |
| 4211 | * This is the same as {@link ServiceState#getVoiceOperatorAlphaShort()}. |
| 4212 | * @hide |
| 4213 | */ |
| 4214 | public static final String VOICE_OPERATOR_ALPHA_SHORT = "voice_operator_alpha_short"; |
| 4215 | |
| 4216 | |
| 4217 | /** |
| 4218 | * The current registered operator numeric id. |
| 4219 | * <p> |
| 4220 | * In GSM/UMTS, numeric format is 3 digit country code plus 2 or 3 digit |
| 4221 | * network code. |
| 4222 | * <p> |
| 4223 | * This is the same as {@link ServiceState#getOperatorNumeric()}. |
| 4224 | */ |
| 4225 | public static final String VOICE_OPERATOR_NUMERIC = "voice_operator_numeric"; |
| 4226 | |
| 4227 | /** |
| 4228 | * The current registered data network operator name in long alphanumeric format. |
| 4229 | * <p> |
| 4230 | * This is the same as {@link ServiceState#getDataOperatorAlphaLong()}. |
| 4231 | * @hide |
| 4232 | */ |
| 4233 | public static final String DATA_OPERATOR_ALPHA_LONG = "data_operator_alpha_long"; |
| 4234 | |
| 4235 | /** |
| 4236 | * The current registered data network operator name in short alphanumeric format. |
| 4237 | * <p> |
| 4238 | * This is the same as {@link ServiceState#getDataOperatorAlphaShort()}. |
| 4239 | * @hide |
| 4240 | */ |
| 4241 | public static final String DATA_OPERATOR_ALPHA_SHORT = "data_operator_alpha_short"; |
| 4242 | |
| 4243 | /** |
| 4244 | * The current registered data network operator numeric id. |
| 4245 | * <p> |
| 4246 | * This is the same as {@link ServiceState#getDataOperatorNumeric()}. |
| 4247 | * @hide |
| 4248 | */ |
| 4249 | public static final String DATA_OPERATOR_NUMERIC = "data_operator_numeric"; |
| 4250 | |
| 4251 | /** |
| 4252 | * The current network selection mode. |
| 4253 | * <p> |
| 4254 | * This is the same as {@link ServiceState#getIsManualSelection()}. |
| 4255 | */ |
| 4256 | public static final String IS_MANUAL_NETWORK_SELECTION = "is_manual_network_selection"; |
| 4257 | |
| 4258 | /** |
| 4259 | * This is the same as {@link ServiceState#getRilVoiceRadioTechnology()}. |
| 4260 | * @hide |
| 4261 | */ |
| 4262 | public static final String RIL_VOICE_RADIO_TECHNOLOGY = "ril_voice_radio_technology"; |
| 4263 | |
| 4264 | /** |
| 4265 | * This is the same as {@link ServiceState#getRilDataRadioTechnology()}. |
| 4266 | * @hide |
| 4267 | */ |
| 4268 | public static final String RIL_DATA_RADIO_TECHNOLOGY = "ril_data_radio_technology"; |
| 4269 | |
| 4270 | /** |
| 4271 | * This is the same as {@link ServiceState#getCssIndicator()}. |
| 4272 | * @hide |
| 4273 | */ |
| 4274 | public static final String CSS_INDICATOR = "css_indicator"; |
| 4275 | |
| 4276 | /** |
Jack Yu | 2661fac | 2018-03-15 13:51:05 -0700 | [diff] [blame] | 4277 | * This is the same as {@link ServiceState#getCdmaNetworkId()}. |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 4278 | * @hide |
| 4279 | */ |
| 4280 | public static final String NETWORK_ID = "network_id"; |
| 4281 | |
| 4282 | /** |
Jack Yu | 2661fac | 2018-03-15 13:51:05 -0700 | [diff] [blame] | 4283 | * This is the same as {@link ServiceState#getCdmaSystemId()}. |
Jordan Liu | b9b75ed | 2017-02-28 18:15:07 -0800 | [diff] [blame] | 4284 | * @hide |
| 4285 | */ |
| 4286 | public static final String SYSTEM_ID = "system_id"; |
| 4287 | |
| 4288 | /** |
| 4289 | * This is the same as {@link ServiceState#getCdmaRoamingIndicator()}. |
| 4290 | * @hide |
| 4291 | */ |
| 4292 | public static final String CDMA_ROAMING_INDICATOR = "cdma_roaming_indicator"; |
| 4293 | |
| 4294 | /** |
| 4295 | * This is the same as {@link ServiceState#getCdmaDefaultRoamingIndicator()}. |
| 4296 | * @hide |
| 4297 | */ |
| 4298 | public static final String CDMA_DEFAULT_ROAMING_INDICATOR = |
| 4299 | "cdma_default_roaming_indicator"; |
| 4300 | |
| 4301 | /** |
| 4302 | * This is the same as {@link ServiceState#getCdmaEriIconIndex()}. |
| 4303 | * @hide |
| 4304 | */ |
| 4305 | public static final String CDMA_ERI_ICON_INDEX = "cdma_eri_icon_index"; |
| 4306 | |
| 4307 | /** |
| 4308 | * This is the same as {@link ServiceState#getCdmaEriIconMode()}. |
| 4309 | * @hide |
| 4310 | */ |
| 4311 | public static final String CDMA_ERI_ICON_MODE = "cdma_eri_icon_mode"; |
| 4312 | |
| 4313 | /** |
| 4314 | * This is the same as {@link ServiceState#isEmergencyOnly()}. |
| 4315 | * @hide |
| 4316 | */ |
| 4317 | public static final String IS_EMERGENCY_ONLY = "is_emergency_only"; |
| 4318 | |
| 4319 | /** |
| 4320 | * This is the same as {@link ServiceState#getDataRoamingFromRegistration()}. |
| 4321 | * @hide |
| 4322 | */ |
| 4323 | public static final String IS_DATA_ROAMING_FROM_REGISTRATION = |
| 4324 | "is_data_roaming_from_registration"; |
| 4325 | |
| 4326 | /** |
| 4327 | * This is the same as {@link ServiceState#isUsingCarrierAggregation()}. |
| 4328 | * @hide |
| 4329 | */ |
| 4330 | public static final String IS_USING_CARRIER_AGGREGATION = "is_using_carrier_aggregation"; |
| 4331 | } |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4332 | |
| 4333 | /** |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4334 | * Contains carrier identification information for the current subscriptions. |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4335 | */ |
fionaxu | 62bc747 | 2018-02-28 11:18:45 -0800 | [diff] [blame] | 4336 | public static final class CarrierId implements BaseColumns { |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4337 | /** |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4338 | * Not instantiable. |
| 4339 | * @hide |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4340 | */ |
fionaxu | 62bc747 | 2018-02-28 11:18:45 -0800 | [diff] [blame] | 4341 | private CarrierId() {} |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4342 | |
| 4343 | /** |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4344 | * The {@code content://} style URI for this provider. |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4345 | */ |
fionaxu | 62bc747 | 2018-02-28 11:18:45 -0800 | [diff] [blame] | 4346 | public static final Uri CONTENT_URI = Uri.parse("content://carrier_id"); |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4347 | |
| 4348 | /** |
fionaxu | 62bc747 | 2018-02-28 11:18:45 -0800 | [diff] [blame] | 4349 | * The authority string for the CarrierId Provider |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4350 | * @hide |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4351 | */ |
fionaxu | 62bc747 | 2018-02-28 11:18:45 -0800 | [diff] [blame] | 4352 | public static final String AUTHORITY = "carrier_id"; |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4353 | |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4354 | |
| 4355 | /** |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4356 | * Generates a content {@link Uri} used to receive updates on carrier identity change |
| 4357 | * on the given subscriptionId |
| 4358 | * <p> |
| 4359 | * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the |
fionaxu | c8d483e | 2018-03-07 21:52:05 -0800 | [diff] [blame] | 4360 | * carrier identity {@link TelephonyManager#getSimCarrierId()} |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4361 | * while your app is running. You can also use a {@link JobService} to ensure your app |
| 4362 | * is notified of changes to the {@link Uri} even when it is not running. |
| 4363 | * Note, however, that using a {@link JobService} does not guarantee timely delivery of |
| 4364 | * updates to the {@link Uri}. |
| 4365 | * |
| 4366 | * @param subscriptionId the subscriptionId to receive updates on |
| 4367 | * @return the Uri used to observe carrier identity changes |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4368 | */ |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4369 | public static Uri getUriForSubscriptionId(int subscriptionId) { |
| 4370 | return CONTENT_URI.buildUpon().appendEncodedPath( |
| 4371 | String.valueOf(subscriptionId)).build(); |
| 4372 | } |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4373 | |
| 4374 | /** |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4375 | * Generates a content {@link Uri} used to receive updates on specific carrier identity |
chen xu | d47a068 | 2018-12-06 15:34:05 -0800 | [diff] [blame] | 4376 | * change on the given subscriptionId returned by |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4377 | * {@link TelephonyManager#getSimSpecificCarrierId()}. |
| 4378 | * @see TelephonyManager#ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED |
chen xu | dd44d81 | 2018-11-02 17:49:57 -0700 | [diff] [blame] | 4379 | * <p> |
| 4380 | * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4381 | * specific carrier identity {@link TelephonyManager#getSimSpecificCarrierId()} |
chen xu | dd44d81 | 2018-11-02 17:49:57 -0700 | [diff] [blame] | 4382 | * while your app is running. You can also use a {@link JobService} to ensure your app |
| 4383 | * is notified of changes to the {@link Uri} even when it is not running. |
| 4384 | * Note, however, that using a {@link JobService} does not guarantee timely delivery of |
| 4385 | * updates to the {@link Uri}. |
| 4386 | * |
| 4387 | * @param subscriptionId the subscriptionId to receive updates on |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4388 | * @return the Uri used to observe specific carrier identity changes |
chen xu | dd44d81 | 2018-11-02 17:49:57 -0700 | [diff] [blame] | 4389 | */ |
chen xu | 8165386 | 2019-02-28 10:44:54 -0800 | [diff] [blame] | 4390 | @NonNull |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4391 | public static Uri getSpecificCarrierIdUriForSubscriptionId(int subscriptionId) { |
| 4392 | return Uri.withAppendedPath(Uri.withAppendedPath(CONTENT_URI, "specific"), |
chen xu | dd44d81 | 2018-11-02 17:49:57 -0700 | [diff] [blame] | 4393 | String.valueOf(subscriptionId)); |
| 4394 | } |
| 4395 | |
| 4396 | /** |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4397 | * A user facing carrier name. |
fionaxu | c8d483e | 2018-03-07 21:52:05 -0800 | [diff] [blame] | 4398 | * @see TelephonyManager#getSimCarrierIdName() |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4399 | * <P>Type: TEXT </P> |
| 4400 | */ |
fionaxu | 62bc747 | 2018-02-28 11:18:45 -0800 | [diff] [blame] | 4401 | public static final String CARRIER_NAME = "carrier_name"; |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4402 | |
| 4403 | /** |
| 4404 | * A unique carrier id |
fionaxu | c8d483e | 2018-03-07 21:52:05 -0800 | [diff] [blame] | 4405 | * @see TelephonyManager#getSimCarrierId() |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4406 | * <P>Type: INTEGER </P> |
| 4407 | */ |
fionaxu | 62bc747 | 2018-02-28 11:18:45 -0800 | [diff] [blame] | 4408 | public static final String CARRIER_ID = "carrier_id"; |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4409 | |
| 4410 | /** |
chen xu | dd44d81 | 2018-11-02 17:49:57 -0700 | [diff] [blame] | 4411 | * A fine-grained carrier id. |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4412 | * The specific carrier ID would be used for configuration purposes, but apps wishing to |
| 4413 | * know about the carrier itself should use the regular carrier ID returned by |
| 4414 | * {@link TelephonyManager#getSimCarrierId()}. |
| 4415 | * |
| 4416 | * @see TelephonyManager#getSimSpecificCarrierId() |
chen xu | dd44d81 | 2018-11-02 17:49:57 -0700 | [diff] [blame] | 4417 | * This is not a database column, only used to notify content observers for |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4418 | * {@link #getSpecificCarrierIdUriForSubscriptionId(int)} |
chen xu | dd44d81 | 2018-11-02 17:49:57 -0700 | [diff] [blame] | 4419 | */ |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4420 | public static final String SPECIFIC_CARRIER_ID = "specific_carrier_id"; |
chen xu | dd44d81 | 2018-11-02 17:49:57 -0700 | [diff] [blame] | 4421 | |
| 4422 | /** |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4423 | * A user facing carrier name for specific carrier id {@link #SPECIFIC_CARRIER_ID}. |
| 4424 | * @see TelephonyManager#getSimSpecificCarrierIdName() |
chen xu | d47a068 | 2018-12-06 15:34:05 -0800 | [diff] [blame] | 4425 | * This is not a database column, only used to notify content observers for |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4426 | * {@link #getSpecificCarrierIdUriForSubscriptionId(int)} |
chen xu | d47a068 | 2018-12-06 15:34:05 -0800 | [diff] [blame] | 4427 | */ |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4428 | public static final String SPECIFIC_CARRIER_ID_NAME = "specific_carrier_id_name"; |
chen xu | d47a068 | 2018-12-06 15:34:05 -0800 | [diff] [blame] | 4429 | |
| 4430 | /** |
chen xu | dd44d81 | 2018-11-02 17:49:57 -0700 | [diff] [blame] | 4431 | * A unique parent carrier id. The parent-child |
| 4432 | * relationship can be used to further differentiate a single carrier by different networks, |
chen xu | 45f6621 | 2019-03-06 14:43:40 -0800 | [diff] [blame] | 4433 | * by prepaid v.s. postpaid. It's an optional field. |
| 4434 | * A carrier id with a valid parent_carrier_id is considered fine-grained specific carrier |
| 4435 | * ID, will not be returned as {@link #CARRIER_ID} but {@link #SPECIFIC_CARRIER_ID}. |
chen xu | dd44d81 | 2018-11-02 17:49:57 -0700 | [diff] [blame] | 4436 | * <P>Type: INTEGER </P> |
| 4437 | * @hide |
| 4438 | */ |
| 4439 | public static final String PARENT_CARRIER_ID = "parent_carrier_id"; |
| 4440 | |
| 4441 | /** |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4442 | * Contains mappings between matching rules with carrier id for all carriers. |
| 4443 | * @hide |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4444 | */ |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4445 | public static final class All implements BaseColumns { |
| 4446 | /** |
| 4447 | * Numeric operator ID (as String). {@code MCC + MNC} |
| 4448 | * <P>Type: TEXT </P> |
| 4449 | */ |
| 4450 | public static final String MCCMNC = "mccmnc"; |
| 4451 | |
| 4452 | /** |
| 4453 | * Group id level 1 (as String). |
| 4454 | * <P>Type: TEXT </P> |
| 4455 | */ |
| 4456 | public static final String GID1 = "gid1"; |
| 4457 | |
| 4458 | /** |
| 4459 | * Group id level 2 (as String). |
| 4460 | * <P>Type: TEXT </P> |
| 4461 | */ |
| 4462 | public static final String GID2 = "gid2"; |
| 4463 | |
| 4464 | /** |
| 4465 | * Public Land Mobile Network name. |
| 4466 | * <P>Type: TEXT </P> |
| 4467 | */ |
| 4468 | public static final String PLMN = "plmn"; |
| 4469 | |
| 4470 | /** |
| 4471 | * Prefix xpattern of IMSI (International Mobile Subscriber Identity). |
| 4472 | * <P>Type: TEXT </P> |
| 4473 | */ |
| 4474 | public static final String IMSI_PREFIX_XPATTERN = "imsi_prefix_xpattern"; |
| 4475 | |
| 4476 | /** |
| 4477 | * Service Provider Name. |
| 4478 | * <P>Type: TEXT </P> |
| 4479 | */ |
| 4480 | public static final String SPN = "spn"; |
| 4481 | |
| 4482 | /** |
| 4483 | * Prefer APN name. |
| 4484 | * <P>Type: TEXT </P> |
| 4485 | */ |
| 4486 | public static final String APN = "apn"; |
| 4487 | |
| 4488 | /** |
| 4489 | * Prefix of Integrated Circuit Card Identifier. |
| 4490 | * <P>Type: TEXT </P> |
| 4491 | */ |
| 4492 | public static final String ICCID_PREFIX = "iccid_prefix"; |
| 4493 | |
| 4494 | /** |
fionaxu | f958357 | 2018-06-08 16:55:25 -0700 | [diff] [blame] | 4495 | * Certificate for carrier privilege access rules. |
| 4496 | * <P>Type: TEXT in hex string </P> |
| 4497 | */ |
| 4498 | public static final String PRIVILEGE_ACCESS_RULE = "privilege_access_rule"; |
| 4499 | |
| 4500 | /** |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4501 | * The {@code content://} URI for this table. |
| 4502 | */ |
fionaxu | 62bc747 | 2018-02-28 11:18:45 -0800 | [diff] [blame] | 4503 | public static final Uri CONTENT_URI = Uri.parse("content://carrier_id/all"); |
fionaxu | 58278be | 2018-01-29 14:08:12 -0800 | [diff] [blame] | 4504 | } |
fionaxu | 3d0ad1f | 2017-10-25 23:09:36 -0700 | [diff] [blame] | 4505 | } |
Dan Willemsen | 4980bf4 | 2017-02-14 14:17:12 -0800 | [diff] [blame] | 4506 | } |