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