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