blob: bff00b134f866de01a7245a9dcd43e564683482e [file] [log] [blame]
Dan Willemsen4980bf42017-02-14 14:17:12 -08001/*
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
17package android.provider;
18
19import android.annotation.SdkConstant;
20import android.annotation.SdkConstant.SdkConstantType;
21import android.annotation.TestApi;
Jordan Liub9b75ed2017-02-28 18:15:07 -080022import android.app.job.JobService;
Dan Willemsen4980bf42017-02-14 14:17:12 -080023import android.content.ComponentName;
24import android.content.ContentResolver;
25import android.content.ContentValues;
26import android.content.Context;
27import android.content.Intent;
28import android.database.Cursor;
Jordan Liub9b75ed2017-02-28 18:15:07 -080029import android.database.ContentObserver;
Dan Willemsen4980bf42017-02-14 14:17:12 -080030import android.database.sqlite.SqliteWrapper;
31import android.net.Uri;
Jordan Liub9b75ed2017-02-28 18:15:07 -080032import android.telephony.Rlog;
33import android.telephony.ServiceState;
Dan Willemsen4980bf42017-02-14 14:17:12 -080034import android.telephony.SmsMessage;
35import android.telephony.SubscriptionManager;
fionaxu58278be2018-01-29 14:08:12 -080036import android.telephony.TelephonyManager;
Dan Willemsen4980bf42017-02-14 14:17:12 -080037import android.text.TextUtils;
Dan Willemsen4980bf42017-02-14 14:17:12 -080038import android.util.Patterns;
39
40import com.android.internal.telephony.PhoneConstants;
41import com.android.internal.telephony.SmsApplication;
42
43
44import java.util.HashSet;
45import java.util.Set;
46import java.util.regex.Matcher;
47import java.util.regex.Pattern;
48
49/**
50 * The Telephony provider contains data related to phone operation, specifically SMS and MMS
Jordan Liub9b75ed2017-02-28 18:15:07 -080051 * messages, access to the APN list, including the MMSC to use, and the service state.
Dan Willemsen4980bf42017-02-14 14:17:12 -080052 *
53 * <p class="note"><strong>Note:</strong> These APIs are not available on all Android-powered
54 * devices. If your app depends on telephony features such as for managing SMS messages, include
55 * a <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}
56 * </a> element in your manifest that declares the {@code "android.hardware.telephony"} hardware
57 * feature. Alternatively, you can check for telephony availability at runtime using either
58 * {@link android.content.pm.PackageManager#hasSystemFeature
59 * hasSystemFeature(PackageManager.FEATURE_TELEPHONY)} or {@link
60 * android.telephony.TelephonyManager#getPhoneType}.</p>
61 *
62 * <h3>Creating an SMS app</h3>
63 *
64 * <p>Only the default SMS app (selected by the user in system settings) is able to write to the
65 * SMS Provider (the tables defined within the {@code Telephony} class) and only the default SMS
66 * app receives the {@link android.provider.Telephony.Sms.Intents#SMS_DELIVER_ACTION} broadcast
67 * when the user receives an SMS or the {@link
68 * android.provider.Telephony.Sms.Intents#WAP_PUSH_DELIVER_ACTION} broadcast when the user
69 * receives an MMS.</p>
70 *
71 * <p>Any app that wants to behave as the user's default SMS app must handle the following intents:
72 * <ul>
73 * <li>In a broadcast receiver, include an intent filter for {@link Sms.Intents#SMS_DELIVER_ACTION}
74 * (<code>"android.provider.Telephony.SMS_DELIVER"</code>). The broadcast receiver must also
75 * require the {@link android.Manifest.permission#BROADCAST_SMS} permission.
76 * <p>This allows your app to directly receive incoming SMS messages.</p></li>
77 * <li>In a broadcast receiver, include an intent filter for {@link
78 * Sms.Intents#WAP_PUSH_DELIVER_ACTION}} ({@code "android.provider.Telephony.WAP_PUSH_DELIVER"})
79 * with the MIME type <code>"application/vnd.wap.mms-message"</code>.
80 * The broadcast receiver must also require the {@link
81 * android.Manifest.permission#BROADCAST_WAP_PUSH} permission.
82 * <p>This allows your app to directly receive incoming MMS messages.</p></li>
83 * <li>In your activity that delivers new messages, include an intent filter for
84 * {@link android.content.Intent#ACTION_SENDTO} (<code>"android.intent.action.SENDTO"
85 * </code>) with schemas, <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and
86 * <code>mmsto:</code>.
87 * <p>This allows your app to receive intents from other apps that want to deliver a
88 * message.</p></li>
89 * <li>In a service, include an intent filter for {@link
90 * android.telephony.TelephonyManager#ACTION_RESPOND_VIA_MESSAGE}
91 * (<code>"android.intent.action.RESPOND_VIA_MESSAGE"</code>) with schemas,
92 * <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and <code>mmsto:</code>.
93 * This service must also require the {@link
94 * android.Manifest.permission#SEND_RESPOND_VIA_MESSAGE} permission.
95 * <p>This allows users to respond to incoming phone calls with an immediate text message
96 * using your app.</p></li>
97 * </ul>
98 *
99 * <p>Other apps that are not selected as the default SMS app can only <em>read</em> the SMS
100 * Provider, but may also be notified when a new SMS arrives by listening for the {@link
101 * Sms.Intents#SMS_RECEIVED_ACTION}
102 * broadcast, which is a non-abortable broadcast that may be delivered to multiple apps. This
103 * broadcast is intended for apps that&mdash;while not selected as the default SMS app&mdash;need to
104 * read special incoming messages such as to perform phone number verification.</p>
105 *
106 * <p>For more information about building SMS apps, read the blog post, <a
107 * href="http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html"
108 * >Getting Your SMS Apps Ready for KitKat</a>.</p>
109 *
110 */
111public final class Telephony {
112 private static final String TAG = "Telephony";
113
114 /**
115 * Not instantiable.
116 * @hide
117 */
118 private Telephony() {
119 }
120
121 /**
122 * Base columns for tables that contain text-based SMSs.
123 */
124 public interface TextBasedSmsColumns {
125
126 /** Message type: all messages. */
127 public static final int MESSAGE_TYPE_ALL = 0;
128
129 /** Message type: inbox. */
130 public static final int MESSAGE_TYPE_INBOX = 1;
131
132 /** Message type: sent messages. */
133 public static final int MESSAGE_TYPE_SENT = 2;
134
135 /** Message type: drafts. */
136 public static final int MESSAGE_TYPE_DRAFT = 3;
137
138 /** Message type: outbox. */
139 public static final int MESSAGE_TYPE_OUTBOX = 4;
140
141 /** Message type: failed outgoing message. */
142 public static final int MESSAGE_TYPE_FAILED = 5;
143
144 /** Message type: queued to send later. */
145 public static final int MESSAGE_TYPE_QUEUED = 6;
146
147 /**
148 * The type of message.
149 * <P>Type: INTEGER</P>
150 */
151 public static final String TYPE = "type";
152
153 /**
154 * The thread ID of the message.
155 * <P>Type: INTEGER</P>
156 */
157 public static final String THREAD_ID = "thread_id";
158
159 /**
160 * The address of the other party.
161 * <P>Type: TEXT</P>
162 */
163 public static final String ADDRESS = "address";
164
165 /**
166 * The date the message was received.
167 * <P>Type: INTEGER (long)</P>
168 */
169 public static final String DATE = "date";
170
171 /**
172 * The date the message was sent.
173 * <P>Type: INTEGER (long)</P>
174 */
175 public static final String DATE_SENT = "date_sent";
176
177 /**
178 * Has the message been read?
179 * <P>Type: INTEGER (boolean)</P>
180 */
181 public static final String READ = "read";
182
183 /**
184 * Has the message been seen by the user? The "seen" flag determines
185 * whether we need to show a notification.
186 * <P>Type: INTEGER (boolean)</P>
187 */
188 public static final String SEEN = "seen";
189
190 /**
191 * {@code TP-Status} value for the message, or -1 if no status has been received.
192 * <P>Type: INTEGER</P>
193 */
194 public static final String STATUS = "status";
195
196 /** TP-Status: no status received. */
197 public static final int STATUS_NONE = -1;
198 /** TP-Status: complete. */
199 public static final int STATUS_COMPLETE = 0;
200 /** TP-Status: pending. */
201 public static final int STATUS_PENDING = 32;
202 /** TP-Status: failed. */
203 public static final int STATUS_FAILED = 64;
204
205 /**
206 * The subject of the message, if present.
207 * <P>Type: TEXT</P>
208 */
209 public static final String SUBJECT = "subject";
210
211 /**
212 * The body of the message.
213 * <P>Type: TEXT</P>
214 */
215 public static final String BODY = "body";
216
217 /**
218 * The ID of the sender of the conversation, if present.
219 * <P>Type: INTEGER (reference to item in {@code content://contacts/people})</P>
220 */
221 public static final String PERSON = "person";
222
223 /**
224 * The protocol identifier code.
225 * <P>Type: INTEGER</P>
226 */
227 public static final String PROTOCOL = "protocol";
228
229 /**
230 * Is the {@code TP-Reply-Path} flag set?
231 * <P>Type: BOOLEAN</P>
232 */
233 public static final String REPLY_PATH_PRESENT = "reply_path_present";
234
235 /**
236 * The service center (SC) through which to send the message, if present.
237 * <P>Type: TEXT</P>
238 */
239 public static final String SERVICE_CENTER = "service_center";
240
241 /**
242 * Is the message locked?
243 * <P>Type: INTEGER (boolean)</P>
244 */
245 public static final String LOCKED = "locked";
246
247 /**
248 * The subscription to which the message belongs to. Its value will be
249 * < 0 if the sub id cannot be determined.
250 * <p>Type: INTEGER (long) </p>
251 */
252 public static final String SUBSCRIPTION_ID = "sub_id";
253
254 /**
255 * The MTU size of the mobile interface to which the APN connected
256 * @hide
257 */
258 public static final String MTU = "mtu";
259
260 /**
261 * Error code associated with sending or receiving this message
262 * <P>Type: INTEGER</P>
263 */
264 public static final String ERROR_CODE = "error_code";
265
266 /**
267 * The identity of the sender of a sent message. It is
268 * usually the package name of the app which sends the message.
269 * <p class="note"><strong>Note:</strong>
270 * This column is read-only. It is set by the provider and can not be changed by apps.
271 * <p>Type: TEXT</p>
272 */
273 public static final String CREATOR = "creator";
274 }
275
276 /**
Vasu Nori84db0f52018-02-14 15:14:32 -0800277 * Columns in sms_changes table.
278 * @hide
279 */
280 public interface TextBasedSmsChangesColumns {
281 /**
282 * The {@code content://} style URL for this table.
283 * @hide
284 */
285 public static final Uri CONTENT_URI = Uri.parse("content://sms-changes");
286
287 /**
288 * Primary key.
289 * <P>Type: INTEGER (long)</P>
290 * @hide
291 */
292 public static final String ID = "_id";
293
294 /**
295 * Triggers on sms table create a row in this table for each update/delete.
296 * This column is the "_id" of the row from sms table that was updated/deleted.
297 * <P>Type: INTEGER (long)</P>
298 * @hide
299 */
300 public static final String ORIG_ROW_ID = "orig_rowid";
301
302 /**
303 * Triggers on sms table create a row in this table for each update/delete.
304 * This column is the "sub_id" of the row from sms table that was updated/deleted.
305 * @hide
306 * <P>Type: INTEGER (long)</P>
307 */
308 public static final String SUB_ID = "sub_id";
309
310 /**
311 * The type of operation that created this row.
312 * {@link #TYPE_UPDATE} = update op
313 * {@link #TYPE_DELETE} = delete op
314 * @hide
315 * <P>Type: INTEGER (long)</P>
316 */
317 public static final String TYPE = "type";
318
319 /**
320 * One of the possible values for the above column "type". Indicates it is an update op.
321 * @hide
322 */
323 public static final int TYPE_UPDATE = 0;
324
325 /**
326 * One of the possible values for the above column "type". Indicates it is a delete op.
327 * @hide
328 */
329 public static final int TYPE_DELETE = 1;
330
331 /**
332 * This column contains a non-null value only if the operation on sms table is an update op
333 * and the column "read" is changed by the update op.
334 * <P>Type: INTEGER (boolean)</P>
335 * @hide
336 */
337 public static final String NEW_READ_STATUS = "new_read_status";
338 }
339
340 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -0800341 * Contains all text-based SMS messages.
342 */
343 public static final class Sms implements BaseColumns, TextBasedSmsColumns {
344
345 /**
346 * Not instantiable.
347 * @hide
348 */
349 private Sms() {
350 }
351
352 /**
353 * Used to determine the currently configured default SMS package.
354 * @param context context of the requesting application
355 * @return package name for the default SMS package or null
356 */
357 public static String getDefaultSmsPackage(Context context) {
358 ComponentName component = SmsApplication.getDefaultSmsApplication(context, false);
359 if (component != null) {
360 return component.getPackageName();
361 }
362 return null;
363 }
364
365 /**
366 * Return cursor for table query.
367 * @hide
368 */
369 public static Cursor query(ContentResolver cr, String[] projection) {
370 return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER);
371 }
372
373 /**
374 * Return cursor for table query.
375 * @hide
376 */
377 public static Cursor query(ContentResolver cr, String[] projection,
378 String where, String orderBy) {
379 return cr.query(CONTENT_URI, projection, where,
380 null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
381 }
382
383 /**
384 * The {@code content://} style URL for this table.
385 */
386 public static final Uri CONTENT_URI = Uri.parse("content://sms");
387
388 /**
389 * The default sort order for this table.
390 */
391 public static final String DEFAULT_SORT_ORDER = "date DESC";
392
393 /**
394 * Add an SMS to the given URI.
395 *
396 * @param resolver the content resolver to use
397 * @param uri the URI to add the message to
398 * @param address the address of the sender
399 * @param body the body of the message
400 * @param subject the pseudo-subject of the message
401 * @param date the timestamp for the message
402 * @param read true if the message has been read, false if not
403 * @param deliveryReport true if a delivery report was requested, false if not
404 * @return the URI for the new message
405 * @hide
406 */
407 public static Uri addMessageToUri(ContentResolver resolver,
408 Uri uri, String address, String body, String subject,
409 Long date, boolean read, boolean deliveryReport) {
410 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
411 resolver, uri, address, body, subject, date, read, deliveryReport, -1L);
412 }
413
414 /**
415 * Add an SMS to the given URI.
416 *
417 * @param resolver the content resolver to use
418 * @param uri the URI to add the message to
419 * @param address the address of the sender
420 * @param body the body of the message
421 * @param subject the psuedo-subject of the message
422 * @param date the timestamp for the message
423 * @param read true if the message has been read, false if not
424 * @param deliveryReport true if a delivery report was requested, false if not
425 * @param subId the subscription which the message belongs to
426 * @return the URI for the new message
427 * @hide
428 */
429 public static Uri addMessageToUri(int subId, ContentResolver resolver,
430 Uri uri, String address, String body, String subject,
431 Long date, boolean read, boolean deliveryReport) {
432 return addMessageToUri(subId, resolver, uri, address, body, subject,
433 date, read, deliveryReport, -1L);
434 }
435
436 /**
437 * Add an SMS to the given URI with the specified thread ID.
438 *
439 * @param resolver the content resolver to use
440 * @param uri the URI to add the message to
441 * @param address the address of the sender
442 * @param body the body of the message
443 * @param subject the pseudo-subject of the message
444 * @param date the timestamp for the message
445 * @param read true if the message has been read, false if not
446 * @param deliveryReport true if a delivery report was requested, false if not
447 * @param threadId the thread_id of the message
448 * @return the URI for the new message
449 * @hide
450 */
451 public static Uri addMessageToUri(ContentResolver resolver,
452 Uri uri, String address, String body, String subject,
453 Long date, boolean read, boolean deliveryReport, long threadId) {
454 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
455 resolver, uri, address, body, subject,
456 date, read, deliveryReport, threadId);
457 }
458
459 /**
460 * Add an SMS to the given URI with thread_id specified.
461 *
462 * @param resolver the content resolver to use
463 * @param uri the URI to add the message to
464 * @param address the address of the sender
465 * @param body the body of the message
466 * @param subject the psuedo-subject of the message
467 * @param date the timestamp for the message
468 * @param read true if the message has been read, false if not
469 * @param deliveryReport true if a delivery report was requested, false if not
470 * @param threadId the thread_id of the message
471 * @param subId the subscription which the message belongs to
472 * @return the URI for the new message
473 * @hide
474 */
475 public static Uri addMessageToUri(int subId, ContentResolver resolver,
476 Uri uri, String address, String body, String subject,
477 Long date, boolean read, boolean deliveryReport, long threadId) {
478 ContentValues values = new ContentValues(8);
479 Rlog.v(TAG,"Telephony addMessageToUri sub id: " + subId);
480
481 values.put(SUBSCRIPTION_ID, subId);
482 values.put(ADDRESS, address);
483 if (date != null) {
484 values.put(DATE, date);
485 }
486 values.put(READ, read ? Integer.valueOf(1) : Integer.valueOf(0));
487 values.put(SUBJECT, subject);
488 values.put(BODY, body);
489 if (deliveryReport) {
490 values.put(STATUS, STATUS_PENDING);
491 }
492 if (threadId != -1L) {
493 values.put(THREAD_ID, threadId);
494 }
495 return resolver.insert(uri, values);
496 }
497
498 /**
499 * Move a message to the given folder.
500 *
501 * @param context the context to use
502 * @param uri the message to move
503 * @param folder the folder to move to
504 * @return true if the operation succeeded
505 * @hide
506 */
507 public static boolean moveMessageToFolder(Context context,
508 Uri uri, int folder, int error) {
509 if (uri == null) {
510 return false;
511 }
512
513 boolean markAsUnread = false;
514 boolean markAsRead = false;
515 switch(folder) {
516 case MESSAGE_TYPE_INBOX:
517 case MESSAGE_TYPE_DRAFT:
518 break;
519 case MESSAGE_TYPE_OUTBOX:
520 case MESSAGE_TYPE_SENT:
521 markAsRead = true;
522 break;
523 case MESSAGE_TYPE_FAILED:
524 case MESSAGE_TYPE_QUEUED:
525 markAsUnread = true;
526 break;
527 default:
528 return false;
529 }
530
531 ContentValues values = new ContentValues(3);
532
533 values.put(TYPE, folder);
534 if (markAsUnread) {
535 values.put(READ, 0);
536 } else if (markAsRead) {
537 values.put(READ, 1);
538 }
539 values.put(ERROR_CODE, error);
540
541 return 1 == SqliteWrapper.update(context, context.getContentResolver(),
542 uri, values, null, null);
543 }
544
545 /**
546 * Returns true iff the folder (message type) identifies an
547 * outgoing message.
548 * @hide
549 */
550 public static boolean isOutgoingFolder(int messageType) {
551 return (messageType == MESSAGE_TYPE_FAILED)
552 || (messageType == MESSAGE_TYPE_OUTBOX)
553 || (messageType == MESSAGE_TYPE_SENT)
554 || (messageType == MESSAGE_TYPE_QUEUED);
555 }
556
557 /**
558 * Contains all text-based SMS messages in the SMS app inbox.
559 */
560 public static final class Inbox implements BaseColumns, TextBasedSmsColumns {
561
562 /**
563 * Not instantiable.
564 * @hide
565 */
566 private Inbox() {
567 }
568
569 /**
570 * The {@code content://} style URL for this table.
571 */
572 public static final Uri CONTENT_URI = Uri.parse("content://sms/inbox");
573
574 /**
575 * The default sort order for this table.
576 */
577 public static final String DEFAULT_SORT_ORDER = "date DESC";
578
579 /**
580 * Add an SMS to the Draft box.
581 *
582 * @param resolver the content resolver to use
583 * @param address the address of the sender
584 * @param body the body of the message
585 * @param subject the pseudo-subject of the message
586 * @param date the timestamp for the message
587 * @param read true if the message has been read, false if not
588 * @return the URI for the new message
589 * @hide
590 */
591 public static Uri addMessage(ContentResolver resolver,
592 String address, String body, String subject, Long date,
593 boolean read) {
594 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
595 resolver, CONTENT_URI, address, body, subject, date, read, false);
596 }
597
598 /**
599 * Add an SMS to the Draft box.
600 *
601 * @param resolver the content resolver to use
602 * @param address the address of the sender
603 * @param body the body of the message
604 * @param subject the psuedo-subject of the message
605 * @param date the timestamp for the message
606 * @param read true if the message has been read, false if not
607 * @param subId the subscription which the message belongs to
608 * @return the URI for the new message
609 * @hide
610 */
611 public static Uri addMessage(int subId, ContentResolver resolver,
612 String address, String body, String subject, Long date, boolean read) {
613 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
614 subject, date, read, false);
615 }
616 }
617
618 /**
619 * Contains all sent text-based SMS messages in the SMS app.
620 */
621 public static final class Sent implements BaseColumns, TextBasedSmsColumns {
622
623 /**
624 * Not instantiable.
625 * @hide
626 */
627 private Sent() {
628 }
629
630 /**
631 * The {@code content://} style URL for this table.
632 */
633 public static final Uri CONTENT_URI = Uri.parse("content://sms/sent");
634
635 /**
636 * The default sort order for this table.
637 */
638 public static final String DEFAULT_SORT_ORDER = "date DESC";
639
640 /**
641 * Add an SMS to the Draft box.
642 *
643 * @param resolver the content resolver to use
644 * @param address the address of the sender
645 * @param body the body of the message
646 * @param subject the pseudo-subject of the message
647 * @param date the timestamp for the message
648 * @return the URI for the new message
649 * @hide
650 */
651 public static Uri addMessage(ContentResolver resolver,
652 String address, String body, String subject, Long date) {
653 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
654 resolver, CONTENT_URI, address, body, subject, date, true, false);
655 }
656
657 /**
658 * Add an SMS to the Draft box.
659 *
660 * @param resolver the content resolver to use
661 * @param address the address of the sender
662 * @param body the body of the message
663 * @param subject the psuedo-subject of the message
664 * @param date the timestamp for the message
665 * @param subId the subscription which the message belongs to
666 * @return the URI for the new message
667 * @hide
668 */
669 public static Uri addMessage(int subId, ContentResolver resolver,
670 String address, String body, String subject, Long date) {
671 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
672 subject, date, true, false);
673 }
674 }
675
676 /**
677 * Contains all sent text-based SMS messages in the SMS app.
678 */
679 public static final class Draft implements BaseColumns, TextBasedSmsColumns {
680
681 /**
682 * Not instantiable.
683 * @hide
684 */
685 private Draft() {
686 }
687
688 /**
689 * The {@code content://} style URL for this table.
690 */
691 public static final Uri CONTENT_URI = Uri.parse("content://sms/draft");
692
693 /**
694 * @hide
695 */
696 public static Uri addMessage(ContentResolver resolver,
697 String address, String body, String subject, Long date) {
698 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
699 resolver, CONTENT_URI, address, body, subject, date, true, false);
700 }
701
702 /**
703 * Add an SMS to the Draft box.
704 *
705 * @param resolver the content resolver to use
706 * @param address the address of the sender
707 * @param body the body of the message
708 * @param subject the psuedo-subject of the message
709 * @param date the timestamp for the message
710 * @param subId the subscription which the message belongs to
711 * @return the URI for the new message
712 * @hide
713 */
714 public static Uri addMessage(int subId, ContentResolver resolver,
715 String address, String body, String subject, Long date) {
716 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
717 subject, date, true, false);
718 }
719
720 /**
721 * The default sort order for this table.
722 */
723 public static final String DEFAULT_SORT_ORDER = "date DESC";
724 }
725
726 /**
727 * Contains all pending outgoing text-based SMS messages.
728 */
729 public static final class Outbox implements BaseColumns, TextBasedSmsColumns {
730
731 /**
732 * Not instantiable.
733 * @hide
734 */
735 private Outbox() {
736 }
737
738 /**
739 * The {@code content://} style URL for this table.
740 */
741 public static final Uri CONTENT_URI = Uri.parse("content://sms/outbox");
742
743 /**
744 * The default sort order for this table.
745 */
746 public static final String DEFAULT_SORT_ORDER = "date DESC";
747
748 /**
749 * Add an SMS to the outbox.
750 *
751 * @param resolver the content resolver to use
752 * @param address the address of the sender
753 * @param body the body of the message
754 * @param subject the pseudo-subject of the message
755 * @param date the timestamp for the message
756 * @param deliveryReport whether a delivery report was requested for the message
757 * @return the URI for the new message
758 * @hide
759 */
760 public static Uri addMessage(ContentResolver resolver,
761 String address, String body, String subject, Long date,
762 boolean deliveryReport, long threadId) {
763 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
764 resolver, CONTENT_URI, address, body, subject, date,
765 true, deliveryReport, threadId);
766 }
767
768 /**
769 * Add an SMS to the Out box.
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 psuedo-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 * @param subId the subscription which the message belongs to
778 * @return the URI for the new message
779 * @hide
780 */
781 public static Uri addMessage(int subId, ContentResolver resolver,
782 String address, String body, String subject, Long date,
783 boolean deliveryReport, long threadId) {
784 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
785 subject, date, true, deliveryReport, threadId);
786 }
787 }
788
789 /**
790 * Contains all sent text-based SMS messages in the SMS app.
791 */
792 public static final class Conversations
793 implements BaseColumns, TextBasedSmsColumns {
794
795 /**
796 * Not instantiable.
797 * @hide
798 */
799 private Conversations() {
800 }
801
802 /**
803 * The {@code content://} style URL for this table.
804 */
805 public static final Uri CONTENT_URI = Uri.parse("content://sms/conversations");
806
807 /**
808 * The default sort order for this table.
809 */
810 public static final String DEFAULT_SORT_ORDER = "date DESC";
811
812 /**
813 * The first 45 characters of the body of the message.
814 * <P>Type: TEXT</P>
815 */
816 public static final String SNIPPET = "snippet";
817
818 /**
819 * The number of messages in the conversation.
820 * <P>Type: INTEGER</P>
821 */
822 public static final String MESSAGE_COUNT = "msg_count";
823 }
824
825 /**
826 * Contains constants for SMS related Intents that are broadcast.
827 */
828 public static final class Intents {
829
830 /**
831 * Not instantiable.
832 * @hide
833 */
834 private Intents() {
835 }
836
837 /**
838 * Set by BroadcastReceiver to indicate that the message was handled
839 * successfully.
840 */
841 public static final int RESULT_SMS_HANDLED = 1;
842
843 /**
844 * Set by BroadcastReceiver to indicate a generic error while
845 * processing the message.
846 */
847 public static final int RESULT_SMS_GENERIC_ERROR = 2;
848
849 /**
850 * Set by BroadcastReceiver to indicate insufficient memory to store
851 * the message.
852 */
853 public static final int RESULT_SMS_OUT_OF_MEMORY = 3;
854
855 /**
856 * Set by BroadcastReceiver to indicate that the message, while
857 * possibly valid, is of a format or encoding that is not
858 * supported.
859 */
860 public static final int RESULT_SMS_UNSUPPORTED = 4;
861
862 /**
863 * Set by BroadcastReceiver to indicate a duplicate incoming message.
864 */
865 public static final int RESULT_SMS_DUPLICATED = 5;
866
867 /**
868 * Activity action: Ask the user to change the default
869 * SMS application. This will show a dialog that asks the
870 * user whether they want to replace the current default
871 * SMS application with the one specified in
872 * {@link #EXTRA_PACKAGE_NAME}.
873 */
874 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
875 public static final String ACTION_CHANGE_DEFAULT =
876 "android.provider.Telephony.ACTION_CHANGE_DEFAULT";
877
878 /**
879 * The PackageName string passed in as an
880 * extra for {@link #ACTION_CHANGE_DEFAULT}
881 *
882 * @see #ACTION_CHANGE_DEFAULT
883 */
884 public static final String EXTRA_PACKAGE_NAME = "package";
885
886 /**
887 * Broadcast Action: A new text-based SMS message has been received
888 * by the device. This intent will only be delivered to the default
889 * sms app. That app is responsible for writing the message and notifying
890 * the user. The intent will have the following extra values:</p>
891 *
892 * <ul>
893 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
894 * that make up the message.</li>
895 * <li><em>"format"</em> - A String describing the format of the PDUs. It can
896 * be either "3gpp" or "3gpp2".</li>
897 * <li><em>"subscription"</em> - An optional long value of the subscription id which
898 * received the message.</li>
899 * <li><em>"slot"</em> - An optional int value of the SIM slot containing the
900 * subscription.</li>
901 * <li><em>"phone"</em> - An optional int value of the phone id associated with the
902 * subscription.</li>
903 * <li><em>"errorCode"</em> - An optional int error code associated with receiving
904 * the message.</li>
905 * </ul>
906 *
907 * <p>The extra values can be extracted using
908 * {@link #getMessagesFromIntent(Intent)}.</p>
909 *
910 * <p>If a BroadcastReceiver encounters an error while processing
911 * this intent it should set the result code appropriately.</p>
912 *
913 * <p class="note"><strong>Note:</strong>
914 * The broadcast receiver that filters for this intent must declare
915 * {@link android.Manifest.permission#BROADCAST_SMS} as a required permission in
916 * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code
917 * <receiver>}</a> tag.
918 *
919 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
920 */
921 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
922 public static final String SMS_DELIVER_ACTION =
923 "android.provider.Telephony.SMS_DELIVER";
924
925 /**
926 * Broadcast Action: A new text-based SMS message has been received
927 * by the device. This intent will be delivered to all registered
928 * receivers as a notification. These apps are not expected to write the
929 * message or notify the user. The intent will have the following extra
930 * values:</p>
931 *
932 * <ul>
933 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
934 * that make up the message.</li>
935 * </ul>
936 *
937 * <p>The extra values can be extracted using
938 * {@link #getMessagesFromIntent(Intent)}.</p>
939 *
940 * <p>If a BroadcastReceiver encounters an error while processing
941 * this intent it should set the result code appropriately.</p>
942 *
943 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
944 */
945 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
946 public static final String SMS_RECEIVED_ACTION =
947 "android.provider.Telephony.SMS_RECEIVED";
948
949 /**
950 * Broadcast Action: A new data based SMS message has been received
951 * by the device. This intent will be delivered to all registered
952 * receivers as a notification. The intent will have the following extra
953 * values:</p>
954 *
955 * <ul>
956 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
957 * that make up the message.</li>
958 * </ul>
959 *
960 * <p>The extra values can be extracted using
961 * {@link #getMessagesFromIntent(Intent)}.</p>
962 *
963 * <p>If a BroadcastReceiver encounters an error while processing
964 * this intent it should set the result code appropriately.</p>
965 *
966 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
967 */
968 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
969 public static final String DATA_SMS_RECEIVED_ACTION =
970 "android.intent.action.DATA_SMS_RECEIVED";
971
972 /**
973 * Broadcast Action: A new WAP PUSH message has been received by the
974 * device. This intent will only be delivered to the default
975 * sms app. That app is responsible for writing the message and notifying
976 * the user. The intent will have the following extra values:</p>
977 *
978 * <ul>
979 * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li>
980 * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li>
981 * <li><em>"header"</em> - (byte[]) The header of the message</li>
982 * <li><em>"data"</em> - (byte[]) The data payload of the message</li>
983 * <li><em>"contentTypeParameters" </em>
984 * -(HashMap&lt;String,String&gt;) Any parameters associated with the content type
985 * (decoded from the WSP Content-Type header)</li>
986 * <li><em>"subscription"</em> - An optional long value of the subscription id which
987 * received the message.</li>
988 * <li><em>"slot"</em> - An optional int value of the SIM slot containing the
989 * subscription.</li>
990 * <li><em>"phone"</em> - An optional int value of the phone id associated with the
991 * subscription.</li>
992 * </ul>
993 *
994 * <p>If a BroadcastReceiver encounters an error while processing
995 * this intent it should set the result code appropriately.</p>
996 *
997 * <p>The contentTypeParameters extra value is map of content parameters keyed by
998 * their names.</p>
999 *
1000 * <p>If any unassigned well-known parameters are encountered, the key of the map will
1001 * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If
1002 * a parameter has No-Value the value in the map will be null.</p>
1003 *
1004 * <p>Requires {@link android.Manifest.permission#RECEIVE_MMS} or
1005 * {@link android.Manifest.permission#RECEIVE_WAP_PUSH} (depending on WAP PUSH type) to
1006 * receive.</p>
1007 *
1008 * <p class="note"><strong>Note:</strong>
1009 * The broadcast receiver that filters for this intent must declare
1010 * {@link android.Manifest.permission#BROADCAST_WAP_PUSH} as a required permission in
1011 * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code
1012 * <receiver>}</a> tag.
1013 */
1014 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1015 public static final String WAP_PUSH_DELIVER_ACTION =
1016 "android.provider.Telephony.WAP_PUSH_DELIVER";
1017
1018 /**
1019 * Broadcast Action: A new WAP PUSH message has been received by the
1020 * device. This intent will be delivered to all registered
1021 * receivers as a notification. These apps are not expected to write the
1022 * message or notify the user. The intent will have the following extra
1023 * values:</p>
1024 *
1025 * <ul>
1026 * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li>
1027 * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li>
1028 * <li><em>"header"</em> - (byte[]) The header of the message</li>
1029 * <li><em>"data"</em> - (byte[]) The data payload of the message</li>
1030 * <li><em>"contentTypeParameters"</em>
1031 * - (HashMap&lt;String,String&gt;) Any parameters associated with the content type
1032 * (decoded from the WSP Content-Type header)</li>
1033 * </ul>
1034 *
1035 * <p>If a BroadcastReceiver encounters an error while processing
1036 * this intent it should set the result code appropriately.</p>
1037 *
1038 * <p>The contentTypeParameters extra value is map of content parameters keyed by
1039 * their names.</p>
1040 *
1041 * <p>If any unassigned well-known parameters are encountered, the key of the map will
1042 * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If
1043 * a parameter has No-Value the value in the map will be null.</p>
1044 *
1045 * <p>Requires {@link android.Manifest.permission#RECEIVE_MMS} or
1046 * {@link android.Manifest.permission#RECEIVE_WAP_PUSH} (depending on WAP PUSH type) to
1047 * receive.</p>
1048 */
1049 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1050 public static final String WAP_PUSH_RECEIVED_ACTION =
1051 "android.provider.Telephony.WAP_PUSH_RECEIVED";
1052
1053 /**
1054 * Broadcast Action: A new Cell Broadcast message has been received
1055 * by the device. The intent will have the following extra
1056 * values:</p>
1057 *
1058 * <ul>
1059 * <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message
1060 * data. This is not an emergency alert, so ETWS and CMAS data will be null.</li>
1061 * </ul>
1062 *
1063 * <p>The extra values can be extracted using
1064 * {@link #getMessagesFromIntent(Intent)}.</p>
1065 *
1066 * <p>If a BroadcastReceiver encounters an error while processing
1067 * this intent it should set the result code appropriately.</p>
1068 *
1069 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1070 */
1071 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1072 public static final String SMS_CB_RECEIVED_ACTION =
1073 "android.provider.Telephony.SMS_CB_RECEIVED";
1074
1075 /**
1076 * Action: A SMS based carrier provision intent. Used to identify default
1077 * carrier provisioning app on the device.
1078 * @hide
1079 */
1080 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1081 @TestApi
1082 public static final String SMS_CARRIER_PROVISION_ACTION =
1083 "android.provider.Telephony.SMS_CARRIER_PROVISION";
1084
1085 /**
1086 * Broadcast Action: A new Emergency Broadcast message has been received
1087 * by the device. The intent will have the following extra
1088 * values:</p>
1089 *
1090 * <ul>
1091 * <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message
1092 * data, including ETWS or CMAS warning notification info if present.</li>
1093 * </ul>
1094 *
1095 * <p>The extra values can be extracted using
1096 * {@link #getMessagesFromIntent(Intent)}.</p>
1097 *
1098 * <p>If a BroadcastReceiver encounters an error while processing
1099 * this intent it should set the result code appropriately.</p>
1100 *
1101 * <p>Requires {@link android.Manifest.permission#RECEIVE_EMERGENCY_BROADCAST} to
1102 * receive.</p>
1103 * @removed
1104 */
1105 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1106 public static final String SMS_EMERGENCY_CB_RECEIVED_ACTION =
1107 "android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED";
1108
1109 /**
1110 * Broadcast Action: A new CDMA SMS has been received containing Service Category
1111 * Program Data (updates the list of enabled broadcast channels). The intent will
1112 * have the following extra values:</p>
1113 *
1114 * <ul>
1115 * <li><em>"operations"</em> - An array of CdmaSmsCbProgramData objects containing
1116 * the service category operations (add/delete/clear) to perform.</li>
1117 * </ul>
1118 *
1119 * <p>The extra values can be extracted using
1120 * {@link #getMessagesFromIntent(Intent)}.</p>
1121 *
1122 * <p>If a BroadcastReceiver encounters an error while processing
1123 * this intent it should set the result code appropriately.</p>
1124 *
1125 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1126 */
1127 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1128 public static final String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION =
1129 "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED";
1130
1131 /**
1132 * Broadcast Action: The SIM storage for SMS messages is full. If
1133 * space is not freed, messages targeted for the SIM (class 2) may
1134 * not be saved.
1135 *
1136 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1137 */
1138 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1139 public static final String SIM_FULL_ACTION =
1140 "android.provider.Telephony.SIM_FULL";
1141
1142 /**
1143 * Broadcast Action: An incoming SMS has been rejected by the
1144 * telephony framework. This intent is sent in lieu of any
1145 * of the RECEIVED_ACTION intents. The intent will have the
1146 * following extra value:</p>
1147 *
1148 * <ul>
1149 * <li><em>"result"</em> - An int result code, e.g. {@link #RESULT_SMS_OUT_OF_MEMORY}
1150 * indicating the error returned to the network.</li>
1151 * </ul>
1152 *
1153 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1154 */
1155 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1156 public static final String SMS_REJECTED_ACTION =
1157 "android.provider.Telephony.SMS_REJECTED";
1158
1159 /**
1160 * Broadcast Action: An incoming MMS has been downloaded. The intent is sent to all
1161 * users, except for secondary users where SMS has been disabled and to managed
1162 * profiles.
1163 * @hide
1164 */
1165 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1166 public static final String MMS_DOWNLOADED_ACTION =
1167 "android.provider.Telephony.MMS_DOWNLOADED";
1168
1169 /**
Cassie5b97cf12018-02-22 09:58:33 -08001170 * Broadcast Action: A debug code has been entered in the dialer. This intent is
1171 * broadcast by the system and OEM telephony apps may need to receive these broadcasts.
1172 * These "secret codes" are used to activate developer menus by dialing certain codes.
1173 * And they are of the form {@code *#*#&lt;code&gt;#*#*}. The intent will have the data
1174 * URI: {@code android_secret_code://&lt;code&gt;}. It is possible that a manifest
1175 * receiver would be woken up even if it is not currently running.
1176 *
1177 * <p>Requires {@code android.Manifest.permission#CONTROL_INCALL_EXPERIENCE} to
1178 * send and receive.</p>
Cassie866f4942018-01-19 17:23:36 -08001179 */
1180 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1181 public static final String SECRET_CODE_ACTION =
1182 "android.provider.Telephony.SECRET_CODE";
1183
1184 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08001185 * Broadcast action: When the default SMS package changes,
1186 * the previous default SMS package and the new default SMS
1187 * package are sent this broadcast to notify them of the change.
1188 * A boolean is specified in {@link #EXTRA_IS_DEFAULT_SMS_APP} to
1189 * indicate whether the package is the new default SMS package.
1190 */
1191 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1192 public static final String ACTION_DEFAULT_SMS_PACKAGE_CHANGED =
1193 "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED";
1194
1195 /**
1196 * The IsDefaultSmsApp boolean passed as an
1197 * extra for {@link #ACTION_DEFAULT_SMS_PACKAGE_CHANGED} to indicate whether the
1198 * SMS app is becoming the default SMS app or is no longer the default.
1199 *
1200 * @see #ACTION_DEFAULT_SMS_PACKAGE_CHANGED
1201 */
1202 public static final String EXTRA_IS_DEFAULT_SMS_APP =
1203 "android.provider.extra.IS_DEFAULT_SMS_APP";
1204
1205 /**
1206 * Broadcast action: When a change is made to the SmsProvider or
1207 * MmsProvider by a process other than the default SMS application,
1208 * this intent is broadcast to the default SMS application so it can
1209 * re-sync or update the change. The uri that was used to call the provider
1210 * can be retrieved from the intent with getData(). The actual affected uris
1211 * (which would depend on the selection specified) are not included.
1212 */
1213 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1214 public static final String ACTION_EXTERNAL_PROVIDER_CHANGE =
1215 "android.provider.action.EXTERNAL_PROVIDER_CHANGE";
1216
1217 /**
1218 * Read the PDUs out of an {@link #SMS_RECEIVED_ACTION} or a
1219 * {@link #DATA_SMS_RECEIVED_ACTION} intent.
1220 *
1221 * @param intent the intent to read from
1222 * @return an array of SmsMessages for the PDUs
1223 */
1224 public static SmsMessage[] getMessagesFromIntent(Intent intent) {
1225 Object[] messages;
1226 try {
1227 messages = (Object[]) intent.getSerializableExtra("pdus");
1228 }
1229 catch (ClassCastException e) {
1230 Rlog.e(TAG, "getMessagesFromIntent: " + e);
1231 return null;
1232 }
1233
1234 if (messages == null) {
1235 Rlog.e(TAG, "pdus does not exist in the intent");
1236 return null;
1237 }
1238
1239 String format = intent.getStringExtra("format");
1240 int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
1241 SubscriptionManager.getDefaultSmsSubscriptionId());
1242
1243 Rlog.v(TAG, " getMessagesFromIntent sub_id : " + subId);
1244
1245 int pduCount = messages.length;
1246 SmsMessage[] msgs = new SmsMessage[pduCount];
1247
1248 for (int i = 0; i < pduCount; i++) {
1249 byte[] pdu = (byte[]) messages[i];
1250 msgs[i] = SmsMessage.createFromPdu(pdu, format);
1251 if (msgs[i] != null) msgs[i].setSubId(subId);
1252 }
1253 return msgs;
1254 }
1255 }
1256 }
1257
1258 /**
pkanwar16b8a0d2017-06-07 10:59:41 -07001259 * Base column for the table that contain Carrier Public key.
1260 * @hide
1261 */
1262 public interface CarrierColumns extends BaseColumns {
1263
1264 public static final String MCC = "mcc";
1265 public static final String MNC = "mnc";
1266 public static final String KEY_TYPE = "key_type";
1267 public static final String MVNO_TYPE = "mvno_type";
1268 public static final String MVNO_MATCH_DATA = "mvno_match_data";
1269 public static final String PUBLIC_KEY = "public_key";
1270 public static final String KEY_IDENTIFIER = "key_identifier";
1271 public static final String EXPIRATION_TIME = "expiration_time";
1272 public static final String LAST_MODIFIED = "last_modified";
1273
1274 /**
1275 * The {@code content://} style URL for this table.
1276 * @hide
1277 */
1278 public static final Uri CONTENT_URI = Uri.parse("content://carrier_information/carrier");
1279 }
1280
1281 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08001282 * Base columns for tables that contain MMSs.
1283 */
1284 public interface BaseMmsColumns extends BaseColumns {
1285
1286 /** Message box: all messages. */
1287 public static final int MESSAGE_BOX_ALL = 0;
1288 /** Message box: inbox. */
1289 public static final int MESSAGE_BOX_INBOX = 1;
1290 /** Message box: sent messages. */
1291 public static final int MESSAGE_BOX_SENT = 2;
1292 /** Message box: drafts. */
1293 public static final int MESSAGE_BOX_DRAFTS = 3;
1294 /** Message box: outbox. */
1295 public static final int MESSAGE_BOX_OUTBOX = 4;
1296 /** Message box: failed. */
1297 public static final int MESSAGE_BOX_FAILED = 5;
1298
1299 /**
1300 * The thread ID of the message.
1301 * <P>Type: INTEGER (long)</P>
1302 */
1303 public static final String THREAD_ID = "thread_id";
1304
1305 /**
1306 * The date the message was received.
1307 * <P>Type: INTEGER (long)</P>
1308 */
1309 public static final String DATE = "date";
1310
1311 /**
1312 * The date the message was sent.
1313 * <P>Type: INTEGER (long)</P>
1314 */
1315 public static final String DATE_SENT = "date_sent";
1316
1317 /**
1318 * The box which the message belongs to, e.g. {@link #MESSAGE_BOX_INBOX}.
1319 * <P>Type: INTEGER</P>
1320 */
1321 public static final String MESSAGE_BOX = "msg_box";
1322
1323 /**
1324 * Has the message been read?
1325 * <P>Type: INTEGER (boolean)</P>
1326 */
1327 public static final String READ = "read";
1328
1329 /**
1330 * Has the message been seen by the user? The "seen" flag determines
1331 * whether we need to show a new message notification.
1332 * <P>Type: INTEGER (boolean)</P>
1333 */
1334 public static final String SEEN = "seen";
1335
1336 /**
1337 * Does the message have only a text part (can also have a subject) with
1338 * no picture, slideshow, sound, etc. parts?
1339 * <P>Type: INTEGER (boolean)</P>
1340 */
1341 public static final String TEXT_ONLY = "text_only";
1342
1343 /**
1344 * The {@code Message-ID} of the message.
1345 * <P>Type: TEXT</P>
1346 */
1347 public static final String MESSAGE_ID = "m_id";
1348
1349 /**
1350 * The subject of the message, if present.
1351 * <P>Type: TEXT</P>
1352 */
1353 public static final String SUBJECT = "sub";
1354
1355 /**
1356 * The character set of the subject, if present.
1357 * <P>Type: INTEGER</P>
1358 */
1359 public static final String SUBJECT_CHARSET = "sub_cs";
1360
1361 /**
1362 * The {@code Content-Type} of the message.
1363 * <P>Type: TEXT</P>
1364 */
1365 public static final String CONTENT_TYPE = "ct_t";
1366
1367 /**
1368 * The {@code Content-Location} of the message.
1369 * <P>Type: TEXT</P>
1370 */
1371 public static final String CONTENT_LOCATION = "ct_l";
1372
1373 /**
1374 * The expiry time of the message.
1375 * <P>Type: INTEGER (long)</P>
1376 */
1377 public static final String EXPIRY = "exp";
1378
1379 /**
1380 * The class of the message.
1381 * <P>Type: TEXT</P>
1382 */
1383 public static final String MESSAGE_CLASS = "m_cls";
1384
1385 /**
1386 * The type of the message defined by MMS spec.
1387 * <P>Type: INTEGER</P>
1388 */
1389 public static final String MESSAGE_TYPE = "m_type";
1390
1391 /**
1392 * The version of the specification that this message conforms to.
1393 * <P>Type: INTEGER</P>
1394 */
1395 public static final String MMS_VERSION = "v";
1396
1397 /**
1398 * The size of the message.
1399 * <P>Type: INTEGER</P>
1400 */
1401 public static final String MESSAGE_SIZE = "m_size";
1402
1403 /**
1404 * The priority of the message.
1405 * <P>Type: INTEGER</P>
1406 */
1407 public static final String PRIORITY = "pri";
1408
1409 /**
1410 * The {@code read-report} of the message.
1411 * <P>Type: INTEGER (boolean)</P>
1412 */
1413 public static final String READ_REPORT = "rr";
1414
1415 /**
1416 * Is read report allowed?
1417 * <P>Type: INTEGER (boolean)</P>
1418 */
1419 public static final String REPORT_ALLOWED = "rpt_a";
1420
1421 /**
1422 * The {@code response-status} of the message.
1423 * <P>Type: INTEGER</P>
1424 */
1425 public static final String RESPONSE_STATUS = "resp_st";
1426
1427 /**
1428 * The {@code status} of the message.
1429 * <P>Type: INTEGER</P>
1430 */
1431 public static final String STATUS = "st";
1432
1433 /**
1434 * The {@code transaction-id} of the message.
1435 * <P>Type: TEXT</P>
1436 */
1437 public static final String TRANSACTION_ID = "tr_id";
1438
1439 /**
1440 * The {@code retrieve-status} of the message.
1441 * <P>Type: INTEGER</P>
1442 */
1443 public static final String RETRIEVE_STATUS = "retr_st";
1444
1445 /**
1446 * The {@code retrieve-text} of the message.
1447 * <P>Type: TEXT</P>
1448 */
1449 public static final String RETRIEVE_TEXT = "retr_txt";
1450
1451 /**
1452 * The character set of the retrieve-text.
1453 * <P>Type: INTEGER</P>
1454 */
1455 public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs";
1456
1457 /**
1458 * The {@code read-status} of the message.
1459 * <P>Type: INTEGER</P>
1460 */
1461 public static final String READ_STATUS = "read_status";
1462
1463 /**
1464 * The {@code content-class} of the message.
1465 * <P>Type: INTEGER</P>
1466 */
1467 public static final String CONTENT_CLASS = "ct_cls";
1468
1469 /**
1470 * The {@code delivery-report} of the message.
1471 * <P>Type: INTEGER</P>
1472 */
1473 public static final String DELIVERY_REPORT = "d_rpt";
1474
1475 /**
1476 * The {@code delivery-time-token} of the message.
1477 * <P>Type: INTEGER</P>
1478 * @deprecated this column is no longer supported.
1479 * @hide
1480 */
1481 @Deprecated
1482 public static final String DELIVERY_TIME_TOKEN = "d_tm_tok";
1483
1484 /**
1485 * The {@code delivery-time} of the message.
1486 * <P>Type: INTEGER</P>
1487 */
1488 public static final String DELIVERY_TIME = "d_tm";
1489
1490 /**
1491 * The {@code response-text} of the message.
1492 * <P>Type: TEXT</P>
1493 */
1494 public static final String RESPONSE_TEXT = "resp_txt";
1495
1496 /**
1497 * The {@code sender-visibility} of the message.
1498 * <P>Type: TEXT</P>
1499 * @deprecated this column is no longer supported.
1500 * @hide
1501 */
1502 @Deprecated
1503 public static final String SENDER_VISIBILITY = "s_vis";
1504
1505 /**
1506 * The {@code reply-charging} of the message.
1507 * <P>Type: INTEGER</P>
1508 * @deprecated this column is no longer supported.
1509 * @hide
1510 */
1511 @Deprecated
1512 public static final String REPLY_CHARGING = "r_chg";
1513
1514 /**
1515 * The {@code reply-charging-deadline-token} of the message.
1516 * <P>Type: INTEGER</P>
1517 * @deprecated this column is no longer supported.
1518 * @hide
1519 */
1520 @Deprecated
1521 public static final String REPLY_CHARGING_DEADLINE_TOKEN = "r_chg_dl_tok";
1522
1523 /**
1524 * The {@code reply-charging-deadline} of the message.
1525 * <P>Type: INTEGER</P>
1526 * @deprecated this column is no longer supported.
1527 * @hide
1528 */
1529 @Deprecated
1530 public static final String REPLY_CHARGING_DEADLINE = "r_chg_dl";
1531
1532 /**
1533 * The {@code reply-charging-id} of the message.
1534 * <P>Type: TEXT</P>
1535 * @deprecated this column is no longer supported.
1536 * @hide
1537 */
1538 @Deprecated
1539 public static final String REPLY_CHARGING_ID = "r_chg_id";
1540
1541 /**
1542 * The {@code reply-charging-size} of the message.
1543 * <P>Type: INTEGER</P>
1544 * @deprecated this column is no longer supported.
1545 * @hide
1546 */
1547 @Deprecated
1548 public static final String REPLY_CHARGING_SIZE = "r_chg_sz";
1549
1550 /**
1551 * The {@code previously-sent-by} of the message.
1552 * <P>Type: TEXT</P>
1553 * @deprecated this column is no longer supported.
1554 * @hide
1555 */
1556 @Deprecated
1557 public static final String PREVIOUSLY_SENT_BY = "p_s_by";
1558
1559 /**
1560 * The {@code previously-sent-date} of the message.
1561 * <P>Type: INTEGER</P>
1562 * @deprecated this column is no longer supported.
1563 * @hide
1564 */
1565 @Deprecated
1566 public static final String PREVIOUSLY_SENT_DATE = "p_s_d";
1567
1568 /**
1569 * The {@code store} of the message.
1570 * <P>Type: TEXT</P>
1571 * @deprecated this column is no longer supported.
1572 * @hide
1573 */
1574 @Deprecated
1575 public static final String STORE = "store";
1576
1577 /**
1578 * The {@code mm-state} of the message.
1579 * <P>Type: INTEGER</P>
1580 * @deprecated this column is no longer supported.
1581 * @hide
1582 */
1583 @Deprecated
1584 public static final String MM_STATE = "mm_st";
1585
1586 /**
1587 * The {@code mm-flags-token} of the message.
1588 * <P>Type: INTEGER</P>
1589 * @deprecated this column is no longer supported.
1590 * @hide
1591 */
1592 @Deprecated
1593 public static final String MM_FLAGS_TOKEN = "mm_flg_tok";
1594
1595 /**
1596 * The {@code mm-flags} of the message.
1597 * <P>Type: TEXT</P>
1598 * @deprecated this column is no longer supported.
1599 * @hide
1600 */
1601 @Deprecated
1602 public static final String MM_FLAGS = "mm_flg";
1603
1604 /**
1605 * The {@code store-status} of the message.
1606 * <P>Type: TEXT</P>
1607 * @deprecated this column is no longer supported.
1608 * @hide
1609 */
1610 @Deprecated
1611 public static final String STORE_STATUS = "store_st";
1612
1613 /**
1614 * The {@code store-status-text} of the message.
1615 * <P>Type: TEXT</P>
1616 * @deprecated this column is no longer supported.
1617 * @hide
1618 */
1619 @Deprecated
1620 public static final String STORE_STATUS_TEXT = "store_st_txt";
1621
1622 /**
1623 * The {@code stored} of the message.
1624 * <P>Type: TEXT</P>
1625 * @deprecated this column is no longer supported.
1626 * @hide
1627 */
1628 @Deprecated
1629 public static final String STORED = "stored";
1630
1631 /**
1632 * The {@code totals} of the message.
1633 * <P>Type: TEXT</P>
1634 * @deprecated this column is no longer supported.
1635 * @hide
1636 */
1637 @Deprecated
1638 public static final String TOTALS = "totals";
1639
1640 /**
1641 * The {@code mbox-totals} of the message.
1642 * <P>Type: TEXT</P>
1643 * @deprecated this column is no longer supported.
1644 * @hide
1645 */
1646 @Deprecated
1647 public static final String MBOX_TOTALS = "mb_t";
1648
1649 /**
1650 * The {@code mbox-totals-token} of the message.
1651 * <P>Type: INTEGER</P>
1652 * @deprecated this column is no longer supported.
1653 * @hide
1654 */
1655 @Deprecated
1656 public static final String MBOX_TOTALS_TOKEN = "mb_t_tok";
1657
1658 /**
1659 * The {@code quotas} of the message.
1660 * <P>Type: TEXT</P>
1661 * @deprecated this column is no longer supported.
1662 * @hide
1663 */
1664 @Deprecated
1665 public static final String QUOTAS = "qt";
1666
1667 /**
1668 * The {@code mbox-quotas} of the message.
1669 * <P>Type: TEXT</P>
1670 * @deprecated this column is no longer supported.
1671 * @hide
1672 */
1673 @Deprecated
1674 public static final String MBOX_QUOTAS = "mb_qt";
1675
1676 /**
1677 * The {@code mbox-quotas-token} of the message.
1678 * <P>Type: INTEGER</P>
1679 * @deprecated this column is no longer supported.
1680 * @hide
1681 */
1682 @Deprecated
1683 public static final String MBOX_QUOTAS_TOKEN = "mb_qt_tok";
1684
1685 /**
1686 * The {@code message-count} of the message.
1687 * <P>Type: INTEGER</P>
1688 * @deprecated this column is no longer supported.
1689 * @hide
1690 */
1691 @Deprecated
1692 public static final String MESSAGE_COUNT = "m_cnt";
1693
1694 /**
1695 * The {@code start} of the message.
1696 * <P>Type: INTEGER</P>
1697 * @deprecated this column is no longer supported.
1698 * @hide
1699 */
1700 @Deprecated
1701 public static final String START = "start";
1702
1703 /**
1704 * The {@code distribution-indicator} of the message.
1705 * <P>Type: TEXT</P>
1706 * @deprecated this column is no longer supported.
1707 * @hide
1708 */
1709 @Deprecated
1710 public static final String DISTRIBUTION_INDICATOR = "d_ind";
1711
1712 /**
1713 * The {@code element-descriptor} of the message.
1714 * <P>Type: TEXT</P>
1715 * @deprecated this column is no longer supported.
1716 * @hide
1717 */
1718 @Deprecated
1719 public static final String ELEMENT_DESCRIPTOR = "e_des";
1720
1721 /**
1722 * The {@code limit} of the message.
1723 * <P>Type: INTEGER</P>
1724 * @deprecated this column is no longer supported.
1725 * @hide
1726 */
1727 @Deprecated
1728 public static final String LIMIT = "limit";
1729
1730 /**
1731 * The {@code recommended-retrieval-mode} of the message.
1732 * <P>Type: INTEGER</P>
1733 * @deprecated this column is no longer supported.
1734 * @hide
1735 */
1736 @Deprecated
1737 public static final String RECOMMENDED_RETRIEVAL_MODE = "r_r_mod";
1738
1739 /**
1740 * The {@code recommended-retrieval-mode-text} of the message.
1741 * <P>Type: TEXT</P>
1742 * @deprecated this column is no longer supported.
1743 * @hide
1744 */
1745 @Deprecated
1746 public static final String RECOMMENDED_RETRIEVAL_MODE_TEXT = "r_r_mod_txt";
1747
1748 /**
1749 * The {@code status-text} of the message.
1750 * <P>Type: TEXT</P>
1751 * @deprecated this column is no longer supported.
1752 * @hide
1753 */
1754 @Deprecated
1755 public static final String STATUS_TEXT = "st_txt";
1756
1757 /**
1758 * The {@code applic-id} of the message.
1759 * <P>Type: TEXT</P>
1760 * @deprecated this column is no longer supported.
1761 * @hide
1762 */
1763 @Deprecated
1764 public static final String APPLIC_ID = "apl_id";
1765
1766 /**
1767 * The {@code reply-applic-id} of the message.
1768 * <P>Type: TEXT</P>
1769 * @deprecated this column is no longer supported.
1770 * @hide
1771 */
1772 @Deprecated
1773 public static final String REPLY_APPLIC_ID = "r_apl_id";
1774
1775 /**
1776 * The {@code aux-applic-id} of the message.
1777 * <P>Type: TEXT</P>
1778 * @deprecated this column is no longer supported.
1779 * @hide
1780 */
1781 @Deprecated
1782 public static final String AUX_APPLIC_ID = "aux_apl_id";
1783
1784 /**
1785 * The {@code drm-content} of the message.
1786 * <P>Type: TEXT</P>
1787 * @deprecated this column is no longer supported.
1788 * @hide
1789 */
1790 @Deprecated
1791 public static final String DRM_CONTENT = "drm_c";
1792
1793 /**
1794 * The {@code adaptation-allowed} of the message.
1795 * <P>Type: TEXT</P>
1796 * @deprecated this column is no longer supported.
1797 * @hide
1798 */
1799 @Deprecated
1800 public static final String ADAPTATION_ALLOWED = "adp_a";
1801
1802 /**
1803 * The {@code replace-id} of the message.
1804 * <P>Type: TEXT</P>
1805 * @deprecated this column is no longer supported.
1806 * @hide
1807 */
1808 @Deprecated
1809 public static final String REPLACE_ID = "repl_id";
1810
1811 /**
1812 * The {@code cancel-id} of the message.
1813 * <P>Type: TEXT</P>
1814 * @deprecated this column is no longer supported.
1815 * @hide
1816 */
1817 @Deprecated
1818 public static final String CANCEL_ID = "cl_id";
1819
1820 /**
1821 * The {@code cancel-status} of the message.
1822 * <P>Type: INTEGER</P>
1823 * @deprecated this column is no longer supported.
1824 * @hide
1825 */
1826 @Deprecated
1827 public static final String CANCEL_STATUS = "cl_st";
1828
1829 /**
1830 * Is the message locked?
1831 * <P>Type: INTEGER (boolean)</P>
1832 */
1833 public static final String LOCKED = "locked";
1834
1835 /**
1836 * The subscription to which the message belongs to. Its value will be
1837 * < 0 if the sub id cannot be determined.
1838 * <p>Type: INTEGER (long)</p>
1839 */
1840 public static final String SUBSCRIPTION_ID = "sub_id";
1841
1842 /**
1843 * The identity of the sender of a sent message. It is
1844 * usually the package name of the app which sends the message.
1845 * <p class="note"><strong>Note:</strong>
1846 * This column is read-only. It is set by the provider and can not be changed by apps.
1847 * <p>Type: TEXT</p>
1848 */
1849 public static final String CREATOR = "creator";
1850 }
1851
1852 /**
1853 * Columns for the "canonical_addresses" table used by MMS and SMS.
1854 */
1855 public interface CanonicalAddressesColumns extends BaseColumns {
1856 /**
1857 * An address used in MMS or SMS. Email addresses are
1858 * converted to lower case and are compared by string
1859 * equality. Other addresses are compared using
1860 * PHONE_NUMBERS_EQUAL.
1861 * <P>Type: TEXT</P>
1862 */
1863 public static final String ADDRESS = "address";
1864 }
1865
1866 /**
1867 * Columns for the "threads" table used by MMS and SMS.
1868 */
1869 public interface ThreadsColumns extends BaseColumns {
1870
1871 /**
1872 * The date at which the thread was created.
1873 * <P>Type: INTEGER (long)</P>
1874 */
1875 public static final String DATE = "date";
1876
1877 /**
1878 * A string encoding of the recipient IDs of the recipients of
1879 * the message, in numerical order and separated by spaces.
1880 * <P>Type: TEXT</P>
1881 */
1882 public static final String RECIPIENT_IDS = "recipient_ids";
1883
1884 /**
1885 * The message count of the thread.
1886 * <P>Type: INTEGER</P>
1887 */
1888 public static final String MESSAGE_COUNT = "message_count";
1889
1890 /**
1891 * Indicates whether all messages of the thread have been read.
1892 * <P>Type: INTEGER</P>
1893 */
1894 public static final String READ = "read";
1895
1896 /**
1897 * The snippet of the latest message in the thread.
1898 * <P>Type: TEXT</P>
1899 */
1900 public static final String SNIPPET = "snippet";
1901
1902 /**
1903 * The charset of the snippet.
1904 * <P>Type: INTEGER</P>
1905 */
1906 public static final String SNIPPET_CHARSET = "snippet_cs";
1907
1908 /**
1909 * Type of the thread, either {@link Threads#COMMON_THREAD} or
1910 * {@link Threads#BROADCAST_THREAD}.
1911 * <P>Type: INTEGER</P>
1912 */
1913 public static final String TYPE = "type";
1914
1915 /**
1916 * Indicates whether there is a transmission error in the thread.
1917 * <P>Type: INTEGER</P>
1918 */
1919 public static final String ERROR = "error";
1920
1921 /**
1922 * Indicates whether this thread contains any attachments.
1923 * <P>Type: INTEGER</P>
1924 */
1925 public static final String HAS_ATTACHMENT = "has_attachment";
1926
1927 /**
1928 * If the thread is archived
1929 * <P>Type: INTEGER (boolean)</P>
1930 */
1931 public static final String ARCHIVED = "archived";
1932 }
1933
1934 /**
1935 * Helper functions for the "threads" table used by MMS and SMS.
1936 */
1937 public static final class Threads implements ThreadsColumns {
1938
1939 private static final String[] ID_PROJECTION = { BaseColumns._ID };
1940
1941 /**
1942 * Private {@code content://} style URL for this table. Used by
1943 * {@link #getOrCreateThreadId(android.content.Context, java.util.Set)}.
1944 */
1945 private static final Uri THREAD_ID_CONTENT_URI = Uri.parse(
1946 "content://mms-sms/threadID");
1947
1948 /**
1949 * The {@code content://} style URL for this table, by conversation.
1950 */
1951 public static final Uri CONTENT_URI = Uri.withAppendedPath(
1952 MmsSms.CONTENT_URI, "conversations");
1953
1954 /**
1955 * The {@code content://} style URL for this table, for obsolete threads.
1956 */
1957 public static final Uri OBSOLETE_THREADS_URI = Uri.withAppendedPath(
1958 CONTENT_URI, "obsolete");
1959
1960 /** Thread type: common thread. */
1961 public static final int COMMON_THREAD = 0;
1962
1963 /** Thread type: broadcast thread. */
1964 public static final int BROADCAST_THREAD = 1;
1965
1966 /**
1967 * Not instantiable.
1968 * @hide
1969 */
1970 private Threads() {
1971 }
1972
1973 /**
1974 * This is a single-recipient version of {@code getOrCreateThreadId}.
1975 * It's convenient for use with SMS messages.
1976 * @param context the context object to use.
1977 * @param recipient the recipient to send to.
1978 */
1979 public static long getOrCreateThreadId(Context context, String recipient) {
1980 Set<String> recipients = new HashSet<String>();
1981
1982 recipients.add(recipient);
1983 return getOrCreateThreadId(context, recipients);
1984 }
1985
1986 /**
1987 * Given the recipients list and subject of an unsaved message,
1988 * return its thread ID. If the message starts a new thread,
1989 * allocate a new thread ID. Otherwise, use the appropriate
1990 * existing thread ID.
1991 *
1992 * <p>Find the thread ID of the same set of recipients (in any order,
1993 * without any additions). If one is found, return it. Otherwise,
1994 * return a unique thread ID.</p>
1995 */
1996 public static long getOrCreateThreadId(
1997 Context context, Set<String> recipients) {
1998 Uri.Builder uriBuilder = THREAD_ID_CONTENT_URI.buildUpon();
1999
2000 for (String recipient : recipients) {
2001 if (Mms.isEmailAddress(recipient)) {
2002 recipient = Mms.extractAddrSpec(recipient);
2003 }
2004
2005 uriBuilder.appendQueryParameter("recipient", recipient);
2006 }
2007
2008 Uri uri = uriBuilder.build();
2009 //if (DEBUG) Rlog.v(TAG, "getOrCreateThreadId uri: " + uri);
2010
2011 Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(),
2012 uri, ID_PROJECTION, null, null, null);
2013 if (cursor != null) {
2014 try {
2015 if (cursor.moveToFirst()) {
2016 return cursor.getLong(0);
2017 } else {
2018 Rlog.e(TAG, "getOrCreateThreadId returned no rows!");
2019 }
2020 } finally {
2021 cursor.close();
2022 }
2023 }
2024
2025 Rlog.e(TAG, "getOrCreateThreadId failed with " + recipients.size() + " recipients");
2026 throw new IllegalArgumentException("Unable to find or allocate a thread ID.");
2027 }
2028 }
2029
2030 /**
2031 * Contains all MMS messages.
2032 */
2033 public static final class Mms implements BaseMmsColumns {
2034
2035 /**
2036 * Not instantiable.
2037 * @hide
2038 */
2039 private Mms() {
2040 }
2041
2042 /**
2043 * The {@code content://} URI for this table.
2044 */
2045 public static final Uri CONTENT_URI = Uri.parse("content://mms");
2046
2047 /**
2048 * Content URI for getting MMS report requests.
2049 */
2050 public static final Uri REPORT_REQUEST_URI = Uri.withAppendedPath(
2051 CONTENT_URI, "report-request");
2052
2053 /**
2054 * Content URI for getting MMS report status.
2055 */
2056 public static final Uri REPORT_STATUS_URI = Uri.withAppendedPath(
2057 CONTENT_URI, "report-status");
2058
2059 /**
2060 * The default sort order for this table.
2061 */
2062 public static final String DEFAULT_SORT_ORDER = "date DESC";
2063
2064 /**
2065 * Regex pattern for names and email addresses.
2066 * <ul>
2067 * <li><em>mailbox</em> = {@code name-addr}</li>
2068 * <li><em>name-addr</em> = {@code [display-name] angle-addr}</li>
2069 * <li><em>angle-addr</em> = {@code [CFWS] "<" addr-spec ">" [CFWS]}</li>
2070 * </ul>
2071 * @hide
2072 */
2073 public static final Pattern NAME_ADDR_EMAIL_PATTERN =
2074 Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*");
2075
2076 /**
2077 * Helper method to query this table.
2078 * @hide
2079 */
2080 public static Cursor query(
2081 ContentResolver cr, String[] projection) {
2082 return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER);
2083 }
2084
2085 /**
2086 * Helper method to query this table.
2087 * @hide
2088 */
2089 public static Cursor query(
2090 ContentResolver cr, String[] projection,
2091 String where, String orderBy) {
2092 return cr.query(CONTENT_URI, projection,
2093 where, null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
2094 }
2095
2096 /**
2097 * Helper method to extract email address from address string.
2098 * @hide
2099 */
2100 public static String extractAddrSpec(String address) {
2101 Matcher match = NAME_ADDR_EMAIL_PATTERN.matcher(address);
2102
2103 if (match.matches()) {
2104 return match.group(2);
2105 }
2106 return address;
2107 }
2108
2109 /**
2110 * Is the specified address an email address?
2111 *
2112 * @param address the input address to test
2113 * @return true if address is an email address; false otherwise.
2114 * @hide
2115 */
2116 public static boolean isEmailAddress(String address) {
2117 if (TextUtils.isEmpty(address)) {
2118 return false;
2119 }
2120
2121 String s = extractAddrSpec(address);
2122 Matcher match = Patterns.EMAIL_ADDRESS.matcher(s);
2123 return match.matches();
2124 }
2125
2126 /**
2127 * Is the specified number a phone number?
2128 *
2129 * @param number the input number to test
2130 * @return true if number is a phone number; false otherwise.
2131 * @hide
2132 */
2133 public static boolean isPhoneNumber(String number) {
2134 if (TextUtils.isEmpty(number)) {
2135 return false;
2136 }
2137
2138 Matcher match = Patterns.PHONE.matcher(number);
2139 return match.matches();
2140 }
2141
2142 /**
2143 * Contains all MMS messages in the MMS app inbox.
2144 */
2145 public static final class Inbox implements BaseMmsColumns {
2146
2147 /**
2148 * Not instantiable.
2149 * @hide
2150 */
2151 private Inbox() {
2152 }
2153
2154 /**
2155 * The {@code content://} style URL for this table.
2156 */
2157 public static final Uri
2158 CONTENT_URI = Uri.parse("content://mms/inbox");
2159
2160 /**
2161 * The default sort order for this table.
2162 */
2163 public static final String DEFAULT_SORT_ORDER = "date DESC";
2164 }
2165
2166 /**
2167 * Contains all MMS messages in the MMS app sent folder.
2168 */
2169 public static final class Sent implements BaseMmsColumns {
2170
2171 /**
2172 * Not instantiable.
2173 * @hide
2174 */
2175 private Sent() {
2176 }
2177
2178 /**
2179 * The {@code content://} style URL for this table.
2180 */
2181 public static final Uri
2182 CONTENT_URI = Uri.parse("content://mms/sent");
2183
2184 /**
2185 * The default sort order for this table.
2186 */
2187 public static final String DEFAULT_SORT_ORDER = "date DESC";
2188 }
2189
2190 /**
2191 * Contains all MMS messages in the MMS app drafts folder.
2192 */
2193 public static final class Draft implements BaseMmsColumns {
2194
2195 /**
2196 * Not instantiable.
2197 * @hide
2198 */
2199 private Draft() {
2200 }
2201
2202 /**
2203 * The {@code content://} style URL for this table.
2204 */
2205 public static final Uri
2206 CONTENT_URI = Uri.parse("content://mms/drafts");
2207
2208 /**
2209 * The default sort order for this table.
2210 */
2211 public static final String DEFAULT_SORT_ORDER = "date DESC";
2212 }
2213
2214 /**
2215 * Contains all MMS messages in the MMS app outbox.
2216 */
2217 public static final class Outbox implements BaseMmsColumns {
2218
2219 /**
2220 * Not instantiable.
2221 * @hide
2222 */
2223 private Outbox() {
2224 }
2225
2226 /**
2227 * The {@code content://} style URL for this table.
2228 */
2229 public static final Uri
2230 CONTENT_URI = Uri.parse("content://mms/outbox");
2231
2232 /**
2233 * The default sort order for this table.
2234 */
2235 public static final String DEFAULT_SORT_ORDER = "date DESC";
2236 }
2237
2238 /**
2239 * Contains address information for an MMS message.
2240 */
2241 public static final class Addr implements BaseColumns {
2242
2243 /**
2244 * Not instantiable.
2245 * @hide
2246 */
2247 private Addr() {
2248 }
2249
2250 /**
2251 * The ID of MM which this address entry belongs to.
2252 * <P>Type: INTEGER (long)</P>
2253 */
2254 public static final String MSG_ID = "msg_id";
2255
2256 /**
2257 * The ID of contact entry in Phone Book.
2258 * <P>Type: INTEGER (long)</P>
2259 */
2260 public static final String CONTACT_ID = "contact_id";
2261
2262 /**
2263 * The address text.
2264 * <P>Type: TEXT</P>
2265 */
2266 public static final String ADDRESS = "address";
2267
2268 /**
2269 * Type of address: must be one of {@code PduHeaders.BCC},
2270 * {@code PduHeaders.CC}, {@code PduHeaders.FROM}, {@code PduHeaders.TO}.
2271 * <P>Type: INTEGER</P>
2272 */
2273 public static final String TYPE = "type";
2274
2275 /**
2276 * Character set of this entry (MMS charset value).
2277 * <P>Type: INTEGER</P>
2278 */
2279 public static final String CHARSET = "charset";
2280 }
2281
2282 /**
2283 * Contains message parts.
2284 */
2285 public static final class Part implements BaseColumns {
2286
2287 /**
2288 * Not instantiable.
2289 * @hide
2290 */
2291 private Part() {
2292 }
2293
2294 /**
2295 * The identifier of the message which this part belongs to.
2296 * <P>Type: INTEGER</P>
2297 */
2298 public static final String MSG_ID = "mid";
2299
2300 /**
2301 * The order of the part.
2302 * <P>Type: INTEGER</P>
2303 */
2304 public static final String SEQ = "seq";
2305
2306 /**
2307 * The content type of the part.
2308 * <P>Type: TEXT</P>
2309 */
2310 public static final String CONTENT_TYPE = "ct";
2311
2312 /**
2313 * The name of the part.
2314 * <P>Type: TEXT</P>
2315 */
2316 public static final String NAME = "name";
2317
2318 /**
2319 * The charset of the part.
2320 * <P>Type: TEXT</P>
2321 */
2322 public static final String CHARSET = "chset";
2323
2324 /**
2325 * The file name of the part.
2326 * <P>Type: TEXT</P>
2327 */
2328 public static final String FILENAME = "fn";
2329
2330 /**
2331 * The content disposition of the part.
2332 * <P>Type: TEXT</P>
2333 */
2334 public static final String CONTENT_DISPOSITION = "cd";
2335
2336 /**
2337 * The content ID of the part.
2338 * <P>Type: INTEGER</P>
2339 */
2340 public static final String CONTENT_ID = "cid";
2341
2342 /**
2343 * The content location of the part.
2344 * <P>Type: INTEGER</P>
2345 */
2346 public static final String CONTENT_LOCATION = "cl";
2347
2348 /**
2349 * The start of content-type of the message.
2350 * <P>Type: INTEGER</P>
2351 */
2352 public static final String CT_START = "ctt_s";
2353
2354 /**
2355 * The type of content-type of the message.
2356 * <P>Type: TEXT</P>
2357 */
2358 public static final String CT_TYPE = "ctt_t";
2359
2360 /**
2361 * The location (on filesystem) of the binary data of the part.
2362 * <P>Type: INTEGER</P>
2363 */
2364 public static final String _DATA = "_data";
2365
2366 /**
2367 * The message text.
2368 * <P>Type: TEXT</P>
2369 */
2370 public static final String TEXT = "text";
2371 }
2372
2373 /**
2374 * Message send rate table.
2375 */
2376 public static final class Rate {
2377
2378 /**
2379 * Not instantiable.
2380 * @hide
2381 */
2382 private Rate() {
2383 }
2384
2385 /**
2386 * The {@code content://} style URL for this table.
2387 */
2388 public static final Uri CONTENT_URI = Uri.withAppendedPath(
2389 Mms.CONTENT_URI, "rate");
2390
2391 /**
2392 * When a message was successfully sent.
2393 * <P>Type: INTEGER (long)</P>
2394 */
2395 public static final String SENT_TIME = "sent_time";
2396 }
2397
2398 /**
2399 * Intents class.
2400 */
2401 public static final class Intents {
2402
2403 /**
2404 * Not instantiable.
2405 * @hide
2406 */
2407 private Intents() {
2408 }
2409
2410 /**
2411 * Indicates that the contents of specified URIs were changed.
2412 * The application which is showing or caching these contents
2413 * should be updated.
2414 */
2415 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
2416 public static final String CONTENT_CHANGED_ACTION
2417 = "android.intent.action.CONTENT_CHANGED";
2418
2419 /**
2420 * An extra field which stores the URI of deleted contents.
2421 */
2422 public static final String DELETED_CONTENTS = "deleted_contents";
2423 }
2424 }
2425
2426 /**
2427 * Contains all MMS and SMS messages.
2428 */
2429 public static final class MmsSms implements BaseColumns {
2430
2431 /**
2432 * Not instantiable.
2433 * @hide
2434 */
2435 private MmsSms() {
2436 }
2437
2438 /**
2439 * The column to distinguish SMS and MMS messages in query results.
2440 */
2441 public static final String TYPE_DISCRIMINATOR_COLUMN =
2442 "transport_type";
2443
2444 /**
2445 * The {@code content://} style URL for this table.
2446 */
2447 public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/");
2448
2449 /**
2450 * The {@code content://} style URL for this table, by conversation.
2451 */
2452 public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse(
2453 "content://mms-sms/conversations");
2454
2455 /**
2456 * The {@code content://} style URL for this table, by phone number.
2457 */
2458 public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse(
2459 "content://mms-sms/messages/byphone");
2460
2461 /**
2462 * The {@code content://} style URL for undelivered messages in this table.
2463 */
2464 public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse(
2465 "content://mms-sms/undelivered");
2466
2467 /**
2468 * The {@code content://} style URL for draft messages in this table.
2469 */
2470 public static final Uri CONTENT_DRAFT_URI = Uri.parse(
2471 "content://mms-sms/draft");
2472
2473 /**
2474 * The {@code content://} style URL for locked messages in this table.
2475 */
2476 public static final Uri CONTENT_LOCKED_URI = Uri.parse(
2477 "content://mms-sms/locked");
2478
2479 /**
2480 * Pass in a query parameter called "pattern" which is the text to search for.
2481 * The sort order is fixed to be: {@code thread_id ASC, date DESC}.
2482 */
2483 public static final Uri SEARCH_URI = Uri.parse(
2484 "content://mms-sms/search");
2485
2486 // Constants for message protocol types.
2487
2488 /** SMS protocol type. */
2489 public static final int SMS_PROTO = 0;
2490
2491 /** MMS protocol type. */
2492 public static final int MMS_PROTO = 1;
2493
2494 // Constants for error types of pending messages.
2495
2496 /** Error type: no error. */
2497 public static final int NO_ERROR = 0;
2498
2499 /** Error type: generic transient error. */
2500 public static final int ERR_TYPE_GENERIC = 1;
2501
2502 /** Error type: SMS protocol transient error. */
2503 public static final int ERR_TYPE_SMS_PROTO_TRANSIENT = 2;
2504
2505 /** Error type: MMS protocol transient error. */
2506 public static final int ERR_TYPE_MMS_PROTO_TRANSIENT = 3;
2507
2508 /** Error type: transport failure. */
2509 public static final int ERR_TYPE_TRANSPORT_FAILURE = 4;
2510
2511 /** Error type: permanent error (along with all higher error values). */
2512 public static final int ERR_TYPE_GENERIC_PERMANENT = 10;
2513
2514 /** Error type: SMS protocol permanent error. */
2515 public static final int ERR_TYPE_SMS_PROTO_PERMANENT = 11;
2516
2517 /** Error type: MMS protocol permanent error. */
2518 public static final int ERR_TYPE_MMS_PROTO_PERMANENT = 12;
2519
2520 /**
2521 * Contains pending messages info.
2522 */
2523 public static final class PendingMessages implements BaseColumns {
2524
2525 /**
2526 * Not instantiable.
2527 * @hide
2528 */
2529 private PendingMessages() {
2530 }
2531
2532 public static final Uri CONTENT_URI = Uri.withAppendedPath(
2533 MmsSms.CONTENT_URI, "pending");
2534
2535 /**
2536 * The type of transport protocol (MMS or SMS).
2537 * <P>Type: INTEGER</P>
2538 */
2539 public static final String PROTO_TYPE = "proto_type";
2540
2541 /**
2542 * The ID of the message to be sent or downloaded.
2543 * <P>Type: INTEGER (long)</P>
2544 */
2545 public static final String MSG_ID = "msg_id";
2546
2547 /**
2548 * The type of the message to be sent or downloaded.
2549 * This field is only valid for MM. For SM, its value is always set to 0.
2550 * <P>Type: INTEGER</P>
2551 */
2552 public static final String MSG_TYPE = "msg_type";
2553
2554 /**
2555 * The type of the error code.
2556 * <P>Type: INTEGER</P>
2557 */
2558 public static final String ERROR_TYPE = "err_type";
2559
2560 /**
2561 * The error code of sending/retrieving process.
2562 * <P>Type: INTEGER</P>
2563 */
2564 public static final String ERROR_CODE = "err_code";
2565
2566 /**
2567 * How many times we tried to send or download the message.
2568 * <P>Type: INTEGER</P>
2569 */
2570 public static final String RETRY_INDEX = "retry_index";
2571
2572 /**
2573 * The time to do next retry.
2574 * <P>Type: INTEGER (long)</P>
2575 */
2576 public static final String DUE_TIME = "due_time";
2577
2578 /**
2579 * The time we last tried to send or download the message.
2580 * <P>Type: INTEGER (long)</P>
2581 */
2582 public static final String LAST_TRY = "last_try";
2583
2584 /**
2585 * The subscription to which the message belongs to. Its value will be
2586 * < 0 if the sub id cannot be determined.
2587 * <p>Type: INTEGER (long) </p>
2588 */
2589 public static final String SUBSCRIPTION_ID = "pending_sub_id";
2590 }
2591
2592 /**
2593 * Words table used by provider for full-text searches.
2594 * @hide
2595 */
2596 public static final class WordsTable {
2597
2598 /**
2599 * Not instantiable.
2600 * @hide
2601 */
2602 private WordsTable() {}
2603
2604 /**
2605 * Primary key.
2606 * <P>Type: INTEGER (long)</P>
2607 */
2608 public static final String ID = "_id";
2609
2610 /**
2611 * Source row ID.
2612 * <P>Type: INTEGER (long)</P>
2613 */
2614 public static final String SOURCE_ROW_ID = "source_id";
2615
2616 /**
2617 * Table ID (either 1 or 2).
2618 * <P>Type: INTEGER</P>
2619 */
2620 public static final String TABLE_ID = "table_to_use";
2621
2622 /**
2623 * The words to index.
2624 * <P>Type: TEXT</P>
2625 */
2626 public static final String INDEXED_TEXT = "index_text";
2627 }
2628 }
2629
2630 /**
2631 * Carriers class contains information about APNs, including MMSC information.
2632 */
2633 public static final class Carriers implements BaseColumns {
2634
2635 /**
2636 * Not instantiable.
2637 * @hide
2638 */
2639 private Carriers() {}
2640
2641 /**
2642 * The {@code content://} style URL for this table.
2643 */
2644 public static final Uri CONTENT_URI = Uri.parse("content://telephony/carriers");
2645
2646 /**
yuemingw4c0065f2018-01-16 19:48:10 +00002647 * The {@code content://} style URL to be called from DevicePolicyManagerService,
2648 * can manage DPC-owned APNs.
2649 * @hide
2650 */
2651 public static final Uri DPC_URI = Uri.parse("content://telephony/carriers/dpc");
2652
2653 /**
2654 * The {@code content://} style URL to be called from Telephony to query APNs.
2655 * When DPC-owned APNs are enforced, only DPC-owned APNs are returned, otherwise only
2656 * non-DPC-owned APNs are returned.
2657 * @hide
2658 */
2659 public static final Uri FILTERED_URI = Uri.parse("content://telephony/carriers/filtered");
2660
2661 /**
2662 * The {@code content://} style URL to be called from DevicePolicyManagerService
2663 * or Telephony to manage whether DPC-owned APNs are enforced.
2664 * @hide
2665 */
2666 public static final Uri ENFORCE_MANAGED_URI = Uri.parse(
2667 "content://telephony/carriers/enforce_managed");
2668
2669 /**
2670 * The column name for ENFORCE_MANAGED_URI, indicates whether DPC-owned APNs are enforced.
2671 * @hide
2672 */
2673 public static final String ENFORCE_KEY = "enforced";
2674
2675 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08002676 * The default sort order for this table.
2677 */
2678 public static final String DEFAULT_SORT_ORDER = "name ASC";
2679
2680 /**
2681 * Entry name.
2682 * <P>Type: TEXT</P>
2683 */
2684 public static final String NAME = "name";
2685
2686 /**
2687 * APN name.
2688 * <P>Type: TEXT</P>
2689 */
2690 public static final String APN = "apn";
2691
2692 /**
2693 * Proxy address.
2694 * <P>Type: TEXT</P>
2695 */
2696 public static final String PROXY = "proxy";
2697
2698 /**
2699 * Proxy port.
2700 * <P>Type: TEXT</P>
2701 */
2702 public static final String PORT = "port";
2703
2704 /**
2705 * MMS proxy address.
2706 * <P>Type: TEXT</P>
2707 */
2708 public static final String MMSPROXY = "mmsproxy";
2709
2710 /**
2711 * MMS proxy port.
2712 * <P>Type: TEXT</P>
2713 */
2714 public static final String MMSPORT = "mmsport";
2715
2716 /**
2717 * Server address.
2718 * <P>Type: TEXT</P>
2719 */
2720 public static final String SERVER = "server";
2721
2722 /**
2723 * APN username.
2724 * <P>Type: TEXT</P>
2725 */
2726 public static final String USER = "user";
2727
2728 /**
2729 * APN password.
2730 * <P>Type: TEXT</P>
2731 */
2732 public static final String PASSWORD = "password";
2733
2734 /**
2735 * MMSC URL.
2736 * <P>Type: TEXT</P>
2737 */
2738 public static final String MMSC = "mmsc";
2739
2740 /**
2741 * Mobile Country Code (MCC).
2742 * <P>Type: TEXT</P>
2743 */
2744 public static final String MCC = "mcc";
2745
2746 /**
2747 * Mobile Network Code (MNC).
2748 * <P>Type: TEXT</P>
2749 */
2750 public static final String MNC = "mnc";
2751
2752 /**
2753 * Numeric operator ID (as String). Usually {@code MCC + MNC}.
2754 * <P>Type: TEXT</P>
2755 */
2756 public static final String NUMERIC = "numeric";
2757
2758 /**
2759 * Authentication type.
2760 * <P>Type: INTEGER</P>
2761 */
2762 public static final String AUTH_TYPE = "authtype";
2763
2764 /**
2765 * Comma-delimited list of APN types.
2766 * <P>Type: TEXT</P>
2767 */
2768 public static final String TYPE = "type";
2769
2770 /**
2771 * The protocol to use to connect to this APN.
2772 *
2773 * One of the {@code PDP_type} values in TS 27.007 section 10.1.1.
2774 * For example: {@code IP}, {@code IPV6}, {@code IPV4V6}, or {@code PPP}.
2775 * <P>Type: TEXT</P>
2776 */
2777 public static final String PROTOCOL = "protocol";
2778
2779 /**
2780 * The protocol to use to connect to this APN when roaming.
2781 * The syntax is the same as protocol.
2782 * <P>Type: TEXT</P>
2783 */
2784 public static final String ROAMING_PROTOCOL = "roaming_protocol";
2785
2786 /**
2787 * Is this the current APN?
2788 * <P>Type: INTEGER (boolean)</P>
2789 */
2790 public static final String CURRENT = "current";
2791
2792 /**
2793 * Is this APN enabled?
2794 * <P>Type: INTEGER (boolean)</P>
2795 */
2796 public static final String CARRIER_ENABLED = "carrier_enabled";
2797
2798 /**
2799 * Radio Access Technology info.
2800 * To check what values are allowed, refer to {@link android.telephony.ServiceState}.
2801 * This should be spread to other technologies,
2802 * but is currently only used for LTE (14) and eHRPD (13).
2803 * <P>Type: INTEGER</P>
Cassiee1c88022018-02-22 08:51:03 -08002804 * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead
Dan Willemsen4980bf42017-02-14 14:17:12 -08002805 */
Cassied53df962017-12-05 13:34:33 -08002806 @Deprecated
Dan Willemsen4980bf42017-02-14 14:17:12 -08002807 public static final String BEARER = "bearer";
2808
2809 /**
2810 * Radio Access Technology bitmask.
2811 * To check what values can be contained, refer to {@link android.telephony.ServiceState}.
2812 * 0 indicates all techs otherwise first bit refers to RAT/bearer 1, second bit refers to
2813 * RAT/bearer 2 and so on.
2814 * Bitmask for a radio tech R is (1 << (R - 1))
2815 * <P>Type: INTEGER</P>
2816 * @hide
Cassiee1c88022018-02-22 08:51:03 -08002817 * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead
Dan Willemsen4980bf42017-02-14 14:17:12 -08002818 */
Cassied53df962017-12-05 13:34:33 -08002819 @Deprecated
Dan Willemsen4980bf42017-02-14 14:17:12 -08002820 public static final String BEARER_BITMASK = "bearer_bitmask";
2821
2822 /**
Cassied53df962017-12-05 13:34:33 -08002823 * Radio technology (network type) bitmask.
Cassiee1c88022018-02-22 08:51:03 -08002824 * To check what values can be contained, refer to the NETWORK_TYPE_ constants in
Cassied53df962017-12-05 13:34:33 -08002825 * {@link android.telephony.TelephonyManager}.
2826 * Bitmask for a radio tech R is (1 << (R - 1))
2827 * <P>Type: INTEGER</P>
2828 */
2829 public static final String NETWORK_TYPE_BITMASK = "network_type_bitmask";
2830
2831 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08002832 * MVNO type:
2833 * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}.
2834 * <P>Type: TEXT</P>
2835 */
2836 public static final String MVNO_TYPE = "mvno_type";
2837
2838 /**
2839 * MVNO data.
2840 * Use the following examples.
2841 * <ul>
2842 * <li>SPN: A MOBILE, BEN NL, ...</li>
2843 * <li>IMSI: 302720x94, 2060188, ...</li>
2844 * <li>GID: 4E, 33, ...</li>
2845 * </ul>
2846 * <P>Type: TEXT</P>
2847 */
2848 public static final String MVNO_MATCH_DATA = "mvno_match_data";
2849
2850 /**
2851 * The subscription to which the APN belongs to
2852 * <p>Type: INTEGER (long) </p>
2853 */
2854 public static final String SUBSCRIPTION_ID = "sub_id";
2855
2856 /**
2857 * The profile_id to which the APN saved in modem
2858 * <p>Type: INTEGER</p>
2859 *@hide
2860 */
2861 public static final String PROFILE_ID = "profile_id";
2862
2863 /**
2864 * Is the apn setting to be set in modem
2865 * <P>Type: INTEGER (boolean)</P>
2866 *@hide
2867 */
2868 public static final String MODEM_COGNITIVE = "modem_cognitive";
2869
2870 /**
2871 * The max connections of this apn
2872 * <p>Type: INTEGER</p>
2873 *@hide
2874 */
2875 public static final String MAX_CONNS = "max_conns";
2876
2877 /**
2878 * The wait time for retry of the apn
2879 * <p>Type: INTEGER</p>
2880 *@hide
2881 */
2882 public static final String WAIT_TIME = "wait_time";
2883
2884 /**
2885 * The time to limit max connection for the apn
2886 * <p>Type: INTEGER</p>
2887 *@hide
2888 */
2889 public static final String MAX_CONNS_TIME = "max_conns_time";
2890
2891 /**
2892 * The MTU size of the mobile interface to which the APN connected
2893 * <p>Type: INTEGER </p>
2894 * @hide
2895 */
2896 public static final String MTU = "mtu";
2897
2898 /**
2899 * Is this APN added/edited/deleted by a user or carrier?
2900 * <p>Type: INTEGER </p>
2901 * @hide
2902 */
2903 public static final String EDITED = "edited";
2904
2905 /**
2906 * Is this APN visible to the user?
2907 * <p>Type: INTEGER (boolean) </p>
2908 * @hide
2909 */
2910 public static final String USER_VISIBLE = "user_visible";
2911
2912 /**
Amit Mahajand4977942017-07-17 14:46:39 -07002913 * Is the user allowed to edit this APN?
2914 * <p>Type: INTEGER (boolean) </p>
2915 * @hide
2916 */
2917 public static final String USER_EDITABLE = "user_editable";
2918
2919 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08002920 * Following are possible values for the EDITED field
2921 * @hide
2922 */
2923 public static final int UNEDITED = 0;
2924 /**
2925 * @hide
2926 */
2927 public static final int USER_EDITED = 1;
2928 /**
2929 * @hide
2930 */
2931 public static final int USER_DELETED = 2;
2932 /**
2933 * DELETED_BUT_PRESENT is an intermediate value used to indicate that an entry deleted
2934 * by the user is still present in the new APN database and therefore must remain tagged
2935 * as user deleted rather than completely removed from the database
2936 * @hide
2937 */
2938 public static final int USER_DELETED_BUT_PRESENT_IN_XML = 3;
2939 /**
2940 * @hide
2941 */
2942 public static final int CARRIER_EDITED = 4;
2943 /**
2944 * CARRIER_DELETED values are currently not used as there is no usecase. If they are used,
2945 * delete() will have to change accordingly. Currently it is hardcoded to USER_DELETED.
2946 * @hide
2947 */
2948 public static final int CARRIER_DELETED = 5;
2949 /**
2950 * @hide
2951 */
2952 public static final int CARRIER_DELETED_BUT_PRESENT_IN_XML = 6;
yuemingwcf263eb2017-11-08 13:12:18 +00002953
2954 /**
2955 * The owner of the APN.
2956 * <p>Type: INTEGER</p>
2957 * @hide
2958 */
2959 public static final String OWNED_BY = "owned_by";
2960
2961 /**
2962 * Possible value for the OWNED_BY field.
2963 * APN is owned by DPC.
2964 * @hide
2965 */
2966 public static final int OWNED_BY_DPC = 0;
2967 /**
2968 * Possible value for the OWNED_BY field.
2969 * APN is owned by other sources.
2970 * @hide
2971 */
2972 public static final int OWNED_BY_OTHERS = 1;
Dan Willemsen4980bf42017-02-14 14:17:12 -08002973 }
2974
2975 /**
2976 * Contains received SMS cell broadcast messages.
2977 * @hide
2978 */
2979 public static final class CellBroadcasts implements BaseColumns {
2980
2981 /**
2982 * Not instantiable.
2983 * @hide
2984 */
2985 private CellBroadcasts() {}
2986
2987 /**
2988 * The {@code content://} URI for this table.
2989 */
2990 public static final Uri CONTENT_URI = Uri.parse("content://cellbroadcasts");
2991
2992 /**
2993 * Message geographical scope.
2994 * <P>Type: INTEGER</P>
2995 */
2996 public static final String GEOGRAPHICAL_SCOPE = "geo_scope";
2997
2998 /**
2999 * Message serial number.
3000 * <P>Type: INTEGER</P>
3001 */
3002 public static final String SERIAL_NUMBER = "serial_number";
3003
3004 /**
3005 * PLMN of broadcast sender. {@code SERIAL_NUMBER + PLMN + LAC + CID} uniquely identifies
3006 * a broadcast for duplicate detection purposes.
3007 * <P>Type: TEXT</P>
3008 */
3009 public static final String PLMN = "plmn";
3010
3011 /**
3012 * Location Area (GSM) or Service Area (UMTS) of broadcast sender. Unused for CDMA.
3013 * Only included if Geographical Scope of message is not PLMN wide (01).
3014 * <P>Type: INTEGER</P>
3015 */
3016 public static final String LAC = "lac";
3017
3018 /**
3019 * Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the
3020 * Geographical Scope of message is cell wide (00 or 11).
3021 * <P>Type: INTEGER</P>
3022 */
3023 public static final String CID = "cid";
3024
3025 /**
3026 * Message code. <em>OBSOLETE: merged into SERIAL_NUMBER.</em>
3027 * <P>Type: INTEGER</P>
3028 */
3029 public static final String V1_MESSAGE_CODE = "message_code";
3030
3031 /**
3032 * Message identifier. <em>OBSOLETE: renamed to SERVICE_CATEGORY.</em>
3033 * <P>Type: INTEGER</P>
3034 */
3035 public static final String V1_MESSAGE_IDENTIFIER = "message_id";
3036
3037 /**
3038 * Service category (GSM/UMTS: message identifier; CDMA: service category).
3039 * <P>Type: INTEGER</P>
3040 */
3041 public static final String SERVICE_CATEGORY = "service_category";
3042
3043 /**
3044 * Message language code.
3045 * <P>Type: TEXT</P>
3046 */
3047 public static final String LANGUAGE_CODE = "language";
3048
3049 /**
3050 * Message body.
3051 * <P>Type: TEXT</P>
3052 */
3053 public static final String MESSAGE_BODY = "body";
3054
3055 /**
3056 * Message delivery time.
3057 * <P>Type: INTEGER (long)</P>
3058 */
3059 public static final String DELIVERY_TIME = "date";
3060
3061 /**
3062 * Has the message been viewed?
3063 * <P>Type: INTEGER (boolean)</P>
3064 */
3065 public static final String MESSAGE_READ = "read";
3066
3067 /**
3068 * Message format (3GPP or 3GPP2).
3069 * <P>Type: INTEGER</P>
3070 */
3071 public static final String MESSAGE_FORMAT = "format";
3072
3073 /**
3074 * Message priority (including emergency).
3075 * <P>Type: INTEGER</P>
3076 */
3077 public static final String MESSAGE_PRIORITY = "priority";
3078
3079 /**
3080 * ETWS warning type (ETWS alerts only).
3081 * <P>Type: INTEGER</P>
3082 */
3083 public static final String ETWS_WARNING_TYPE = "etws_warning_type";
3084
3085 /**
3086 * CMAS message class (CMAS alerts only).
3087 * <P>Type: INTEGER</P>
3088 */
3089 public static final String CMAS_MESSAGE_CLASS = "cmas_message_class";
3090
3091 /**
3092 * CMAS category (CMAS alerts only).
3093 * <P>Type: INTEGER</P>
3094 */
3095 public static final String CMAS_CATEGORY = "cmas_category";
3096
3097 /**
3098 * CMAS response type (CMAS alerts only).
3099 * <P>Type: INTEGER</P>
3100 */
3101 public static final String CMAS_RESPONSE_TYPE = "cmas_response_type";
3102
3103 /**
3104 * CMAS severity (CMAS alerts only).
3105 * <P>Type: INTEGER</P>
3106 */
3107 public static final String CMAS_SEVERITY = "cmas_severity";
3108
3109 /**
3110 * CMAS urgency (CMAS alerts only).
3111 * <P>Type: INTEGER</P>
3112 */
3113 public static final String CMAS_URGENCY = "cmas_urgency";
3114
3115 /**
3116 * CMAS certainty (CMAS alerts only).
3117 * <P>Type: INTEGER</P>
3118 */
3119 public static final String CMAS_CERTAINTY = "cmas_certainty";
3120
3121 /** The default sort order for this table. */
3122 public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC";
3123
3124 /**
3125 * Query columns for instantiating {@link android.telephony.CellBroadcastMessage} objects.
3126 */
3127 public static final String[] QUERY_COLUMNS = {
3128 _ID,
3129 GEOGRAPHICAL_SCOPE,
3130 PLMN,
3131 LAC,
3132 CID,
3133 SERIAL_NUMBER,
3134 SERVICE_CATEGORY,
3135 LANGUAGE_CODE,
3136 MESSAGE_BODY,
3137 DELIVERY_TIME,
3138 MESSAGE_READ,
3139 MESSAGE_FORMAT,
3140 MESSAGE_PRIORITY,
3141 ETWS_WARNING_TYPE,
3142 CMAS_MESSAGE_CLASS,
3143 CMAS_CATEGORY,
3144 CMAS_RESPONSE_TYPE,
3145 CMAS_SEVERITY,
3146 CMAS_URGENCY,
3147 CMAS_CERTAINTY
3148 };
3149 }
Jordan Liub9b75ed2017-02-28 18:15:07 -08003150
3151 /**
3152 * Constants for interfacing with the ServiceStateProvider and the different fields of the
3153 * {@link ServiceState} class accessible through the provider.
3154 */
3155 public static final class ServiceStateTable {
3156
3157 /**
3158 * Not instantiable.
3159 * @hide
3160 */
3161 private ServiceStateTable() {}
3162
3163 /**
3164 * The authority string for the ServiceStateProvider
3165 */
3166 public static final String AUTHORITY = "service-state";
3167
3168 /**
3169 * The {@code content://} style URL for the ServiceStateProvider
3170 */
3171 public static final Uri CONTENT_URI = Uri.parse("content://service-state/");
3172
3173 /**
3174 * Generates a content {@link Uri} used to receive updates on a specific field in the
3175 * ServiceState provider.
3176 * <p>
3177 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
3178 * {@link ServiceState} while your app is running. You can also use a {@link JobService} to
3179 * ensure your app is notified of changes to the {@link Uri} even when it is not running.
3180 * Note, however, that using a {@link JobService} does not guarantee timely delivery of
3181 * updates to the {@link Uri}.
3182 *
Jordan Liu0f332522017-04-19 14:25:29 -07003183 * @param subscriptionId the subscriptionId to receive updates on
Jordan Liub9b75ed2017-02-28 18:15:07 -08003184 * @param field the ServiceState field to receive updates on
3185 * @return the Uri used to observe {@link ServiceState} changes
3186 */
Jordan Liu0f332522017-04-19 14:25:29 -07003187 public static Uri getUriForSubscriptionIdAndField(int subscriptionId, String field) {
3188 return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId))
Jordan Liub9b75ed2017-02-28 18:15:07 -08003189 .appendEncodedPath(field).build();
3190 }
3191
3192 /**
3193 * Generates a content {@link Uri} used to receive updates on every field in the
3194 * ServiceState provider.
3195 * <p>
3196 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
3197 * {@link ServiceState} while your app is running. You can also use a {@link JobService} to
3198 * ensure your app is notified of changes to the {@link Uri} even when it is not running.
3199 * Note, however, that using a {@link JobService} does not guarantee timely delivery of
3200 * updates to the {@link Uri}.
3201 *
Jordan Liu0f332522017-04-19 14:25:29 -07003202 * @param subscriptionId the subscriptionId to receive updates on
Jordan Liub9b75ed2017-02-28 18:15:07 -08003203 * @return the Uri used to observe {@link ServiceState} changes
3204 */
Jordan Liu0f332522017-04-19 14:25:29 -07003205 public static Uri getUriForSubscriptionId(int subscriptionId) {
3206 return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId)).build();
Jordan Liub9b75ed2017-02-28 18:15:07 -08003207 }
3208
3209 /**
3210 * Used to insert a ServiceState into the ServiceStateProvider as a ContentValues instance.
3211 *
3212 * @param state the ServiceState to convert into ContentValues
3213 * @return the convertedContentValues instance
3214 * @hide
3215 */
3216 public static ContentValues getContentValuesForServiceState(ServiceState state) {
3217 ContentValues values = new ContentValues();
3218 values.put(VOICE_REG_STATE, state.getVoiceRegState());
3219 values.put(DATA_REG_STATE, state.getDataRegState());
3220 values.put(VOICE_ROAMING_TYPE, state.getVoiceRoamingType());
3221 values.put(DATA_ROAMING_TYPE, state.getDataRoamingType());
3222 values.put(VOICE_OPERATOR_ALPHA_LONG, state.getVoiceOperatorAlphaLong());
3223 values.put(VOICE_OPERATOR_ALPHA_SHORT, state.getVoiceOperatorAlphaShort());
3224 values.put(VOICE_OPERATOR_NUMERIC, state.getVoiceOperatorNumeric());
3225 values.put(DATA_OPERATOR_ALPHA_LONG, state.getDataOperatorAlphaLong());
3226 values.put(DATA_OPERATOR_ALPHA_SHORT, state.getDataOperatorAlphaShort());
3227 values.put(DATA_OPERATOR_NUMERIC, state.getDataOperatorNumeric());
3228 values.put(IS_MANUAL_NETWORK_SELECTION, state.getIsManualSelection());
3229 values.put(RIL_VOICE_RADIO_TECHNOLOGY, state.getRilVoiceRadioTechnology());
3230 values.put(RIL_DATA_RADIO_TECHNOLOGY, state.getRilDataRadioTechnology());
3231 values.put(CSS_INDICATOR, state.getCssIndicator());
3232 values.put(NETWORK_ID, state.getNetworkId());
3233 values.put(SYSTEM_ID, state.getSystemId());
3234 values.put(CDMA_ROAMING_INDICATOR, state.getCdmaRoamingIndicator());
3235 values.put(CDMA_DEFAULT_ROAMING_INDICATOR, state.getCdmaDefaultRoamingIndicator());
3236 values.put(CDMA_ERI_ICON_INDEX, state.getCdmaEriIconIndex());
3237 values.put(CDMA_ERI_ICON_MODE, state.getCdmaEriIconMode());
3238 values.put(IS_EMERGENCY_ONLY, state.isEmergencyOnly());
3239 values.put(IS_DATA_ROAMING_FROM_REGISTRATION, state.getDataRoamingFromRegistration());
3240 values.put(IS_USING_CARRIER_AGGREGATION, state.isUsingCarrierAggregation());
3241 return values;
3242 }
3243
3244 /**
3245 * An integer value indicating the current voice service state.
3246 * <p>
3247 * Valid values: {@link ServiceState#STATE_IN_SERVICE},
3248 * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY},
3249 * {@link ServiceState#STATE_POWER_OFF}.
3250 * <p>
3251 * This is the same as {@link ServiceState#getState()}.
3252 */
3253 public static final String VOICE_REG_STATE = "voice_reg_state";
3254
3255 /**
3256 * An integer value indicating the current data service state.
3257 * <p>
3258 * Valid values: {@link ServiceState#STATE_IN_SERVICE},
3259 * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY},
3260 * {@link ServiceState#STATE_POWER_OFF}.
3261 * <p>
3262 * This is the same as {@link ServiceState#getDataRegState()}.
3263 * @hide
3264 */
3265 public static final String DATA_REG_STATE = "data_reg_state";
3266
3267 /**
3268 * An integer value indicating the current voice roaming type.
3269 * <p>
3270 * This is the same as {@link ServiceState#getVoiceRoamingType()}.
3271 * @hide
3272 */
3273 public static final String VOICE_ROAMING_TYPE = "voice_roaming_type";
3274
3275 /**
3276 * An integer value indicating the current data roaming type.
3277 * <p>
3278 * This is the same as {@link ServiceState#getDataRoamingType()}.
3279 * @hide
3280 */
3281 public static final String DATA_ROAMING_TYPE = "data_roaming_type";
3282
3283 /**
3284 * The current registered voice network operator name in long alphanumeric format.
3285 * <p>
3286 * This is the same as {@link ServiceState#getVoiceOperatorAlphaLong()}.
3287 * @hide
3288 */
3289 public static final String VOICE_OPERATOR_ALPHA_LONG = "voice_operator_alpha_long";
3290
3291 /**
3292 * The current registered operator name in short alphanumeric format.
3293 * <p>
3294 * In GSM/UMTS, short format can be up to 8 characters long. The current registered voice
3295 * network operator name in long alphanumeric format.
3296 * <p>
3297 * This is the same as {@link ServiceState#getVoiceOperatorAlphaShort()}.
3298 * @hide
3299 */
3300 public static final String VOICE_OPERATOR_ALPHA_SHORT = "voice_operator_alpha_short";
3301
3302
3303 /**
3304 * The current registered operator numeric id.
3305 * <p>
3306 * In GSM/UMTS, numeric format is 3 digit country code plus 2 or 3 digit
3307 * network code.
3308 * <p>
3309 * This is the same as {@link ServiceState#getOperatorNumeric()}.
3310 */
3311 public static final String VOICE_OPERATOR_NUMERIC = "voice_operator_numeric";
3312
3313 /**
3314 * The current registered data network operator name in long alphanumeric format.
3315 * <p>
3316 * This is the same as {@link ServiceState#getDataOperatorAlphaLong()}.
3317 * @hide
3318 */
3319 public static final String DATA_OPERATOR_ALPHA_LONG = "data_operator_alpha_long";
3320
3321 /**
3322 * The current registered data network operator name in short alphanumeric format.
3323 * <p>
3324 * This is the same as {@link ServiceState#getDataOperatorAlphaShort()}.
3325 * @hide
3326 */
3327 public static final String DATA_OPERATOR_ALPHA_SHORT = "data_operator_alpha_short";
3328
3329 /**
3330 * The current registered data network operator numeric id.
3331 * <p>
3332 * This is the same as {@link ServiceState#getDataOperatorNumeric()}.
3333 * @hide
3334 */
3335 public static final String DATA_OPERATOR_NUMERIC = "data_operator_numeric";
3336
3337 /**
3338 * The current network selection mode.
3339 * <p>
3340 * This is the same as {@link ServiceState#getIsManualSelection()}.
3341 */
3342 public static final String IS_MANUAL_NETWORK_SELECTION = "is_manual_network_selection";
3343
3344 /**
3345 * This is the same as {@link ServiceState#getRilVoiceRadioTechnology()}.
3346 * @hide
3347 */
3348 public static final String RIL_VOICE_RADIO_TECHNOLOGY = "ril_voice_radio_technology";
3349
3350 /**
3351 * This is the same as {@link ServiceState#getRilDataRadioTechnology()}.
3352 * @hide
3353 */
3354 public static final String RIL_DATA_RADIO_TECHNOLOGY = "ril_data_radio_technology";
3355
3356 /**
3357 * This is the same as {@link ServiceState#getCssIndicator()}.
3358 * @hide
3359 */
3360 public static final String CSS_INDICATOR = "css_indicator";
3361
3362 /**
3363 * This is the same as {@link ServiceState#getNetworkId()}.
3364 * @hide
3365 */
3366 public static final String NETWORK_ID = "network_id";
3367
3368 /**
3369 * This is the same as {@link ServiceState#getSystemId()}.
3370 * @hide
3371 */
3372 public static final String SYSTEM_ID = "system_id";
3373
3374 /**
3375 * This is the same as {@link ServiceState#getCdmaRoamingIndicator()}.
3376 * @hide
3377 */
3378 public static final String CDMA_ROAMING_INDICATOR = "cdma_roaming_indicator";
3379
3380 /**
3381 * This is the same as {@link ServiceState#getCdmaDefaultRoamingIndicator()}.
3382 * @hide
3383 */
3384 public static final String CDMA_DEFAULT_ROAMING_INDICATOR =
3385 "cdma_default_roaming_indicator";
3386
3387 /**
3388 * This is the same as {@link ServiceState#getCdmaEriIconIndex()}.
3389 * @hide
3390 */
3391 public static final String CDMA_ERI_ICON_INDEX = "cdma_eri_icon_index";
3392
3393 /**
3394 * This is the same as {@link ServiceState#getCdmaEriIconMode()}.
3395 * @hide
3396 */
3397 public static final String CDMA_ERI_ICON_MODE = "cdma_eri_icon_mode";
3398
3399 /**
3400 * This is the same as {@link ServiceState#isEmergencyOnly()}.
3401 * @hide
3402 */
3403 public static final String IS_EMERGENCY_ONLY = "is_emergency_only";
3404
3405 /**
3406 * This is the same as {@link ServiceState#getDataRoamingFromRegistration()}.
3407 * @hide
3408 */
3409 public static final String IS_DATA_ROAMING_FROM_REGISTRATION =
3410 "is_data_roaming_from_registration";
3411
3412 /**
3413 * This is the same as {@link ServiceState#isUsingCarrierAggregation()}.
3414 * @hide
3415 */
3416 public static final String IS_USING_CARRIER_AGGREGATION = "is_using_carrier_aggregation";
3417 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07003418
3419 /**
fionaxu58278be2018-01-29 14:08:12 -08003420 * Contains carrier identification information for the current subscriptions.
3421 * @see SubscriptionManager#getActiveSubscriptionIdList()
fionaxu3d0ad1f2017-10-25 23:09:36 -07003422 */
fionaxu62bc7472018-02-28 11:18:45 -08003423 public static final class CarrierId implements BaseColumns {
fionaxu3d0ad1f2017-10-25 23:09:36 -07003424 /**
fionaxu58278be2018-01-29 14:08:12 -08003425 * Not instantiable.
3426 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07003427 */
fionaxu62bc7472018-02-28 11:18:45 -08003428 private CarrierId() {}
fionaxu3d0ad1f2017-10-25 23:09:36 -07003429
3430 /**
fionaxu58278be2018-01-29 14:08:12 -08003431 * The {@code content://} style URI for this provider.
fionaxu3d0ad1f2017-10-25 23:09:36 -07003432 */
fionaxu62bc7472018-02-28 11:18:45 -08003433 public static final Uri CONTENT_URI = Uri.parse("content://carrier_id");
fionaxu3d0ad1f2017-10-25 23:09:36 -07003434
3435 /**
fionaxu62bc7472018-02-28 11:18:45 -08003436 * The authority string for the CarrierId Provider
fionaxu58278be2018-01-29 14:08:12 -08003437 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07003438 */
fionaxu62bc7472018-02-28 11:18:45 -08003439 public static final String AUTHORITY = "carrier_id";
fionaxu58278be2018-01-29 14:08:12 -08003440
fionaxu3d0ad1f2017-10-25 23:09:36 -07003441
3442 /**
fionaxu58278be2018-01-29 14:08:12 -08003443 * Generates a content {@link Uri} used to receive updates on carrier identity change
3444 * on the given subscriptionId
3445 * <p>
3446 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
fionaxuc8d483e2018-03-07 21:52:05 -08003447 * carrier identity {@link TelephonyManager#getSimCarrierId()}
fionaxu58278be2018-01-29 14:08:12 -08003448 * while your app is running. You can also use a {@link JobService} to ensure your app
3449 * is notified of changes to the {@link Uri} even when it is not running.
3450 * Note, however, that using a {@link JobService} does not guarantee timely delivery of
3451 * updates to the {@link Uri}.
3452 *
3453 * @param subscriptionId the subscriptionId to receive updates on
3454 * @return the Uri used to observe carrier identity changes
fionaxu3d0ad1f2017-10-25 23:09:36 -07003455 */
fionaxu58278be2018-01-29 14:08:12 -08003456 public static Uri getUriForSubscriptionId(int subscriptionId) {
3457 return CONTENT_URI.buildUpon().appendEncodedPath(
3458 String.valueOf(subscriptionId)).build();
3459 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07003460
3461 /**
fionaxu58278be2018-01-29 14:08:12 -08003462 * A user facing carrier name.
fionaxuc8d483e2018-03-07 21:52:05 -08003463 * @see TelephonyManager#getSimCarrierIdName()
fionaxu3d0ad1f2017-10-25 23:09:36 -07003464 * <P>Type: TEXT </P>
3465 */
fionaxu62bc7472018-02-28 11:18:45 -08003466 public static final String CARRIER_NAME = "carrier_name";
fionaxu3d0ad1f2017-10-25 23:09:36 -07003467
3468 /**
3469 * A unique carrier id
fionaxuc8d483e2018-03-07 21:52:05 -08003470 * @see TelephonyManager#getSimCarrierId()
fionaxu3d0ad1f2017-10-25 23:09:36 -07003471 * <P>Type: INTEGER </P>
3472 */
fionaxu62bc7472018-02-28 11:18:45 -08003473 public static final String CARRIER_ID = "carrier_id";
fionaxu3d0ad1f2017-10-25 23:09:36 -07003474
3475 /**
fionaxu58278be2018-01-29 14:08:12 -08003476 * Contains mappings between matching rules with carrier id for all carriers.
3477 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07003478 */
fionaxu58278be2018-01-29 14:08:12 -08003479 public static final class All implements BaseColumns {
3480 /**
3481 * Numeric operator ID (as String). {@code MCC + MNC}
3482 * <P>Type: TEXT </P>
3483 */
3484 public static final String MCCMNC = "mccmnc";
3485
3486 /**
3487 * Group id level 1 (as String).
3488 * <P>Type: TEXT </P>
3489 */
3490 public static final String GID1 = "gid1";
3491
3492 /**
3493 * Group id level 2 (as String).
3494 * <P>Type: TEXT </P>
3495 */
3496 public static final String GID2 = "gid2";
3497
3498 /**
3499 * Public Land Mobile Network name.
3500 * <P>Type: TEXT </P>
3501 */
3502 public static final String PLMN = "plmn";
3503
3504 /**
3505 * Prefix xpattern of IMSI (International Mobile Subscriber Identity).
3506 * <P>Type: TEXT </P>
3507 */
3508 public static final String IMSI_PREFIX_XPATTERN = "imsi_prefix_xpattern";
3509
3510 /**
3511 * Service Provider Name.
3512 * <P>Type: TEXT </P>
3513 */
3514 public static final String SPN = "spn";
3515
3516 /**
3517 * Prefer APN name.
3518 * <P>Type: TEXT </P>
3519 */
3520 public static final String APN = "apn";
3521
3522 /**
3523 * Prefix of Integrated Circuit Card Identifier.
3524 * <P>Type: TEXT </P>
3525 */
3526 public static final String ICCID_PREFIX = "iccid_prefix";
3527
3528 /**
3529 * The {@code content://} URI for this table.
3530 */
fionaxu62bc7472018-02-28 11:18:45 -08003531 public static final Uri CONTENT_URI = Uri.parse("content://carrier_id/all");
fionaxu58278be2018-01-29 14:08:12 -08003532 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07003533 }
Dan Willemsen4980bf42017-02-14 14:17:12 -08003534}