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