Debian Codegraph @

core/java/android/provider/Telephony.java

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