blob: 50b8f79892fd664fa7ed5ccf2eb18e856bec0264 [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
2125 * content provider
2126 */
2127 Uri RCS_1_TO_1_THREAD_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2128 RCS_1_TO_1_THREAD_URI_PART);
2129
2130 /**
2131 * The SMS/MMS thread to fallback to in case of an RCS outage
2132 */
2133 String FALLBACK_THREAD_ID_COLUMN = "rcs_fallback_thread_id";
2134 }
2135
2136 /**
2137 * The table that {@link android.telephony.ims.RcsGroupThread} gets persisted to
2138 */
2139 interface RcsGroupThreadColumns extends RcsThreadColumns {
2140 /**
2141 * The path that should be used for referring to
2142 * {@link android.telephony.ims.RcsGroupThread}s in
2143 * {@link com.android.providers.telephony.RcsProvider} URIs.
2144 */
2145 String RCS_GROUP_THREAD_URI_PART = "group_thread";
2146
2147 /**
2148 * The URI to query or modify {@link android.telephony.ims.RcsGroupThread}s via the
2149 * content provider
2150 */
2151 Uri RCS_GROUP_THREAD_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2152 RCS_GROUP_THREAD_URI_PART);
2153
2154 /**
2155 * The owner/admin of the {@link android.telephony.ims.RcsGroupThread}
2156 */
2157 String OWNER_PARTICIPANT_COLUMN = "owner_participant";
2158
2159 /**
2160 * The user visible name of the group
2161 */
2162 String GROUP_NAME_COLUMN = "group_name";
2163
2164 /**
2165 * The user visible icon of the group
2166 */
2167 String GROUP_ICON_COLUMN = "group_icon";
2168
2169 /**
2170 * The RCS conference URI for this group
2171 */
2172 String CONFERENCE_URI_COLUMN = "conference_uri";
2173 }
2174
2175 /**
2176 * The view that enables polling from all types of RCS threads at once
2177 */
2178 interface RcsUnifiedThreadColumns extends RcsThreadColumns, Rcs1To1ThreadColumns,
2179 RcsGroupThreadColumns {
2180 /**
2181 * The type of this {@link android.telephony.ims.RcsThread}
2182 */
2183 String THREAD_TYPE_COLUMN = "thread_type";
2184
2185 /**
2186 * Integer returned as a result from a database query that denotes the thread is 1 to 1
2187 */
2188 int THREAD_TYPE_1_TO_1 = 0;
2189
2190 /**
2191 * Integer returned as a result from a database query that denotes the thread is 1 to 1
2192 */
2193 int THREAD_TYPE_GROUP = 1;
2194 }
2195
2196 /**
2197 * The table that {@link android.telephony.ims.RcsParticipant} gets persisted to
2198 */
2199 interface RcsParticipantColumns {
2200 /**
2201 * The path that should be used for referring to
2202 * {@link android.telephony.ims.RcsParticipant}s in
2203 * {@link com.android.providers.telephony.RcsProvider} URIs.
2204 */
2205 String RCS_PARTICIPANT_URI_PART = "participant";
2206
2207 /**
2208 * The URI to query or modify {@link android.telephony.ims.RcsParticipant}s via the
2209 * content provider
2210 */
2211 Uri RCS_PARTICIPANT_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2212 RCS_PARTICIPANT_URI_PART);
2213
2214 /**
2215 * The unique identifier of the entry in the database
2216 */
2217 String RCS_PARTICIPANT_ID_COLUMN = "rcs_participant_id";
2218
2219 /**
2220 * A foreign key on canonical_address table, also used by SMS/MMS
2221 */
2222 String CANONICAL_ADDRESS_ID_COLUMN = "canonical_address_id";
2223
2224 /**
2225 * The user visible RCS alias for this participant.
2226 */
2227 String RCS_ALIAS_COLUMN = "rcs_alias";
2228 }
2229
2230 /**
2231 * Additional constants to enable access to {@link android.telephony.ims.RcsParticipant}
2232 * related data
2233 */
2234 interface RcsParticipantHelpers extends RcsParticipantColumns {
2235 /**
2236 * The view that unifies "rcs_participant" and "canonical_addresses" tables for easy
2237 * access to participant address.
2238 */
2239 String RCS_PARTICIPANT_WITH_ADDRESS_VIEW = "rcs_participant_with_address_view";
2240
2241 /**
2242 * The view that unifies "rcs_participant", "canonical_addresses" and
2243 * "rcs_thread_participant" junction table to get full information on participants that
2244 * contribute to threads.
2245 */
2246 String RCS_PARTICIPANT_WITH_THREAD_VIEW = "rcs_participant_with_thread_view";
2247 }
2248
2249 /**
2250 * The table that {@link android.telephony.ims.RcsMessage} gets persisted to
2251 */
2252 interface RcsMessageColumns {
2253 /**
2254 * Denotes the type of this message (i.e.
2255 * {@link android.telephony.ims.RcsIncomingMessage} or
2256 * {@link android.telephony.ims.RcsOutgoingMessage}
2257 */
2258 String MESSAGE_TYPE_COLUMN = "rcs_message_type";
2259
2260 /**
2261 * The unique identifier for the message in the database - i.e. the primary key.
2262 */
2263 String MESSAGE_ID_COLUMN = "rcs_message_row_id";
2264
2265 /**
2266 * The globally unique RCS identifier for the message. Please see 4.4.5.2 - GSMA
2267 * RCC.53 (RCS Device API 1.6 Specification)
2268 */
2269 String GLOBAL_ID_COLUMN = "rcs_message_global_id";
2270
2271 /**
2272 * The subscription where this message was sent from/to.
2273 */
2274 String SUB_ID_COLUMN = "sub_id";
2275
2276 /**
2277 * The sending status of the message.
2278 * @see android.telephony.ims.RcsMessage.RcsMessageStatus
2279 */
2280 String STATUS_COLUMN = "status";
2281
2282 /**
2283 * The creation timestamp of the message.
2284 */
2285 String ORIGINATION_TIMESTAMP_COLUMN = "origination_timestamp";
2286
2287 /**
2288 * The text content of the message.
2289 */
2290 String MESSAGE_TEXT_COLUMN = "rcs_text";
2291
2292 /**
2293 * The latitude content of the message, if it contains a location.
2294 */
2295 String LATITUDE_COLUMN = "latitude";
2296
2297 /**
2298 * The longitude content of the message, if it contains a location.
2299 */
2300 String LONGITUDE_COLUMN = "longitude";
2301 }
2302
2303 /**
2304 * The table that additional information of {@link android.telephony.ims.RcsIncomingMessage}
2305 * gets persisted to.
2306 */
2307 interface RcsIncomingMessageColumns extends RcsMessageColumns {
2308 /**
2309 The path that should be used for referring to
2310 * {@link android.telephony.ims.RcsIncomingMessage}s in
2311 * {@link com.android.providers.telephony.RcsProvider} URIs.
2312 */
2313 String INCOMING_MESSAGE_URI_PART = "incoming_message";
2314
2315 /**
2316 * The URI to query incoming messages through
2317 * {@link com.android.providers.telephony.RcsProvider}
2318 */
2319 Uri INCOMING_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2320 INCOMING_MESSAGE_URI_PART);
2321
2322 /**
2323 * The ID of the {@link android.telephony.ims.RcsParticipant} that sent this message
2324 */
2325 String SENDER_PARTICIPANT_ID_COLUMN = "sender_participant";
2326
2327 /**
2328 * The timestamp of arrival for this message.
2329 */
2330 String ARRIVAL_TIMESTAMP_COLUMN = "arrival_timestamp";
2331
2332 /**
2333 * The time when the recipient has read this message.
2334 */
2335 String SEEN_TIMESTAMP_COLUMN = "seen_timestamp";
2336 }
2337
2338 /**
2339 * The table that additional information of {@link android.telephony.ims.RcsOutgoingMessage}
2340 * gets persisted to.
2341 */
2342 interface RcsOutgoingMessageColumns extends RcsMessageColumns {
2343 /**
2344 * The path that should be used for referring to
2345 * {@link android.telephony.ims.RcsOutgoingMessage}s in
2346 * {@link com.android.providers.telephony.RcsProvider} URIs.
2347 */
2348 String OUTGOING_MESSAGE_URI_PART = "outgoing_message";
2349
2350 /**
2351 * The URI to query or modify {@link android.telephony.ims.RcsOutgoingMessage}s via the
2352 * content provider
2353 */
2354 Uri OUTGOING_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2355 OUTGOING_MESSAGE_URI_PART);
2356 }
2357
2358 /**
2359 * The delivery information of an {@link android.telephony.ims.RcsOutgoingMessage}
2360 */
2361 interface RcsMessageDeliveryColumns extends RcsOutgoingMessageColumns {
2362 /**
2363 * The path that should be used for referring to
2364 * {@link android.telephony.ims.RcsOutgoingMessageDelivery}s in
2365 * {@link com.android.providers.telephony.RcsProvider} URIs.
2366 */
2367 String DELIVERY_URI_PART = "delivery";
2368
2369 /**
2370 * The timestamp of delivery of this message.
2371 */
2372 String DELIVERED_TIMESTAMP_COLUMN = "delivered_timestamp";
2373
2374 /**
2375 * The time when the recipient has read this message.
2376 */
2377 String SEEN_TIMESTAMP_COLUMN = "seen_timestamp";
2378 }
2379
2380 /**
2381 * The views that allow querying {@link android.telephony.ims.RcsIncomingMessage} and
2382 * {@link android.telephony.ims.RcsOutgoingMessage} at the same time.
2383 */
2384 interface RcsUnifiedMessageColumns extends RcsIncomingMessageColumns,
2385 RcsOutgoingMessageColumns {
2386 /**
2387 * The path that is used to query all {@link android.telephony.ims.RcsMessage} in
2388 * {@link com.android.providers.telephony.RcsProvider} URIs.
2389 */
2390 String UNIFIED_MESSAGE_URI_PART = "message";
2391
2392 /**
2393 * The URI to query all types of {@link android.telephony.ims.RcsMessage}s
2394 */
2395 Uri UNIFIED_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2396 UNIFIED_MESSAGE_URI_PART);
2397
2398 /**
2399 * The name of the view that unites rcs_message and rcs_incoming_message tables.
2400 */
2401 String UNIFIED_INCOMING_MESSAGE_VIEW = "unified_incoming_message_view";
2402
2403 /**
2404 * The name of the view that unites rcs_message and rcs_outgoing_message tables.
2405 */
2406 String UNIFIED_OUTGOING_MESSAGE_VIEW = "unified_outgoing_message_view";
2407
2408 /**
2409 * The column that shows from which table the message entry came from.
2410 */
2411 String MESSAGE_TYPE_COLUMN = "message_type";
2412
2413 /**
2414 * Integer returned as a result from a database query that denotes that the message is
2415 * an incoming message
2416 */
2417 int MESSAGE_TYPE_INCOMING = 1;
2418
2419 /**
2420 * Integer returned as a result from a database query that denotes that the message is
2421 * an outgoing message
2422 */
2423 int MESSAGE_TYPE_OUTGOING = 0;
2424 }
2425
2426 /**
2427 * The table that {@link android.telephony.ims.RcsFileTransferPart} gets persisted to.
2428 */
2429 interface RcsFileTransferColumns {
2430 /**
2431 * The path that should be used for referring to
2432 * {@link android.telephony.ims.RcsFileTransferPart}s in
2433 * {@link com.android.providers.telephony.RcsProvider} URIs.
2434 */
2435 String FILE_TRANSFER_URI_PART = "file_transfer";
2436
2437 /**
2438 * The URI to query or modify {@link android.telephony.ims.RcsFileTransferPart}s via the
2439 * content provider
2440 */
2441 Uri FILE_TRANSFER_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2442 FILE_TRANSFER_URI_PART);
2443
2444 /**
2445 * The globally unique file transfer ID for this RCS file transfer.
2446 */
2447 String FILE_TRANSFER_ID_COLUMN = "rcs_file_transfer_id";
2448
2449 /**
2450 * The RCS session ID for this file transfer. The ID is implementation dependent but
2451 * should be unique.
2452 */
2453 String SESSION_ID_COLUMN = "session_id";
2454
2455 /**
2456 * The URI that points to the content of this file transfer
2457 */
2458 String CONTENT_URI_COLUMN = "content_uri";
2459
2460 /**
2461 * The file type of this file transfer in bytes. The validity of types is not enforced
2462 * in {@link android.telephony.ims.RcsMessageStore} APIs.
2463 */
2464 String CONTENT_TYPE_COLUMN = "content_type";
2465
2466 /**
2467 * The size of the file transfer in bytes.
2468 */
2469 String FILE_SIZE_COLUMN = "file_size";
2470
2471 /**
2472 * Number of bytes that was successfully transmitted for this file transfer
2473 */
2474 String SUCCESSFULLY_TRANSFERRED_BYTES = "transfer_offset";
2475
2476 /**
2477 * The status of this file transfer
2478 * @see android.telephony.ims.RcsFileTransferPart.RcsFileTransferStatus
2479 */
2480 String TRANSFER_STATUS_COLUMN = "transfer_status";
2481
2482 /**
2483 * The on-screen width of the file transfer, if it contains multi-media
2484 */
2485 String WIDTH_COLUMN = "width";
2486
2487 /**
2488 * The on-screen height of the file transfer, if it contains multi-media
2489 */
2490 String HEIGHT_COLUMN = "height";
2491
2492 /**
2493 * The duration of the content in milliseconds if this file transfer contains
2494 * multi-media
2495 */
2496 String DURATION_MILLIS_COLUMN = "duration";
2497
2498 /**
2499 * The URI to the preview of the content of this file transfer
2500 */
2501 String PREVIEW_URI_COLUMN = "preview_uri";
2502
2503 /**
2504 * The type of the preview of the content of this file transfer. The validity of types
2505 * is not enforced in {@link android.telephony.ims.RcsMessageStore} APIs.
2506 */
2507 String PREVIEW_TYPE_COLUMN = "preview_type";
2508 }
2509
2510 /**
2511 * The table that holds the information for
2512 * {@link android.telephony.ims.RcsGroupThreadEvent} and its subclasses.
2513 */
2514 interface RcsThreadEventColumns {
2515 /**
2516 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2517 * refer to participant joined events (example URI:
2518 * {@code content://rcs/group_thread/3/participant_joined_event})
2519 */
2520 String PARTICIPANT_JOINED_URI_PART = "participant_joined_event";
2521
2522 /**
2523 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2524 * refer to participant left events. (example URI:
2525 * {@code content://rcs/group_thread/3/participant_left_event/4})
2526 */
2527 String PARTICIPANT_LEFT_URI_PART = "participant_left_event";
2528
2529 /**
2530 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2531 * refer to name changed events. (example URI:
2532 * {@code content://rcs/group_thread/3/name_changed_event})
2533 */
2534 String NAME_CHANGED_URI_PART = "name_changed_event";
2535
2536 /**
2537 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2538 * refer to icon changed events. (example URI:
2539 * {@code content://rcs/group_thread/3/icon_changed_event})
2540 */
2541 String ICON_CHANGED_URI_PART = "icon_changed_event";
2542
2543 /**
2544 * The unique ID of this event in the database, i.e. the primary key
2545 */
2546 String EVENT_ID_COLUMN = "event_id";
2547
2548 /**
2549 * The type of this event
2550 *
2551 * @see RcsEventTypes
2552 */
2553 String EVENT_TYPE_COLUMN = "event_type";
2554
2555 /**
2556 * The timestamp in milliseconds of when this event happened
2557 */
2558 String TIMESTAMP_COLUMN = "origination_timestamp";
2559
2560 /**
2561 * The participant that generated this event
2562 */
2563 String SOURCE_PARTICIPANT_ID_COLUMN = "source_participant";
2564
2565 /**
2566 * The receiving participant of this event if this was an
2567 * {@link android.telephony.ims.RcsGroupThreadParticipantJoinedEvent} or
2568 * {@link android.telephony.ims.RcsGroupThreadParticipantLeftEvent}
2569 */
2570 String DESTINATION_PARTICIPANT_ID_COLUMN = "destination_participant";
2571
2572 /**
2573 * The URI for the new icon of the group thread if this was an
2574 * {@link android.telephony.ims.RcsGroupThreadIconChangedEvent}
2575 */
2576 String NEW_ICON_URI_COLUMN = "new_icon_uri";
2577
2578 /**
2579 * The URI for the new name of the group thread if this was an
2580 * {@link android.telephony.ims.RcsGroupThreadNameChangedEvent}
2581 */
2582 String NEW_NAME_COLUMN = "new_name";
2583 }
2584
2585 /**
2586 * The table that {@link android.telephony.ims.RcsParticipantAliasChangedEvent} gets
2587 * persisted to
2588 */
2589 interface RcsParticipantEventColumns {
2590 /**
2591 * The path that should be used for referring to
2592 * {@link android.telephony.ims.RcsParticipantAliasChangedEvent}s in
2593 * {@link com.android.providers.telephony.RcsProvider} URIs.
2594 */
2595 String ALIAS_CHANGE_EVENT_URI_PART = "alias_change_event";
2596
2597 /**
2598 * The new alias of the participant
2599 */
2600 String NEW_ALIAS_COLUMN = "new_alias";
2601 }
2602
2603 /**
2604 * These values are used in {@link com.android.providers.telephony.RcsProvider} to determine
2605 * what kind of event is present in the storage.
2606 */
2607 interface RcsEventTypes {
2608 /**
2609 * Integer constant that is stored in the
2610 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2611 * is of type {@link android.telephony.ims.RcsParticipantAliasChangedEvent}
2612 */
2613 int PARTICIPANT_ALIAS_CHANGED_EVENT_TYPE = 1;
2614
2615 /**
2616 * Integer constant that is stored in the
2617 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2618 * is of type {@link android.telephony.ims.RcsGroupThreadParticipantJoinedEvent}
2619 */
2620 int PARTICIPANT_JOINED_EVENT_TYPE = 2;
2621
2622 /**
2623 * Integer constant that is stored in the
2624 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2625 * is of type {@link android.telephony.ims.RcsGroupThreadParticipantLeftEvent}
2626 */
2627 int PARTICIPANT_LEFT_EVENT_TYPE = 4;
2628
2629 /**
2630 * Integer constant that is stored in the
2631 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2632 * is of type {@link android.telephony.ims.RcsGroupThreadIconChangedEvent}
2633 */
2634 int ICON_CHANGED_EVENT_TYPE = 8;
2635
2636 /**
2637 * Integer constant that is stored in the
2638 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2639 * is of type {@link android.telephony.ims.RcsGroupThreadNameChangedEvent}
2640 */
2641 int NAME_CHANGED_EVENT_TYPE = 16;
2642 }
2643
2644 /**
2645 * The view that allows unified querying across all events
2646 */
2647 interface RcsUnifiedEventHelper extends RcsParticipantEventColumns, RcsThreadEventColumns {
2648 /**
2649 * The path that should be used for referring to
2650 * {@link android.telephony.ims.RcsEvent}s in
2651 * {@link com.android.providers.telephony.RcsProvider} URIs.
2652 */
2653 String RCS_EVENT_QUERY_URI_PATH = "event";
2654
2655 /**
2656 * The URI to query {@link android.telephony.ims.RcsEvent}s via the content provider.
2657 */
2658 Uri RCS_EVENT_QUERY_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2659 RCS_EVENT_QUERY_URI_PATH);
2660 }
Leland Miller7b378ab2019-01-24 16:09:10 -08002661
2662 /**
2663 * Allows RCS specific canonical address handling.
2664 */
2665 interface RcsCanonicalAddressHelper {
2666 /**
2667 * Returns the canonical address ID for a canonical address, if now row exists, this
2668 * will add a row and return its ID. This helper works against the same table used by
2669 * the SMS and MMS threads, but is accessible only by the phone process for use by RCS
2670 * message storage.
2671 *
2672 * @throws IllegalArgumentException if unable to retrieve or create the canonical
2673 * address entry.
2674 */
2675 static long getOrCreateCanonicalAddressId(
2676 ContentResolver contentResolver, String canonicalAddress) {
2677
2678 Uri.Builder uriBuilder = CONTENT_AND_AUTHORITY.buildUpon();
2679 uriBuilder.appendPath("canonical-address");
2680 uriBuilder.appendQueryParameter("address", canonicalAddress);
2681 Uri uri = uriBuilder.build();
2682
2683 try (Cursor cursor = contentResolver.query(uri, null, null, null)) {
2684 if (cursor != null && cursor.moveToFirst()) {
2685 return cursor.getLong(cursor.getColumnIndex(CanonicalAddressesColumns._ID));
2686 } else {
2687 Rlog.e(TAG, "getOrCreateCanonicalAddressId returned no rows");
2688 }
2689 }
2690
2691 Rlog.e(TAG, "getOrCreateCanonicalAddressId failed");
2692 throw new IllegalArgumentException(
2693 "Unable to find or allocate a canonical address ID");
2694 }
2695 }
Sahin Caliskanf00a8762019-01-24 14:32:12 -08002696 }
2697
2698 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08002699 * Contains all MMS messages.
2700 */
2701 public static final class Mms implements BaseMmsColumns {
2702
2703 /**
2704 * Not instantiable.
2705 * @hide
2706 */
2707 private Mms() {
2708 }
2709
2710 /**
2711 * The {@code content://} URI for this table.
2712 */
2713 public static final Uri CONTENT_URI = Uri.parse("content://mms");
2714
2715 /**
2716 * Content URI for getting MMS report requests.
2717 */
2718 public static final Uri REPORT_REQUEST_URI = Uri.withAppendedPath(
2719 CONTENT_URI, "report-request");
2720
2721 /**
2722 * Content URI for getting MMS report status.
2723 */
2724 public static final Uri REPORT_STATUS_URI = Uri.withAppendedPath(
2725 CONTENT_URI, "report-status");
2726
2727 /**
2728 * The default sort order for this table.
2729 */
2730 public static final String DEFAULT_SORT_ORDER = "date DESC";
2731
2732 /**
2733 * Regex pattern for names and email addresses.
2734 * <ul>
2735 * <li><em>mailbox</em> = {@code name-addr}</li>
2736 * <li><em>name-addr</em> = {@code [display-name] angle-addr}</li>
2737 * <li><em>angle-addr</em> = {@code [CFWS] "<" addr-spec ">" [CFWS]}</li>
2738 * </ul>
2739 * @hide
2740 */
Mathew Inwoodba503112018-08-10 09:37:35 +01002741 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002742 public static final Pattern NAME_ADDR_EMAIL_PATTERN =
2743 Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*");
2744
2745 /**
2746 * Helper method to query this table.
2747 * @hide
2748 */
2749 public static Cursor query(
2750 ContentResolver cr, String[] projection) {
2751 return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER);
2752 }
2753
2754 /**
2755 * Helper method to query this table.
2756 * @hide
2757 */
2758 public static Cursor query(
2759 ContentResolver cr, String[] projection,
2760 String where, String orderBy) {
2761 return cr.query(CONTENT_URI, projection,
2762 where, null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
2763 }
2764
2765 /**
2766 * Helper method to extract email address from address string.
2767 * @hide
2768 */
Mathew Inwoodba503112018-08-10 09:37:35 +01002769 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002770 public static String extractAddrSpec(String address) {
2771 Matcher match = NAME_ADDR_EMAIL_PATTERN.matcher(address);
2772
2773 if (match.matches()) {
2774 return match.group(2);
2775 }
2776 return address;
2777 }
2778
2779 /**
2780 * Is the specified address an email address?
2781 *
2782 * @param address the input address to test
2783 * @return true if address is an email address; false otherwise.
2784 * @hide
2785 */
Mathew Inwoodba503112018-08-10 09:37:35 +01002786 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002787 public static boolean isEmailAddress(String address) {
2788 if (TextUtils.isEmpty(address)) {
2789 return false;
2790 }
2791
2792 String s = extractAddrSpec(address);
2793 Matcher match = Patterns.EMAIL_ADDRESS.matcher(s);
2794 return match.matches();
2795 }
2796
2797 /**
2798 * Is the specified number a phone number?
2799 *
2800 * @param number the input number to test
2801 * @return true if number is a phone number; false otherwise.
2802 * @hide
2803 */
Mathew Inwoodba503112018-08-10 09:37:35 +01002804 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002805 public static boolean isPhoneNumber(String number) {
2806 if (TextUtils.isEmpty(number)) {
2807 return false;
2808 }
2809
2810 Matcher match = Patterns.PHONE.matcher(number);
2811 return match.matches();
2812 }
2813
2814 /**
2815 * Contains all MMS messages in the MMS app inbox.
2816 */
2817 public static final class Inbox implements BaseMmsColumns {
2818
2819 /**
2820 * Not instantiable.
2821 * @hide
2822 */
2823 private Inbox() {
2824 }
2825
2826 /**
2827 * The {@code content://} style URL for this table.
2828 */
2829 public static final Uri
2830 CONTENT_URI = Uri.parse("content://mms/inbox");
2831
2832 /**
2833 * The default sort order for this table.
2834 */
2835 public static final String DEFAULT_SORT_ORDER = "date DESC";
2836 }
2837
2838 /**
2839 * Contains all MMS messages in the MMS app sent folder.
2840 */
2841 public static final class Sent implements BaseMmsColumns {
2842
2843 /**
2844 * Not instantiable.
2845 * @hide
2846 */
2847 private Sent() {
2848 }
2849
2850 /**
2851 * The {@code content://} style URL for this table.
2852 */
2853 public static final Uri
2854 CONTENT_URI = Uri.parse("content://mms/sent");
2855
2856 /**
2857 * The default sort order for this table.
2858 */
2859 public static final String DEFAULT_SORT_ORDER = "date DESC";
2860 }
2861
2862 /**
2863 * Contains all MMS messages in the MMS app drafts folder.
2864 */
2865 public static final class Draft implements BaseMmsColumns {
2866
2867 /**
2868 * Not instantiable.
2869 * @hide
2870 */
2871 private Draft() {
2872 }
2873
2874 /**
2875 * The {@code content://} style URL for this table.
2876 */
2877 public static final Uri
2878 CONTENT_URI = Uri.parse("content://mms/drafts");
2879
2880 /**
2881 * The default sort order for this table.
2882 */
2883 public static final String DEFAULT_SORT_ORDER = "date DESC";
2884 }
2885
2886 /**
2887 * Contains all MMS messages in the MMS app outbox.
2888 */
2889 public static final class Outbox implements BaseMmsColumns {
2890
2891 /**
2892 * Not instantiable.
2893 * @hide
2894 */
2895 private Outbox() {
2896 }
2897
2898 /**
2899 * The {@code content://} style URL for this table.
2900 */
2901 public static final Uri
2902 CONTENT_URI = Uri.parse("content://mms/outbox");
2903
2904 /**
2905 * The default sort order for this table.
2906 */
2907 public static final String DEFAULT_SORT_ORDER = "date DESC";
2908 }
2909
2910 /**
2911 * Contains address information for an MMS message.
2912 */
2913 public static final class Addr implements BaseColumns {
2914
2915 /**
2916 * Not instantiable.
2917 * @hide
2918 */
2919 private Addr() {
2920 }
2921
2922 /**
2923 * The ID of MM which this address entry belongs to.
2924 * <P>Type: INTEGER (long)</P>
2925 */
2926 public static final String MSG_ID = "msg_id";
2927
2928 /**
2929 * The ID of contact entry in Phone Book.
2930 * <P>Type: INTEGER (long)</P>
2931 */
2932 public static final String CONTACT_ID = "contact_id";
2933
2934 /**
2935 * The address text.
2936 * <P>Type: TEXT</P>
2937 */
2938 public static final String ADDRESS = "address";
2939
2940 /**
2941 * Type of address: must be one of {@code PduHeaders.BCC},
2942 * {@code PduHeaders.CC}, {@code PduHeaders.FROM}, {@code PduHeaders.TO}.
2943 * <P>Type: INTEGER</P>
2944 */
2945 public static final String TYPE = "type";
2946
2947 /**
2948 * Character set of this entry (MMS charset value).
2949 * <P>Type: INTEGER</P>
2950 */
2951 public static final String CHARSET = "charset";
2952 }
2953
2954 /**
2955 * Contains message parts.
Leland Miller6c753552019-01-22 17:28:55 -08002956 *
2957 * To avoid issues where applications might cache a part ID, the ID of a deleted part must
2958 * not be reused to point at a new part.
Dan Willemsen4980bf42017-02-14 14:17:12 -08002959 */
2960 public static final class Part implements BaseColumns {
2961
2962 /**
2963 * Not instantiable.
2964 * @hide
2965 */
2966 private Part() {
2967 }
2968
2969 /**
Leland Miller6c753552019-01-22 17:28:55 -08002970 * The {@code content://} style URL for this table. Can be appended with a part ID to
2971 * address individual parts.
2972 */
2973 public static final Uri CONTENT_URI = Uri.withAppendedPath(Mms.CONTENT_URI, "part");
2974
2975 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08002976 * The identifier of the message which this part belongs to.
2977 * <P>Type: INTEGER</P>
2978 */
2979 public static final String MSG_ID = "mid";
2980
2981 /**
2982 * The order of the part.
2983 * <P>Type: INTEGER</P>
2984 */
2985 public static final String SEQ = "seq";
2986
2987 /**
2988 * The content type of the part.
2989 * <P>Type: TEXT</P>
2990 */
2991 public static final String CONTENT_TYPE = "ct";
2992
2993 /**
2994 * The name of the part.
2995 * <P>Type: TEXT</P>
2996 */
2997 public static final String NAME = "name";
2998
2999 /**
3000 * The charset of the part.
3001 * <P>Type: TEXT</P>
3002 */
3003 public static final String CHARSET = "chset";
3004
3005 /**
3006 * The file name of the part.
3007 * <P>Type: TEXT</P>
3008 */
3009 public static final String FILENAME = "fn";
3010
3011 /**
3012 * The content disposition of the part.
3013 * <P>Type: TEXT</P>
3014 */
3015 public static final String CONTENT_DISPOSITION = "cd";
3016
3017 /**
3018 * The content ID of the part.
3019 * <P>Type: INTEGER</P>
3020 */
3021 public static final String CONTENT_ID = "cid";
3022
3023 /**
3024 * The content location of the part.
3025 * <P>Type: INTEGER</P>
3026 */
3027 public static final String CONTENT_LOCATION = "cl";
3028
3029 /**
3030 * The start of content-type of the message.
3031 * <P>Type: INTEGER</P>
3032 */
3033 public static final String CT_START = "ctt_s";
3034
3035 /**
3036 * The type of content-type of the message.
3037 * <P>Type: TEXT</P>
3038 */
3039 public static final String CT_TYPE = "ctt_t";
3040
3041 /**
3042 * The location (on filesystem) of the binary data of the part.
3043 * <P>Type: INTEGER</P>
3044 */
3045 public static final String _DATA = "_data";
3046
3047 /**
3048 * The message text.
3049 * <P>Type: TEXT</P>
3050 */
3051 public static final String TEXT = "text";
3052 }
3053
3054 /**
3055 * Message send rate table.
3056 */
3057 public static final class Rate {
3058
3059 /**
3060 * Not instantiable.
3061 * @hide
3062 */
3063 private Rate() {
3064 }
3065
3066 /**
3067 * The {@code content://} style URL for this table.
3068 */
3069 public static final Uri CONTENT_URI = Uri.withAppendedPath(
3070 Mms.CONTENT_URI, "rate");
3071
3072 /**
3073 * When a message was successfully sent.
3074 * <P>Type: INTEGER (long)</P>
3075 */
3076 public static final String SENT_TIME = "sent_time";
3077 }
3078
3079 /**
3080 * Intents class.
3081 */
3082 public static final class Intents {
3083
3084 /**
3085 * Not instantiable.
3086 * @hide
3087 */
3088 private Intents() {
3089 }
3090
3091 /**
3092 * Indicates that the contents of specified URIs were changed.
3093 * The application which is showing or caching these contents
3094 * should be updated.
3095 */
3096 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
3097 public static final String CONTENT_CHANGED_ACTION
3098 = "android.intent.action.CONTENT_CHANGED";
3099
3100 /**
3101 * An extra field which stores the URI of deleted contents.
3102 */
3103 public static final String DELETED_CONTENTS = "deleted_contents";
3104 }
3105 }
3106
3107 /**
3108 * Contains all MMS and SMS messages.
3109 */
3110 public static final class MmsSms implements BaseColumns {
3111
3112 /**
3113 * Not instantiable.
3114 * @hide
3115 */
3116 private MmsSms() {
3117 }
3118
3119 /**
3120 * The column to distinguish SMS and MMS messages in query results.
3121 */
3122 public static final String TYPE_DISCRIMINATOR_COLUMN =
3123 "transport_type";
3124
3125 /**
3126 * The {@code content://} style URL for this table.
3127 */
3128 public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/");
3129
3130 /**
3131 * The {@code content://} style URL for this table, by conversation.
3132 */
3133 public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse(
3134 "content://mms-sms/conversations");
3135
3136 /**
3137 * The {@code content://} style URL for this table, by phone number.
3138 */
3139 public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse(
3140 "content://mms-sms/messages/byphone");
3141
3142 /**
3143 * The {@code content://} style URL for undelivered messages in this table.
3144 */
3145 public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse(
3146 "content://mms-sms/undelivered");
3147
3148 /**
3149 * The {@code content://} style URL for draft messages in this table.
3150 */
3151 public static final Uri CONTENT_DRAFT_URI = Uri.parse(
3152 "content://mms-sms/draft");
3153
3154 /**
3155 * The {@code content://} style URL for locked messages in this table.
3156 */
3157 public static final Uri CONTENT_LOCKED_URI = Uri.parse(
3158 "content://mms-sms/locked");
3159
3160 /**
3161 * Pass in a query parameter called "pattern" which is the text to search for.
3162 * The sort order is fixed to be: {@code thread_id ASC, date DESC}.
3163 */
3164 public static final Uri SEARCH_URI = Uri.parse(
3165 "content://mms-sms/search");
3166
3167 // Constants for message protocol types.
3168
3169 /** SMS protocol type. */
3170 public static final int SMS_PROTO = 0;
3171
3172 /** MMS protocol type. */
3173 public static final int MMS_PROTO = 1;
3174
3175 // Constants for error types of pending messages.
3176
3177 /** Error type: no error. */
3178 public static final int NO_ERROR = 0;
3179
3180 /** Error type: generic transient error. */
3181 public static final int ERR_TYPE_GENERIC = 1;
3182
3183 /** Error type: SMS protocol transient error. */
3184 public static final int ERR_TYPE_SMS_PROTO_TRANSIENT = 2;
3185
3186 /** Error type: MMS protocol transient error. */
3187 public static final int ERR_TYPE_MMS_PROTO_TRANSIENT = 3;
3188
3189 /** Error type: transport failure. */
3190 public static final int ERR_TYPE_TRANSPORT_FAILURE = 4;
3191
3192 /** Error type: permanent error (along with all higher error values). */
3193 public static final int ERR_TYPE_GENERIC_PERMANENT = 10;
3194
3195 /** Error type: SMS protocol permanent error. */
3196 public static final int ERR_TYPE_SMS_PROTO_PERMANENT = 11;
3197
3198 /** Error type: MMS protocol permanent error. */
3199 public static final int ERR_TYPE_MMS_PROTO_PERMANENT = 12;
3200
3201 /**
3202 * Contains pending messages info.
3203 */
3204 public static final class PendingMessages implements BaseColumns {
3205
3206 /**
3207 * Not instantiable.
3208 * @hide
3209 */
3210 private PendingMessages() {
3211 }
3212
3213 public static final Uri CONTENT_URI = Uri.withAppendedPath(
3214 MmsSms.CONTENT_URI, "pending");
3215
3216 /**
3217 * The type of transport protocol (MMS or SMS).
3218 * <P>Type: INTEGER</P>
3219 */
3220 public static final String PROTO_TYPE = "proto_type";
3221
3222 /**
3223 * The ID of the message to be sent or downloaded.
3224 * <P>Type: INTEGER (long)</P>
3225 */
3226 public static final String MSG_ID = "msg_id";
3227
3228 /**
3229 * The type of the message to be sent or downloaded.
3230 * This field is only valid for MM. For SM, its value is always set to 0.
3231 * <P>Type: INTEGER</P>
3232 */
3233 public static final String MSG_TYPE = "msg_type";
3234
3235 /**
3236 * The type of the error code.
3237 * <P>Type: INTEGER</P>
3238 */
3239 public static final String ERROR_TYPE = "err_type";
3240
3241 /**
3242 * The error code of sending/retrieving process.
3243 * <P>Type: INTEGER</P>
3244 */
3245 public static final String ERROR_CODE = "err_code";
3246
3247 /**
3248 * How many times we tried to send or download the message.
3249 * <P>Type: INTEGER</P>
3250 */
3251 public static final String RETRY_INDEX = "retry_index";
3252
3253 /**
3254 * The time to do next retry.
3255 * <P>Type: INTEGER (long)</P>
3256 */
3257 public static final String DUE_TIME = "due_time";
3258
3259 /**
3260 * The time we last tried to send or download the message.
3261 * <P>Type: INTEGER (long)</P>
3262 */
3263 public static final String LAST_TRY = "last_try";
3264
3265 /**
3266 * The subscription to which the message belongs to. Its value will be
3267 * < 0 if the sub id cannot be determined.
3268 * <p>Type: INTEGER (long) </p>
3269 */
3270 public static final String SUBSCRIPTION_ID = "pending_sub_id";
3271 }
3272
3273 /**
3274 * Words table used by provider for full-text searches.
3275 * @hide
3276 */
3277 public static final class WordsTable {
3278
3279 /**
3280 * Not instantiable.
3281 * @hide
3282 */
3283 private WordsTable() {}
3284
3285 /**
3286 * Primary key.
3287 * <P>Type: INTEGER (long)</P>
3288 */
3289 public static final String ID = "_id";
3290
3291 /**
3292 * Source row ID.
3293 * <P>Type: INTEGER (long)</P>
3294 */
3295 public static final String SOURCE_ROW_ID = "source_id";
3296
3297 /**
3298 * Table ID (either 1 or 2).
3299 * <P>Type: INTEGER</P>
3300 */
3301 public static final String TABLE_ID = "table_to_use";
3302
3303 /**
3304 * The words to index.
3305 * <P>Type: TEXT</P>
3306 */
3307 public static final String INDEXED_TEXT = "index_text";
3308 }
3309 }
3310
3311 /**
3312 * Carriers class contains information about APNs, including MMSC information.
3313 */
3314 public static final class Carriers implements BaseColumns {
3315
3316 /**
3317 * Not instantiable.
3318 * @hide
3319 */
3320 private Carriers() {}
3321
3322 /**
3323 * The {@code content://} style URL for this table.
calvinpan5e272372018-12-07 20:03:48 +08003324 * For MSIM, this will return APNs for the default subscription
3325 * {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId for MSIM,
3326 * use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003327 */
3328 public static final Uri CONTENT_URI = Uri.parse("content://telephony/carriers");
3329
3330 /**
calvinpan5e272372018-12-07 20:03:48 +08003331 * The {@code content://} style URL for this table. Used for APN query based on current
3332 * subscription. Instead of specifying carrier matching information in the selection,
3333 * this API will return all matching APNs from current subscription carrier and queries
3334 * will be applied on top of that. If there is no match for MVNO (Mobile Virtual Network
3335 * Operator) APNs, return APNs from its MNO (based on mccmnc) instead. For MSIM, this will
3336 * return APNs for the default subscription
3337 * {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId for MSIM,
3338 * use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id.
3339 */
3340 public static final Uri SIM_APN_URI = Uri.parse(
3341 "content://telephony/carriers/sim_apn_list");
3342
3343 /**
yuemingw4c0065f2018-01-16 19:48:10 +00003344 * The {@code content://} style URL to be called from DevicePolicyManagerService,
3345 * can manage DPC-owned APNs.
3346 * @hide
3347 */
3348 public static final Uri DPC_URI = Uri.parse("content://telephony/carriers/dpc");
3349
3350 /**
3351 * The {@code content://} style URL to be called from Telephony to query APNs.
3352 * When DPC-owned APNs are enforced, only DPC-owned APNs are returned, otherwise only
calvinpan5e272372018-12-07 20:03:48 +08003353 * non-DPC-owned APNs are returned. For MSIM, this will return APNs for the default
3354 * subscription {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId
3355 * for MSIM, use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id.
yuemingw4c0065f2018-01-16 19:48:10 +00003356 * @hide
3357 */
3358 public static final Uri FILTERED_URI = Uri.parse("content://telephony/carriers/filtered");
3359
3360 /**
3361 * The {@code content://} style URL to be called from DevicePolicyManagerService
3362 * or Telephony to manage whether DPC-owned APNs are enforced.
3363 * @hide
3364 */
3365 public static final Uri ENFORCE_MANAGED_URI = Uri.parse(
3366 "content://telephony/carriers/enforce_managed");
3367
3368 /**
3369 * The column name for ENFORCE_MANAGED_URI, indicates whether DPC-owned APNs are enforced.
3370 * @hide
3371 */
3372 public static final String ENFORCE_KEY = "enforced";
3373
3374 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08003375 * The default sort order for this table.
3376 */
3377 public static final String DEFAULT_SORT_ORDER = "name ASC";
3378
3379 /**
3380 * Entry name.
3381 * <P>Type: TEXT</P>
3382 */
3383 public static final String NAME = "name";
3384
3385 /**
3386 * APN name.
3387 * <P>Type: TEXT</P>
3388 */
3389 public static final String APN = "apn";
3390
3391 /**
3392 * Proxy address.
3393 * <P>Type: TEXT</P>
3394 */
3395 public static final String PROXY = "proxy";
3396
3397 /**
3398 * Proxy port.
3399 * <P>Type: TEXT</P>
3400 */
3401 public static final String PORT = "port";
3402
3403 /**
3404 * MMS proxy address.
3405 * <P>Type: TEXT</P>
3406 */
3407 public static final String MMSPROXY = "mmsproxy";
3408
3409 /**
3410 * MMS proxy port.
3411 * <P>Type: TEXT</P>
3412 */
3413 public static final String MMSPORT = "mmsport";
3414
3415 /**
3416 * Server address.
3417 * <P>Type: TEXT</P>
3418 */
3419 public static final String SERVER = "server";
3420
3421 /**
3422 * APN username.
3423 * <P>Type: TEXT</P>
3424 */
3425 public static final String USER = "user";
3426
3427 /**
3428 * APN password.
3429 * <P>Type: TEXT</P>
3430 */
3431 public static final String PASSWORD = "password";
3432
3433 /**
3434 * MMSC URL.
3435 * <P>Type: TEXT</P>
3436 */
3437 public static final String MMSC = "mmsc";
3438
3439 /**
3440 * Mobile Country Code (MCC).
3441 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003442 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3443 * matching APNs based on current subscription carrier, thus no need to specify MCC and
3444 * other carrier matching information. In the future, Android will not support MCC for
3445 * APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003446 */
3447 public static final String MCC = "mcc";
3448
3449 /**
3450 * Mobile Network Code (MNC).
3451 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003452 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3453 * matching APNs based on current subscription carrier, thus no need to specify MNC and
3454 * other carrier matching information. In the future, Android will not support MNC for
3455 * APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003456 */
3457 public static final String MNC = "mnc";
3458
3459 /**
3460 * Numeric operator ID (as String). Usually {@code MCC + MNC}.
3461 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003462 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3463 * matching APNs based on current subscription carrier, thus no need to specify Numeric
3464 * and other carrier matching information. In the future, Android will not support Numeric
3465 * for APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003466 */
3467 public static final String NUMERIC = "numeric";
3468
3469 /**
3470 * Authentication type.
3471 * <P>Type: INTEGER</P>
3472 */
3473 public static final String AUTH_TYPE = "authtype";
3474
3475 /**
3476 * Comma-delimited list of APN types.
3477 * <P>Type: TEXT</P>
3478 */
3479 public static final String TYPE = "type";
3480
3481 /**
3482 * The protocol to use to connect to this APN.
3483 *
3484 * One of the {@code PDP_type} values in TS 27.007 section 10.1.1.
3485 * For example: {@code IP}, {@code IPV6}, {@code IPV4V6}, or {@code PPP}.
3486 * <P>Type: TEXT</P>
3487 */
3488 public static final String PROTOCOL = "protocol";
3489
3490 /**
3491 * The protocol to use to connect to this APN when roaming.
3492 * The syntax is the same as protocol.
3493 * <P>Type: TEXT</P>
3494 */
3495 public static final String ROAMING_PROTOCOL = "roaming_protocol";
3496
3497 /**
3498 * Is this the current APN?
3499 * <P>Type: INTEGER (boolean)</P>
3500 */
3501 public static final String CURRENT = "current";
3502
3503 /**
3504 * Is this APN enabled?
3505 * <P>Type: INTEGER (boolean)</P>
3506 */
3507 public static final String CARRIER_ENABLED = "carrier_enabled";
3508
3509 /**
3510 * Radio Access Technology info.
3511 * To check what values are allowed, refer to {@link android.telephony.ServiceState}.
3512 * This should be spread to other technologies,
3513 * but is currently only used for LTE (14) and eHRPD (13).
3514 * <P>Type: INTEGER</P>
Cassiee1c88022018-02-22 08:51:03 -08003515 * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead
Dan Willemsen4980bf42017-02-14 14:17:12 -08003516 */
Cassied53df962017-12-05 13:34:33 -08003517 @Deprecated
Dan Willemsen4980bf42017-02-14 14:17:12 -08003518 public static final String BEARER = "bearer";
3519
3520 /**
3521 * Radio Access Technology bitmask.
3522 * To check what values can be contained, refer to {@link android.telephony.ServiceState}.
3523 * 0 indicates all techs otherwise first bit refers to RAT/bearer 1, second bit refers to
3524 * RAT/bearer 2 and so on.
3525 * Bitmask for a radio tech R is (1 << (R - 1))
3526 * <P>Type: INTEGER</P>
3527 * @hide
Cassiee1c88022018-02-22 08:51:03 -08003528 * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead
Dan Willemsen4980bf42017-02-14 14:17:12 -08003529 */
Cassied53df962017-12-05 13:34:33 -08003530 @Deprecated
Dan Willemsen4980bf42017-02-14 14:17:12 -08003531 public static final String BEARER_BITMASK = "bearer_bitmask";
3532
3533 /**
Cassied53df962017-12-05 13:34:33 -08003534 * Radio technology (network type) bitmask.
Cassiee1c88022018-02-22 08:51:03 -08003535 * To check what values can be contained, refer to the NETWORK_TYPE_ constants in
Cassied53df962017-12-05 13:34:33 -08003536 * {@link android.telephony.TelephonyManager}.
3537 * Bitmask for a radio tech R is (1 << (R - 1))
3538 * <P>Type: INTEGER</P>
3539 */
3540 public static final String NETWORK_TYPE_BITMASK = "network_type_bitmask";
3541
3542 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08003543 * MVNO type:
3544 * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}.
3545 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003546 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3547 * matching APNs based on current subscription carrier, thus no need to specify MVNO_TYPE
3548 * and other carrier matching information. In the future, Android will not support MVNO_TYPE
3549 * for APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003550 */
3551 public static final String MVNO_TYPE = "mvno_type";
3552
3553 /**
3554 * MVNO data.
3555 * Use the following examples.
3556 * <ul>
3557 * <li>SPN: A MOBILE, BEN NL, ...</li>
3558 * <li>IMSI: 302720x94, 2060188, ...</li>
3559 * <li>GID: 4E, 33, ...</li>
3560 * </ul>
3561 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003562 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3563 * matching APNs based on current subscription carrier, thus no need to specify
3564 * MVNO_MATCH_DATA and other carrier matching information. In the future, Android will not
3565 * support MVNO_MATCH_DATA for APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003566 */
3567 public static final String MVNO_MATCH_DATA = "mvno_match_data";
3568
3569 /**
3570 * The subscription to which the APN belongs to
3571 * <p>Type: INTEGER (long) </p>
3572 */
3573 public static final String SUBSCRIPTION_ID = "sub_id";
3574
3575 /**
chen xu85100482018-10-12 15:30:34 -07003576 * The profile_id to which the APN saved in modem.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003577 * <p>Type: INTEGER</p>
3578 *@hide
3579 */
3580 public static final String PROFILE_ID = "profile_id";
3581
3582 /**
chen xu85100482018-10-12 15:30:34 -07003583 * If set to {@code true}, then the APN setting will persist to the modem.
3584 * <p>Type: INTEGER (boolean)</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003585 *@hide
3586 */
chen xu85100482018-10-12 15:30:34 -07003587 @SystemApi
chen xu7ebcd782018-11-28 00:21:50 -08003588 public static final String MODEM_PERSIST = "modem_cognitive";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003589
3590 /**
chen xu7ebcd782018-11-28 00:21:50 -08003591 * The max number of connections of this APN.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003592 * <p>Type: INTEGER</p>
3593 *@hide
3594 */
chen xu85100482018-10-12 15:30:34 -07003595 @SystemApi
chen xu7ebcd782018-11-28 00:21:50 -08003596 public static final String MAX_CONNECTIONS = "max_conns";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003597
3598 /**
chen xu7ebcd782018-11-28 00:21:50 -08003599 * The wait time for retrying the APN, in milliseconds.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003600 * <p>Type: INTEGER</p>
3601 *@hide
3602 */
chen xu85100482018-10-12 15:30:34 -07003603 @SystemApi
chen xu7ebcd782018-11-28 00:21:50 -08003604 public static final String WAIT_TIME_RETRY = "wait_time";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003605
3606 /**
chen xu7ebcd782018-11-28 00:21:50 -08003607 * The max number of seconds this APN will support its maximum number of connections
3608 * as defined in {@link #MAX_CONNECTIONS}.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003609 * <p>Type: INTEGER</p>
3610 *@hide
3611 */
chen xu85100482018-10-12 15:30:34 -07003612 @SystemApi
chen xu7ebcd782018-11-28 00:21:50 -08003613 public static final String TIME_LIMIT_FOR_MAX_CONNECTIONS = "max_conns_time";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003614
3615 /**
chen xu7ebcd782018-11-28 00:21:50 -08003616 * The MTU (maximum transmit unit) size of the mobile interface to which the APN is
3617 * connected, in bytes.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003618 * <p>Type: INTEGER </p>
3619 * @hide
3620 */
chen xu85100482018-10-12 15:30:34 -07003621 @SystemApi
Dan Willemsen4980bf42017-02-14 14:17:12 -08003622 public static final String MTU = "mtu";
3623
3624 /**
chen xu85100482018-10-12 15:30:34 -07003625 * APN edit status. APN could be added/edited/deleted by a user or carrier.
chen xu7ebcd782018-11-28 00:21:50 -08003626 * see all possible returned APN edit status.
3627 * <ul>
3628 * <li>{@link #UNEDITED}</li>
3629 * <li>{@link #USER_EDITED}</li>
3630 * <li>{@link #USER_DELETED}</li>
3631 * <li>{@link #CARRIER_EDITED}</li>
3632 * <li>{@link #CARRIER_DELETED}</li>
3633 * </ul>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003634 * <p>Type: INTEGER </p>
3635 * @hide
3636 */
chen xu85100482018-10-12 15:30:34 -07003637 @SystemApi
chen xu7ebcd782018-11-28 00:21:50 -08003638 public static final String EDITED_STATUS = "edited";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003639
3640 /**
chen xu85100482018-10-12 15:30:34 -07003641 * {@code true} if this APN visible to the user, {@code false} otherwise.
3642 * <p>Type: INTEGER (boolean)</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003643 * @hide
3644 */
chen xu85100482018-10-12 15:30:34 -07003645 @SystemApi
Dan Willemsen4980bf42017-02-14 14:17:12 -08003646 public static final String USER_VISIBLE = "user_visible";
3647
3648 /**
chen xu85100482018-10-12 15:30:34 -07003649 * {@code true} if the user allowed to edit this APN, {@code false} otherwise.
3650 * <p>Type: INTEGER (boolean)</p>
Amit Mahajand4977942017-07-17 14:46:39 -07003651 * @hide
3652 */
chen xu85100482018-10-12 15:30:34 -07003653 @SystemApi
Amit Mahajand4977942017-07-17 14:46:39 -07003654 public static final String USER_EDITABLE = "user_editable";
3655
3656 /**
chen xu7ebcd782018-11-28 00:21:50 -08003657 * {@link #EDITED_STATUS APN edit status} indicates that this APN has not been edited or
3658 * fails to edit.
chen xu85100482018-10-12 15:30:34 -07003659 * <p>Type: INTEGER </p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003660 * @hide
3661 */
chen xu85100482018-10-12 15:30:34 -07003662 @SystemApi
chen xu7ebcd782018-11-28 00:21:50 -08003663 public static final @EditStatus int UNEDITED = 0;
chen xu85100482018-10-12 15:30:34 -07003664
Dan Willemsen4980bf42017-02-14 14:17:12 -08003665 /**
chen xu7ebcd782018-11-28 00:21:50 -08003666 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by users.
chen xu85100482018-10-12 15:30:34 -07003667 * <p>Type: INTEGER </p>
3668 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003669 */
chen xu85100482018-10-12 15:30:34 -07003670 @SystemApi
chen xu7ebcd782018-11-28 00:21:50 -08003671 public static final @EditStatus int USER_EDITED = 1;
chen xu85100482018-10-12 15:30:34 -07003672
Dan Willemsen4980bf42017-02-14 14:17:12 -08003673 /**
chen xu7ebcd782018-11-28 00:21:50 -08003674 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by users.
chen xu85100482018-10-12 15:30:34 -07003675 * <p>Type: INTEGER </p>
3676 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003677 */
chen xu85100482018-10-12 15:30:34 -07003678 @SystemApi
chen xu7ebcd782018-11-28 00:21:50 -08003679 public static final @EditStatus int USER_DELETED = 2;
chen xu85100482018-10-12 15:30:34 -07003680
Dan Willemsen4980bf42017-02-14 14:17:12 -08003681 /**
chen xu7ebcd782018-11-28 00:21:50 -08003682 * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an
3683 * entry deleted by the user is still present in the new APN database and therefore must
3684 * remain tagged as user deleted rather than completely removed from the database.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003685 * @hide
3686 */
3687 public static final int USER_DELETED_BUT_PRESENT_IN_XML = 3;
chen xu85100482018-10-12 15:30:34 -07003688
Dan Willemsen4980bf42017-02-14 14:17:12 -08003689 /**
chen xu7ebcd782018-11-28 00:21:50 -08003690 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by
3691 * carriers.
chen xu85100482018-10-12 15:30:34 -07003692 * <p>Type: INTEGER </p>
3693 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003694 */
chen xu85100482018-10-12 15:30:34 -07003695 @SystemApi
chen xu7ebcd782018-11-28 00:21:50 -08003696 public static final @EditStatus int CARRIER_EDITED = 4;
chen xu85100482018-10-12 15:30:34 -07003697
Dan Willemsen4980bf42017-02-14 14:17:12 -08003698 /**
chen xu7ebcd782018-11-28 00:21:50 -08003699 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by
3700 * carriers. CARRIER_DELETED values are currently not used as there is no use case.
3701 * If they are used, delete() will have to change accordingly. Currently it is hardcoded to
3702 * USER_DELETED.
chen xu85100482018-10-12 15:30:34 -07003703 * <p>Type: INTEGER </p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003704 * @hide
3705 */
chen xu7ebcd782018-11-28 00:21:50 -08003706 public static final @EditStatus int CARRIER_DELETED = 5;
chen xu85100482018-10-12 15:30:34 -07003707
Dan Willemsen4980bf42017-02-14 14:17:12 -08003708 /**
chen xu7ebcd782018-11-28 00:21:50 -08003709 * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an
3710 * entry deleted by the carrier is still present in the new APN database and therefore must
3711 * remain tagged as user deleted rather than completely removed from the database.
chen xu85100482018-10-12 15:30:34 -07003712 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003713 */
3714 public static final int CARRIER_DELETED_BUT_PRESENT_IN_XML = 6;
yuemingwcf263eb2017-11-08 13:12:18 +00003715
3716 /**
3717 * The owner of the APN.
3718 * <p>Type: INTEGER</p>
3719 * @hide
3720 */
3721 public static final String OWNED_BY = "owned_by";
3722
3723 /**
3724 * Possible value for the OWNED_BY field.
3725 * APN is owned by DPC.
3726 * @hide
3727 */
3728 public static final int OWNED_BY_DPC = 0;
Jordan Liu40617152018-04-06 11:10:12 -07003729
yuemingwcf263eb2017-11-08 13:12:18 +00003730 /**
3731 * Possible value for the OWNED_BY field.
3732 * APN is owned by other sources.
3733 * @hide
3734 */
3735 public static final int OWNED_BY_OTHERS = 1;
Jordan Liu40617152018-04-06 11:10:12 -07003736
3737 /**
3738 * The APN set id. When the user manually selects an APN or the framework sets an APN as
3739 * preferred, all APNs with the same set id as the selected APN should be prioritized over
3740 * APNs in other sets.
chen xu85100482018-10-12 15:30:34 -07003741 * <p>Type: INTEGER</p>
Jordan Liu40617152018-04-06 11:10:12 -07003742 * @hide
3743 */
chen xu85100482018-10-12 15:30:34 -07003744 @SystemApi
Jordan Liu40617152018-04-06 11:10:12 -07003745 public static final String APN_SET_ID = "apn_set_id";
3746
3747 /**
chen xu7ebcd782018-11-28 00:21:50 -08003748 * Possible value for the {@link #APN_SET_ID} field. By default APNs will not belong to a
3749 * set. If the user manually selects an APN without apn set id, there is no need to
3750 * prioritize any specific APN set ids.
chen xu85100482018-10-12 15:30:34 -07003751 * <p>Type: INTEGER</p>
Jordan Liu40617152018-04-06 11:10:12 -07003752 * @hide
3753 */
chen xu85100482018-10-12 15:30:34 -07003754 @SystemApi
chen xu7ebcd782018-11-28 00:21:50 -08003755 public static final int NO_APN_SET_ID = 0;
Jordan Liu40617152018-04-06 11:10:12 -07003756
calvinpan3689c962018-10-19 15:11:22 +08003757 /**
3758 * A unique carrier id associated with this APN
3759 * {@see TelephonyManager#getSimCarrierId()}
3760 * <p>Type: STRING</p>
3761 */
3762 public static final String CARRIER_ID = "carrier_id";
3763
chen xu7ebcd782018-11-28 00:21:50 -08003764 /** @hide */
3765 @IntDef({
3766 UNEDITED,
3767 USER_EDITED,
3768 USER_DELETED,
3769 CARRIER_DELETED,
3770 CARRIER_EDITED,
3771 })
3772 @Retention(RetentionPolicy.SOURCE)
3773 public @interface EditStatus {}
Dan Willemsen4980bf42017-02-14 14:17:12 -08003774 }
3775
3776 /**
3777 * Contains received SMS cell broadcast messages.
3778 * @hide
3779 */
3780 public static final class CellBroadcasts implements BaseColumns {
3781
3782 /**
3783 * Not instantiable.
3784 * @hide
3785 */
3786 private CellBroadcasts() {}
3787
3788 /**
3789 * The {@code content://} URI for this table.
3790 */
3791 public static final Uri CONTENT_URI = Uri.parse("content://cellbroadcasts");
3792
3793 /**
3794 * Message geographical scope.
3795 * <P>Type: INTEGER</P>
3796 */
3797 public static final String GEOGRAPHICAL_SCOPE = "geo_scope";
3798
3799 /**
3800 * Message serial number.
3801 * <P>Type: INTEGER</P>
3802 */
3803 public static final String SERIAL_NUMBER = "serial_number";
3804
3805 /**
3806 * PLMN of broadcast sender. {@code SERIAL_NUMBER + PLMN + LAC + CID} uniquely identifies
3807 * a broadcast for duplicate detection purposes.
3808 * <P>Type: TEXT</P>
3809 */
3810 public static final String PLMN = "plmn";
3811
3812 /**
3813 * Location Area (GSM) or Service Area (UMTS) of broadcast sender. Unused for CDMA.
3814 * Only included if Geographical Scope of message is not PLMN wide (01).
3815 * <P>Type: INTEGER</P>
3816 */
3817 public static final String LAC = "lac";
3818
3819 /**
3820 * Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the
3821 * Geographical Scope of message is cell wide (00 or 11).
3822 * <P>Type: INTEGER</P>
3823 */
3824 public static final String CID = "cid";
3825
3826 /**
3827 * Message code. <em>OBSOLETE: merged into SERIAL_NUMBER.</em>
3828 * <P>Type: INTEGER</P>
3829 */
3830 public static final String V1_MESSAGE_CODE = "message_code";
3831
3832 /**
3833 * Message identifier. <em>OBSOLETE: renamed to SERVICE_CATEGORY.</em>
3834 * <P>Type: INTEGER</P>
3835 */
3836 public static final String V1_MESSAGE_IDENTIFIER = "message_id";
3837
3838 /**
3839 * Service category (GSM/UMTS: message identifier; CDMA: service category).
3840 * <P>Type: INTEGER</P>
3841 */
3842 public static final String SERVICE_CATEGORY = "service_category";
3843
3844 /**
3845 * Message language code.
3846 * <P>Type: TEXT</P>
3847 */
3848 public static final String LANGUAGE_CODE = "language";
3849
3850 /**
3851 * Message body.
3852 * <P>Type: TEXT</P>
3853 */
3854 public static final String MESSAGE_BODY = "body";
3855
3856 /**
3857 * Message delivery time.
3858 * <P>Type: INTEGER (long)</P>
3859 */
3860 public static final String DELIVERY_TIME = "date";
3861
3862 /**
3863 * Has the message been viewed?
3864 * <P>Type: INTEGER (boolean)</P>
3865 */
3866 public static final String MESSAGE_READ = "read";
3867
3868 /**
3869 * Message format (3GPP or 3GPP2).
3870 * <P>Type: INTEGER</P>
3871 */
3872 public static final String MESSAGE_FORMAT = "format";
3873
3874 /**
3875 * Message priority (including emergency).
3876 * <P>Type: INTEGER</P>
3877 */
3878 public static final String MESSAGE_PRIORITY = "priority";
3879
3880 /**
3881 * ETWS warning type (ETWS alerts only).
3882 * <P>Type: INTEGER</P>
3883 */
3884 public static final String ETWS_WARNING_TYPE = "etws_warning_type";
3885
3886 /**
3887 * CMAS message class (CMAS alerts only).
3888 * <P>Type: INTEGER</P>
3889 */
3890 public static final String CMAS_MESSAGE_CLASS = "cmas_message_class";
3891
3892 /**
3893 * CMAS category (CMAS alerts only).
3894 * <P>Type: INTEGER</P>
3895 */
3896 public static final String CMAS_CATEGORY = "cmas_category";
3897
3898 /**
3899 * CMAS response type (CMAS alerts only).
3900 * <P>Type: INTEGER</P>
3901 */
3902 public static final String CMAS_RESPONSE_TYPE = "cmas_response_type";
3903
3904 /**
3905 * CMAS severity (CMAS alerts only).
3906 * <P>Type: INTEGER</P>
3907 */
3908 public static final String CMAS_SEVERITY = "cmas_severity";
3909
3910 /**
3911 * CMAS urgency (CMAS alerts only).
3912 * <P>Type: INTEGER</P>
3913 */
3914 public static final String CMAS_URGENCY = "cmas_urgency";
3915
3916 /**
3917 * CMAS certainty (CMAS alerts only).
3918 * <P>Type: INTEGER</P>
3919 */
3920 public static final String CMAS_CERTAINTY = "cmas_certainty";
3921
3922 /** The default sort order for this table. */
3923 public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC";
3924
3925 /**
3926 * Query columns for instantiating {@link android.telephony.CellBroadcastMessage} objects.
3927 */
3928 public static final String[] QUERY_COLUMNS = {
3929 _ID,
3930 GEOGRAPHICAL_SCOPE,
3931 PLMN,
3932 LAC,
3933 CID,
3934 SERIAL_NUMBER,
3935 SERVICE_CATEGORY,
3936 LANGUAGE_CODE,
3937 MESSAGE_BODY,
3938 DELIVERY_TIME,
3939 MESSAGE_READ,
3940 MESSAGE_FORMAT,
3941 MESSAGE_PRIORITY,
3942 ETWS_WARNING_TYPE,
3943 CMAS_MESSAGE_CLASS,
3944 CMAS_CATEGORY,
3945 CMAS_RESPONSE_TYPE,
3946 CMAS_SEVERITY,
3947 CMAS_URGENCY,
3948 CMAS_CERTAINTY
3949 };
3950 }
Jordan Liub9b75ed2017-02-28 18:15:07 -08003951
3952 /**
3953 * Constants for interfacing with the ServiceStateProvider and the different fields of the
3954 * {@link ServiceState} class accessible through the provider.
3955 */
3956 public static final class ServiceStateTable {
3957
3958 /**
3959 * Not instantiable.
3960 * @hide
3961 */
3962 private ServiceStateTable() {}
3963
3964 /**
3965 * The authority string for the ServiceStateProvider
3966 */
3967 public static final String AUTHORITY = "service-state";
3968
3969 /**
3970 * The {@code content://} style URL for the ServiceStateProvider
3971 */
3972 public static final Uri CONTENT_URI = Uri.parse("content://service-state/");
3973
3974 /**
3975 * Generates a content {@link Uri} used to receive updates on a specific field in the
3976 * ServiceState provider.
3977 * <p>
3978 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
3979 * {@link ServiceState} while your app is running. You can also use a {@link JobService} to
3980 * ensure your app is notified of changes to the {@link Uri} even when it is not running.
3981 * Note, however, that using a {@link JobService} does not guarantee timely delivery of
3982 * updates to the {@link Uri}.
3983 *
Jordan Liu0f332522017-04-19 14:25:29 -07003984 * @param subscriptionId the subscriptionId to receive updates on
Jordan Liub9b75ed2017-02-28 18:15:07 -08003985 * @param field the ServiceState field to receive updates on
3986 * @return the Uri used to observe {@link ServiceState} changes
3987 */
Jordan Liu0f332522017-04-19 14:25:29 -07003988 public static Uri getUriForSubscriptionIdAndField(int subscriptionId, String field) {
3989 return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId))
Jordan Liub9b75ed2017-02-28 18:15:07 -08003990 .appendEncodedPath(field).build();
3991 }
3992
3993 /**
3994 * Generates a content {@link Uri} used to receive updates on every field in the
3995 * ServiceState provider.
3996 * <p>
3997 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
3998 * {@link ServiceState} while your app is running. You can also use a {@link JobService} to
3999 * ensure your app is notified of changes to the {@link Uri} even when it is not running.
4000 * Note, however, that using a {@link JobService} does not guarantee timely delivery of
4001 * updates to the {@link Uri}.
4002 *
Jordan Liu0f332522017-04-19 14:25:29 -07004003 * @param subscriptionId the subscriptionId to receive updates on
Jordan Liub9b75ed2017-02-28 18:15:07 -08004004 * @return the Uri used to observe {@link ServiceState} changes
4005 */
Jordan Liu0f332522017-04-19 14:25:29 -07004006 public static Uri getUriForSubscriptionId(int subscriptionId) {
4007 return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId)).build();
Jordan Liub9b75ed2017-02-28 18:15:07 -08004008 }
4009
4010 /**
4011 * Used to insert a ServiceState into the ServiceStateProvider as a ContentValues instance.
4012 *
4013 * @param state the ServiceState to convert into ContentValues
4014 * @return the convertedContentValues instance
4015 * @hide
4016 */
4017 public static ContentValues getContentValuesForServiceState(ServiceState state) {
4018 ContentValues values = new ContentValues();
4019 values.put(VOICE_REG_STATE, state.getVoiceRegState());
4020 values.put(DATA_REG_STATE, state.getDataRegState());
4021 values.put(VOICE_ROAMING_TYPE, state.getVoiceRoamingType());
4022 values.put(DATA_ROAMING_TYPE, state.getDataRoamingType());
4023 values.put(VOICE_OPERATOR_ALPHA_LONG, state.getVoiceOperatorAlphaLong());
4024 values.put(VOICE_OPERATOR_ALPHA_SHORT, state.getVoiceOperatorAlphaShort());
4025 values.put(VOICE_OPERATOR_NUMERIC, state.getVoiceOperatorNumeric());
4026 values.put(DATA_OPERATOR_ALPHA_LONG, state.getDataOperatorAlphaLong());
4027 values.put(DATA_OPERATOR_ALPHA_SHORT, state.getDataOperatorAlphaShort());
4028 values.put(DATA_OPERATOR_NUMERIC, state.getDataOperatorNumeric());
4029 values.put(IS_MANUAL_NETWORK_SELECTION, state.getIsManualSelection());
4030 values.put(RIL_VOICE_RADIO_TECHNOLOGY, state.getRilVoiceRadioTechnology());
4031 values.put(RIL_DATA_RADIO_TECHNOLOGY, state.getRilDataRadioTechnology());
4032 values.put(CSS_INDICATOR, state.getCssIndicator());
Jack Yu2661fac2018-03-15 13:51:05 -07004033 values.put(NETWORK_ID, state.getCdmaNetworkId());
4034 values.put(SYSTEM_ID, state.getCdmaSystemId());
Jordan Liub9b75ed2017-02-28 18:15:07 -08004035 values.put(CDMA_ROAMING_INDICATOR, state.getCdmaRoamingIndicator());
4036 values.put(CDMA_DEFAULT_ROAMING_INDICATOR, state.getCdmaDefaultRoamingIndicator());
4037 values.put(CDMA_ERI_ICON_INDEX, state.getCdmaEriIconIndex());
4038 values.put(CDMA_ERI_ICON_MODE, state.getCdmaEriIconMode());
4039 values.put(IS_EMERGENCY_ONLY, state.isEmergencyOnly());
Jordan Liub9b75ed2017-02-28 18:15:07 -08004040 values.put(IS_USING_CARRIER_AGGREGATION, state.isUsingCarrierAggregation());
4041 return values;
4042 }
4043
4044 /**
4045 * An integer value indicating the current voice service state.
4046 * <p>
4047 * Valid values: {@link ServiceState#STATE_IN_SERVICE},
4048 * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY},
4049 * {@link ServiceState#STATE_POWER_OFF}.
4050 * <p>
4051 * This is the same as {@link ServiceState#getState()}.
4052 */
4053 public static final String VOICE_REG_STATE = "voice_reg_state";
4054
4055 /**
4056 * An integer value indicating the current data service state.
4057 * <p>
4058 * Valid values: {@link ServiceState#STATE_IN_SERVICE},
4059 * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY},
4060 * {@link ServiceState#STATE_POWER_OFF}.
4061 * <p>
4062 * This is the same as {@link ServiceState#getDataRegState()}.
4063 * @hide
4064 */
4065 public static final String DATA_REG_STATE = "data_reg_state";
4066
4067 /**
4068 * An integer value indicating the current voice roaming type.
4069 * <p>
4070 * This is the same as {@link ServiceState#getVoiceRoamingType()}.
4071 * @hide
4072 */
4073 public static final String VOICE_ROAMING_TYPE = "voice_roaming_type";
4074
4075 /**
4076 * An integer value indicating the current data roaming type.
4077 * <p>
4078 * This is the same as {@link ServiceState#getDataRoamingType()}.
4079 * @hide
4080 */
4081 public static final String DATA_ROAMING_TYPE = "data_roaming_type";
4082
4083 /**
4084 * The current registered voice network operator name in long alphanumeric format.
4085 * <p>
4086 * This is the same as {@link ServiceState#getVoiceOperatorAlphaLong()}.
4087 * @hide
4088 */
4089 public static final String VOICE_OPERATOR_ALPHA_LONG = "voice_operator_alpha_long";
4090
4091 /**
4092 * The current registered operator name in short alphanumeric format.
4093 * <p>
4094 * In GSM/UMTS, short format can be up to 8 characters long. The current registered voice
4095 * network operator name in long alphanumeric format.
4096 * <p>
4097 * This is the same as {@link ServiceState#getVoiceOperatorAlphaShort()}.
4098 * @hide
4099 */
4100 public static final String VOICE_OPERATOR_ALPHA_SHORT = "voice_operator_alpha_short";
4101
4102
4103 /**
4104 * The current registered operator numeric id.
4105 * <p>
4106 * In GSM/UMTS, numeric format is 3 digit country code plus 2 or 3 digit
4107 * network code.
4108 * <p>
4109 * This is the same as {@link ServiceState#getOperatorNumeric()}.
4110 */
4111 public static final String VOICE_OPERATOR_NUMERIC = "voice_operator_numeric";
4112
4113 /**
4114 * The current registered data network operator name in long alphanumeric format.
4115 * <p>
4116 * This is the same as {@link ServiceState#getDataOperatorAlphaLong()}.
4117 * @hide
4118 */
4119 public static final String DATA_OPERATOR_ALPHA_LONG = "data_operator_alpha_long";
4120
4121 /**
4122 * The current registered data network operator name in short alphanumeric format.
4123 * <p>
4124 * This is the same as {@link ServiceState#getDataOperatorAlphaShort()}.
4125 * @hide
4126 */
4127 public static final String DATA_OPERATOR_ALPHA_SHORT = "data_operator_alpha_short";
4128
4129 /**
4130 * The current registered data network operator numeric id.
4131 * <p>
4132 * This is the same as {@link ServiceState#getDataOperatorNumeric()}.
4133 * @hide
4134 */
4135 public static final String DATA_OPERATOR_NUMERIC = "data_operator_numeric";
4136
4137 /**
4138 * The current network selection mode.
4139 * <p>
4140 * This is the same as {@link ServiceState#getIsManualSelection()}.
4141 */
4142 public static final String IS_MANUAL_NETWORK_SELECTION = "is_manual_network_selection";
4143
4144 /**
4145 * This is the same as {@link ServiceState#getRilVoiceRadioTechnology()}.
4146 * @hide
4147 */
4148 public static final String RIL_VOICE_RADIO_TECHNOLOGY = "ril_voice_radio_technology";
4149
4150 /**
4151 * This is the same as {@link ServiceState#getRilDataRadioTechnology()}.
4152 * @hide
4153 */
4154 public static final String RIL_DATA_RADIO_TECHNOLOGY = "ril_data_radio_technology";
4155
4156 /**
4157 * This is the same as {@link ServiceState#getCssIndicator()}.
4158 * @hide
4159 */
4160 public static final String CSS_INDICATOR = "css_indicator";
4161
4162 /**
Jack Yu2661fac2018-03-15 13:51:05 -07004163 * This is the same as {@link ServiceState#getCdmaNetworkId()}.
Jordan Liub9b75ed2017-02-28 18:15:07 -08004164 * @hide
4165 */
4166 public static final String NETWORK_ID = "network_id";
4167
4168 /**
Jack Yu2661fac2018-03-15 13:51:05 -07004169 * This is the same as {@link ServiceState#getCdmaSystemId()}.
Jordan Liub9b75ed2017-02-28 18:15:07 -08004170 * @hide
4171 */
4172 public static final String SYSTEM_ID = "system_id";
4173
4174 /**
4175 * This is the same as {@link ServiceState#getCdmaRoamingIndicator()}.
4176 * @hide
4177 */
4178 public static final String CDMA_ROAMING_INDICATOR = "cdma_roaming_indicator";
4179
4180 /**
4181 * This is the same as {@link ServiceState#getCdmaDefaultRoamingIndicator()}.
4182 * @hide
4183 */
4184 public static final String CDMA_DEFAULT_ROAMING_INDICATOR =
4185 "cdma_default_roaming_indicator";
4186
4187 /**
4188 * This is the same as {@link ServiceState#getCdmaEriIconIndex()}.
4189 * @hide
4190 */
4191 public static final String CDMA_ERI_ICON_INDEX = "cdma_eri_icon_index";
4192
4193 /**
4194 * This is the same as {@link ServiceState#getCdmaEriIconMode()}.
4195 * @hide
4196 */
4197 public static final String CDMA_ERI_ICON_MODE = "cdma_eri_icon_mode";
4198
4199 /**
4200 * This is the same as {@link ServiceState#isEmergencyOnly()}.
4201 * @hide
4202 */
4203 public static final String IS_EMERGENCY_ONLY = "is_emergency_only";
4204
4205 /**
4206 * This is the same as {@link ServiceState#getDataRoamingFromRegistration()}.
4207 * @hide
4208 */
4209 public static final String IS_DATA_ROAMING_FROM_REGISTRATION =
4210 "is_data_roaming_from_registration";
4211
4212 /**
4213 * This is the same as {@link ServiceState#isUsingCarrierAggregation()}.
4214 * @hide
4215 */
4216 public static final String IS_USING_CARRIER_AGGREGATION = "is_using_carrier_aggregation";
4217 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07004218
4219 /**
fionaxu58278be2018-01-29 14:08:12 -08004220 * Contains carrier identification information for the current subscriptions.
4221 * @see SubscriptionManager#getActiveSubscriptionIdList()
fionaxu3d0ad1f2017-10-25 23:09:36 -07004222 */
fionaxu62bc7472018-02-28 11:18:45 -08004223 public static final class CarrierId implements BaseColumns {
fionaxu3d0ad1f2017-10-25 23:09:36 -07004224 /**
fionaxu58278be2018-01-29 14:08:12 -08004225 * Not instantiable.
4226 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07004227 */
fionaxu62bc7472018-02-28 11:18:45 -08004228 private CarrierId() {}
fionaxu3d0ad1f2017-10-25 23:09:36 -07004229
4230 /**
fionaxu58278be2018-01-29 14:08:12 -08004231 * The {@code content://} style URI for this provider.
fionaxu3d0ad1f2017-10-25 23:09:36 -07004232 */
fionaxu62bc7472018-02-28 11:18:45 -08004233 public static final Uri CONTENT_URI = Uri.parse("content://carrier_id");
fionaxu3d0ad1f2017-10-25 23:09:36 -07004234
4235 /**
fionaxu62bc7472018-02-28 11:18:45 -08004236 * The authority string for the CarrierId Provider
fionaxu58278be2018-01-29 14:08:12 -08004237 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07004238 */
fionaxu62bc7472018-02-28 11:18:45 -08004239 public static final String AUTHORITY = "carrier_id";
fionaxu58278be2018-01-29 14:08:12 -08004240
fionaxu3d0ad1f2017-10-25 23:09:36 -07004241
4242 /**
fionaxu58278be2018-01-29 14:08:12 -08004243 * Generates a content {@link Uri} used to receive updates on carrier identity change
4244 * on the given subscriptionId
4245 * <p>
4246 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
fionaxuc8d483e2018-03-07 21:52:05 -08004247 * carrier identity {@link TelephonyManager#getSimCarrierId()}
fionaxu58278be2018-01-29 14:08:12 -08004248 * while your app is running. You can also use a {@link JobService} to ensure your app
4249 * is notified of changes to the {@link Uri} even when it is not running.
4250 * Note, however, that using a {@link JobService} does not guarantee timely delivery of
4251 * updates to the {@link Uri}.
4252 *
4253 * @param subscriptionId the subscriptionId to receive updates on
4254 * @return the Uri used to observe carrier identity changes
fionaxu3d0ad1f2017-10-25 23:09:36 -07004255 */
fionaxu58278be2018-01-29 14:08:12 -08004256 public static Uri getUriForSubscriptionId(int subscriptionId) {
4257 return CONTENT_URI.buildUpon().appendEncodedPath(
4258 String.valueOf(subscriptionId)).build();
4259 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07004260
4261 /**
chen xua8d3d482018-11-02 17:49:57 -07004262 * Generates a content {@link Uri} used to receive updates on precise carrier identity
chen xu64c1d7642018-12-06 15:34:05 -08004263 * change on the given subscriptionId returned by
4264 * {@link TelephonyManager#getSimPreciseCarrierId()}.
4265 * @see TelephonyManager#ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED
chen xua8d3d482018-11-02 17:49:57 -07004266 * <p>
4267 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
4268 * precise carrier identity {@link TelephonyManager#getSimPreciseCarrierId()}
4269 * while your app is running. You can also use a {@link JobService} to ensure your app
4270 * is notified of changes to the {@link Uri} even when it is not running.
4271 * Note, however, that using a {@link JobService} does not guarantee timely delivery of
4272 * updates to the {@link Uri}.
4273 *
4274 * @param subscriptionId the subscriptionId to receive updates on
4275 * @return the Uri used to observe precise carrier identity changes
chen xua8d3d482018-11-02 17:49:57 -07004276 */
4277 public static Uri getPreciseCarrierIdUriForSubscriptionId(int subscriptionId) {
4278 return Uri.withAppendedPath(Uri.withAppendedPath(CONTENT_URI, "precise"),
4279 String.valueOf(subscriptionId));
4280 }
4281
4282 /**
fionaxu58278be2018-01-29 14:08:12 -08004283 * A user facing carrier name.
fionaxuc8d483e2018-03-07 21:52:05 -08004284 * @see TelephonyManager#getSimCarrierIdName()
fionaxu3d0ad1f2017-10-25 23:09:36 -07004285 * <P>Type: TEXT </P>
4286 */
fionaxu62bc7472018-02-28 11:18:45 -08004287 public static final String CARRIER_NAME = "carrier_name";
fionaxu3d0ad1f2017-10-25 23:09:36 -07004288
4289 /**
4290 * A unique carrier id
fionaxuc8d483e2018-03-07 21:52:05 -08004291 * @see TelephonyManager#getSimCarrierId()
fionaxu3d0ad1f2017-10-25 23:09:36 -07004292 * <P>Type: INTEGER </P>
4293 */
fionaxu62bc7472018-02-28 11:18:45 -08004294 public static final String CARRIER_ID = "carrier_id";
fionaxu3d0ad1f2017-10-25 23:09:36 -07004295
4296 /**
chen xua8d3d482018-11-02 17:49:57 -07004297 * A fine-grained carrier id.
4298 * @see TelephonyManager#getSimPreciseCarrierId()
4299 * This is not a database column, only used to notify content observers for
4300 * {@link #getPreciseCarrierIdUriForSubscriptionId(int)}
chen xua8d3d482018-11-02 17:49:57 -07004301 */
4302 public static final String PRECISE_CARRIER_ID = "precise_carrier_id";
4303
4304 /**
chen xu64c1d7642018-12-06 15:34:05 -08004305 * A user facing carrier name for precise carrier id {@link #PRECISE_CARRIER_ID}.
4306 * @see TelephonyManager#getSimPreciseCarrierIdName()
4307 * This is not a database column, only used to notify content observers for
4308 * {@link #getPreciseCarrierIdUriForSubscriptionId(int)}
4309 */
4310 public static final String PRECISE_CARRIER_ID_NAME = "precise_carrier_id_name";
4311
4312 /**
chen xua8d3d482018-11-02 17:49:57 -07004313 * A unique parent carrier id. The parent-child
4314 * relationship can be used to further differentiate a single carrier by different networks,
4315 * by prepaid v.s. postpaid or even by 4G v.s. 3G plan. It's an optional field.
4316 * A carrier id with a valid parent_carrier_id is considered fine-grained carrier id, will
4317 * not be returned as {@link #CARRIER_ID} but {@link #PRECISE_CARRIER_ID}.
4318 * <P>Type: INTEGER </P>
4319 * @hide
4320 */
4321 public static final String PARENT_CARRIER_ID = "parent_carrier_id";
4322
4323 /**
fionaxu58278be2018-01-29 14:08:12 -08004324 * Contains mappings between matching rules with carrier id for all carriers.
4325 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07004326 */
fionaxu58278be2018-01-29 14:08:12 -08004327 public static final class All implements BaseColumns {
4328 /**
4329 * Numeric operator ID (as String). {@code MCC + MNC}
4330 * <P>Type: TEXT </P>
4331 */
4332 public static final String MCCMNC = "mccmnc";
4333
4334 /**
4335 * Group id level 1 (as String).
4336 * <P>Type: TEXT </P>
4337 */
4338 public static final String GID1 = "gid1";
4339
4340 /**
4341 * Group id level 2 (as String).
4342 * <P>Type: TEXT </P>
4343 */
4344 public static final String GID2 = "gid2";
4345
4346 /**
4347 * Public Land Mobile Network name.
4348 * <P>Type: TEXT </P>
4349 */
4350 public static final String PLMN = "plmn";
4351
4352 /**
4353 * Prefix xpattern of IMSI (International Mobile Subscriber Identity).
4354 * <P>Type: TEXT </P>
4355 */
4356 public static final String IMSI_PREFIX_XPATTERN = "imsi_prefix_xpattern";
4357
4358 /**
4359 * Service Provider Name.
4360 * <P>Type: TEXT </P>
4361 */
4362 public static final String SPN = "spn";
4363
4364 /**
4365 * Prefer APN name.
4366 * <P>Type: TEXT </P>
4367 */
4368 public static final String APN = "apn";
4369
4370 /**
4371 * Prefix of Integrated Circuit Card Identifier.
4372 * <P>Type: TEXT </P>
4373 */
4374 public static final String ICCID_PREFIX = "iccid_prefix";
4375
4376 /**
fionaxue9c6da72018-06-08 16:55:25 -07004377 * Certificate for carrier privilege access rules.
4378 * <P>Type: TEXT in hex string </P>
4379 */
4380 public static final String PRIVILEGE_ACCESS_RULE = "privilege_access_rule";
4381
4382 /**
fionaxu58278be2018-01-29 14:08:12 -08004383 * The {@code content://} URI for this table.
4384 */
fionaxu62bc7472018-02-28 11:18:45 -08004385 public static final Uri CONTENT_URI = Uri.parse("content://carrier_id/all");
fionaxu58278be2018-01-29 14:08:12 -08004386 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07004387 }
Dan Willemsen4980bf42017-02-14 14:17:12 -08004388}