blob: e80df2ddd0108dd63df7f2b4e8456e8f2b23d9d2 [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 Xudd0c1c32019-10-21 22:47:27 -070019import android.Manifest;
chen xu5caa18c2018-11-28 00:21:50 -080020import android.annotation.IntDef;
chen xu81653862019-02-28 10:44:54 -080021import android.annotation.NonNull;
Jayachandran C349b9ba2018-10-30 15:09:06 -070022import android.annotation.RequiresPermission;
Dan Willemsen4980bf42017-02-14 14:17:12 -080023import android.annotation.SdkConstant;
24import android.annotation.SdkConstant.SdkConstantType;
chen xu85100482018-10-12 15:30:34 -070025import android.annotation.SystemApi;
Dan Willemsen4980bf42017-02-14 14:17:12 -080026import android.annotation.TestApi;
Mathew Inwood6750f2e2018-08-10 09:29:25 +010027import android.annotation.UnsupportedAppUsage;
Jordan Liub9b75ed2017-02-28 18:15:07 -080028import android.app.job.JobService;
Dan Willemsen4980bf42017-02-14 14:17:12 -080029import android.content.ComponentName;
30import android.content.ContentResolver;
31import android.content.ContentValues;
32import android.content.Context;
33import android.content.Intent;
Jordan Liub9b75ed2017-02-28 18:15:07 -080034import android.database.ContentObserver;
Aurimas Liutikas7f695332018-05-31 21:07:32 -070035import android.database.Cursor;
Dan Willemsen4980bf42017-02-14 14:17:12 -080036import android.database.sqlite.SqliteWrapper;
37import android.net.Uri;
Mathew Inwood8c854f82018-09-14 12:35:36 +010038import android.os.Build;
Jack Yu2e273b22019-04-02 10:49:35 -070039import android.os.Parcel;
Jordan Liub9b75ed2017-02-28 18:15:07 -080040import android.telephony.Rlog;
41import android.telephony.ServiceState;
Dan Willemsen4980bf42017-02-14 14:17:12 -080042import android.telephony.SmsMessage;
43import android.telephony.SubscriptionManager;
fionaxu58278be2018-01-29 14:08:12 -080044import android.telephony.TelephonyManager;
Dan Willemsen4980bf42017-02-14 14:17:12 -080045import android.text.TextUtils;
Dan Willemsen4980bf42017-02-14 14:17:12 -080046import android.util.Patterns;
47
48import com.android.internal.telephony.PhoneConstants;
49import com.android.internal.telephony.SmsApplication;
50
chen xu5caa18c2018-11-28 00:21:50 -080051import java.lang.annotation.Retention;
52import java.lang.annotation.RetentionPolicy;
Dan Willemsen4980bf42017-02-14 14:17:12 -080053import java.util.HashSet;
54import java.util.Set;
55import java.util.regex.Matcher;
56import java.util.regex.Pattern;
57
58/**
59 * The Telephony provider contains data related to phone operation, specifically SMS and MMS
Jordan Liub9b75ed2017-02-28 18:15:07 -080060 * messages, access to the APN list, including the MMSC to use, and the service state.
Dan Willemsen4980bf42017-02-14 14:17:12 -080061 *
62 * <p class="note"><strong>Note:</strong> These APIs are not available on all Android-powered
63 * devices. If your app depends on telephony features such as for managing SMS messages, include
64 * a <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}
65 * </a> element in your manifest that declares the {@code "android.hardware.telephony"} hardware
66 * feature. Alternatively, you can check for telephony availability at runtime using either
67 * {@link android.content.pm.PackageManager#hasSystemFeature
68 * hasSystemFeature(PackageManager.FEATURE_TELEPHONY)} or {@link
69 * android.telephony.TelephonyManager#getPhoneType}.</p>
70 *
71 * <h3>Creating an SMS app</h3>
72 *
73 * <p>Only the default SMS app (selected by the user in system settings) is able to write to the
74 * SMS Provider (the tables defined within the {@code Telephony} class) and only the default SMS
75 * app receives the {@link android.provider.Telephony.Sms.Intents#SMS_DELIVER_ACTION} broadcast
76 * when the user receives an SMS or the {@link
77 * android.provider.Telephony.Sms.Intents#WAP_PUSH_DELIVER_ACTION} broadcast when the user
78 * receives an MMS.</p>
79 *
80 * <p>Any app that wants to behave as the user's default SMS app must handle the following intents:
81 * <ul>
82 * <li>In a broadcast receiver, include an intent filter for {@link Sms.Intents#SMS_DELIVER_ACTION}
83 * (<code>"android.provider.Telephony.SMS_DELIVER"</code>). The broadcast receiver must also
84 * require the {@link android.Manifest.permission#BROADCAST_SMS} permission.
85 * <p>This allows your app to directly receive incoming SMS messages.</p></li>
86 * <li>In a broadcast receiver, include an intent filter for {@link
87 * Sms.Intents#WAP_PUSH_DELIVER_ACTION}} ({@code "android.provider.Telephony.WAP_PUSH_DELIVER"})
88 * with the MIME type <code>"application/vnd.wap.mms-message"</code>.
89 * The broadcast receiver must also require the {@link
90 * android.Manifest.permission#BROADCAST_WAP_PUSH} permission.
91 * <p>This allows your app to directly receive incoming MMS messages.</p></li>
92 * <li>In your activity that delivers new messages, include an intent filter for
93 * {@link android.content.Intent#ACTION_SENDTO} (<code>"android.intent.action.SENDTO"
94 * </code>) with schemas, <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and
95 * <code>mmsto:</code>.
96 * <p>This allows your app to receive intents from other apps that want to deliver a
97 * message.</p></li>
98 * <li>In a service, include an intent filter for {@link
99 * android.telephony.TelephonyManager#ACTION_RESPOND_VIA_MESSAGE}
100 * (<code>"android.intent.action.RESPOND_VIA_MESSAGE"</code>) with schemas,
101 * <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and <code>mmsto:</code>.
102 * This service must also require the {@link
103 * android.Manifest.permission#SEND_RESPOND_VIA_MESSAGE} permission.
104 * <p>This allows users to respond to incoming phone calls with an immediate text message
105 * using your app.</p></li>
106 * </ul>
107 *
108 * <p>Other apps that are not selected as the default SMS app can only <em>read</em> the SMS
109 * Provider, but may also be notified when a new SMS arrives by listening for the {@link
110 * Sms.Intents#SMS_RECEIVED_ACTION}
111 * broadcast, which is a non-abortable broadcast that may be delivered to multiple apps. This
112 * broadcast is intended for apps that&mdash;while not selected as the default SMS app&mdash;need to
113 * read special incoming messages such as to perform phone number verification.</p>
114 *
115 * <p>For more information about building SMS apps, read the blog post, <a
116 * href="http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html"
117 * >Getting Your SMS Apps Ready for KitKat</a>.</p>
118 *
119 */
120public final class Telephony {
121 private static final String TAG = "Telephony";
122
123 /**
124 * Not instantiable.
125 * @hide
126 */
127 private Telephony() {
128 }
129
130 /**
131 * Base columns for tables that contain text-based SMSs.
132 */
133 public interface TextBasedSmsColumns {
134
135 /** Message type: all messages. */
136 public static final int MESSAGE_TYPE_ALL = 0;
137
138 /** Message type: inbox. */
139 public static final int MESSAGE_TYPE_INBOX = 1;
140
141 /** Message type: sent messages. */
142 public static final int MESSAGE_TYPE_SENT = 2;
143
144 /** Message type: drafts. */
145 public static final int MESSAGE_TYPE_DRAFT = 3;
146
147 /** Message type: outbox. */
148 public static final int MESSAGE_TYPE_OUTBOX = 4;
149
150 /** Message type: failed outgoing message. */
151 public static final int MESSAGE_TYPE_FAILED = 5;
152
153 /** Message type: queued to send later. */
154 public static final int MESSAGE_TYPE_QUEUED = 6;
155
156 /**
157 * The type of message.
158 * <P>Type: INTEGER</P>
159 */
160 public static final String TYPE = "type";
161
162 /**
163 * The thread ID of the message.
164 * <P>Type: INTEGER</P>
165 */
166 public static final String THREAD_ID = "thread_id";
167
168 /**
169 * The address of the other party.
170 * <P>Type: TEXT</P>
171 */
172 public static final String ADDRESS = "address";
173
174 /**
175 * The date the message was received.
176 * <P>Type: INTEGER (long)</P>
177 */
178 public static final String DATE = "date";
179
180 /**
181 * The date the message was sent.
182 * <P>Type: INTEGER (long)</P>
183 */
184 public static final String DATE_SENT = "date_sent";
185
186 /**
187 * Has the message been read?
188 * <P>Type: INTEGER (boolean)</P>
189 */
190 public static final String READ = "read";
191
192 /**
193 * Has the message been seen by the user? The "seen" flag determines
194 * whether we need to show a notification.
195 * <P>Type: INTEGER (boolean)</P>
196 */
197 public static final String SEEN = "seen";
198
199 /**
200 * {@code TP-Status} value for the message, or -1 if no status has been received.
201 * <P>Type: INTEGER</P>
202 */
203 public static final String STATUS = "status";
204
205 /** TP-Status: no status received. */
206 public static final int STATUS_NONE = -1;
207 /** TP-Status: complete. */
208 public static final int STATUS_COMPLETE = 0;
209 /** TP-Status: pending. */
210 public static final int STATUS_PENDING = 32;
211 /** TP-Status: failed. */
212 public static final int STATUS_FAILED = 64;
213
214 /**
215 * The subject of the message, if present.
216 * <P>Type: TEXT</P>
217 */
218 public static final String SUBJECT = "subject";
219
220 /**
221 * The body of the message.
222 * <P>Type: TEXT</P>
223 */
224 public static final String BODY = "body";
225
226 /**
227 * The ID of the sender of the conversation, if present.
228 * <P>Type: INTEGER (reference to item in {@code content://contacts/people})</P>
229 */
230 public static final String PERSON = "person";
231
232 /**
233 * The protocol identifier code.
234 * <P>Type: INTEGER</P>
235 */
236 public static final String PROTOCOL = "protocol";
237
238 /**
239 * Is the {@code TP-Reply-Path} flag set?
240 * <P>Type: BOOLEAN</P>
241 */
242 public static final String REPLY_PATH_PRESENT = "reply_path_present";
243
244 /**
245 * The service center (SC) through which to send the message, if present.
246 * <P>Type: TEXT</P>
247 */
248 public static final String SERVICE_CENTER = "service_center";
249
250 /**
251 * Is the message locked?
252 * <P>Type: INTEGER (boolean)</P>
253 */
254 public static final String LOCKED = "locked";
255
256 /**
257 * The subscription to which the message belongs to. Its value will be
258 * < 0 if the sub id cannot be determined.
259 * <p>Type: INTEGER (long) </p>
260 */
261 public static final String SUBSCRIPTION_ID = "sub_id";
262
263 /**
264 * The MTU size of the mobile interface to which the APN connected
265 * @hide
266 */
267 public static final String MTU = "mtu";
268
269 /**
270 * Error code associated with sending or receiving this message
271 * <P>Type: INTEGER</P>
272 */
273 public static final String ERROR_CODE = "error_code";
274
275 /**
276 * The identity of the sender of a sent message. It is
277 * usually the package name of the app which sends the message.
278 * <p class="note"><strong>Note:</strong>
279 * This column is read-only. It is set by the provider and can not be changed by apps.
280 * <p>Type: TEXT</p>
281 */
282 public static final String CREATOR = "creator";
283 }
284
285 /**
Vasu Nori84db0f52018-02-14 15:14:32 -0800286 * Columns in sms_changes table.
287 * @hide
288 */
289 public interface TextBasedSmsChangesColumns {
290 /**
291 * The {@code content://} style URL for this table.
292 * @hide
293 */
294 public static final Uri CONTENT_URI = Uri.parse("content://sms-changes");
295
296 /**
297 * Primary key.
298 * <P>Type: INTEGER (long)</P>
299 * @hide
300 */
301 public static final String ID = "_id";
302
303 /**
304 * Triggers on sms table create a row in this table for each update/delete.
305 * This column is the "_id" of the row from sms table that was updated/deleted.
306 * <P>Type: INTEGER (long)</P>
307 * @hide
308 */
309 public static final String ORIG_ROW_ID = "orig_rowid";
310
311 /**
312 * Triggers on sms table create a row in this table for each update/delete.
313 * This column is the "sub_id" of the row from sms table that was updated/deleted.
314 * @hide
315 * <P>Type: INTEGER (long)</P>
316 */
317 public static final String SUB_ID = "sub_id";
318
319 /**
320 * The type of operation that created this row.
321 * {@link #TYPE_UPDATE} = update op
322 * {@link #TYPE_DELETE} = delete op
323 * @hide
324 * <P>Type: INTEGER (long)</P>
325 */
326 public static final String TYPE = "type";
327
328 /**
329 * One of the possible values for the above column "type". Indicates it is an update op.
330 * @hide
331 */
332 public static final int TYPE_UPDATE = 0;
333
334 /**
335 * One of the possible values for the above column "type". Indicates it is a delete op.
336 * @hide
337 */
338 public static final int TYPE_DELETE = 1;
339
340 /**
341 * This column contains a non-null value only if the operation on sms table is an update op
342 * and the column "read" is changed by the update op.
343 * <P>Type: INTEGER (boolean)</P>
344 * @hide
345 */
346 public static final String NEW_READ_STATUS = "new_read_status";
347 }
348
349 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -0800350 * Contains all text-based SMS messages.
351 */
352 public static final class Sms implements BaseColumns, TextBasedSmsColumns {
353
354 /**
355 * Not instantiable.
356 * @hide
357 */
358 private Sms() {
359 }
360
361 /**
362 * Used to determine the currently configured default SMS package.
363 * @param context context of the requesting application
364 * @return package name for the default SMS package or null
365 */
366 public static String getDefaultSmsPackage(Context context) {
367 ComponentName component = SmsApplication.getDefaultSmsApplication(context, false);
368 if (component != null) {
369 return component.getPackageName();
370 }
371 return null;
372 }
373
374 /**
375 * Return cursor for table query.
376 * @hide
377 */
378 public static Cursor query(ContentResolver cr, String[] projection) {
379 return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER);
380 }
381
382 /**
383 * Return cursor for table query.
384 * @hide
385 */
Mathew Inwood8c854f82018-09-14 12:35:36 +0100386 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Dan Willemsen4980bf42017-02-14 14:17:12 -0800387 public static Cursor query(ContentResolver cr, String[] projection,
388 String where, String orderBy) {
389 return cr.query(CONTENT_URI, projection, where,
390 null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
391 }
392
393 /**
394 * The {@code content://} style URL for this table.
395 */
396 public static final Uri CONTENT_URI = Uri.parse("content://sms");
397
398 /**
399 * The default sort order for this table.
400 */
401 public static final String DEFAULT_SORT_ORDER = "date DESC";
402
403 /**
404 * Add an SMS to the given URI.
405 *
406 * @param resolver the content resolver to use
407 * @param uri the URI to add the message to
408 * @param address the address of the sender
409 * @param body the body of the message
410 * @param subject the pseudo-subject of the message
411 * @param date the timestamp for the message
412 * @param read true if the message has been read, false if not
413 * @param deliveryReport true if a delivery report was requested, false if not
414 * @return the URI for the new message
415 * @hide
416 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100417 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800418 public static Uri addMessageToUri(ContentResolver resolver,
419 Uri uri, String address, String body, String subject,
420 Long date, boolean read, boolean deliveryReport) {
421 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
422 resolver, uri, address, body, subject, date, read, deliveryReport, -1L);
423 }
424
425 /**
426 * Add an SMS to the given URI.
427 *
428 * @param resolver the content resolver to use
429 * @param uri the URI to add the message to
430 * @param address the address of the sender
431 * @param body the body of the message
432 * @param subject the psuedo-subject of the message
433 * @param date the timestamp for the message
434 * @param read true if the message has been read, false if not
435 * @param deliveryReport true if a delivery report was requested, false if not
436 * @param subId the subscription which the message belongs to
437 * @return the URI for the new message
438 * @hide
439 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100440 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800441 public static Uri addMessageToUri(int subId, ContentResolver resolver,
442 Uri uri, String address, String body, String subject,
443 Long date, boolean read, boolean deliveryReport) {
444 return addMessageToUri(subId, resolver, uri, address, body, subject,
445 date, read, deliveryReport, -1L);
446 }
447
448 /**
449 * Add an SMS to the given URI with the specified thread ID.
450 *
451 * @param resolver the content resolver to use
452 * @param uri the URI to add the message to
453 * @param address the address of the sender
454 * @param body the body of the message
455 * @param subject the pseudo-subject of the message
456 * @param date the timestamp for the message
457 * @param read true if the message has been read, false if not
458 * @param deliveryReport true if a delivery report was requested, false if not
459 * @param threadId the thread_id of the message
460 * @return the URI for the new message
461 * @hide
462 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100463 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800464 public static Uri addMessageToUri(ContentResolver resolver,
465 Uri uri, String address, String body, String subject,
466 Long date, boolean read, boolean deliveryReport, long threadId) {
467 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
468 resolver, uri, address, body, subject,
469 date, read, deliveryReport, threadId);
470 }
471
472 /**
473 * Add an SMS to the given URI with thread_id specified.
474 *
475 * @param resolver the content resolver to use
476 * @param uri the URI to add the message to
477 * @param address the address of the sender
478 * @param body the body of the message
479 * @param subject the psuedo-subject of the message
480 * @param date the timestamp for the message
481 * @param read true if the message has been read, false if not
482 * @param deliveryReport true if a delivery report was requested, false if not
483 * @param threadId the thread_id of the message
484 * @param subId the subscription which the message belongs to
485 * @return the URI for the new message
486 * @hide
487 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100488 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800489 public static Uri addMessageToUri(int subId, ContentResolver resolver,
490 Uri uri, String address, String body, String subject,
491 Long date, boolean read, boolean deliveryReport, long threadId) {
492 ContentValues values = new ContentValues(8);
493 Rlog.v(TAG,"Telephony addMessageToUri sub id: " + subId);
494
495 values.put(SUBSCRIPTION_ID, subId);
496 values.put(ADDRESS, address);
497 if (date != null) {
498 values.put(DATE, date);
499 }
500 values.put(READ, read ? Integer.valueOf(1) : Integer.valueOf(0));
501 values.put(SUBJECT, subject);
502 values.put(BODY, body);
503 if (deliveryReport) {
504 values.put(STATUS, STATUS_PENDING);
505 }
506 if (threadId != -1L) {
507 values.put(THREAD_ID, threadId);
508 }
509 return resolver.insert(uri, values);
510 }
511
512 /**
513 * Move a message to the given folder.
514 *
515 * @param context the context to use
516 * @param uri the message to move
517 * @param folder the folder to move to
518 * @return true if the operation succeeded
519 * @hide
520 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100521 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800522 public static boolean moveMessageToFolder(Context context,
523 Uri uri, int folder, int error) {
524 if (uri == null) {
525 return false;
526 }
527
528 boolean markAsUnread = false;
529 boolean markAsRead = false;
530 switch(folder) {
531 case MESSAGE_TYPE_INBOX:
532 case MESSAGE_TYPE_DRAFT:
533 break;
534 case MESSAGE_TYPE_OUTBOX:
535 case MESSAGE_TYPE_SENT:
536 markAsRead = true;
537 break;
538 case MESSAGE_TYPE_FAILED:
539 case MESSAGE_TYPE_QUEUED:
540 markAsUnread = true;
541 break;
542 default:
543 return false;
544 }
545
546 ContentValues values = new ContentValues(3);
547
548 values.put(TYPE, folder);
549 if (markAsUnread) {
550 values.put(READ, 0);
551 } else if (markAsRead) {
552 values.put(READ, 1);
553 }
554 values.put(ERROR_CODE, error);
555
556 return 1 == SqliteWrapper.update(context, context.getContentResolver(),
557 uri, values, null, null);
558 }
559
560 /**
561 * Returns true iff the folder (message type) identifies an
562 * outgoing message.
563 * @hide
564 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100565 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800566 public static boolean isOutgoingFolder(int messageType) {
567 return (messageType == MESSAGE_TYPE_FAILED)
568 || (messageType == MESSAGE_TYPE_OUTBOX)
569 || (messageType == MESSAGE_TYPE_SENT)
570 || (messageType == MESSAGE_TYPE_QUEUED);
571 }
572
573 /**
574 * Contains all text-based SMS messages in the SMS app inbox.
575 */
576 public static final class Inbox implements BaseColumns, TextBasedSmsColumns {
577
578 /**
579 * Not instantiable.
580 * @hide
581 */
582 private Inbox() {
583 }
584
585 /**
586 * The {@code content://} style URL for this table.
587 */
588 public static final Uri CONTENT_URI = Uri.parse("content://sms/inbox");
589
590 /**
591 * The default sort order for this table.
592 */
593 public static final String DEFAULT_SORT_ORDER = "date DESC";
594
595 /**
596 * Add an SMS to the Draft box.
597 *
598 * @param resolver the content resolver to use
599 * @param address the address of the sender
600 * @param body the body of the message
601 * @param subject the pseudo-subject of the message
602 * @param date the timestamp for the message
603 * @param read true if the message has been read, false if not
604 * @return the URI for the new message
605 * @hide
606 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100607 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800608 public static Uri addMessage(ContentResolver resolver,
609 String address, String body, String subject, Long date,
610 boolean read) {
611 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
612 resolver, CONTENT_URI, address, body, subject, date, read, false);
613 }
614
615 /**
616 * Add an SMS to the Draft box.
617 *
618 * @param resolver the content resolver to use
619 * @param address the address of the sender
620 * @param body the body of the message
621 * @param subject the psuedo-subject of the message
622 * @param date the timestamp for the message
623 * @param read true if the message has been read, false if not
624 * @param subId the subscription which the message belongs to
625 * @return the URI for the new message
626 * @hide
627 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100628 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800629 public static Uri addMessage(int subId, ContentResolver resolver,
630 String address, String body, String subject, Long date, boolean read) {
631 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
632 subject, date, read, false);
633 }
634 }
635
636 /**
637 * Contains all sent text-based SMS messages in the SMS app.
638 */
639 public static final class Sent implements BaseColumns, TextBasedSmsColumns {
640
641 /**
642 * Not instantiable.
643 * @hide
644 */
645 private Sent() {
646 }
647
648 /**
649 * The {@code content://} style URL for this table.
650 */
651 public static final Uri CONTENT_URI = Uri.parse("content://sms/sent");
652
653 /**
654 * The default sort order for this table.
655 */
656 public static final String DEFAULT_SORT_ORDER = "date DESC";
657
658 /**
659 * Add an SMS to the Draft box.
660 *
661 * @param resolver the content resolver to use
662 * @param address the address of the sender
663 * @param body the body of the message
664 * @param subject the pseudo-subject of the message
665 * @param date the timestamp for the message
666 * @return the URI for the new message
667 * @hide
668 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100669 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800670 public static Uri addMessage(ContentResolver resolver,
671 String address, String body, String subject, Long date) {
672 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
673 resolver, CONTENT_URI, address, body, subject, date, true, false);
674 }
675
676 /**
677 * Add an SMS to the Draft box.
678 *
679 * @param resolver the content resolver to use
680 * @param address the address of the sender
681 * @param body the body of the message
682 * @param subject the psuedo-subject of the message
683 * @param date the timestamp for the message
684 * @param subId the subscription which the message belongs to
685 * @return the URI for the new message
686 * @hide
687 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100688 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800689 public static Uri addMessage(int subId, ContentResolver resolver,
690 String address, String body, String subject, Long date) {
691 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
692 subject, date, true, false);
693 }
694 }
695
696 /**
Leland Miller86272562019-08-08 10:16:31 -0700697 * Contains all draft text-based SMS messages in the SMS app.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800698 */
699 public static final class Draft implements BaseColumns, TextBasedSmsColumns {
700
701 /**
702 * Not instantiable.
703 * @hide
704 */
705 private Draft() {
706 }
707
708 /**
709 * The {@code content://} style URL for this table.
710 */
711 public static final Uri CONTENT_URI = Uri.parse("content://sms/draft");
712
713 /**
714 * @hide
715 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100716 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800717 public static Uri addMessage(ContentResolver resolver,
718 String address, String body, String subject, Long date) {
719 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
720 resolver, CONTENT_URI, address, body, subject, date, true, false);
721 }
722
723 /**
724 * Add an SMS to the Draft box.
725 *
726 * @param resolver the content resolver to use
727 * @param address the address of the sender
728 * @param body the body of the message
729 * @param subject the psuedo-subject of the message
730 * @param date the timestamp for the message
731 * @param subId the subscription which the message belongs to
732 * @return the URI for the new message
733 * @hide
734 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100735 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800736 public static Uri addMessage(int subId, ContentResolver resolver,
737 String address, String body, String subject, Long date) {
738 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
739 subject, date, true, false);
740 }
741
742 /**
743 * The default sort order for this table.
744 */
745 public static final String DEFAULT_SORT_ORDER = "date DESC";
746 }
747
748 /**
749 * Contains all pending outgoing text-based SMS messages.
750 */
751 public static final class Outbox implements BaseColumns, TextBasedSmsColumns {
752
753 /**
754 * Not instantiable.
755 * @hide
756 */
757 private Outbox() {
758 }
759
760 /**
761 * The {@code content://} style URL for this table.
762 */
763 public static final Uri CONTENT_URI = Uri.parse("content://sms/outbox");
764
765 /**
766 * The default sort order for this table.
767 */
768 public static final String DEFAULT_SORT_ORDER = "date DESC";
769
770 /**
771 * Add an SMS to the outbox.
772 *
773 * @param resolver the content resolver to use
774 * @param address the address of the sender
775 * @param body the body of the message
776 * @param subject the pseudo-subject of the message
777 * @param date the timestamp for the message
778 * @param deliveryReport whether a delivery report was requested for the message
779 * @return the URI for the new message
780 * @hide
781 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100782 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800783 public static Uri addMessage(ContentResolver resolver,
784 String address, String body, String subject, Long date,
785 boolean deliveryReport, long threadId) {
786 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
787 resolver, CONTENT_URI, address, body, subject, date,
788 true, deliveryReport, threadId);
789 }
790
791 /**
792 * Add an SMS to the Out box.
793 *
794 * @param resolver the content resolver to use
795 * @param address the address of the sender
796 * @param body the body of the message
797 * @param subject the psuedo-subject of the message
798 * @param date the timestamp for the message
799 * @param deliveryReport whether a delivery report was requested for the message
800 * @param subId the subscription which the message belongs to
801 * @return the URI for the new message
802 * @hide
803 */
804 public static Uri addMessage(int subId, ContentResolver resolver,
805 String address, String body, String subject, Long date,
806 boolean deliveryReport, long threadId) {
807 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
808 subject, date, true, deliveryReport, threadId);
809 }
810 }
811
812 /**
Leland Miller86272562019-08-08 10:16:31 -0700813 * Contains a view of SMS conversations (also referred to as threads). This is similar to
814 * {@link Threads}, but only includes SMS messages and columns relevant to SMS
815 * conversations.
816 * <p>
817 * Note that this view ignores any information about MMS messages, it is a
818 * view of conversations as if MMS messages did not exist at all. This means that all
819 * relevant information, such as snippets and message count, will ignore any MMS messages
820 * that might be in the same thread through other views and present only data based on the
821 * SMS messages in that thread.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800822 */
823 public static final class Conversations
824 implements BaseColumns, TextBasedSmsColumns {
825
826 /**
827 * Not instantiable.
828 * @hide
829 */
830 private Conversations() {
831 }
832
833 /**
834 * The {@code content://} style URL for this table.
835 */
836 public static final Uri CONTENT_URI = Uri.parse("content://sms/conversations");
837
838 /**
839 * The default sort order for this table.
840 */
841 public static final String DEFAULT_SORT_ORDER = "date DESC";
842
843 /**
Gowroji Sunil37ffaec2019-04-24 12:16:13 +0530844 * The first 45 characters of the body of the most recent message.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800845 * <P>Type: TEXT</P>
846 */
847 public static final String SNIPPET = "snippet";
848
849 /**
850 * The number of messages in the conversation.
851 * <P>Type: INTEGER</P>
852 */
853 public static final String MESSAGE_COUNT = "msg_count";
854 }
855
856 /**
857 * Contains constants for SMS related Intents that are broadcast.
858 */
859 public static final class Intents {
860
861 /**
862 * Not instantiable.
863 * @hide
864 */
865 private Intents() {
866 }
867
868 /**
869 * Set by BroadcastReceiver to indicate that the message was handled
870 * successfully.
871 */
872 public static final int RESULT_SMS_HANDLED = 1;
873
874 /**
875 * Set by BroadcastReceiver to indicate a generic error while
876 * processing the message.
877 */
878 public static final int RESULT_SMS_GENERIC_ERROR = 2;
879
880 /**
881 * Set by BroadcastReceiver to indicate insufficient memory to store
882 * the message.
883 */
884 public static final int RESULT_SMS_OUT_OF_MEMORY = 3;
885
886 /**
887 * Set by BroadcastReceiver to indicate that the message, while
888 * possibly valid, is of a format or encoding that is not
889 * supported.
890 */
891 public static final int RESULT_SMS_UNSUPPORTED = 4;
892
893 /**
894 * Set by BroadcastReceiver to indicate a duplicate incoming message.
895 */
896 public static final int RESULT_SMS_DUPLICATED = 5;
897
898 /**
899 * Activity action: Ask the user to change the default
900 * SMS application. This will show a dialog that asks the
901 * user whether they want to replace the current default
902 * SMS application with the one specified in
903 * {@link #EXTRA_PACKAGE_NAME}.
Hai Zhang929085f2019-05-03 15:31:43 +0800904 * <p>
905 * This is no longer supported since Q, please use
906 * {@link android.app.role.RoleManager#createRequestRoleIntent(String)} with
907 * {@link android.app.role.RoleManager#ROLE_SMS} instead.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800908 */
909 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
910 public static final String ACTION_CHANGE_DEFAULT =
911 "android.provider.Telephony.ACTION_CHANGE_DEFAULT";
912
913 /**
914 * The PackageName string passed in as an
915 * extra for {@link #ACTION_CHANGE_DEFAULT}
916 *
917 * @see #ACTION_CHANGE_DEFAULT
Hai Zhang929085f2019-05-03 15:31:43 +0800918 * <p>
919 * This is no longer supported since Q, please use
920 * {@link android.app.role.RoleManager#createRequestRoleIntent(String)} with
921 * {@link android.app.role.RoleManager#ROLE_SMS} instead.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800922 */
923 public static final String EXTRA_PACKAGE_NAME = "package";
924
925 /**
926 * Broadcast Action: A new text-based SMS message has been received
927 * by the device. This intent will only be delivered to the default
928 * sms app. That app is responsible for writing the message and notifying
929 * the user. The intent will have the following extra values:</p>
930 *
931 * <ul>
932 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
933 * that make up the message.</li>
934 * <li><em>"format"</em> - A String describing the format of the PDUs. It can
935 * be either "3gpp" or "3gpp2".</li>
936 * <li><em>"subscription"</em> - An optional long value of the subscription id which
937 * received the message.</li>
938 * <li><em>"slot"</em> - An optional int value of the SIM slot containing the
939 * subscription.</li>
940 * <li><em>"phone"</em> - An optional int value of the phone id associated with the
941 * subscription.</li>
942 * <li><em>"errorCode"</em> - An optional int error code associated with receiving
943 * the message.</li>
944 * </ul>
945 *
946 * <p>The extra values can be extracted using
947 * {@link #getMessagesFromIntent(Intent)}.</p>
948 *
949 * <p>If a BroadcastReceiver encounters an error while processing
950 * this intent it should set the result code appropriately.</p>
951 *
952 * <p class="note"><strong>Note:</strong>
953 * The broadcast receiver that filters for this intent must declare
954 * {@link android.Manifest.permission#BROADCAST_SMS} as a required permission in
955 * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code
956 * <receiver>}</a> tag.
957 *
958 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
959 */
960 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
961 public static final String SMS_DELIVER_ACTION =
962 "android.provider.Telephony.SMS_DELIVER";
963
964 /**
965 * Broadcast Action: A new text-based SMS message has been received
966 * by the device. This intent will be delivered to all registered
967 * receivers as a notification. These apps are not expected to write the
968 * message or notify the user. The intent will have the following extra
969 * values:</p>
970 *
971 * <ul>
972 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
973 * that make up the message.</li>
974 * </ul>
975 *
976 * <p>The extra values can be extracted using
977 * {@link #getMessagesFromIntent(Intent)}.</p>
978 *
979 * <p>If a BroadcastReceiver encounters an error while processing
980 * this intent it should set the result code appropriately.</p>
981 *
982 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
983 */
984 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
985 public static final String SMS_RECEIVED_ACTION =
986 "android.provider.Telephony.SMS_RECEIVED";
987
988 /**
989 * Broadcast Action: A new data based SMS message has been received
990 * by the device. This intent will be delivered to all registered
991 * receivers as a notification. The intent will have the following extra
992 * values:</p>
993 *
994 * <ul>
995 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
996 * that make up the message.</li>
997 * </ul>
998 *
999 * <p>The extra values can be extracted using
1000 * {@link #getMessagesFromIntent(Intent)}.</p>
1001 *
1002 * <p>If a BroadcastReceiver encounters an error while processing
1003 * this intent it should set the result code appropriately.</p>
1004 *
1005 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1006 */
1007 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1008 public static final String DATA_SMS_RECEIVED_ACTION =
1009 "android.intent.action.DATA_SMS_RECEIVED";
1010
1011 /**
1012 * Broadcast Action: A new WAP PUSH message has been received by the
1013 * device. This intent will only be delivered to the default
1014 * sms app. That app is responsible for writing the message and notifying
1015 * the user. The intent will have the following extra values:</p>
1016 *
1017 * <ul>
1018 * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li>
1019 * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li>
1020 * <li><em>"header"</em> - (byte[]) The header of the message</li>
1021 * <li><em>"data"</em> - (byte[]) The data payload of the message</li>
1022 * <li><em>"contentTypeParameters" </em>
1023 * -(HashMap&lt;String,String&gt;) Any parameters associated with the content type
1024 * (decoded from the WSP Content-Type header)</li>
1025 * <li><em>"subscription"</em> - An optional long value of the subscription id which
1026 * received the message.</li>
1027 * <li><em>"slot"</em> - An optional int value of the SIM slot containing the
1028 * subscription.</li>
1029 * <li><em>"phone"</em> - An optional int value of the phone id associated with the
1030 * subscription.</li>
1031 * </ul>
1032 *
1033 * <p>If a BroadcastReceiver encounters an error while processing
1034 * this intent it should set the result code appropriately.</p>
1035 *
1036 * <p>The contentTypeParameters extra value is map of content parameters keyed by
1037 * their names.</p>
1038 *
1039 * <p>If any unassigned well-known parameters are encountered, the key of the map will
1040 * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If
1041 * a parameter has No-Value the value in the map will be null.</p>
1042 *
1043 * <p>Requires {@link android.Manifest.permission#RECEIVE_MMS} or
1044 * {@link android.Manifest.permission#RECEIVE_WAP_PUSH} (depending on WAP PUSH type) to
1045 * receive.</p>
1046 *
1047 * <p class="note"><strong>Note:</strong>
1048 * The broadcast receiver that filters for this intent must declare
1049 * {@link android.Manifest.permission#BROADCAST_WAP_PUSH} as a required permission in
1050 * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code
1051 * <receiver>}</a> tag.
1052 */
1053 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1054 public static final String WAP_PUSH_DELIVER_ACTION =
1055 "android.provider.Telephony.WAP_PUSH_DELIVER";
1056
1057 /**
1058 * Broadcast Action: A new WAP PUSH message has been received by the
1059 * device. This intent will be delivered to all registered
1060 * receivers as a notification. These apps are not expected to write the
1061 * message or notify the user. The intent will have the following extra
1062 * values:</p>
1063 *
1064 * <ul>
1065 * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li>
1066 * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li>
1067 * <li><em>"header"</em> - (byte[]) The header of the message</li>
1068 * <li><em>"data"</em> - (byte[]) The data payload of the message</li>
1069 * <li><em>"contentTypeParameters"</em>
1070 * - (HashMap&lt;String,String&gt;) Any parameters associated with the content type
1071 * (decoded from the WSP Content-Type header)</li>
1072 * </ul>
1073 *
1074 * <p>If a BroadcastReceiver encounters an error while processing
1075 * this intent it should set the result code appropriately.</p>
1076 *
1077 * <p>The contentTypeParameters extra value is map of content parameters keyed by
1078 * their names.</p>
1079 *
1080 * <p>If any unassigned well-known parameters are encountered, the key of the map will
1081 * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If
1082 * a parameter has No-Value the value in the map will be null.</p>
1083 *
1084 * <p>Requires {@link android.Manifest.permission#RECEIVE_MMS} or
1085 * {@link android.Manifest.permission#RECEIVE_WAP_PUSH} (depending on WAP PUSH type) to
1086 * receive.</p>
1087 */
1088 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1089 public static final String WAP_PUSH_RECEIVED_ACTION =
1090 "android.provider.Telephony.WAP_PUSH_RECEIVED";
1091
1092 /**
1093 * Broadcast Action: A new Cell Broadcast message has been received
1094 * by the device. The intent will have the following extra
1095 * values:</p>
1096 *
1097 * <ul>
1098 * <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message
1099 * data. This is not an emergency alert, so ETWS and CMAS data will be null.</li>
1100 * </ul>
1101 *
1102 * <p>The extra values can be extracted using
1103 * {@link #getMessagesFromIntent(Intent)}.</p>
1104 *
1105 * <p>If a BroadcastReceiver encounters an error while processing
1106 * this intent it should set the result code appropriately.</p>
1107 *
1108 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1109 */
1110 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1111 public static final String SMS_CB_RECEIVED_ACTION =
1112 "android.provider.Telephony.SMS_CB_RECEIVED";
1113
1114 /**
1115 * Action: A SMS based carrier provision intent. Used to identify default
1116 * carrier provisioning app on the device.
1117 * @hide
1118 */
1119 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1120 @TestApi
1121 public static final String SMS_CARRIER_PROVISION_ACTION =
1122 "android.provider.Telephony.SMS_CARRIER_PROVISION";
1123
1124 /**
1125 * Broadcast Action: A new Emergency Broadcast message has been received
1126 * by the device. The intent will have the following extra
1127 * values:</p>
1128 *
1129 * <ul>
Chen Xu39b95942019-11-06 20:30:58 -08001130 * <li><em>"message"</em> - An {@link android.telephony.SmsCbMessage} object
1131 * containing the broadcast message data, including ETWS or CMAS warning notification
1132 * info if present.</li>
Dan Willemsen4980bf42017-02-14 14:17:12 -08001133 * </ul>
1134 *
1135 * <p>The extra values can be extracted using
1136 * {@link #getMessagesFromIntent(Intent)}.</p>
1137 *
1138 * <p>If a BroadcastReceiver encounters an error while processing
1139 * this intent it should set the result code appropriately.</p>
1140 *
1141 * <p>Requires {@link android.Manifest.permission#RECEIVE_EMERGENCY_BROADCAST} to
1142 * receive.</p>
Chen Xu39b95942019-11-06 20:30:58 -08001143 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08001144 */
1145 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
Chen Xu39b95942019-11-06 20:30:58 -08001146 @SystemApi
1147 public static final String ACTION_SMS_EMERGENCY_CB_RECEIVED =
1148 "android.provider.action.SMS_EMERGENCY_CB_RECEIVED";
Dan Willemsen4980bf42017-02-14 14:17:12 -08001149
1150 /**
1151 * Broadcast Action: A new CDMA SMS has been received containing Service Category
1152 * Program Data (updates the list of enabled broadcast channels). The intent will
1153 * have the following extra values:</p>
1154 *
1155 * <ul>
1156 * <li><em>"operations"</em> - An array of CdmaSmsCbProgramData objects containing
1157 * the service category operations (add/delete/clear) to perform.</li>
1158 * </ul>
1159 *
1160 * <p>The extra values can be extracted using
1161 * {@link #getMessagesFromIntent(Intent)}.</p>
1162 *
1163 * <p>If a BroadcastReceiver encounters an error while processing
1164 * this intent it should set the result code appropriately.</p>
1165 *
1166 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1167 */
1168 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1169 public static final String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION =
1170 "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED";
1171
1172 /**
1173 * Broadcast Action: The SIM storage for SMS messages is full. If
1174 * space is not freed, messages targeted for the SIM (class 2) may
1175 * not be saved.
1176 *
1177 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1178 */
1179 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1180 public static final String SIM_FULL_ACTION =
1181 "android.provider.Telephony.SIM_FULL";
1182
1183 /**
1184 * Broadcast Action: An incoming SMS has been rejected by the
1185 * telephony framework. This intent is sent in lieu of any
1186 * of the RECEIVED_ACTION intents. The intent will have the
1187 * following extra value:</p>
1188 *
1189 * <ul>
1190 * <li><em>"result"</em> - An int result code, e.g. {@link #RESULT_SMS_OUT_OF_MEMORY}
1191 * indicating the error returned to the network.</li>
1192 * </ul>
1193 *
1194 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1195 */
1196 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1197 public static final String SMS_REJECTED_ACTION =
1198 "android.provider.Telephony.SMS_REJECTED";
1199
1200 /**
1201 * Broadcast Action: An incoming MMS has been downloaded. The intent is sent to all
1202 * users, except for secondary users where SMS has been disabled and to managed
1203 * profiles.
1204 * @hide
1205 */
1206 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1207 public static final String MMS_DOWNLOADED_ACTION =
1208 "android.provider.Telephony.MMS_DOWNLOADED";
1209
1210 /**
Cassie5b97cf12018-02-22 09:58:33 -08001211 * Broadcast Action: A debug code has been entered in the dialer. This intent is
1212 * broadcast by the system and OEM telephony apps may need to receive these broadcasts.
1213 * These "secret codes" are used to activate developer menus by dialing certain codes.
Alan Stokesa9b5b2a2019-02-28 16:45:47 +00001214 * And they are of the form {@code *#*#<code>#*#*}. The intent will have the data
1215 * URI: {@code android_secret_code://<code>}. It is possible that a manifest
Cassie5b97cf12018-02-22 09:58:33 -08001216 * receiver would be woken up even if it is not currently running.
1217 *
1218 * <p>Requires {@code android.Manifest.permission#CONTROL_INCALL_EXPERIENCE} to
1219 * send and receive.</p>
Cassie6d0a5712018-08-21 13:38:39 -07001220 * @deprecated it is no longer supported, use {@link
1221 * TelephonyManager#ACTION_SECRET_CODE} instead
Cassie866f4942018-01-19 17:23:36 -08001222 */
Cassie6d0a5712018-08-21 13:38:39 -07001223 @Deprecated
Cassie866f4942018-01-19 17:23:36 -08001224 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1225 public static final String SECRET_CODE_ACTION =
1226 "android.provider.Telephony.SECRET_CODE";
1227
1228 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08001229 * Broadcast action: When the default SMS package changes,
1230 * the previous default SMS package and the new default SMS
1231 * package are sent this broadcast to notify them of the change.
1232 * A boolean is specified in {@link #EXTRA_IS_DEFAULT_SMS_APP} to
1233 * indicate whether the package is the new default SMS package.
1234 */
1235 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1236 public static final String ACTION_DEFAULT_SMS_PACKAGE_CHANGED =
1237 "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED";
1238
1239 /**
1240 * The IsDefaultSmsApp boolean passed as an
1241 * extra for {@link #ACTION_DEFAULT_SMS_PACKAGE_CHANGED} to indicate whether the
1242 * SMS app is becoming the default SMS app or is no longer the default.
1243 *
1244 * @see #ACTION_DEFAULT_SMS_PACKAGE_CHANGED
1245 */
1246 public static final String EXTRA_IS_DEFAULT_SMS_APP =
1247 "android.provider.extra.IS_DEFAULT_SMS_APP";
1248
1249 /**
1250 * Broadcast action: When a change is made to the SmsProvider or
1251 * MmsProvider by a process other than the default SMS application,
1252 * this intent is broadcast to the default SMS application so it can
1253 * re-sync or update the change. The uri that was used to call the provider
1254 * can be retrieved from the intent with getData(). The actual affected uris
1255 * (which would depend on the selection specified) are not included.
1256 */
1257 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1258 public static final String ACTION_EXTERNAL_PROVIDER_CHANGE =
1259 "android.provider.action.EXTERNAL_PROVIDER_CHANGE";
1260
1261 /**
Makoto Onukia042aaa2018-09-18 16:14:12 -07001262 * Same as {@link #ACTION_DEFAULT_SMS_PACKAGE_CHANGED} but it's implicit (e.g. sent to
1263 * all apps) and requires
1264 * {@link android.Manifest.permission#MONITOR_DEFAULT_SMS_PACKAGE} to receive.
1265 *
1266 * @hide
1267 */
1268 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1269 public static final String ACTION_DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL =
1270 "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL";
1271
1272 /**
Amit Mahajan8c1c45a2018-10-22 10:43:34 -07001273 * Broadcast action: When SMS-MMS db is being created. If file-based encryption is
1274 * supported, this broadcast indicates creation of the db in credential-encrypted
1275 * storage. A boolean is specified in {@link #EXTRA_IS_INITIAL_CREATE} to indicate if
1276 * this is the initial create of the db. Requires
1277 * {@link android.Manifest.permission#READ_SMS} to receive.
1278 *
1279 * @see #EXTRA_IS_INITIAL_CREATE
1280 *
1281 * @hide
1282 */
1283 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1284 public static final String ACTION_SMS_MMS_DB_CREATED =
1285 "android.provider.action.SMS_MMS_DB_CREATED";
1286
1287 /**
1288 * Boolean flag passed as an extra with {@link #ACTION_SMS_MMS_DB_CREATED} to indicate
1289 * whether the DB creation is the initial creation on the device, that is it is after a
1290 * factory-data reset or a new device. Any subsequent creations of the DB (which
1291 * happens only in error scenarios) will have this flag set to false.
1292 *
1293 * @see #ACTION_SMS_MMS_DB_CREATED
1294 *
1295 * @hide
1296 */
1297 public static final String EXTRA_IS_INITIAL_CREATE =
1298 "android.provider.extra.IS_INITIAL_CREATE";
Jayachandran C349b9ba2018-10-30 15:09:06 -07001299
1300 /**
1301 * Broadcast intent action indicating that the telephony provider SMS MMS database is
1302 * corrupted. A boolean is specified in {@link #EXTRA_IS_CORRUPTED} to indicate if the
1303 * database is corrupted. Requires the
1304 * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE permission.
1305 *
1306 * @hide
1307 */
1308 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1309 @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
1310 public static final String ACTION_SMS_MMS_DB_LOST =
1311 "android.provider.action.SMS_MMS_DB_LOST";
1312
1313 /**
1314 * Boolean flag passed as an extra with {@link #ACTION_SMS_MMS_DB_LOST} to indicate
1315 * whether the DB got corrupted or not.
1316 *
1317 * @see #ACTION_SMS_MMS_DB_LOST
1318 *
1319 * @hide
1320 */
1321 public static final String EXTRA_IS_CORRUPTED =
1322 "android.provider.extra.IS_CORRUPTED";
1323
Amit Mahajan8c1c45a2018-10-22 10:43:34 -07001324 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08001325 * Read the PDUs out of an {@link #SMS_RECEIVED_ACTION} or a
1326 * {@link #DATA_SMS_RECEIVED_ACTION} intent.
1327 *
1328 * @param intent the intent to read from
1329 * @return an array of SmsMessages for the PDUs
1330 */
1331 public static SmsMessage[] getMessagesFromIntent(Intent intent) {
1332 Object[] messages;
1333 try {
1334 messages = (Object[]) intent.getSerializableExtra("pdus");
1335 }
1336 catch (ClassCastException e) {
1337 Rlog.e(TAG, "getMessagesFromIntent: " + e);
1338 return null;
1339 }
1340
1341 if (messages == null) {
1342 Rlog.e(TAG, "pdus does not exist in the intent");
1343 return null;
1344 }
1345
1346 String format = intent.getStringExtra("format");
1347 int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
1348 SubscriptionManager.getDefaultSmsSubscriptionId());
1349
1350 Rlog.v(TAG, " getMessagesFromIntent sub_id : " + subId);
1351
1352 int pduCount = messages.length;
1353 SmsMessage[] msgs = new SmsMessage[pduCount];
1354
1355 for (int i = 0; i < pduCount; i++) {
1356 byte[] pdu = (byte[]) messages[i];
1357 msgs[i] = SmsMessage.createFromPdu(pdu, format);
1358 if (msgs[i] != null) msgs[i].setSubId(subId);
1359 }
1360 return msgs;
1361 }
1362 }
1363 }
1364
1365 /**
pkanwar16b8a0d2017-06-07 10:59:41 -07001366 * Base column for the table that contain Carrier Public key.
1367 * @hide
1368 */
zoey chencb52ec32019-11-01 15:09:11 +08001369 @SystemApi
pkanwar16b8a0d2017-06-07 10:59:41 -07001370 public interface CarrierColumns extends BaseColumns {
1371
zoey chencb52ec32019-11-01 15:09:11 +08001372 /**
1373 * Mobile Country Code (MCC).
1374 * <P> Type: TEXT </P>
1375 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001376 public static final String MCC = "mcc";
zoey chencb52ec32019-11-01 15:09:11 +08001377
1378 /**
1379 * Mobile Network Code (MNC).
1380 * <P> Type: TEXT </P>
1381 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001382 public static final String MNC = "mnc";
zoey chencb52ec32019-11-01 15:09:11 +08001383
1384 /**
1385 * KeyType whether the key is being used for WLAN or ePDG.
1386 * <P> Type: INTEGER </P>
1387 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001388 public static final String KEY_TYPE = "key_type";
zoey chencb52ec32019-11-01 15:09:11 +08001389
1390 /**
1391 * MVNO type:
1392 * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}.
1393 * <P> Type: TEXT </P>
1394 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001395 public static final String MVNO_TYPE = "mvno_type";
zoey chencb52ec32019-11-01 15:09:11 +08001396
1397 /**
1398 * MVNO data.
1399 * Use the following examples.
1400 * <ul>
1401 * <li>SPN: A MOBILE, BEN NL, ...</li>
1402 * <li>IMSI: 302720x94, 2060188, ...</li>
1403 * <li>GID: 4E, 33, ...</li>
1404 * </ul>
1405 * <P> Type: TEXT </P>
1406 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001407 public static final String MVNO_MATCH_DATA = "mvno_match_data";
zoey chencb52ec32019-11-01 15:09:11 +08001408
1409 /**
1410 * The carrier public key that is used for the IMSI encryption.
1411 * <P> Type: TEXT </P>
1412 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001413 public static final String PUBLIC_KEY = "public_key";
zoey chencb52ec32019-11-01 15:09:11 +08001414
1415 /**
1416 * The key identifier Attribute value pair that helps a server locate
1417 * the private key to decrypt the permanent identity.
1418 * <P> Type: TEXT </P>
1419 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001420 public static final String KEY_IDENTIFIER = "key_identifier";
zoey chencb52ec32019-11-01 15:09:11 +08001421
1422 /**
1423 * Date-Time in UTC when the key will expire.
1424 * <P> Type: INTEGER (long) </P>
1425 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001426 public static final String EXPIRATION_TIME = "expiration_time";
zoey chencb52ec32019-11-01 15:09:11 +08001427
1428 /**
1429 * Timestamp when this table was last modified, in milliseconds since
1430 * January 1, 1970 00:00:00.0 UTC.
1431 * <P> Type: INTEGER (long) </P>
1432 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001433 public static final String LAST_MODIFIED = "last_modified";
1434
1435 /**
1436 * The {@code content://} style URL for this table.
pkanwar16b8a0d2017-06-07 10:59:41 -07001437 */
zoey chencb52ec32019-11-01 15:09:11 +08001438 @NonNull
pkanwar16b8a0d2017-06-07 10:59:41 -07001439 public static final Uri CONTENT_URI = Uri.parse("content://carrier_information/carrier");
1440 }
1441
1442 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08001443 * Base columns for tables that contain MMSs.
1444 */
1445 public interface BaseMmsColumns extends BaseColumns {
1446
1447 /** Message box: all messages. */
1448 public static final int MESSAGE_BOX_ALL = 0;
1449 /** Message box: inbox. */
1450 public static final int MESSAGE_BOX_INBOX = 1;
1451 /** Message box: sent messages. */
1452 public static final int MESSAGE_BOX_SENT = 2;
1453 /** Message box: drafts. */
1454 public static final int MESSAGE_BOX_DRAFTS = 3;
1455 /** Message box: outbox. */
1456 public static final int MESSAGE_BOX_OUTBOX = 4;
1457 /** Message box: failed. */
1458 public static final int MESSAGE_BOX_FAILED = 5;
1459
1460 /**
1461 * The thread ID of the message.
1462 * <P>Type: INTEGER (long)</P>
1463 */
1464 public static final String THREAD_ID = "thread_id";
1465
1466 /**
1467 * The date the message was received.
1468 * <P>Type: INTEGER (long)</P>
1469 */
1470 public static final String DATE = "date";
1471
1472 /**
1473 * The date the message was sent.
1474 * <P>Type: INTEGER (long)</P>
1475 */
1476 public static final String DATE_SENT = "date_sent";
1477
1478 /**
1479 * The box which the message belongs to, e.g. {@link #MESSAGE_BOX_INBOX}.
1480 * <P>Type: INTEGER</P>
1481 */
1482 public static final String MESSAGE_BOX = "msg_box";
1483
1484 /**
1485 * Has the message been read?
1486 * <P>Type: INTEGER (boolean)</P>
1487 */
1488 public static final String READ = "read";
1489
1490 /**
1491 * Has the message been seen by the user? The "seen" flag determines
1492 * whether we need to show a new message notification.
1493 * <P>Type: INTEGER (boolean)</P>
1494 */
1495 public static final String SEEN = "seen";
1496
1497 /**
1498 * Does the message have only a text part (can also have a subject) with
1499 * no picture, slideshow, sound, etc. parts?
1500 * <P>Type: INTEGER (boolean)</P>
1501 */
1502 public static final String TEXT_ONLY = "text_only";
1503
1504 /**
1505 * The {@code Message-ID} of the message.
1506 * <P>Type: TEXT</P>
1507 */
1508 public static final String MESSAGE_ID = "m_id";
1509
1510 /**
1511 * The subject of the message, if present.
1512 * <P>Type: TEXT</P>
1513 */
1514 public static final String SUBJECT = "sub";
1515
1516 /**
1517 * The character set of the subject, if present.
1518 * <P>Type: INTEGER</P>
1519 */
1520 public static final String SUBJECT_CHARSET = "sub_cs";
1521
1522 /**
1523 * The {@code Content-Type} of the message.
1524 * <P>Type: TEXT</P>
1525 */
1526 public static final String CONTENT_TYPE = "ct_t";
1527
1528 /**
1529 * The {@code Content-Location} of the message.
1530 * <P>Type: TEXT</P>
1531 */
1532 public static final String CONTENT_LOCATION = "ct_l";
1533
1534 /**
1535 * The expiry time of the message.
1536 * <P>Type: INTEGER (long)</P>
1537 */
1538 public static final String EXPIRY = "exp";
1539
1540 /**
1541 * The class of the message.
1542 * <P>Type: TEXT</P>
1543 */
1544 public static final String MESSAGE_CLASS = "m_cls";
1545
1546 /**
1547 * The type of the message defined by MMS spec.
1548 * <P>Type: INTEGER</P>
1549 */
1550 public static final String MESSAGE_TYPE = "m_type";
1551
1552 /**
1553 * The version of the specification that this message conforms to.
1554 * <P>Type: INTEGER</P>
1555 */
1556 public static final String MMS_VERSION = "v";
1557
1558 /**
1559 * The size of the message.
1560 * <P>Type: INTEGER</P>
1561 */
1562 public static final String MESSAGE_SIZE = "m_size";
1563
1564 /**
1565 * The priority of the message.
1566 * <P>Type: INTEGER</P>
1567 */
1568 public static final String PRIORITY = "pri";
1569
1570 /**
1571 * The {@code read-report} of the message.
1572 * <P>Type: INTEGER (boolean)</P>
1573 */
1574 public static final String READ_REPORT = "rr";
1575
1576 /**
1577 * Is read report allowed?
1578 * <P>Type: INTEGER (boolean)</P>
1579 */
1580 public static final String REPORT_ALLOWED = "rpt_a";
1581
1582 /**
1583 * The {@code response-status} of the message.
1584 * <P>Type: INTEGER</P>
1585 */
1586 public static final String RESPONSE_STATUS = "resp_st";
1587
1588 /**
1589 * The {@code status} of the message.
1590 * <P>Type: INTEGER</P>
1591 */
1592 public static final String STATUS = "st";
1593
1594 /**
1595 * The {@code transaction-id} of the message.
1596 * <P>Type: TEXT</P>
1597 */
1598 public static final String TRANSACTION_ID = "tr_id";
1599
1600 /**
1601 * The {@code retrieve-status} of the message.
1602 * <P>Type: INTEGER</P>
1603 */
1604 public static final String RETRIEVE_STATUS = "retr_st";
1605
1606 /**
1607 * The {@code retrieve-text} of the message.
1608 * <P>Type: TEXT</P>
1609 */
1610 public static final String RETRIEVE_TEXT = "retr_txt";
1611
1612 /**
1613 * The character set of the retrieve-text.
1614 * <P>Type: INTEGER</P>
1615 */
1616 public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs";
1617
1618 /**
1619 * The {@code read-status} of the message.
1620 * <P>Type: INTEGER</P>
1621 */
1622 public static final String READ_STATUS = "read_status";
1623
1624 /**
1625 * The {@code content-class} of the message.
1626 * <P>Type: INTEGER</P>
1627 */
1628 public static final String CONTENT_CLASS = "ct_cls";
1629
1630 /**
1631 * The {@code delivery-report} of the message.
1632 * <P>Type: INTEGER</P>
1633 */
1634 public static final String DELIVERY_REPORT = "d_rpt";
1635
1636 /**
1637 * The {@code delivery-time-token} of the message.
1638 * <P>Type: INTEGER</P>
1639 * @deprecated this column is no longer supported.
1640 * @hide
1641 */
1642 @Deprecated
1643 public static final String DELIVERY_TIME_TOKEN = "d_tm_tok";
1644
1645 /**
1646 * The {@code delivery-time} of the message.
1647 * <P>Type: INTEGER</P>
1648 */
1649 public static final String DELIVERY_TIME = "d_tm";
1650
1651 /**
1652 * The {@code response-text} of the message.
1653 * <P>Type: TEXT</P>
1654 */
1655 public static final String RESPONSE_TEXT = "resp_txt";
1656
1657 /**
1658 * The {@code sender-visibility} of the message.
1659 * <P>Type: TEXT</P>
1660 * @deprecated this column is no longer supported.
1661 * @hide
1662 */
1663 @Deprecated
1664 public static final String SENDER_VISIBILITY = "s_vis";
1665
1666 /**
1667 * The {@code reply-charging} of the message.
1668 * <P>Type: INTEGER</P>
1669 * @deprecated this column is no longer supported.
1670 * @hide
1671 */
1672 @Deprecated
1673 public static final String REPLY_CHARGING = "r_chg";
1674
1675 /**
1676 * The {@code reply-charging-deadline-token} of the message.
1677 * <P>Type: INTEGER</P>
1678 * @deprecated this column is no longer supported.
1679 * @hide
1680 */
1681 @Deprecated
1682 public static final String REPLY_CHARGING_DEADLINE_TOKEN = "r_chg_dl_tok";
1683
1684 /**
1685 * The {@code reply-charging-deadline} of the message.
1686 * <P>Type: INTEGER</P>
1687 * @deprecated this column is no longer supported.
1688 * @hide
1689 */
1690 @Deprecated
1691 public static final String REPLY_CHARGING_DEADLINE = "r_chg_dl";
1692
1693 /**
1694 * The {@code reply-charging-id} of the message.
1695 * <P>Type: TEXT</P>
1696 * @deprecated this column is no longer supported.
1697 * @hide
1698 */
1699 @Deprecated
1700 public static final String REPLY_CHARGING_ID = "r_chg_id";
1701
1702 /**
1703 * The {@code reply-charging-size} of the message.
1704 * <P>Type: INTEGER</P>
1705 * @deprecated this column is no longer supported.
1706 * @hide
1707 */
1708 @Deprecated
1709 public static final String REPLY_CHARGING_SIZE = "r_chg_sz";
1710
1711 /**
1712 * The {@code previously-sent-by} of the message.
1713 * <P>Type: TEXT</P>
1714 * @deprecated this column is no longer supported.
1715 * @hide
1716 */
1717 @Deprecated
1718 public static final String PREVIOUSLY_SENT_BY = "p_s_by";
1719
1720 /**
1721 * The {@code previously-sent-date} of the message.
1722 * <P>Type: INTEGER</P>
1723 * @deprecated this column is no longer supported.
1724 * @hide
1725 */
1726 @Deprecated
1727 public static final String PREVIOUSLY_SENT_DATE = "p_s_d";
1728
1729 /**
1730 * The {@code store} of the message.
1731 * <P>Type: TEXT</P>
1732 * @deprecated this column is no longer supported.
1733 * @hide
1734 */
1735 @Deprecated
1736 public static final String STORE = "store";
1737
1738 /**
1739 * The {@code mm-state} of the message.
1740 * <P>Type: INTEGER</P>
1741 * @deprecated this column is no longer supported.
1742 * @hide
1743 */
1744 @Deprecated
1745 public static final String MM_STATE = "mm_st";
1746
1747 /**
1748 * The {@code mm-flags-token} of the message.
1749 * <P>Type: INTEGER</P>
1750 * @deprecated this column is no longer supported.
1751 * @hide
1752 */
1753 @Deprecated
1754 public static final String MM_FLAGS_TOKEN = "mm_flg_tok";
1755
1756 /**
1757 * The {@code mm-flags} of the message.
1758 * <P>Type: TEXT</P>
1759 * @deprecated this column is no longer supported.
1760 * @hide
1761 */
1762 @Deprecated
1763 public static final String MM_FLAGS = "mm_flg";
1764
1765 /**
1766 * The {@code store-status} of the message.
1767 * <P>Type: TEXT</P>
1768 * @deprecated this column is no longer supported.
1769 * @hide
1770 */
1771 @Deprecated
1772 public static final String STORE_STATUS = "store_st";
1773
1774 /**
1775 * The {@code store-status-text} of the message.
1776 * <P>Type: TEXT</P>
1777 * @deprecated this column is no longer supported.
1778 * @hide
1779 */
1780 @Deprecated
1781 public static final String STORE_STATUS_TEXT = "store_st_txt";
1782
1783 /**
1784 * The {@code stored} of the message.
1785 * <P>Type: TEXT</P>
1786 * @deprecated this column is no longer supported.
1787 * @hide
1788 */
1789 @Deprecated
1790 public static final String STORED = "stored";
1791
1792 /**
1793 * The {@code totals} of the message.
1794 * <P>Type: TEXT</P>
1795 * @deprecated this column is no longer supported.
1796 * @hide
1797 */
1798 @Deprecated
1799 public static final String TOTALS = "totals";
1800
1801 /**
1802 * The {@code mbox-totals} of the message.
1803 * <P>Type: TEXT</P>
1804 * @deprecated this column is no longer supported.
1805 * @hide
1806 */
1807 @Deprecated
1808 public static final String MBOX_TOTALS = "mb_t";
1809
1810 /**
1811 * The {@code mbox-totals-token} of the message.
1812 * <P>Type: INTEGER</P>
1813 * @deprecated this column is no longer supported.
1814 * @hide
1815 */
1816 @Deprecated
1817 public static final String MBOX_TOTALS_TOKEN = "mb_t_tok";
1818
1819 /**
1820 * The {@code quotas} of the message.
1821 * <P>Type: TEXT</P>
1822 * @deprecated this column is no longer supported.
1823 * @hide
1824 */
1825 @Deprecated
1826 public static final String QUOTAS = "qt";
1827
1828 /**
1829 * The {@code mbox-quotas} of the message.
1830 * <P>Type: TEXT</P>
1831 * @deprecated this column is no longer supported.
1832 * @hide
1833 */
1834 @Deprecated
1835 public static final String MBOX_QUOTAS = "mb_qt";
1836
1837 /**
1838 * The {@code mbox-quotas-token} of the message.
1839 * <P>Type: INTEGER</P>
1840 * @deprecated this column is no longer supported.
1841 * @hide
1842 */
1843 @Deprecated
1844 public static final String MBOX_QUOTAS_TOKEN = "mb_qt_tok";
1845
1846 /**
1847 * The {@code message-count} of the message.
1848 * <P>Type: INTEGER</P>
1849 * @deprecated this column is no longer supported.
1850 * @hide
1851 */
1852 @Deprecated
1853 public static final String MESSAGE_COUNT = "m_cnt";
1854
1855 /**
1856 * The {@code start} of the message.
1857 * <P>Type: INTEGER</P>
1858 * @deprecated this column is no longer supported.
1859 * @hide
1860 */
1861 @Deprecated
1862 public static final String START = "start";
1863
1864 /**
1865 * The {@code distribution-indicator} of the message.
1866 * <P>Type: TEXT</P>
1867 * @deprecated this column is no longer supported.
1868 * @hide
1869 */
1870 @Deprecated
1871 public static final String DISTRIBUTION_INDICATOR = "d_ind";
1872
1873 /**
1874 * The {@code element-descriptor} of the message.
1875 * <P>Type: TEXT</P>
1876 * @deprecated this column is no longer supported.
1877 * @hide
1878 */
1879 @Deprecated
1880 public static final String ELEMENT_DESCRIPTOR = "e_des";
1881
1882 /**
1883 * The {@code limit} of the message.
1884 * <P>Type: INTEGER</P>
1885 * @deprecated this column is no longer supported.
1886 * @hide
1887 */
1888 @Deprecated
1889 public static final String LIMIT = "limit";
1890
1891 /**
1892 * The {@code recommended-retrieval-mode} of the message.
1893 * <P>Type: INTEGER</P>
1894 * @deprecated this column is no longer supported.
1895 * @hide
1896 */
1897 @Deprecated
1898 public static final String RECOMMENDED_RETRIEVAL_MODE = "r_r_mod";
1899
1900 /**
1901 * The {@code recommended-retrieval-mode-text} of the message.
1902 * <P>Type: TEXT</P>
1903 * @deprecated this column is no longer supported.
1904 * @hide
1905 */
1906 @Deprecated
1907 public static final String RECOMMENDED_RETRIEVAL_MODE_TEXT = "r_r_mod_txt";
1908
1909 /**
1910 * The {@code status-text} of the message.
1911 * <P>Type: TEXT</P>
1912 * @deprecated this column is no longer supported.
1913 * @hide
1914 */
1915 @Deprecated
1916 public static final String STATUS_TEXT = "st_txt";
1917
1918 /**
1919 * The {@code applic-id} of the message.
1920 * <P>Type: TEXT</P>
1921 * @deprecated this column is no longer supported.
1922 * @hide
1923 */
1924 @Deprecated
1925 public static final String APPLIC_ID = "apl_id";
1926
1927 /**
1928 * The {@code reply-applic-id} of the message.
1929 * <P>Type: TEXT</P>
1930 * @deprecated this column is no longer supported.
1931 * @hide
1932 */
1933 @Deprecated
1934 public static final String REPLY_APPLIC_ID = "r_apl_id";
1935
1936 /**
1937 * The {@code aux-applic-id} of the message.
1938 * <P>Type: TEXT</P>
1939 * @deprecated this column is no longer supported.
1940 * @hide
1941 */
1942 @Deprecated
1943 public static final String AUX_APPLIC_ID = "aux_apl_id";
1944
1945 /**
1946 * The {@code drm-content} of the message.
1947 * <P>Type: TEXT</P>
1948 * @deprecated this column is no longer supported.
1949 * @hide
1950 */
1951 @Deprecated
1952 public static final String DRM_CONTENT = "drm_c";
1953
1954 /**
1955 * The {@code adaptation-allowed} of the message.
1956 * <P>Type: TEXT</P>
1957 * @deprecated this column is no longer supported.
1958 * @hide
1959 */
1960 @Deprecated
1961 public static final String ADAPTATION_ALLOWED = "adp_a";
1962
1963 /**
1964 * The {@code replace-id} of the message.
1965 * <P>Type: TEXT</P>
1966 * @deprecated this column is no longer supported.
1967 * @hide
1968 */
1969 @Deprecated
1970 public static final String REPLACE_ID = "repl_id";
1971
1972 /**
1973 * The {@code cancel-id} of the message.
1974 * <P>Type: TEXT</P>
1975 * @deprecated this column is no longer supported.
1976 * @hide
1977 */
1978 @Deprecated
1979 public static final String CANCEL_ID = "cl_id";
1980
1981 /**
1982 * The {@code cancel-status} of the message.
1983 * <P>Type: INTEGER</P>
1984 * @deprecated this column is no longer supported.
1985 * @hide
1986 */
1987 @Deprecated
1988 public static final String CANCEL_STATUS = "cl_st";
1989
1990 /**
1991 * Is the message locked?
1992 * <P>Type: INTEGER (boolean)</P>
1993 */
1994 public static final String LOCKED = "locked";
1995
1996 /**
1997 * The subscription to which the message belongs to. Its value will be
1998 * < 0 if the sub id cannot be determined.
1999 * <p>Type: INTEGER (long)</p>
2000 */
2001 public static final String SUBSCRIPTION_ID = "sub_id";
2002
2003 /**
2004 * The identity of the sender of a sent message. It is
2005 * usually the package name of the app which sends the message.
2006 * <p class="note"><strong>Note:</strong>
2007 * This column is read-only. It is set by the provider and can not be changed by apps.
2008 * <p>Type: TEXT</p>
2009 */
2010 public static final String CREATOR = "creator";
2011 }
2012
2013 /**
2014 * Columns for the "canonical_addresses" table used by MMS and SMS.
2015 */
2016 public interface CanonicalAddressesColumns extends BaseColumns {
2017 /**
2018 * An address used in MMS or SMS. Email addresses are
2019 * converted to lower case and are compared by string
2020 * equality. Other addresses are compared using
2021 * PHONE_NUMBERS_EQUAL.
2022 * <P>Type: TEXT</P>
2023 */
2024 public static final String ADDRESS = "address";
2025 }
2026
2027 /**
2028 * Columns for the "threads" table used by MMS and SMS.
2029 */
2030 public interface ThreadsColumns extends BaseColumns {
2031
2032 /**
2033 * The date at which the thread was created.
2034 * <P>Type: INTEGER (long)</P>
2035 */
2036 public static final String DATE = "date";
2037
2038 /**
2039 * A string encoding of the recipient IDs of the recipients of
2040 * the message, in numerical order and separated by spaces.
2041 * <P>Type: TEXT</P>
2042 */
2043 public static final String RECIPIENT_IDS = "recipient_ids";
2044
2045 /**
2046 * The message count of the thread.
2047 * <P>Type: INTEGER</P>
2048 */
2049 public static final String MESSAGE_COUNT = "message_count";
2050
2051 /**
2052 * Indicates whether all messages of the thread have been read.
2053 * <P>Type: INTEGER</P>
2054 */
2055 public static final String READ = "read";
2056
2057 /**
2058 * The snippet of the latest message in the thread.
2059 * <P>Type: TEXT</P>
2060 */
2061 public static final String SNIPPET = "snippet";
2062
2063 /**
2064 * The charset of the snippet.
2065 * <P>Type: INTEGER</P>
2066 */
2067 public static final String SNIPPET_CHARSET = "snippet_cs";
2068
2069 /**
2070 * Type of the thread, either {@link Threads#COMMON_THREAD} or
2071 * {@link Threads#BROADCAST_THREAD}.
2072 * <P>Type: INTEGER</P>
2073 */
2074 public static final String TYPE = "type";
2075
2076 /**
2077 * Indicates whether there is a transmission error in the thread.
2078 * <P>Type: INTEGER</P>
2079 */
2080 public static final String ERROR = "error";
2081
2082 /**
2083 * Indicates whether this thread contains any attachments.
2084 * <P>Type: INTEGER</P>
2085 */
2086 public static final String HAS_ATTACHMENT = "has_attachment";
2087
2088 /**
2089 * If the thread is archived
2090 * <P>Type: INTEGER (boolean)</P>
2091 */
2092 public static final String ARCHIVED = "archived";
2093 }
2094
2095 /**
2096 * Helper functions for the "threads" table used by MMS and SMS.
Leland Millerc445b2b2019-01-09 17:00:09 -08002097 *
2098 * Thread IDs are determined by the participants in a conversation and can be used to match
2099 * both SMS and MMS messages.
2100 *
2101 * To avoid issues where applications might cache a thread ID, the thread ID of a deleted thread
2102 * must not be reused to point at a new thread.
Dan Willemsen4980bf42017-02-14 14:17:12 -08002103 */
2104 public static final class Threads implements ThreadsColumns {
2105
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002106 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002107 private static final String[] ID_PROJECTION = { BaseColumns._ID };
2108
2109 /**
2110 * Private {@code content://} style URL for this table. Used by
2111 * {@link #getOrCreateThreadId(android.content.Context, java.util.Set)}.
2112 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002113 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002114 private static final Uri THREAD_ID_CONTENT_URI = Uri.parse(
2115 "content://mms-sms/threadID");
2116
2117 /**
2118 * The {@code content://} style URL for this table, by conversation.
2119 */
2120 public static final Uri CONTENT_URI = Uri.withAppendedPath(
2121 MmsSms.CONTENT_URI, "conversations");
2122
2123 /**
2124 * The {@code content://} style URL for this table, for obsolete threads.
2125 */
2126 public static final Uri OBSOLETE_THREADS_URI = Uri.withAppendedPath(
2127 CONTENT_URI, "obsolete");
2128
2129 /** Thread type: common thread. */
2130 public static final int COMMON_THREAD = 0;
2131
2132 /** Thread type: broadcast thread. */
2133 public static final int BROADCAST_THREAD = 1;
2134
2135 /**
2136 * Not instantiable.
2137 * @hide
2138 */
2139 private Threads() {
2140 }
2141
2142 /**
2143 * This is a single-recipient version of {@code getOrCreateThreadId}.
2144 * It's convenient for use with SMS messages.
2145 * @param context the context object to use.
2146 * @param recipient the recipient to send to.
2147 */
2148 public static long getOrCreateThreadId(Context context, String recipient) {
2149 Set<String> recipients = new HashSet<String>();
2150
2151 recipients.add(recipient);
2152 return getOrCreateThreadId(context, recipients);
2153 }
2154
2155 /**
Leland Millerc445b2b2019-01-09 17:00:09 -08002156 * Given a set of recipients return its thread ID.
2157 * <p>
2158 * If a thread exists containing the provided participants, return its thread ID. Otherwise,
2159 * this will create a new thread containing the provided participants and return its ID.
Dan Willemsen4980bf42017-02-14 14:17:12 -08002160 */
2161 public static long getOrCreateThreadId(
2162 Context context, Set<String> recipients) {
2163 Uri.Builder uriBuilder = THREAD_ID_CONTENT_URI.buildUpon();
2164
2165 for (String recipient : recipients) {
2166 if (Mms.isEmailAddress(recipient)) {
2167 recipient = Mms.extractAddrSpec(recipient);
2168 }
2169
2170 uriBuilder.appendQueryParameter("recipient", recipient);
2171 }
2172
2173 Uri uri = uriBuilder.build();
2174 //if (DEBUG) Rlog.v(TAG, "getOrCreateThreadId uri: " + uri);
2175
2176 Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(),
2177 uri, ID_PROJECTION, null, null, null);
2178 if (cursor != null) {
2179 try {
2180 if (cursor.moveToFirst()) {
2181 return cursor.getLong(0);
2182 } else {
2183 Rlog.e(TAG, "getOrCreateThreadId returned no rows!");
2184 }
2185 } finally {
2186 cursor.close();
2187 }
2188 }
2189
2190 Rlog.e(TAG, "getOrCreateThreadId failed with " + recipients.size() + " recipients");
2191 throw new IllegalArgumentException("Unable to find or allocate a thread ID.");
2192 }
2193 }
2194
2195 /**
Sahin Caliskanf00a8762019-01-24 14:32:12 -08002196 * Columns for the "rcs_*" tables used by {@link android.telephony.ims.RcsMessageStore} classes.
2197 *
2198 * @hide - not meant for public use
2199 */
2200 public interface RcsColumns {
Leland Millerbd7959d2019-02-13 10:31:31 -08002201 // TODO(sahinc): Turn this to true once the schema finalizes, so that people can update
2202 // their messaging databases. NOTE: move the switch/case update in MmsSmsDatabaseHelper to
2203 // the latest version of the database before turning this flag to true.
2204 boolean IS_RCS_TABLE_SCHEMA_CODE_COMPLETE = false;
2205
Sahin Caliskanf00a8762019-01-24 14:32:12 -08002206 /**
2207 * The authority for the content provider
2208 */
2209 String AUTHORITY = "rcs";
2210
2211 /**
2212 * The URI to start building upon to use {@link com.android.providers.telephony.RcsProvider}
2213 */
2214 Uri CONTENT_AND_AUTHORITY = Uri.parse("content://" + AUTHORITY);
2215
2216 /**
2217 * The value to be used whenever a transaction that expects an integer to be returned
2218 * failed.
2219 */
2220 int TRANSACTION_FAILED = Integer.MIN_VALUE;
2221
2222 /**
2223 * The value that denotes a timestamp was not set before (e.g. a message that is not
2224 * delivered yet will not have a DELIVERED_TIMESTAMP)
2225 */
2226 long TIMESTAMP_NOT_SET = 0;
2227
2228 /**
2229 * The table that {@link android.telephony.ims.RcsThread} gets persisted to
2230 */
2231 interface RcsThreadColumns {
2232 /**
2233 * The path that should be used for referring to
2234 * {@link android.telephony.ims.RcsThread}s in
2235 * {@link com.android.providers.telephony.RcsProvider} URIs.
2236 */
2237 String RCS_THREAD_URI_PART = "thread";
2238
2239 /**
2240 * The URI to query or modify {@link android.telephony.ims.RcsThread} via the content
2241 * provider.
2242 */
2243 Uri RCS_THREAD_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY, RCS_THREAD_URI_PART);
2244
2245 /**
2246 * The unique identifier of an {@link android.telephony.ims.RcsThread}
2247 */
2248 String RCS_THREAD_ID_COLUMN = "rcs_thread_id";
2249 }
2250
2251 /**
2252 * The table that {@link android.telephony.ims.Rcs1To1Thread} gets persisted to
2253 */
2254 interface Rcs1To1ThreadColumns extends RcsThreadColumns {
2255 /**
2256 * The path that should be used for referring to
2257 * {@link android.telephony.ims.Rcs1To1Thread}s in
2258 * {@link com.android.providers.telephony.RcsProvider} URIs.
2259 */
2260 String RCS_1_TO_1_THREAD_URI_PART = "p2p_thread";
2261
2262 /**
2263 * The URI to query or modify {@link android.telephony.ims.Rcs1To1Thread}s via the
Leland Millerdb2337f2019-02-20 07:53:49 -08002264 * content provider. Can also insert to this URI to create a new 1-to-1 thread. When
2265 * performing an insert, ensure that the provided content values contain the other
2266 * participant's ID under the key
2267 * {@link RcsParticipantColumns.RCS_PARTICIPANT_ID_COLUMN}
Sahin Caliskanf00a8762019-01-24 14:32:12 -08002268 */
2269 Uri RCS_1_TO_1_THREAD_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2270 RCS_1_TO_1_THREAD_URI_PART);
2271
2272 /**
2273 * The SMS/MMS thread to fallback to in case of an RCS outage
2274 */
2275 String FALLBACK_THREAD_ID_COLUMN = "rcs_fallback_thread_id";
2276 }
2277
2278 /**
2279 * The table that {@link android.telephony.ims.RcsGroupThread} gets persisted to
2280 */
2281 interface RcsGroupThreadColumns extends RcsThreadColumns {
2282 /**
2283 * The path that should be used for referring to
2284 * {@link android.telephony.ims.RcsGroupThread}s in
2285 * {@link com.android.providers.telephony.RcsProvider} URIs.
2286 */
2287 String RCS_GROUP_THREAD_URI_PART = "group_thread";
2288
2289 /**
2290 * The URI to query or modify {@link android.telephony.ims.RcsGroupThread}s via the
2291 * content provider
2292 */
2293 Uri RCS_GROUP_THREAD_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2294 RCS_GROUP_THREAD_URI_PART);
2295
2296 /**
2297 * The owner/admin of the {@link android.telephony.ims.RcsGroupThread}
2298 */
2299 String OWNER_PARTICIPANT_COLUMN = "owner_participant";
2300
2301 /**
2302 * The user visible name of the group
2303 */
2304 String GROUP_NAME_COLUMN = "group_name";
2305
2306 /**
2307 * The user visible icon of the group
2308 */
2309 String GROUP_ICON_COLUMN = "group_icon";
2310
2311 /**
2312 * The RCS conference URI for this group
2313 */
2314 String CONFERENCE_URI_COLUMN = "conference_uri";
2315 }
2316
2317 /**
2318 * The view that enables polling from all types of RCS threads at once
2319 */
2320 interface RcsUnifiedThreadColumns extends RcsThreadColumns, Rcs1To1ThreadColumns,
2321 RcsGroupThreadColumns {
2322 /**
2323 * The type of this {@link android.telephony.ims.RcsThread}
2324 */
2325 String THREAD_TYPE_COLUMN = "thread_type";
2326
2327 /**
2328 * Integer returned as a result from a database query that denotes the thread is 1 to 1
2329 */
2330 int THREAD_TYPE_1_TO_1 = 0;
2331
2332 /**
2333 * Integer returned as a result from a database query that denotes the thread is 1 to 1
2334 */
2335 int THREAD_TYPE_GROUP = 1;
2336 }
2337
2338 /**
2339 * The table that {@link android.telephony.ims.RcsParticipant} gets persisted to
2340 */
2341 interface RcsParticipantColumns {
2342 /**
2343 * The path that should be used for referring to
2344 * {@link android.telephony.ims.RcsParticipant}s in
2345 * {@link com.android.providers.telephony.RcsProvider} URIs.
2346 */
2347 String RCS_PARTICIPANT_URI_PART = "participant";
2348
2349 /**
2350 * The URI to query or modify {@link android.telephony.ims.RcsParticipant}s via the
2351 * content provider
2352 */
2353 Uri RCS_PARTICIPANT_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2354 RCS_PARTICIPANT_URI_PART);
2355
2356 /**
2357 * The unique identifier of the entry in the database
2358 */
2359 String RCS_PARTICIPANT_ID_COLUMN = "rcs_participant_id";
2360
2361 /**
2362 * A foreign key on canonical_address table, also used by SMS/MMS
2363 */
2364 String CANONICAL_ADDRESS_ID_COLUMN = "canonical_address_id";
2365
2366 /**
2367 * The user visible RCS alias for this participant.
2368 */
2369 String RCS_ALIAS_COLUMN = "rcs_alias";
2370 }
2371
2372 /**
2373 * Additional constants to enable access to {@link android.telephony.ims.RcsParticipant}
2374 * related data
2375 */
2376 interface RcsParticipantHelpers extends RcsParticipantColumns {
2377 /**
2378 * The view that unifies "rcs_participant" and "canonical_addresses" tables for easy
2379 * access to participant address.
2380 */
2381 String RCS_PARTICIPANT_WITH_ADDRESS_VIEW = "rcs_participant_with_address_view";
2382
2383 /**
2384 * The view that unifies "rcs_participant", "canonical_addresses" and
2385 * "rcs_thread_participant" junction table to get full information on participants that
2386 * contribute to threads.
2387 */
2388 String RCS_PARTICIPANT_WITH_THREAD_VIEW = "rcs_participant_with_thread_view";
2389 }
2390
2391 /**
2392 * The table that {@link android.telephony.ims.RcsMessage} gets persisted to
2393 */
2394 interface RcsMessageColumns {
2395 /**
2396 * Denotes the type of this message (i.e.
2397 * {@link android.telephony.ims.RcsIncomingMessage} or
2398 * {@link android.telephony.ims.RcsOutgoingMessage}
2399 */
2400 String MESSAGE_TYPE_COLUMN = "rcs_message_type";
2401
2402 /**
2403 * The unique identifier for the message in the database - i.e. the primary key.
2404 */
2405 String MESSAGE_ID_COLUMN = "rcs_message_row_id";
2406
2407 /**
2408 * The globally unique RCS identifier for the message. Please see 4.4.5.2 - GSMA
2409 * RCC.53 (RCS Device API 1.6 Specification)
2410 */
2411 String GLOBAL_ID_COLUMN = "rcs_message_global_id";
2412
2413 /**
2414 * The subscription where this message was sent from/to.
2415 */
2416 String SUB_ID_COLUMN = "sub_id";
2417
2418 /**
2419 * The sending status of the message.
2420 * @see android.telephony.ims.RcsMessage.RcsMessageStatus
2421 */
2422 String STATUS_COLUMN = "status";
2423
2424 /**
2425 * The creation timestamp of the message.
2426 */
2427 String ORIGINATION_TIMESTAMP_COLUMN = "origination_timestamp";
2428
2429 /**
2430 * The text content of the message.
2431 */
2432 String MESSAGE_TEXT_COLUMN = "rcs_text";
2433
2434 /**
2435 * The latitude content of the message, if it contains a location.
2436 */
2437 String LATITUDE_COLUMN = "latitude";
2438
2439 /**
2440 * The longitude content of the message, if it contains a location.
2441 */
2442 String LONGITUDE_COLUMN = "longitude";
2443 }
2444
2445 /**
2446 * The table that additional information of {@link android.telephony.ims.RcsIncomingMessage}
2447 * gets persisted to.
2448 */
2449 interface RcsIncomingMessageColumns extends RcsMessageColumns {
2450 /**
2451 The path that should be used for referring to
2452 * {@link android.telephony.ims.RcsIncomingMessage}s in
2453 * {@link com.android.providers.telephony.RcsProvider} URIs.
2454 */
2455 String INCOMING_MESSAGE_URI_PART = "incoming_message";
2456
2457 /**
2458 * The URI to query incoming messages through
2459 * {@link com.android.providers.telephony.RcsProvider}
2460 */
2461 Uri INCOMING_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2462 INCOMING_MESSAGE_URI_PART);
2463
2464 /**
2465 * The ID of the {@link android.telephony.ims.RcsParticipant} that sent this message
2466 */
2467 String SENDER_PARTICIPANT_ID_COLUMN = "sender_participant";
2468
2469 /**
2470 * The timestamp of arrival for this message.
2471 */
2472 String ARRIVAL_TIMESTAMP_COLUMN = "arrival_timestamp";
2473
2474 /**
2475 * The time when the recipient has read this message.
2476 */
2477 String SEEN_TIMESTAMP_COLUMN = "seen_timestamp";
2478 }
2479
2480 /**
2481 * The table that additional information of {@link android.telephony.ims.RcsOutgoingMessage}
2482 * gets persisted to.
2483 */
2484 interface RcsOutgoingMessageColumns extends RcsMessageColumns {
2485 /**
2486 * The path that should be used for referring to
2487 * {@link android.telephony.ims.RcsOutgoingMessage}s in
2488 * {@link com.android.providers.telephony.RcsProvider} URIs.
2489 */
2490 String OUTGOING_MESSAGE_URI_PART = "outgoing_message";
2491
2492 /**
2493 * The URI to query or modify {@link android.telephony.ims.RcsOutgoingMessage}s via the
2494 * content provider
2495 */
2496 Uri OUTGOING_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2497 OUTGOING_MESSAGE_URI_PART);
2498 }
2499
2500 /**
2501 * The delivery information of an {@link android.telephony.ims.RcsOutgoingMessage}
2502 */
2503 interface RcsMessageDeliveryColumns extends RcsOutgoingMessageColumns {
2504 /**
2505 * The path that should be used for referring to
2506 * {@link android.telephony.ims.RcsOutgoingMessageDelivery}s in
2507 * {@link com.android.providers.telephony.RcsProvider} URIs.
2508 */
2509 String DELIVERY_URI_PART = "delivery";
2510
2511 /**
2512 * The timestamp of delivery of this message.
2513 */
2514 String DELIVERED_TIMESTAMP_COLUMN = "delivered_timestamp";
2515
2516 /**
2517 * The time when the recipient has read this message.
2518 */
2519 String SEEN_TIMESTAMP_COLUMN = "seen_timestamp";
2520 }
2521
2522 /**
2523 * The views that allow querying {@link android.telephony.ims.RcsIncomingMessage} and
2524 * {@link android.telephony.ims.RcsOutgoingMessage} at the same time.
2525 */
2526 interface RcsUnifiedMessageColumns extends RcsIncomingMessageColumns,
2527 RcsOutgoingMessageColumns {
2528 /**
2529 * The path that is used to query all {@link android.telephony.ims.RcsMessage} in
2530 * {@link com.android.providers.telephony.RcsProvider} URIs.
2531 */
2532 String UNIFIED_MESSAGE_URI_PART = "message";
2533
2534 /**
2535 * The URI to query all types of {@link android.telephony.ims.RcsMessage}s
2536 */
2537 Uri UNIFIED_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2538 UNIFIED_MESSAGE_URI_PART);
2539
2540 /**
2541 * The name of the view that unites rcs_message and rcs_incoming_message tables.
2542 */
2543 String UNIFIED_INCOMING_MESSAGE_VIEW = "unified_incoming_message_view";
2544
2545 /**
2546 * The name of the view that unites rcs_message and rcs_outgoing_message tables.
2547 */
2548 String UNIFIED_OUTGOING_MESSAGE_VIEW = "unified_outgoing_message_view";
2549
2550 /**
2551 * The column that shows from which table the message entry came from.
2552 */
2553 String MESSAGE_TYPE_COLUMN = "message_type";
2554
2555 /**
2556 * Integer returned as a result from a database query that denotes that the message is
2557 * an incoming message
2558 */
2559 int MESSAGE_TYPE_INCOMING = 1;
2560
2561 /**
2562 * Integer returned as a result from a database query that denotes that the message is
2563 * an outgoing message
2564 */
2565 int MESSAGE_TYPE_OUTGOING = 0;
2566 }
2567
2568 /**
2569 * The table that {@link android.telephony.ims.RcsFileTransferPart} gets persisted to.
2570 */
2571 interface RcsFileTransferColumns {
2572 /**
2573 * The path that should be used for referring to
2574 * {@link android.telephony.ims.RcsFileTransferPart}s in
2575 * {@link com.android.providers.telephony.RcsProvider} URIs.
2576 */
2577 String FILE_TRANSFER_URI_PART = "file_transfer";
2578
2579 /**
2580 * The URI to query or modify {@link android.telephony.ims.RcsFileTransferPart}s via the
2581 * content provider
2582 */
2583 Uri FILE_TRANSFER_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2584 FILE_TRANSFER_URI_PART);
2585
2586 /**
2587 * The globally unique file transfer ID for this RCS file transfer.
2588 */
2589 String FILE_TRANSFER_ID_COLUMN = "rcs_file_transfer_id";
2590
2591 /**
2592 * The RCS session ID for this file transfer. The ID is implementation dependent but
2593 * should be unique.
2594 */
2595 String SESSION_ID_COLUMN = "session_id";
2596
2597 /**
2598 * The URI that points to the content of this file transfer
2599 */
2600 String CONTENT_URI_COLUMN = "content_uri";
2601
2602 /**
2603 * The file type of this file transfer in bytes. The validity of types is not enforced
2604 * in {@link android.telephony.ims.RcsMessageStore} APIs.
2605 */
2606 String CONTENT_TYPE_COLUMN = "content_type";
2607
2608 /**
2609 * The size of the file transfer in bytes.
2610 */
2611 String FILE_SIZE_COLUMN = "file_size";
2612
2613 /**
2614 * Number of bytes that was successfully transmitted for this file transfer
2615 */
2616 String SUCCESSFULLY_TRANSFERRED_BYTES = "transfer_offset";
2617
2618 /**
2619 * The status of this file transfer
2620 * @see android.telephony.ims.RcsFileTransferPart.RcsFileTransferStatus
2621 */
2622 String TRANSFER_STATUS_COLUMN = "transfer_status";
2623
2624 /**
2625 * The on-screen width of the file transfer, if it contains multi-media
2626 */
2627 String WIDTH_COLUMN = "width";
2628
2629 /**
2630 * The on-screen height of the file transfer, if it contains multi-media
2631 */
2632 String HEIGHT_COLUMN = "height";
2633
2634 /**
2635 * The duration of the content in milliseconds if this file transfer contains
2636 * multi-media
2637 */
2638 String DURATION_MILLIS_COLUMN = "duration";
2639
2640 /**
2641 * The URI to the preview of the content of this file transfer
2642 */
2643 String PREVIEW_URI_COLUMN = "preview_uri";
2644
2645 /**
2646 * The type of the preview of the content of this file transfer. The validity of types
2647 * is not enforced in {@link android.telephony.ims.RcsMessageStore} APIs.
2648 */
2649 String PREVIEW_TYPE_COLUMN = "preview_type";
2650 }
2651
2652 /**
2653 * The table that holds the information for
2654 * {@link android.telephony.ims.RcsGroupThreadEvent} and its subclasses.
2655 */
2656 interface RcsThreadEventColumns {
2657 /**
2658 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2659 * refer to participant joined events (example URI:
2660 * {@code content://rcs/group_thread/3/participant_joined_event})
2661 */
2662 String PARTICIPANT_JOINED_URI_PART = "participant_joined_event";
2663
2664 /**
2665 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2666 * refer to participant left events. (example URI:
2667 * {@code content://rcs/group_thread/3/participant_left_event/4})
2668 */
2669 String PARTICIPANT_LEFT_URI_PART = "participant_left_event";
2670
2671 /**
2672 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2673 * refer to name changed events. (example URI:
2674 * {@code content://rcs/group_thread/3/name_changed_event})
2675 */
2676 String NAME_CHANGED_URI_PART = "name_changed_event";
2677
2678 /**
2679 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2680 * refer to icon changed events. (example URI:
2681 * {@code content://rcs/group_thread/3/icon_changed_event})
2682 */
2683 String ICON_CHANGED_URI_PART = "icon_changed_event";
2684
2685 /**
2686 * The unique ID of this event in the database, i.e. the primary key
2687 */
2688 String EVENT_ID_COLUMN = "event_id";
2689
2690 /**
2691 * The type of this event
2692 *
2693 * @see RcsEventTypes
2694 */
2695 String EVENT_TYPE_COLUMN = "event_type";
2696
2697 /**
2698 * The timestamp in milliseconds of when this event happened
2699 */
2700 String TIMESTAMP_COLUMN = "origination_timestamp";
2701
2702 /**
2703 * The participant that generated this event
2704 */
2705 String SOURCE_PARTICIPANT_ID_COLUMN = "source_participant";
2706
2707 /**
2708 * The receiving participant of this event if this was an
2709 * {@link android.telephony.ims.RcsGroupThreadParticipantJoinedEvent} or
2710 * {@link android.telephony.ims.RcsGroupThreadParticipantLeftEvent}
2711 */
2712 String DESTINATION_PARTICIPANT_ID_COLUMN = "destination_participant";
2713
2714 /**
2715 * The URI for the new icon of the group thread if this was an
2716 * {@link android.telephony.ims.RcsGroupThreadIconChangedEvent}
2717 */
2718 String NEW_ICON_URI_COLUMN = "new_icon_uri";
2719
2720 /**
2721 * The URI for the new name of the group thread if this was an
2722 * {@link android.telephony.ims.RcsGroupThreadNameChangedEvent}
2723 */
2724 String NEW_NAME_COLUMN = "new_name";
2725 }
2726
2727 /**
2728 * The table that {@link android.telephony.ims.RcsParticipantAliasChangedEvent} gets
2729 * persisted to
2730 */
2731 interface RcsParticipantEventColumns {
2732 /**
2733 * The path that should be used for referring to
2734 * {@link android.telephony.ims.RcsParticipantAliasChangedEvent}s in
2735 * {@link com.android.providers.telephony.RcsProvider} URIs.
2736 */
2737 String ALIAS_CHANGE_EVENT_URI_PART = "alias_change_event";
2738
2739 /**
2740 * The new alias of the participant
2741 */
2742 String NEW_ALIAS_COLUMN = "new_alias";
2743 }
2744
2745 /**
2746 * These values are used in {@link com.android.providers.telephony.RcsProvider} to determine
2747 * what kind of event is present in the storage.
2748 */
2749 interface RcsEventTypes {
2750 /**
2751 * Integer constant that is stored in the
2752 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2753 * is of type {@link android.telephony.ims.RcsParticipantAliasChangedEvent}
2754 */
2755 int PARTICIPANT_ALIAS_CHANGED_EVENT_TYPE = 1;
2756
2757 /**
2758 * Integer constant that is stored in the
2759 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2760 * is of type {@link android.telephony.ims.RcsGroupThreadParticipantJoinedEvent}
2761 */
2762 int PARTICIPANT_JOINED_EVENT_TYPE = 2;
2763
2764 /**
2765 * Integer constant that is stored in the
2766 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2767 * is of type {@link android.telephony.ims.RcsGroupThreadParticipantLeftEvent}
2768 */
2769 int PARTICIPANT_LEFT_EVENT_TYPE = 4;
2770
2771 /**
2772 * Integer constant that is stored in the
2773 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2774 * is of type {@link android.telephony.ims.RcsGroupThreadIconChangedEvent}
2775 */
2776 int ICON_CHANGED_EVENT_TYPE = 8;
2777
2778 /**
2779 * Integer constant that is stored in the
2780 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2781 * is of type {@link android.telephony.ims.RcsGroupThreadNameChangedEvent}
2782 */
2783 int NAME_CHANGED_EVENT_TYPE = 16;
2784 }
2785
2786 /**
2787 * The view that allows unified querying across all events
2788 */
2789 interface RcsUnifiedEventHelper extends RcsParticipantEventColumns, RcsThreadEventColumns {
2790 /**
2791 * The path that should be used for referring to
2792 * {@link android.telephony.ims.RcsEvent}s in
2793 * {@link com.android.providers.telephony.RcsProvider} URIs.
2794 */
2795 String RCS_EVENT_QUERY_URI_PATH = "event";
2796
2797 /**
2798 * The URI to query {@link android.telephony.ims.RcsEvent}s via the content provider.
2799 */
2800 Uri RCS_EVENT_QUERY_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2801 RCS_EVENT_QUERY_URI_PATH);
2802 }
Leland Miller7b378ab2019-01-24 16:09:10 -08002803
2804 /**
2805 * Allows RCS specific canonical address handling.
2806 */
2807 interface RcsCanonicalAddressHelper {
2808 /**
2809 * Returns the canonical address ID for a canonical address, if now row exists, this
2810 * will add a row and return its ID. This helper works against the same table used by
2811 * the SMS and MMS threads, but is accessible only by the phone process for use by RCS
2812 * message storage.
2813 *
2814 * @throws IllegalArgumentException if unable to retrieve or create the canonical
2815 * address entry.
2816 */
2817 static long getOrCreateCanonicalAddressId(
2818 ContentResolver contentResolver, String canonicalAddress) {
2819
2820 Uri.Builder uriBuilder = CONTENT_AND_AUTHORITY.buildUpon();
2821 uriBuilder.appendPath("canonical-address");
2822 uriBuilder.appendQueryParameter("address", canonicalAddress);
2823 Uri uri = uriBuilder.build();
2824
2825 try (Cursor cursor = contentResolver.query(uri, null, null, null)) {
2826 if (cursor != null && cursor.moveToFirst()) {
2827 return cursor.getLong(cursor.getColumnIndex(CanonicalAddressesColumns._ID));
2828 } else {
2829 Rlog.e(TAG, "getOrCreateCanonicalAddressId returned no rows");
2830 }
2831 }
2832
2833 Rlog.e(TAG, "getOrCreateCanonicalAddressId failed");
2834 throw new IllegalArgumentException(
2835 "Unable to find or allocate a canonical address ID");
2836 }
2837 }
Sahin Caliskanf00a8762019-01-24 14:32:12 -08002838 }
2839
2840 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08002841 * Contains all MMS messages.
2842 */
2843 public static final class Mms implements BaseMmsColumns {
2844
2845 /**
2846 * Not instantiable.
2847 * @hide
2848 */
2849 private Mms() {
2850 }
2851
2852 /**
2853 * The {@code content://} URI for this table.
2854 */
2855 public static final Uri CONTENT_URI = Uri.parse("content://mms");
2856
2857 /**
2858 * Content URI for getting MMS report requests.
2859 */
2860 public static final Uri REPORT_REQUEST_URI = Uri.withAppendedPath(
2861 CONTENT_URI, "report-request");
2862
2863 /**
2864 * Content URI for getting MMS report status.
2865 */
2866 public static final Uri REPORT_STATUS_URI = Uri.withAppendedPath(
2867 CONTENT_URI, "report-status");
2868
2869 /**
2870 * The default sort order for this table.
2871 */
2872 public static final String DEFAULT_SORT_ORDER = "date DESC";
2873
2874 /**
2875 * Regex pattern for names and email addresses.
2876 * <ul>
2877 * <li><em>mailbox</em> = {@code name-addr}</li>
2878 * <li><em>name-addr</em> = {@code [display-name] angle-addr}</li>
2879 * <li><em>angle-addr</em> = {@code [CFWS] "<" addr-spec ">" [CFWS]}</li>
2880 * </ul>
2881 * @hide
2882 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002883 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002884 public static final Pattern NAME_ADDR_EMAIL_PATTERN =
2885 Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*");
2886
2887 /**
2888 * Helper method to query this table.
2889 * @hide
2890 */
2891 public static Cursor query(
2892 ContentResolver cr, String[] projection) {
2893 return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER);
2894 }
2895
2896 /**
2897 * Helper method to query this table.
2898 * @hide
2899 */
2900 public static Cursor query(
2901 ContentResolver cr, String[] projection,
2902 String where, String orderBy) {
2903 return cr.query(CONTENT_URI, projection,
2904 where, null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
2905 }
2906
2907 /**
2908 * Helper method to extract email address from address string.
2909 * @hide
2910 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002911 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002912 public static String extractAddrSpec(String address) {
2913 Matcher match = NAME_ADDR_EMAIL_PATTERN.matcher(address);
2914
2915 if (match.matches()) {
2916 return match.group(2);
2917 }
2918 return address;
2919 }
2920
2921 /**
2922 * Is the specified address an email address?
2923 *
2924 * @param address the input address to test
2925 * @return true if address is an email address; false otherwise.
2926 * @hide
2927 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002928 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002929 public static boolean isEmailAddress(String address) {
2930 if (TextUtils.isEmpty(address)) {
2931 return false;
2932 }
2933
2934 String s = extractAddrSpec(address);
2935 Matcher match = Patterns.EMAIL_ADDRESS.matcher(s);
2936 return match.matches();
2937 }
2938
2939 /**
2940 * Is the specified number a phone number?
2941 *
2942 * @param number the input number to test
2943 * @return true if number is a phone number; false otherwise.
2944 * @hide
2945 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002946 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002947 public static boolean isPhoneNumber(String number) {
2948 if (TextUtils.isEmpty(number)) {
2949 return false;
2950 }
2951
2952 Matcher match = Patterns.PHONE.matcher(number);
2953 return match.matches();
2954 }
2955
2956 /**
2957 * Contains all MMS messages in the MMS app inbox.
2958 */
2959 public static final class Inbox implements BaseMmsColumns {
2960
2961 /**
2962 * Not instantiable.
2963 * @hide
2964 */
2965 private Inbox() {
2966 }
2967
2968 /**
2969 * The {@code content://} style URL for this table.
2970 */
2971 public static final Uri
2972 CONTENT_URI = Uri.parse("content://mms/inbox");
2973
2974 /**
2975 * The default sort order for this table.
2976 */
2977 public static final String DEFAULT_SORT_ORDER = "date DESC";
2978 }
2979
2980 /**
2981 * Contains all MMS messages in the MMS app sent folder.
2982 */
2983 public static final class Sent implements BaseMmsColumns {
2984
2985 /**
2986 * Not instantiable.
2987 * @hide
2988 */
2989 private Sent() {
2990 }
2991
2992 /**
2993 * The {@code content://} style URL for this table.
2994 */
2995 public static final Uri
2996 CONTENT_URI = Uri.parse("content://mms/sent");
2997
2998 /**
2999 * The default sort order for this table.
3000 */
3001 public static final String DEFAULT_SORT_ORDER = "date DESC";
3002 }
3003
3004 /**
3005 * Contains all MMS messages in the MMS app drafts folder.
3006 */
3007 public static final class Draft implements BaseMmsColumns {
3008
3009 /**
3010 * Not instantiable.
3011 * @hide
3012 */
3013 private Draft() {
3014 }
3015
3016 /**
3017 * The {@code content://} style URL for this table.
3018 */
3019 public static final Uri
3020 CONTENT_URI = Uri.parse("content://mms/drafts");
3021
3022 /**
3023 * The default sort order for this table.
3024 */
3025 public static final String DEFAULT_SORT_ORDER = "date DESC";
3026 }
3027
3028 /**
3029 * Contains all MMS messages in the MMS app outbox.
3030 */
3031 public static final class Outbox implements BaseMmsColumns {
3032
3033 /**
3034 * Not instantiable.
3035 * @hide
3036 */
3037 private Outbox() {
3038 }
3039
3040 /**
3041 * The {@code content://} style URL for this table.
3042 */
3043 public static final Uri
3044 CONTENT_URI = Uri.parse("content://mms/outbox");
3045
3046 /**
3047 * The default sort order for this table.
3048 */
3049 public static final String DEFAULT_SORT_ORDER = "date DESC";
3050 }
3051
3052 /**
3053 * Contains address information for an MMS message.
3054 */
3055 public static final class Addr implements BaseColumns {
3056
3057 /**
3058 * Not instantiable.
3059 * @hide
3060 */
3061 private Addr() {
3062 }
3063
3064 /**
3065 * The ID of MM which this address entry belongs to.
3066 * <P>Type: INTEGER (long)</P>
3067 */
3068 public static final String MSG_ID = "msg_id";
3069
3070 /**
3071 * The ID of contact entry in Phone Book.
3072 * <P>Type: INTEGER (long)</P>
3073 */
3074 public static final String CONTACT_ID = "contact_id";
3075
3076 /**
3077 * The address text.
3078 * <P>Type: TEXT</P>
3079 */
3080 public static final String ADDRESS = "address";
3081
3082 /**
3083 * Type of address: must be one of {@code PduHeaders.BCC},
3084 * {@code PduHeaders.CC}, {@code PduHeaders.FROM}, {@code PduHeaders.TO}.
3085 * <P>Type: INTEGER</P>
3086 */
3087 public static final String TYPE = "type";
3088
3089 /**
3090 * Character set of this entry (MMS charset value).
3091 * <P>Type: INTEGER</P>
3092 */
3093 public static final String CHARSET = "charset";
Nagarajaa15ee4d2019-07-09 14:54:33 +05303094
3095 /**
3096 * Generates a Addr {@link Uri} for message, used to perform Addr table operation
3097 * for mms.
3098 *
3099 * @param messageId the messageId used to generate Addr {@link Uri} dynamically
3100 * @return the addrUri used to perform Addr table operation for mms
3101 */
3102 @NonNull
3103 public static Uri getAddrUriForMessage(@NonNull String messageId) {
3104 Uri addrUri = Mms.CONTENT_URI.buildUpon()
3105 .appendPath(String.valueOf(messageId)).appendPath("addr").build();
3106 return addrUri;
3107 }
Dan Willemsen4980bf42017-02-14 14:17:12 -08003108 }
3109
3110 /**
3111 * Contains message parts.
Leland Miller6c753552019-01-22 17:28:55 -08003112 *
3113 * To avoid issues where applications might cache a part ID, the ID of a deleted part must
3114 * not be reused to point at a new part.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003115 */
3116 public static final class Part implements BaseColumns {
3117
3118 /**
3119 * Not instantiable.
3120 * @hide
3121 */
3122 private Part() {
3123 }
3124
3125 /**
Nagarajaa15ee4d2019-07-09 14:54:33 +05303126 * The name of part table.
3127 */
3128 private static final String TABLE_PART = "part";
3129
3130 /**
Leland Miller6c753552019-01-22 17:28:55 -08003131 * The {@code content://} style URL for this table. Can be appended with a part ID to
3132 * address individual parts.
3133 */
Leland Miller7a29ca62019-04-15 15:57:28 -07003134 @NonNull
Nagarajaa15ee4d2019-07-09 14:54:33 +05303135 public static final Uri CONTENT_URI = Uri.withAppendedPath(Mms.CONTENT_URI, TABLE_PART);
Leland Miller6c753552019-01-22 17:28:55 -08003136
3137 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08003138 * The identifier of the message which this part belongs to.
3139 * <P>Type: INTEGER</P>
3140 */
3141 public static final String MSG_ID = "mid";
3142
3143 /**
3144 * The order of the part.
3145 * <P>Type: INTEGER</P>
3146 */
3147 public static final String SEQ = "seq";
3148
3149 /**
3150 * The content type of the part.
3151 * <P>Type: TEXT</P>
3152 */
3153 public static final String CONTENT_TYPE = "ct";
3154
3155 /**
3156 * The name of the part.
3157 * <P>Type: TEXT</P>
3158 */
3159 public static final String NAME = "name";
3160
3161 /**
3162 * The charset of the part.
3163 * <P>Type: TEXT</P>
3164 */
3165 public static final String CHARSET = "chset";
3166
3167 /**
3168 * The file name of the part.
3169 * <P>Type: TEXT</P>
3170 */
3171 public static final String FILENAME = "fn";
3172
3173 /**
3174 * The content disposition of the part.
3175 * <P>Type: TEXT</P>
3176 */
3177 public static final String CONTENT_DISPOSITION = "cd";
3178
3179 /**
3180 * The content ID of the part.
3181 * <P>Type: INTEGER</P>
3182 */
3183 public static final String CONTENT_ID = "cid";
3184
3185 /**
3186 * The content location of the part.
3187 * <P>Type: INTEGER</P>
3188 */
3189 public static final String CONTENT_LOCATION = "cl";
3190
3191 /**
3192 * The start of content-type of the message.
3193 * <P>Type: INTEGER</P>
3194 */
3195 public static final String CT_START = "ctt_s";
3196
3197 /**
3198 * The type of content-type of the message.
3199 * <P>Type: TEXT</P>
3200 */
3201 public static final String CT_TYPE = "ctt_t";
3202
3203 /**
3204 * The location (on filesystem) of the binary data of the part.
3205 * <P>Type: INTEGER</P>
3206 */
3207 public static final String _DATA = "_data";
3208
3209 /**
3210 * The message text.
3211 * <P>Type: TEXT</P>
3212 */
3213 public static final String TEXT = "text";
Nagarajaa15ee4d2019-07-09 14:54:33 +05303214
3215 /**
3216 * Generates a Part {@link Uri} for message, used to perform Part table operation
3217 * for mms.
3218 *
3219 * @param messageId the messageId used to generate Part {@link Uri} dynamically
3220 * @return the partUri used to perform Part table operation for mms
3221 */
3222 @NonNull
3223 public static Uri getPartUriForMessage(@NonNull String messageId) {
3224 Uri partUri = Mms.CONTENT_URI.buildUpon()
3225 .appendPath(String.valueOf(messageId)).appendPath(
3226 TABLE_PART).build();
3227 return partUri;
3228 }
Dan Willemsen4980bf42017-02-14 14:17:12 -08003229 }
3230
3231 /**
3232 * Message send rate table.
3233 */
3234 public static final class Rate {
3235
3236 /**
3237 * Not instantiable.
3238 * @hide
3239 */
3240 private Rate() {
3241 }
3242
3243 /**
3244 * The {@code content://} style URL for this table.
3245 */
3246 public static final Uri CONTENT_URI = Uri.withAppendedPath(
3247 Mms.CONTENT_URI, "rate");
3248
3249 /**
3250 * When a message was successfully sent.
3251 * <P>Type: INTEGER (long)</P>
3252 */
3253 public static final String SENT_TIME = "sent_time";
3254 }
3255
3256 /**
3257 * Intents class.
3258 */
3259 public static final class Intents {
3260
3261 /**
3262 * Not instantiable.
3263 * @hide
3264 */
3265 private Intents() {
3266 }
3267
3268 /**
3269 * Indicates that the contents of specified URIs were changed.
3270 * The application which is showing or caching these contents
3271 * should be updated.
3272 */
3273 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
3274 public static final String CONTENT_CHANGED_ACTION
3275 = "android.intent.action.CONTENT_CHANGED";
3276
3277 /**
3278 * An extra field which stores the URI of deleted contents.
3279 */
3280 public static final String DELETED_CONTENTS = "deleted_contents";
3281 }
3282 }
3283
3284 /**
3285 * Contains all MMS and SMS messages.
3286 */
3287 public static final class MmsSms implements BaseColumns {
3288
3289 /**
3290 * Not instantiable.
3291 * @hide
3292 */
3293 private MmsSms() {
3294 }
3295
3296 /**
3297 * The column to distinguish SMS and MMS messages in query results.
3298 */
3299 public static final String TYPE_DISCRIMINATOR_COLUMN =
3300 "transport_type";
3301
3302 /**
3303 * The {@code content://} style URL for this table.
3304 */
3305 public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/");
3306
3307 /**
3308 * The {@code content://} style URL for this table, by conversation.
3309 */
3310 public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse(
3311 "content://mms-sms/conversations");
3312
3313 /**
3314 * The {@code content://} style URL for this table, by phone number.
3315 */
3316 public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse(
3317 "content://mms-sms/messages/byphone");
3318
3319 /**
3320 * The {@code content://} style URL for undelivered messages in this table.
3321 */
3322 public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse(
3323 "content://mms-sms/undelivered");
3324
3325 /**
3326 * The {@code content://} style URL for draft messages in this table.
3327 */
3328 public static final Uri CONTENT_DRAFT_URI = Uri.parse(
3329 "content://mms-sms/draft");
3330
3331 /**
3332 * The {@code content://} style URL for locked messages in this table.
Nagarajaec816a02019-05-22 15:57:59 +05303333 * <P>This {@link Uri} is used to check at most one locked message found in the union of MMS
3334 * and SMS messages. Also this will return only _id column in response.</P>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003335 */
3336 public static final Uri CONTENT_LOCKED_URI = Uri.parse(
3337 "content://mms-sms/locked");
3338
3339 /**
3340 * Pass in a query parameter called "pattern" which is the text to search for.
3341 * The sort order is fixed to be: {@code thread_id ASC, date DESC}.
3342 */
3343 public static final Uri SEARCH_URI = Uri.parse(
3344 "content://mms-sms/search");
3345
3346 // Constants for message protocol types.
3347
3348 /** SMS protocol type. */
3349 public static final int SMS_PROTO = 0;
3350
3351 /** MMS protocol type. */
3352 public static final int MMS_PROTO = 1;
3353
3354 // Constants for error types of pending messages.
3355
3356 /** Error type: no error. */
3357 public static final int NO_ERROR = 0;
3358
3359 /** Error type: generic transient error. */
3360 public static final int ERR_TYPE_GENERIC = 1;
3361
3362 /** Error type: SMS protocol transient error. */
3363 public static final int ERR_TYPE_SMS_PROTO_TRANSIENT = 2;
3364
3365 /** Error type: MMS protocol transient error. */
3366 public static final int ERR_TYPE_MMS_PROTO_TRANSIENT = 3;
3367
3368 /** Error type: transport failure. */
3369 public static final int ERR_TYPE_TRANSPORT_FAILURE = 4;
3370
3371 /** Error type: permanent error (along with all higher error values). */
3372 public static final int ERR_TYPE_GENERIC_PERMANENT = 10;
3373
3374 /** Error type: SMS protocol permanent error. */
3375 public static final int ERR_TYPE_SMS_PROTO_PERMANENT = 11;
3376
3377 /** Error type: MMS protocol permanent error. */
3378 public static final int ERR_TYPE_MMS_PROTO_PERMANENT = 12;
3379
3380 /**
3381 * Contains pending messages info.
3382 */
3383 public static final class PendingMessages implements BaseColumns {
3384
3385 /**
3386 * Not instantiable.
3387 * @hide
3388 */
3389 private PendingMessages() {
3390 }
3391
3392 public static final Uri CONTENT_URI = Uri.withAppendedPath(
3393 MmsSms.CONTENT_URI, "pending");
3394
3395 /**
3396 * The type of transport protocol (MMS or SMS).
3397 * <P>Type: INTEGER</P>
3398 */
3399 public static final String PROTO_TYPE = "proto_type";
3400
3401 /**
3402 * The ID of the message to be sent or downloaded.
3403 * <P>Type: INTEGER (long)</P>
3404 */
3405 public static final String MSG_ID = "msg_id";
3406
3407 /**
3408 * The type of the message to be sent or downloaded.
3409 * This field is only valid for MM. For SM, its value is always set to 0.
3410 * <P>Type: INTEGER</P>
3411 */
3412 public static final String MSG_TYPE = "msg_type";
3413
3414 /**
3415 * The type of the error code.
3416 * <P>Type: INTEGER</P>
3417 */
3418 public static final String ERROR_TYPE = "err_type";
3419
3420 /**
3421 * The error code of sending/retrieving process.
3422 * <P>Type: INTEGER</P>
3423 */
3424 public static final String ERROR_CODE = "err_code";
3425
3426 /**
3427 * How many times we tried to send or download the message.
3428 * <P>Type: INTEGER</P>
3429 */
3430 public static final String RETRY_INDEX = "retry_index";
3431
3432 /**
3433 * The time to do next retry.
3434 * <P>Type: INTEGER (long)</P>
3435 */
3436 public static final String DUE_TIME = "due_time";
3437
3438 /**
3439 * The time we last tried to send or download the message.
3440 * <P>Type: INTEGER (long)</P>
3441 */
3442 public static final String LAST_TRY = "last_try";
3443
3444 /**
3445 * The subscription to which the message belongs to. Its value will be
3446 * < 0 if the sub id cannot be determined.
3447 * <p>Type: INTEGER (long) </p>
3448 */
3449 public static final String SUBSCRIPTION_ID = "pending_sub_id";
3450 }
3451
3452 /**
3453 * Words table used by provider for full-text searches.
3454 * @hide
3455 */
3456 public static final class WordsTable {
3457
3458 /**
3459 * Not instantiable.
3460 * @hide
3461 */
3462 private WordsTable() {}
3463
3464 /**
3465 * Primary key.
3466 * <P>Type: INTEGER (long)</P>
3467 */
3468 public static final String ID = "_id";
3469
3470 /**
3471 * Source row ID.
3472 * <P>Type: INTEGER (long)</P>
3473 */
3474 public static final String SOURCE_ROW_ID = "source_id";
3475
3476 /**
3477 * Table ID (either 1 or 2).
3478 * <P>Type: INTEGER</P>
3479 */
3480 public static final String TABLE_ID = "table_to_use";
3481
3482 /**
3483 * The words to index.
3484 * <P>Type: TEXT</P>
3485 */
3486 public static final String INDEXED_TEXT = "index_text";
3487 }
3488 }
3489
3490 /**
3491 * Carriers class contains information about APNs, including MMSC information.
3492 */
3493 public static final class Carriers implements BaseColumns {
3494
3495 /**
3496 * Not instantiable.
3497 * @hide
3498 */
3499 private Carriers() {}
3500
3501 /**
3502 * The {@code content://} style URL for this table.
calvinpan5e272372018-12-07 20:03:48 +08003503 * For MSIM, this will return APNs for the default subscription
3504 * {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId for MSIM,
3505 * use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003506 */
calvinpanef7b99a2019-04-12 18:48:18 +08003507 @NonNull
Dan Willemsen4980bf42017-02-14 14:17:12 -08003508 public static final Uri CONTENT_URI = Uri.parse("content://telephony/carriers");
3509
3510 /**
calvinpan5e272372018-12-07 20:03:48 +08003511 * The {@code content://} style URL for this table. Used for APN query based on current
3512 * subscription. Instead of specifying carrier matching information in the selection,
3513 * this API will return all matching APNs from current subscription carrier and queries
3514 * will be applied on top of that. If there is no match for MVNO (Mobile Virtual Network
3515 * Operator) APNs, return APNs from its MNO (based on mccmnc) instead. For MSIM, this will
3516 * return APNs for the default subscription
3517 * {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId for MSIM,
3518 * use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id.
3519 */
calvinpanef7b99a2019-04-12 18:48:18 +08003520 @NonNull
calvinpan5e272372018-12-07 20:03:48 +08003521 public static final Uri SIM_APN_URI = Uri.parse(
3522 "content://telephony/carriers/sim_apn_list");
3523
3524 /**
yuemingw4c0065f2018-01-16 19:48:10 +00003525 * The {@code content://} style URL to be called from DevicePolicyManagerService,
3526 * can manage DPC-owned APNs.
3527 * @hide
3528 */
3529 public static final Uri DPC_URI = Uri.parse("content://telephony/carriers/dpc");
3530
3531 /**
3532 * The {@code content://} style URL to be called from Telephony to query APNs.
3533 * When DPC-owned APNs are enforced, only DPC-owned APNs are returned, otherwise only
calvinpan5e272372018-12-07 20:03:48 +08003534 * non-DPC-owned APNs are returned. For MSIM, this will return APNs for the default
3535 * subscription {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId
3536 * for MSIM, use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id.
yuemingw4c0065f2018-01-16 19:48:10 +00003537 * @hide
3538 */
3539 public static final Uri FILTERED_URI = Uri.parse("content://telephony/carriers/filtered");
3540
3541 /**
3542 * The {@code content://} style URL to be called from DevicePolicyManagerService
3543 * or Telephony to manage whether DPC-owned APNs are enforced.
3544 * @hide
3545 */
3546 public static final Uri ENFORCE_MANAGED_URI = Uri.parse(
3547 "content://telephony/carriers/enforce_managed");
3548
3549 /**
3550 * The column name for ENFORCE_MANAGED_URI, indicates whether DPC-owned APNs are enforced.
3551 * @hide
3552 */
3553 public static final String ENFORCE_KEY = "enforced";
3554
3555 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08003556 * The default sort order for this table.
3557 */
3558 public static final String DEFAULT_SORT_ORDER = "name ASC";
3559
3560 /**
3561 * Entry name.
3562 * <P>Type: TEXT</P>
3563 */
3564 public static final String NAME = "name";
3565
3566 /**
3567 * APN name.
3568 * <P>Type: TEXT</P>
3569 */
3570 public static final String APN = "apn";
3571
3572 /**
3573 * Proxy address.
3574 * <P>Type: TEXT</P>
3575 */
3576 public static final String PROXY = "proxy";
3577
3578 /**
3579 * Proxy port.
3580 * <P>Type: TEXT</P>
3581 */
3582 public static final String PORT = "port";
3583
3584 /**
3585 * MMS proxy address.
3586 * <P>Type: TEXT</P>
3587 */
3588 public static final String MMSPROXY = "mmsproxy";
3589
3590 /**
3591 * MMS proxy port.
3592 * <P>Type: TEXT</P>
3593 */
3594 public static final String MMSPORT = "mmsport";
3595
3596 /**
3597 * Server address.
3598 * <P>Type: TEXT</P>
3599 */
3600 public static final String SERVER = "server";
3601
3602 /**
3603 * APN username.
3604 * <P>Type: TEXT</P>
3605 */
3606 public static final String USER = "user";
3607
3608 /**
3609 * APN password.
3610 * <P>Type: TEXT</P>
3611 */
3612 public static final String PASSWORD = "password";
3613
3614 /**
3615 * MMSC URL.
3616 * <P>Type: TEXT</P>
3617 */
3618 public static final String MMSC = "mmsc";
3619
3620 /**
3621 * Mobile Country Code (MCC).
3622 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003623 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3624 * matching APNs based on current subscription carrier, thus no need to specify MCC and
3625 * other carrier matching information. In the future, Android will not support MCC for
3626 * APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003627 */
3628 public static final String MCC = "mcc";
3629
3630 /**
3631 * Mobile Network Code (MNC).
3632 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003633 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3634 * matching APNs based on current subscription carrier, thus no need to specify MNC and
3635 * other carrier matching information. In the future, Android will not support MNC for
3636 * APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003637 */
3638 public static final String MNC = "mnc";
3639
3640 /**
3641 * Numeric operator ID (as String). Usually {@code MCC + MNC}.
3642 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003643 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3644 * matching APNs based on current subscription carrier, thus no need to specify Numeric
3645 * and other carrier matching information. In the future, Android will not support Numeric
3646 * for APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003647 */
3648 public static final String NUMERIC = "numeric";
3649
3650 /**
3651 * Authentication type.
3652 * <P>Type: INTEGER</P>
3653 */
3654 public static final String AUTH_TYPE = "authtype";
3655
3656 /**
3657 * Comma-delimited list of APN types.
3658 * <P>Type: TEXT</P>
3659 */
3660 public static final String TYPE = "type";
3661
3662 /**
3663 * The protocol to use to connect to this APN.
3664 *
3665 * One of the {@code PDP_type} values in TS 27.007 section 10.1.1.
3666 * For example: {@code IP}, {@code IPV6}, {@code IPV4V6}, or {@code PPP}.
3667 * <P>Type: TEXT</P>
3668 */
3669 public static final String PROTOCOL = "protocol";
3670
3671 /**
3672 * The protocol to use to connect to this APN when roaming.
3673 * The syntax is the same as protocol.
3674 * <P>Type: TEXT</P>
3675 */
3676 public static final String ROAMING_PROTOCOL = "roaming_protocol";
3677
3678 /**
3679 * Is this the current APN?
3680 * <P>Type: INTEGER (boolean)</P>
3681 */
3682 public static final String CURRENT = "current";
3683
3684 /**
3685 * Is this APN enabled?
3686 * <P>Type: INTEGER (boolean)</P>
3687 */
3688 public static final String CARRIER_ENABLED = "carrier_enabled";
3689
3690 /**
3691 * Radio Access Technology info.
3692 * To check what values are allowed, refer to {@link android.telephony.ServiceState}.
3693 * This should be spread to other technologies,
3694 * but is currently only used for LTE (14) and eHRPD (13).
3695 * <P>Type: INTEGER</P>
Cassiee1c88022018-02-22 08:51:03 -08003696 * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead
Dan Willemsen4980bf42017-02-14 14:17:12 -08003697 */
Cassied53df962017-12-05 13:34:33 -08003698 @Deprecated
Dan Willemsen4980bf42017-02-14 14:17:12 -08003699 public static final String BEARER = "bearer";
3700
3701 /**
3702 * Radio Access Technology bitmask.
3703 * To check what values can be contained, refer to {@link android.telephony.ServiceState}.
3704 * 0 indicates all techs otherwise first bit refers to RAT/bearer 1, second bit refers to
3705 * RAT/bearer 2 and so on.
3706 * Bitmask for a radio tech R is (1 << (R - 1))
3707 * <P>Type: INTEGER</P>
3708 * @hide
Cassiee1c88022018-02-22 08:51:03 -08003709 * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead
Dan Willemsen4980bf42017-02-14 14:17:12 -08003710 */
Cassied53df962017-12-05 13:34:33 -08003711 @Deprecated
Dan Willemsen4980bf42017-02-14 14:17:12 -08003712 public static final String BEARER_BITMASK = "bearer_bitmask";
3713
3714 /**
Cassied53df962017-12-05 13:34:33 -08003715 * Radio technology (network type) bitmask.
Cassiee1c88022018-02-22 08:51:03 -08003716 * To check what values can be contained, refer to the NETWORK_TYPE_ constants in
Cassied53df962017-12-05 13:34:33 -08003717 * {@link android.telephony.TelephonyManager}.
3718 * Bitmask for a radio tech R is (1 << (R - 1))
3719 * <P>Type: INTEGER</P>
3720 */
3721 public static final String NETWORK_TYPE_BITMASK = "network_type_bitmask";
3722
3723 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08003724 * MVNO type:
3725 * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}.
3726 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003727 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3728 * matching APNs based on current subscription carrier, thus no need to specify MVNO_TYPE
3729 * and other carrier matching information. In the future, Android will not support MVNO_TYPE
3730 * for APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003731 */
3732 public static final String MVNO_TYPE = "mvno_type";
3733
3734 /**
3735 * MVNO data.
3736 * Use the following examples.
3737 * <ul>
3738 * <li>SPN: A MOBILE, BEN NL, ...</li>
3739 * <li>IMSI: 302720x94, 2060188, ...</li>
3740 * <li>GID: 4E, 33, ...</li>
3741 * </ul>
3742 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003743 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3744 * matching APNs based on current subscription carrier, thus no need to specify
3745 * MVNO_MATCH_DATA and other carrier matching information. In the future, Android will not
3746 * support MVNO_MATCH_DATA for APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003747 */
3748 public static final String MVNO_MATCH_DATA = "mvno_match_data";
3749
3750 /**
3751 * The subscription to which the APN belongs to
3752 * <p>Type: INTEGER (long) </p>
3753 */
3754 public static final String SUBSCRIPTION_ID = "sub_id";
3755
3756 /**
chen xu85100482018-10-12 15:30:34 -07003757 * The profile_id to which the APN saved in modem.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003758 * <p>Type: INTEGER</p>
3759 *@hide
3760 */
3761 public static final String PROFILE_ID = "profile_id";
3762
3763 /**
chen xu85100482018-10-12 15:30:34 -07003764 * If set to {@code true}, then the APN setting will persist to the modem.
3765 * <p>Type: INTEGER (boolean)</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003766 *@hide
3767 */
chen xu85100482018-10-12 15:30:34 -07003768 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003769 public static final String MODEM_PERSIST = "modem_cognitive";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003770
3771 /**
chen xu5caa18c2018-11-28 00:21:50 -08003772 * The max number of connections of this APN.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003773 * <p>Type: INTEGER</p>
3774 *@hide
3775 */
chen xu85100482018-10-12 15:30:34 -07003776 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003777 public static final String MAX_CONNECTIONS = "max_conns";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003778
3779 /**
chen xu5caa18c2018-11-28 00:21:50 -08003780 * The wait time for retrying the APN, in milliseconds.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003781 * <p>Type: INTEGER</p>
3782 *@hide
3783 */
chen xu85100482018-10-12 15:30:34 -07003784 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003785 public static final String WAIT_TIME_RETRY = "wait_time";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003786
3787 /**
chen xu5caa18c2018-11-28 00:21:50 -08003788 * The max number of seconds this APN will support its maximum number of connections
3789 * as defined in {@link #MAX_CONNECTIONS}.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003790 * <p>Type: INTEGER</p>
3791 *@hide
3792 */
chen xu85100482018-10-12 15:30:34 -07003793 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003794 public static final String TIME_LIMIT_FOR_MAX_CONNECTIONS = "max_conns_time";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003795
3796 /**
chen xu5caa18c2018-11-28 00:21:50 -08003797 * The MTU (maximum transmit unit) size of the mobile interface to which the APN is
3798 * connected, in bytes.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003799 * <p>Type: INTEGER </p>
3800 * @hide
3801 */
chen xu85100482018-10-12 15:30:34 -07003802 @SystemApi
Dan Willemsen4980bf42017-02-14 14:17:12 -08003803 public static final String MTU = "mtu";
3804
3805 /**
chen xu85100482018-10-12 15:30:34 -07003806 * APN edit status. APN could be added/edited/deleted by a user or carrier.
chen xu5caa18c2018-11-28 00:21:50 -08003807 * see all possible returned APN edit status.
3808 * <ul>
3809 * <li>{@link #UNEDITED}</li>
3810 * <li>{@link #USER_EDITED}</li>
3811 * <li>{@link #USER_DELETED}</li>
3812 * <li>{@link #CARRIER_EDITED}</li>
3813 * <li>{@link #CARRIER_DELETED}</li>
3814 * </ul>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003815 * <p>Type: INTEGER </p>
3816 * @hide
3817 */
chen xu85100482018-10-12 15:30:34 -07003818 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003819 public static final String EDITED_STATUS = "edited";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003820
3821 /**
chen xu85100482018-10-12 15:30:34 -07003822 * {@code true} if this APN visible to the user, {@code false} otherwise.
3823 * <p>Type: INTEGER (boolean)</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003824 * @hide
3825 */
chen xu85100482018-10-12 15:30:34 -07003826 @SystemApi
Dan Willemsen4980bf42017-02-14 14:17:12 -08003827 public static final String USER_VISIBLE = "user_visible";
3828
3829 /**
chen xu85100482018-10-12 15:30:34 -07003830 * {@code true} if the user allowed to edit this APN, {@code false} otherwise.
3831 * <p>Type: INTEGER (boolean)</p>
Amit Mahajand4977942017-07-17 14:46:39 -07003832 * @hide
3833 */
chen xu85100482018-10-12 15:30:34 -07003834 @SystemApi
Amit Mahajand4977942017-07-17 14:46:39 -07003835 public static final String USER_EDITABLE = "user_editable";
3836
3837 /**
chen xu5caa18c2018-11-28 00:21:50 -08003838 * {@link #EDITED_STATUS APN edit status} indicates that this APN has not been edited or
3839 * fails to edit.
chen xu85100482018-10-12 15:30:34 -07003840 * <p>Type: INTEGER </p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003841 * @hide
3842 */
chen xu85100482018-10-12 15:30:34 -07003843 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003844 public static final @EditStatus int UNEDITED = 0;
chen xu85100482018-10-12 15:30:34 -07003845
Dan Willemsen4980bf42017-02-14 14:17:12 -08003846 /**
chen xu5caa18c2018-11-28 00:21:50 -08003847 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by users.
chen xu85100482018-10-12 15:30:34 -07003848 * <p>Type: INTEGER </p>
3849 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003850 */
chen xu85100482018-10-12 15:30:34 -07003851 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003852 public static final @EditStatus int USER_EDITED = 1;
chen xu85100482018-10-12 15:30:34 -07003853
Dan Willemsen4980bf42017-02-14 14:17:12 -08003854 /**
chen xu5caa18c2018-11-28 00:21:50 -08003855 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by users.
chen xu85100482018-10-12 15:30:34 -07003856 * <p>Type: INTEGER </p>
3857 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003858 */
chen xu85100482018-10-12 15:30:34 -07003859 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003860 public static final @EditStatus int USER_DELETED = 2;
chen xu85100482018-10-12 15:30:34 -07003861
Dan Willemsen4980bf42017-02-14 14:17:12 -08003862 /**
chen xu5caa18c2018-11-28 00:21:50 -08003863 * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an
3864 * entry deleted by the user is still present in the new APN database and therefore must
3865 * remain tagged as user deleted rather than completely removed from the database.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003866 * @hide
3867 */
3868 public static final int USER_DELETED_BUT_PRESENT_IN_XML = 3;
chen xu85100482018-10-12 15:30:34 -07003869
Dan Willemsen4980bf42017-02-14 14:17:12 -08003870 /**
chen xu5caa18c2018-11-28 00:21:50 -08003871 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by
3872 * carriers.
chen xu85100482018-10-12 15:30:34 -07003873 * <p>Type: INTEGER </p>
3874 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003875 */
chen xu85100482018-10-12 15:30:34 -07003876 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003877 public static final @EditStatus int CARRIER_EDITED = 4;
chen xu85100482018-10-12 15:30:34 -07003878
Dan Willemsen4980bf42017-02-14 14:17:12 -08003879 /**
chen xu5caa18c2018-11-28 00:21:50 -08003880 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by
3881 * carriers. CARRIER_DELETED values are currently not used as there is no use case.
3882 * If they are used, delete() will have to change accordingly. Currently it is hardcoded to
3883 * USER_DELETED.
chen xu85100482018-10-12 15:30:34 -07003884 * <p>Type: INTEGER </p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003885 * @hide
3886 */
chen xu5caa18c2018-11-28 00:21:50 -08003887 public static final @EditStatus int CARRIER_DELETED = 5;
chen xu85100482018-10-12 15:30:34 -07003888
Dan Willemsen4980bf42017-02-14 14:17:12 -08003889 /**
chen xu5caa18c2018-11-28 00:21:50 -08003890 * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an
3891 * entry deleted by the carrier is still present in the new APN database and therefore must
3892 * remain tagged as user deleted rather than completely removed from the database.
chen xu85100482018-10-12 15:30:34 -07003893 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003894 */
3895 public static final int CARRIER_DELETED_BUT_PRESENT_IN_XML = 6;
yuemingwcf263eb2017-11-08 13:12:18 +00003896
3897 /**
3898 * The owner of the APN.
3899 * <p>Type: INTEGER</p>
3900 * @hide
3901 */
3902 public static final String OWNED_BY = "owned_by";
3903
3904 /**
3905 * Possible value for the OWNED_BY field.
3906 * APN is owned by DPC.
3907 * @hide
3908 */
3909 public static final int OWNED_BY_DPC = 0;
Jordan Liu40617152018-04-06 11:10:12 -07003910
yuemingwcf263eb2017-11-08 13:12:18 +00003911 /**
3912 * Possible value for the OWNED_BY field.
3913 * APN is owned by other sources.
3914 * @hide
3915 */
3916 public static final int OWNED_BY_OTHERS = 1;
Jordan Liu40617152018-04-06 11:10:12 -07003917
3918 /**
3919 * The APN set id. When the user manually selects an APN or the framework sets an APN as
3920 * preferred, all APNs with the same set id as the selected APN should be prioritized over
3921 * APNs in other sets.
chen xu85100482018-10-12 15:30:34 -07003922 * <p>Type: INTEGER</p>
Jordan Liu40617152018-04-06 11:10:12 -07003923 * @hide
3924 */
chen xu85100482018-10-12 15:30:34 -07003925 @SystemApi
Jordan Liu40617152018-04-06 11:10:12 -07003926 public static final String APN_SET_ID = "apn_set_id";
3927
3928 /**
chen xu5caa18c2018-11-28 00:21:50 -08003929 * Possible value for the {@link #APN_SET_ID} field. By default APNs will not belong to a
3930 * set. If the user manually selects an APN without apn set id, there is no need to
3931 * prioritize any specific APN set ids.
chen xu85100482018-10-12 15:30:34 -07003932 * <p>Type: INTEGER</p>
Jordan Liu40617152018-04-06 11:10:12 -07003933 * @hide
3934 */
chen xu85100482018-10-12 15:30:34 -07003935 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003936 public static final int NO_APN_SET_ID = 0;
Jordan Liu40617152018-04-06 11:10:12 -07003937
calvinpanbeb6cb32018-10-19 15:11:22 +08003938 /**
3939 * A unique carrier id associated with this APN
3940 * {@see TelephonyManager#getSimCarrierId()}
3941 * <p>Type: STRING</p>
3942 */
3943 public static final String CARRIER_ID = "carrier_id";
3944
Yuuki Habuaaea4a52019-02-22 11:29:26 +09003945 /**
3946 * The skip 464xlat flag. Flag works as follows.
3947 * {@link #SKIP_464XLAT_DEFAULT}: the APN will skip only APN is IMS and no internet.
3948 * {@link #SKIP_464XLAT_DISABLE}: the APN will NOT skip 464xlat
3949 * {@link #SKIP_464XLAT_ENABLE}: the APN will skip 464xlat
3950 * <p>Type: INTEGER</p>
3951 *
3952 * @hide
3953 */
3954 public static final String SKIP_464XLAT = "skip_464xlat";
3955
3956 /**
3957 * Possible value for the {@link #SKIP_464XLAT} field.
3958 * <p>Type: INTEGER</p>
3959 *
3960 * @hide
3961 */
3962 public static final int SKIP_464XLAT_DEFAULT = -1;
3963
3964 /**
3965 * Possible value for the {@link #SKIP_464XLAT} field.
3966 * <p>Type: INTEGER</p>
3967 *
3968 * @hide
3969 */
3970 public static final int SKIP_464XLAT_DISABLE = 0;
3971
3972 /**
3973 * Possible value for the {@link #SKIP_464XLAT} field.
3974 * <p>Type: INTEGER</p>
3975 *
3976 * @hide
3977 */
3978 public static final int SKIP_464XLAT_ENABLE = 1;
3979
3980
chen xu5caa18c2018-11-28 00:21:50 -08003981 /** @hide */
3982 @IntDef({
3983 UNEDITED,
3984 USER_EDITED,
3985 USER_DELETED,
3986 CARRIER_DELETED,
3987 CARRIER_EDITED,
3988 })
3989 @Retention(RetentionPolicy.SOURCE)
3990 public @interface EditStatus {}
Yuuki Habuaaea4a52019-02-22 11:29:26 +09003991
3992 /** @hide */
3993 @IntDef({
3994 SKIP_464XLAT_DEFAULT,
3995 SKIP_464XLAT_DISABLE,
3996 SKIP_464XLAT_ENABLE,
3997 })
3998 @Retention(RetentionPolicy.SOURCE)
3999 public @interface Skip464XlatStatus {}
4000
Dan Willemsen4980bf42017-02-14 14:17:12 -08004001 }
4002
4003 /**
Chen Xudd0c1c32019-10-21 22:47:27 -07004004 * Contains received cell broadcast messages. More details are available in 3GPP TS 23.041.
Dan Willemsen4980bf42017-02-14 14:17:12 -08004005 * @hide
4006 */
Jordan Liue4141f02019-08-16 14:07:03 -07004007 @SystemApi
Chen Xudd0c1c32019-10-21 22:47:27 -07004008 @TestApi
Dan Willemsen4980bf42017-02-14 14:17:12 -08004009 public static final class CellBroadcasts implements BaseColumns {
4010
4011 /**
4012 * Not instantiable.
4013 * @hide
4014 */
4015 private CellBroadcasts() {}
4016
4017 /**
4018 * The {@code content://} URI for this table.
Chen Xudd0c1c32019-10-21 22:47:27 -07004019 * Only privileged framework components running on phone or network stack uid can
4020 * query or modify this table.
Dan Willemsen4980bf42017-02-14 14:17:12 -08004021 */
Jordan Liue4141f02019-08-16 14:07:03 -07004022 @NonNull
Dan Willemsen4980bf42017-02-14 14:17:12 -08004023 public static final Uri CONTENT_URI = Uri.parse("content://cellbroadcasts");
4024
4025 /**
Chen Xudd0c1c32019-10-21 22:47:27 -07004026 * The {@code content://} URI for query cellbroadcast message history.
4027 * query results include following entries
4028 * <ul>
4029 * <li>{@link #_ID}</li>
4030 * <li>{@link #SLOT_INDEX}</li>
4031 * <li>{@link #GEOGRAPHICAL_SCOPE}</li>
4032 * <li>{@link #PLMN}</li>
4033 * <li>{@link #LAC}</li>
4034 * <li>{@link #CID}</li>
4035 * <li>{@link #SERIAL_NUMBER}</li>
4036 * <li>{@link #SERVICE_CATEGORY}</li>
4037 * <li>{@link #LANGUAGE_CODE}</li>
4038 * <li>{@link #MESSAGE_BODY}</li>
4039 * <li>{@link #DELIVERY_TIME}</li>
4040 * <li>{@link #MESSAGE_READ}</li>
4041 * <li>{@link #MESSAGE_FORMAT}</li>
4042 * <li>{@link #MESSAGE_PRIORITY}</li>
4043 * <li>{@link #ETWS_WARNING_TYPE}</li>
4044 * <li>{@link #CMAS_MESSAGE_CLASS}</li>
4045 * <li>{@link #CMAS_CATEGORY}</li>
4046 * <li>{@link #CMAS_RESPONSE_TYPE}</li>
4047 * <li>{@link #CMAS_SEVERITY}</li>
4048 * <li>{@link #CMAS_URGENCY}</li>
4049 * <li>{@link #CMAS_CERTAINTY}</li>
4050 * </ul>
4051 */
4052 @RequiresPermission(Manifest.permission.READ_CELL_BROADCASTS)
4053 @NonNull
4054 public static final Uri MESSAGE_HISTORY_URI = Uri.parse("content://cellbroadcasts/history");
4055
4056 /**
Chen Xua6379bc2019-10-03 16:48:56 -07004057 * The subscription which received this cell broadcast message.
Pengquan Meng9f677a02019-08-27 11:20:17 -07004058 * <P>Type: INTEGER</P>
Pengquan Meng9f677a02019-08-27 11:20:17 -07004059 */
4060 public static final String SUB_ID = "sub_id";
4061
4062 /**
Chen Xua6379bc2019-10-03 16:48:56 -07004063 * The slot which received this cell broadcast message.
4064 * <P>Type: INTEGER</P>
Chen Xua6379bc2019-10-03 16:48:56 -07004065 */
4066 public static final String SLOT_INDEX = "slot_index";
4067
4068 /**
Jordan Liue4141f02019-08-16 14:07:03 -07004069 * Message geographical scope. Valid values are:
4070 * <ul>
4071 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_CELL_WIDE}. meaning the
4072 * message is for the radio service cell</li>
4073 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_CELL_WIDE_IMMEDIATE},
4074 * meaning the message is for the radio service cell and immediately displayed</li>
4075 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_PLMN_WIDE}, meaning the
4076 * message is for the PLMN (i.e. MCC/MNC)</li>
4077 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_LOCATION_AREA_WIDE},
4078 * meaning the message is for the location area (in GSM) or service area (in UMTS)</li>
4079 * </ul>
4080 *
4081 * <p>A message meant for a particular scope is automatically dismissed when the device
4082 * exits that scope.</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004083 * <P>Type: INTEGER</P>
4084 */
4085 public static final String GEOGRAPHICAL_SCOPE = "geo_scope";
4086
4087 /**
4088 * Message serial number.
Jordan Liue4141f02019-08-16 14:07:03 -07004089 * <p>
4090 * A 16-bit integer which identifies a particular CBS (cell
4091 * broadcast short message service) message. The core network is responsible for
4092 * allocating this value, and the value may be managed cyclically (3GPP TS 23.041 section
4093 * 9.2.1) once the serial message has been incremented a sufficient number of times.
4094 * </p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004095 * <P>Type: INTEGER</P>
4096 */
4097 public static final String SERIAL_NUMBER = "serial_number";
4098
4099 /**
Jordan Liue4141f02019-08-16 14:07:03 -07004100 * PLMN (i.e. MCC/MNC) of broadcast sender. {@code SERIAL_NUMBER + PLMN + LAC + CID}
4101 * uniquely identifies a broadcast for duplicate detection purposes.
Dan Willemsen4980bf42017-02-14 14:17:12 -08004102 * <P>Type: TEXT</P>
4103 */
4104 public static final String PLMN = "plmn";
4105
4106 /**
Jordan Liue4141f02019-08-16 14:07:03 -07004107 * Location area code (LAC).
4108 * <p>Code representing location area (GSM) or service area (UMTS) of broadcast sender.
4109 * Unused for CDMA. Only included if Geographical Scope of message is not PLMN wide (01).
4110 * This value is sent by the network based on the cell tower.
Dan Willemsen4980bf42017-02-14 14:17:12 -08004111 * <P>Type: INTEGER</P>
4112 */
4113 public static final String LAC = "lac";
4114
4115 /**
4116 * Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the
4117 * Geographical Scope of message is cell wide (00 or 11).
4118 * <P>Type: INTEGER</P>
4119 */
4120 public static final String CID = "cid";
4121
4122 /**
4123 * Message code. <em>OBSOLETE: merged into SERIAL_NUMBER.</em>
4124 * <P>Type: INTEGER</P>
Jordan Liue4141f02019-08-16 14:07:03 -07004125 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08004126 */
4127 public static final String V1_MESSAGE_CODE = "message_code";
4128
4129 /**
4130 * Message identifier. <em>OBSOLETE: renamed to SERVICE_CATEGORY.</em>
4131 * <P>Type: INTEGER</P>
Jordan Liue4141f02019-08-16 14:07:03 -07004132 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08004133 */
4134 public static final String V1_MESSAGE_IDENTIFIER = "message_id";
4135
4136 /**
Jordan Liue4141f02019-08-16 14:07:03 -07004137 * Service category which represents the general topic of the message.
4138 * <p>
4139 * For GSM/UMTS: message identifier (see 3GPP TS 23.041 section 9.4.1.2.2)
4140 * For CDMA: a 16-bit CDMA service category (see 3GPP2 C.R1001-D section 9.3)
4141 * </p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004142 * <P>Type: INTEGER</P>
4143 */
4144 public static final String SERVICE_CATEGORY = "service_category";
4145
4146 /**
Jordan Liue4141f02019-08-16 14:07:03 -07004147 * Message language code. (See 3GPP TS 23.041 section 9.4.1.2.3 for details).
Dan Willemsen4980bf42017-02-14 14:17:12 -08004148 * <P>Type: TEXT</P>
4149 */
4150 public static final String LANGUAGE_CODE = "language";
4151
4152 /**
4153 * Message body.
4154 * <P>Type: TEXT</P>
4155 */
4156 public static final String MESSAGE_BODY = "body";
4157
4158 /**
4159 * Message delivery time.
Jordan Liue4141f02019-08-16 14:07:03 -07004160 * <p>This value is a system timestamp using {@link System#currentTimeMillis}</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004161 * <P>Type: INTEGER (long)</P>
4162 */
4163 public static final String DELIVERY_TIME = "date";
4164
4165 /**
4166 * Has the message been viewed?
4167 * <P>Type: INTEGER (boolean)</P>
4168 */
4169 public static final String MESSAGE_READ = "read";
4170
4171 /**
Jordan Liue4141f02019-08-16 14:07:03 -07004172 * Message format ({@link android.telephony.SmsCbMessage#MESSAGE_FORMAT_3GPP} or
4173 * {@link android.telephony.SmsCbMessage#MESSAGE_FORMAT_3GPP2}).
Dan Willemsen4980bf42017-02-14 14:17:12 -08004174 * <P>Type: INTEGER</P>
4175 */
4176 public static final String MESSAGE_FORMAT = "format";
4177
4178 /**
Jordan Liue4141f02019-08-16 14:07:03 -07004179 * Message priority.
4180 * <p>This includes
4181 * <ul>
4182 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_NORMAL}</li>
4183 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_INTERACTIVE}</li>
4184 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_URGENT}</li>
4185 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_EMERGENCY}</li>
4186 * </p>
4187 * </ul>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004188 * <P>Type: INTEGER</P>
4189 */
4190 public static final String MESSAGE_PRIORITY = "priority";
4191
4192 /**
Jordan Liue4141f02019-08-16 14:07:03 -07004193 * ETWS (Earthquake and Tsunami Warning System) warning type (ETWS alerts only).
4194 * <p>See {@link android.telephony.SmsCbEtwsInfo}</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004195 * <P>Type: INTEGER</P>
4196 */
4197 public static final String ETWS_WARNING_TYPE = "etws_warning_type";
4198
4199 /**
Jordan Liue4141f02019-08-16 14:07:03 -07004200 * CMAS (Commercial Mobile Alert System) message class (CMAS alerts only).
4201 * <p>See {@link android.telephony.SmsCbCmasInfo}</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004202 * <P>Type: INTEGER</P>
4203 */
4204 public static final String CMAS_MESSAGE_CLASS = "cmas_message_class";
4205
4206 /**
4207 * CMAS category (CMAS alerts only).
4208 * <P>Type: INTEGER</P>
4209 */
4210 public static final String CMAS_CATEGORY = "cmas_category";
4211
4212 /**
4213 * CMAS response type (CMAS alerts only).
4214 * <P>Type: INTEGER</P>
4215 */
4216 public static final String CMAS_RESPONSE_TYPE = "cmas_response_type";
4217
4218 /**
4219 * CMAS severity (CMAS alerts only).
4220 * <P>Type: INTEGER</P>
4221 */
4222 public static final String CMAS_SEVERITY = "cmas_severity";
4223
4224 /**
4225 * CMAS urgency (CMAS alerts only).
4226 * <P>Type: INTEGER</P>
4227 */
4228 public static final String CMAS_URGENCY = "cmas_urgency";
4229
4230 /**
4231 * CMAS certainty (CMAS alerts only).
4232 * <P>Type: INTEGER</P>
4233 */
4234 public static final String CMAS_CERTAINTY = "cmas_certainty";
4235
4236 /** The default sort order for this table. */
4237 public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC";
4238
4239 /**
Pengquan Mengc3427c02019-08-12 23:09:34 -07004240 * The timestamp in millisecond of when the device received the message.
4241 * <P>Type: BIGINT</P>
Pengquan Meng7032c1e2019-07-18 17:30:04 -07004242 */
4243 public static final String RECEIVED_TIME = "received_time";
4244
4245 /**
4246 * Indicates that whether the message has been broadcasted to the application.
4247 * <P>Type: BOOLEAN</P>
4248 */
4249 public static final String MESSAGE_BROADCASTED = "message_broadcasted";
4250
4251 /**
4252 * The Warning Area Coordinates Elements. This element is used for geo-fencing purpose.
4253 *
4254 * The geometry and its coordinates are separated vertical bar, the first item is the
4255 * geometry type and the remaining items are the parameter of this geometry.
4256 *
4257 * Only circle and polygon are supported. The coordinates are represented in Horizontal
4258 * coordinates format.
4259 *
4260 * Coordinate encoding:
4261 * "latitude, longitude"
4262 * where -90.00000 <= latitude <= 90.00000 and -180.00000 <= longitude <= 180.00000
4263 *
4264 * Polygon encoding:
4265 * "polygon|lat1,lng1|lat2,lng2|...|latn,lngn"
4266 * lat1,lng1 ... latn,lngn are the vertices coordinate of the polygon.
4267 *
4268 * Circle encoding:
4269 * "circle|lat,lng|radius".
4270 * lat,lng is the center of the circle. The unit of circle's radius is meter.
4271 *
4272 * Example:
4273 * "circle|0,0|100" mean a circle which center located at (0,0) and its radius is 100 meter.
4274 * "polygon|0,1.5|0,1|1,1|1,0" mean a polygon has vertices (0,1.5),(0,1),(1,1),(1,0).
4275 *
4276 * There could be more than one geometry store in this field, they are separated by a
4277 * semicolon.
4278 *
4279 * Example:
4280 * "circle|0,0|100;polygon|0,0|0,1.5|1,1|1,0;circle|100.123,100|200.123"
4281 *
4282 * <P>Type: TEXT</P>
4283 */
4284 public static final String GEOMETRIES = "geometries";
4285
4286 /**
Pengquan Meng9f677a02019-08-27 11:20:17 -07004287 * Geo-Fencing Maximum Wait Time in second. The range of the time is [0, 255]. A device
4288 * shall allow to determine its position meeting operator policy. If the device is unable to
4289 * determine its position meeting operator policy within the GeoFencing Maximum Wait Time,
4290 * it shall present the alert to the user and discontinue further positioning determination
4291 * for the alert.
4292 *
4293 * <P>Type: INTEGER</P>
Pengquan Meng9f677a02019-08-27 11:20:17 -07004294 */
4295 public static final String MAXIMUM_WAIT_TIME = "maximum_wait_time";
4296
4297 /**
Chen Xua6379bc2019-10-03 16:48:56 -07004298 * Query columns for instantiating com.android.cellbroadcastreceiver.CellBroadcastMessage.
Jordan Liue4141f02019-08-16 14:07:03 -07004299 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08004300 */
Jordan Liue4141f02019-08-16 14:07:03 -07004301 @NonNull
Dan Willemsen4980bf42017-02-14 14:17:12 -08004302 public static final String[] QUERY_COLUMNS = {
4303 _ID,
4304 GEOGRAPHICAL_SCOPE,
4305 PLMN,
4306 LAC,
4307 CID,
4308 SERIAL_NUMBER,
4309 SERVICE_CATEGORY,
4310 LANGUAGE_CODE,
4311 MESSAGE_BODY,
4312 DELIVERY_TIME,
4313 MESSAGE_READ,
4314 MESSAGE_FORMAT,
4315 MESSAGE_PRIORITY,
4316 ETWS_WARNING_TYPE,
4317 CMAS_MESSAGE_CLASS,
4318 CMAS_CATEGORY,
4319 CMAS_RESPONSE_TYPE,
4320 CMAS_SEVERITY,
4321 CMAS_URGENCY,
4322 CMAS_CERTAINTY
4323 };
Pengquan Mengc3427c02019-08-12 23:09:34 -07004324
4325 /**
4326 * Query columns for instantiating {@link android.telephony.SmsCbMessage} objects.
Jordan Liue4141f02019-08-16 14:07:03 -07004327 * @hide
Pengquan Mengc3427c02019-08-12 23:09:34 -07004328 */
4329 public static final String[] QUERY_COLUMNS_FWK = {
4330 _ID,
Chen Xua6379bc2019-10-03 16:48:56 -07004331 SLOT_INDEX,
Jack Yu29dfebb82019-11-20 23:18:29 -08004332 SUB_ID,
Pengquan Mengc3427c02019-08-12 23:09:34 -07004333 GEOGRAPHICAL_SCOPE,
4334 PLMN,
4335 LAC,
4336 CID,
4337 SERIAL_NUMBER,
4338 SERVICE_CATEGORY,
4339 LANGUAGE_CODE,
4340 MESSAGE_BODY,
4341 MESSAGE_FORMAT,
4342 MESSAGE_PRIORITY,
4343 ETWS_WARNING_TYPE,
4344 CMAS_MESSAGE_CLASS,
4345 CMAS_CATEGORY,
4346 CMAS_RESPONSE_TYPE,
4347 CMAS_SEVERITY,
4348 CMAS_URGENCY,
4349 CMAS_CERTAINTY,
4350 RECEIVED_TIME,
4351 MESSAGE_BROADCASTED,
Pengquan Meng9f677a02019-08-27 11:20:17 -07004352 GEOMETRIES,
4353 MAXIMUM_WAIT_TIME
Pengquan Mengc3427c02019-08-12 23:09:34 -07004354 };
Dan Willemsen4980bf42017-02-14 14:17:12 -08004355 }
Jordan Liub9b75ed2017-02-28 18:15:07 -08004356
4357 /**
4358 * Constants for interfacing with the ServiceStateProvider and the different fields of the
4359 * {@link ServiceState} class accessible through the provider.
4360 */
4361 public static final class ServiceStateTable {
4362
4363 /**
4364 * Not instantiable.
4365 * @hide
4366 */
4367 private ServiceStateTable() {}
4368
4369 /**
4370 * The authority string for the ServiceStateProvider
4371 */
4372 public static final String AUTHORITY = "service-state";
4373
4374 /**
4375 * The {@code content://} style URL for the ServiceStateProvider
4376 */
4377 public static final Uri CONTENT_URI = Uri.parse("content://service-state/");
4378
4379 /**
4380 * Generates a content {@link Uri} used to receive updates on a specific field in the
4381 * ServiceState provider.
4382 * <p>
4383 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
4384 * {@link ServiceState} while your app is running. You can also use a {@link JobService} to
4385 * ensure your app is notified of changes to the {@link Uri} even when it is not running.
4386 * Note, however, that using a {@link JobService} does not guarantee timely delivery of
4387 * updates to the {@link Uri}.
4388 *
Jordan Liu0f332522017-04-19 14:25:29 -07004389 * @param subscriptionId the subscriptionId to receive updates on
Jordan Liub9b75ed2017-02-28 18:15:07 -08004390 * @param field the ServiceState field to receive updates on
4391 * @return the Uri used to observe {@link ServiceState} changes
4392 */
Jordan Liu0f332522017-04-19 14:25:29 -07004393 public static Uri getUriForSubscriptionIdAndField(int subscriptionId, String field) {
4394 return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId))
Jordan Liub9b75ed2017-02-28 18:15:07 -08004395 .appendEncodedPath(field).build();
4396 }
4397
4398 /**
4399 * Generates a content {@link Uri} used to receive updates on every field in the
4400 * ServiceState provider.
4401 * <p>
4402 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
4403 * {@link ServiceState} while your app is running. You can also use a {@link JobService} to
4404 * ensure your app is notified of changes to the {@link Uri} even when it is not running.
4405 * Note, however, that using a {@link JobService} does not guarantee timely delivery of
4406 * updates to the {@link Uri}.
4407 *
Jordan Liu0f332522017-04-19 14:25:29 -07004408 * @param subscriptionId the subscriptionId to receive updates on
Jordan Liub9b75ed2017-02-28 18:15:07 -08004409 * @return the Uri used to observe {@link ServiceState} changes
4410 */
Jordan Liu0f332522017-04-19 14:25:29 -07004411 public static Uri getUriForSubscriptionId(int subscriptionId) {
4412 return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId)).build();
Jordan Liub9b75ed2017-02-28 18:15:07 -08004413 }
4414
4415 /**
4416 * Used to insert a ServiceState into the ServiceStateProvider as a ContentValues instance.
4417 *
4418 * @param state the ServiceState to convert into ContentValues
4419 * @return the convertedContentValues instance
4420 * @hide
4421 */
4422 public static ContentValues getContentValuesForServiceState(ServiceState state) {
4423 ContentValues values = new ContentValues();
Jack Yu2e273b22019-04-02 10:49:35 -07004424 final Parcel p = Parcel.obtain();
4425 state.writeToParcel(p, 0);
4426 // Turn the parcel to byte array. Safe to do this because the content values were never
4427 // written into a persistent storage. ServiceStateProvider keeps values in the memory.
4428 values.put(SERVICE_STATE, p.marshall());
Jordan Liub9b75ed2017-02-28 18:15:07 -08004429 return values;
4430 }
4431
4432 /**
Jack Yu2e273b22019-04-02 10:49:35 -07004433 * The current service state.
4434 *
4435 * This is the entire {@link ServiceState} object in byte array.
4436 *
4437 * @hide
4438 */
4439 public static final String SERVICE_STATE = "service_state";
4440
4441 /**
Jordan Liub9b75ed2017-02-28 18:15:07 -08004442 * An integer value indicating the current voice service state.
4443 * <p>
4444 * Valid values: {@link ServiceState#STATE_IN_SERVICE},
4445 * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY},
4446 * {@link ServiceState#STATE_POWER_OFF}.
4447 * <p>
4448 * This is the same as {@link ServiceState#getState()}.
4449 */
4450 public static final String VOICE_REG_STATE = "voice_reg_state";
4451
4452 /**
4453 * An integer value indicating the current data service state.
4454 * <p>
4455 * Valid values: {@link ServiceState#STATE_IN_SERVICE},
4456 * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY},
4457 * {@link ServiceState#STATE_POWER_OFF}.
4458 * <p>
4459 * This is the same as {@link ServiceState#getDataRegState()}.
4460 * @hide
4461 */
4462 public static final String DATA_REG_STATE = "data_reg_state";
4463
4464 /**
4465 * An integer value indicating the current voice roaming type.
4466 * <p>
4467 * This is the same as {@link ServiceState#getVoiceRoamingType()}.
4468 * @hide
4469 */
4470 public static final String VOICE_ROAMING_TYPE = "voice_roaming_type";
4471
4472 /**
4473 * An integer value indicating the current data roaming type.
4474 * <p>
4475 * This is the same as {@link ServiceState#getDataRoamingType()}.
4476 * @hide
4477 */
4478 public static final String DATA_ROAMING_TYPE = "data_roaming_type";
4479
4480 /**
4481 * The current registered voice network operator name in long alphanumeric format.
4482 * <p>
4483 * This is the same as {@link ServiceState#getVoiceOperatorAlphaLong()}.
4484 * @hide
4485 */
4486 public static final String VOICE_OPERATOR_ALPHA_LONG = "voice_operator_alpha_long";
4487
4488 /**
4489 * The current registered operator name in short alphanumeric format.
4490 * <p>
4491 * In GSM/UMTS, short format can be up to 8 characters long. The current registered voice
4492 * network operator name in long alphanumeric format.
4493 * <p>
4494 * This is the same as {@link ServiceState#getVoiceOperatorAlphaShort()}.
4495 * @hide
4496 */
4497 public static final String VOICE_OPERATOR_ALPHA_SHORT = "voice_operator_alpha_short";
4498
4499
4500 /**
4501 * The current registered operator numeric id.
4502 * <p>
4503 * In GSM/UMTS, numeric format is 3 digit country code plus 2 or 3 digit
4504 * network code.
4505 * <p>
4506 * This is the same as {@link ServiceState#getOperatorNumeric()}.
4507 */
4508 public static final String VOICE_OPERATOR_NUMERIC = "voice_operator_numeric";
4509
4510 /**
4511 * The current registered data network operator name in long alphanumeric format.
4512 * <p>
4513 * This is the same as {@link ServiceState#getDataOperatorAlphaLong()}.
4514 * @hide
4515 */
4516 public static final String DATA_OPERATOR_ALPHA_LONG = "data_operator_alpha_long";
4517
4518 /**
4519 * The current registered data network operator name in short alphanumeric format.
4520 * <p>
4521 * This is the same as {@link ServiceState#getDataOperatorAlphaShort()}.
4522 * @hide
4523 */
4524 public static final String DATA_OPERATOR_ALPHA_SHORT = "data_operator_alpha_short";
4525
4526 /**
4527 * The current registered data network operator numeric id.
4528 * <p>
4529 * This is the same as {@link ServiceState#getDataOperatorNumeric()}.
4530 * @hide
4531 */
4532 public static final String DATA_OPERATOR_NUMERIC = "data_operator_numeric";
4533
4534 /**
4535 * The current network selection mode.
4536 * <p>
4537 * This is the same as {@link ServiceState#getIsManualSelection()}.
4538 */
4539 public static final String IS_MANUAL_NETWORK_SELECTION = "is_manual_network_selection";
4540
4541 /**
4542 * This is the same as {@link ServiceState#getRilVoiceRadioTechnology()}.
4543 * @hide
4544 */
4545 public static final String RIL_VOICE_RADIO_TECHNOLOGY = "ril_voice_radio_technology";
4546
4547 /**
4548 * This is the same as {@link ServiceState#getRilDataRadioTechnology()}.
4549 * @hide
4550 */
4551 public static final String RIL_DATA_RADIO_TECHNOLOGY = "ril_data_radio_technology";
4552
4553 /**
4554 * This is the same as {@link ServiceState#getCssIndicator()}.
4555 * @hide
4556 */
4557 public static final String CSS_INDICATOR = "css_indicator";
4558
4559 /**
Jack Yu2661fac2018-03-15 13:51:05 -07004560 * This is the same as {@link ServiceState#getCdmaNetworkId()}.
Jordan Liub9b75ed2017-02-28 18:15:07 -08004561 * @hide
4562 */
4563 public static final String NETWORK_ID = "network_id";
4564
4565 /**
Jack Yu2661fac2018-03-15 13:51:05 -07004566 * This is the same as {@link ServiceState#getCdmaSystemId()}.
Jordan Liub9b75ed2017-02-28 18:15:07 -08004567 * @hide
4568 */
4569 public static final String SYSTEM_ID = "system_id";
4570
4571 /**
4572 * This is the same as {@link ServiceState#getCdmaRoamingIndicator()}.
4573 * @hide
4574 */
4575 public static final String CDMA_ROAMING_INDICATOR = "cdma_roaming_indicator";
4576
4577 /**
4578 * This is the same as {@link ServiceState#getCdmaDefaultRoamingIndicator()}.
4579 * @hide
4580 */
4581 public static final String CDMA_DEFAULT_ROAMING_INDICATOR =
4582 "cdma_default_roaming_indicator";
4583
4584 /**
4585 * This is the same as {@link ServiceState#getCdmaEriIconIndex()}.
4586 * @hide
4587 */
4588 public static final String CDMA_ERI_ICON_INDEX = "cdma_eri_icon_index";
4589
4590 /**
4591 * This is the same as {@link ServiceState#getCdmaEriIconMode()}.
4592 * @hide
4593 */
4594 public static final String CDMA_ERI_ICON_MODE = "cdma_eri_icon_mode";
4595
4596 /**
4597 * This is the same as {@link ServiceState#isEmergencyOnly()}.
4598 * @hide
4599 */
4600 public static final String IS_EMERGENCY_ONLY = "is_emergency_only";
4601
4602 /**
4603 * This is the same as {@link ServiceState#getDataRoamingFromRegistration()}.
4604 * @hide
4605 */
4606 public static final String IS_DATA_ROAMING_FROM_REGISTRATION =
4607 "is_data_roaming_from_registration";
4608
4609 /**
4610 * This is the same as {@link ServiceState#isUsingCarrierAggregation()}.
4611 * @hide
4612 */
4613 public static final String IS_USING_CARRIER_AGGREGATION = "is_using_carrier_aggregation";
SongFerngWang3cbcf752019-03-21 23:14:20 +08004614
4615 /**
4616 * The current registered raw data network operator name in long alphanumeric format.
4617 * <p>
4618 * This is the same as {@link ServiceState#getOperatorAlphaLongRaw()}.
4619 * @hide
4620 */
4621 public static final String OPERATOR_ALPHA_LONG_RAW = "operator_alpha_long_raw";
4622
4623 /**
4624 * The current registered raw data network operator name in short alphanumeric format.
4625 * <p>
4626 * This is the same as {@link ServiceState#getOperatorAlphaShortRaw()}.
4627 * @hide
4628 */
4629 public static final String OPERATOR_ALPHA_SHORT_RAW = "operator_alpha_short_raw";
Jordan Liub9b75ed2017-02-28 18:15:07 -08004630 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07004631
4632 /**
fionaxu58278be2018-01-29 14:08:12 -08004633 * Contains carrier identification information for the current subscriptions.
fionaxu3d0ad1f2017-10-25 23:09:36 -07004634 */
fionaxu62bc7472018-02-28 11:18:45 -08004635 public static final class CarrierId implements BaseColumns {
fionaxu3d0ad1f2017-10-25 23:09:36 -07004636 /**
fionaxu58278be2018-01-29 14:08:12 -08004637 * Not instantiable.
4638 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07004639 */
fionaxu62bc7472018-02-28 11:18:45 -08004640 private CarrierId() {}
fionaxu3d0ad1f2017-10-25 23:09:36 -07004641
4642 /**
fionaxu58278be2018-01-29 14:08:12 -08004643 * The {@code content://} style URI for this provider.
fionaxu3d0ad1f2017-10-25 23:09:36 -07004644 */
fionaxu62bc7472018-02-28 11:18:45 -08004645 public static final Uri CONTENT_URI = Uri.parse("content://carrier_id");
fionaxu3d0ad1f2017-10-25 23:09:36 -07004646
4647 /**
fionaxu62bc7472018-02-28 11:18:45 -08004648 * The authority string for the CarrierId Provider
fionaxu58278be2018-01-29 14:08:12 -08004649 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07004650 */
fionaxu62bc7472018-02-28 11:18:45 -08004651 public static final String AUTHORITY = "carrier_id";
fionaxu58278be2018-01-29 14:08:12 -08004652
fionaxu3d0ad1f2017-10-25 23:09:36 -07004653
4654 /**
fionaxu58278be2018-01-29 14:08:12 -08004655 * Generates a content {@link Uri} used to receive updates on carrier identity change
4656 * on the given subscriptionId
4657 * <p>
4658 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
fionaxuc8d483e2018-03-07 21:52:05 -08004659 * carrier identity {@link TelephonyManager#getSimCarrierId()}
fionaxu58278be2018-01-29 14:08:12 -08004660 * while your app is running. You can also use a {@link JobService} to ensure your app
4661 * is notified of changes to the {@link Uri} even when it is not running.
4662 * Note, however, that using a {@link JobService} does not guarantee timely delivery of
4663 * updates to the {@link Uri}.
4664 *
4665 * @param subscriptionId the subscriptionId to receive updates on
4666 * @return the Uri used to observe carrier identity changes
fionaxu3d0ad1f2017-10-25 23:09:36 -07004667 */
fionaxu58278be2018-01-29 14:08:12 -08004668 public static Uri getUriForSubscriptionId(int subscriptionId) {
4669 return CONTENT_URI.buildUpon().appendEncodedPath(
4670 String.valueOf(subscriptionId)).build();
4671 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07004672
4673 /**
chen xu45f66212019-03-06 14:43:40 -08004674 * Generates a content {@link Uri} used to receive updates on specific carrier identity
chen xud47a0682018-12-06 15:34:05 -08004675 * change on the given subscriptionId returned by
chen xu45f66212019-03-06 14:43:40 -08004676 * {@link TelephonyManager#getSimSpecificCarrierId()}.
4677 * @see TelephonyManager#ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED
chen xudd44d812018-11-02 17:49:57 -07004678 * <p>
4679 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
chen xu45f66212019-03-06 14:43:40 -08004680 * specific carrier identity {@link TelephonyManager#getSimSpecificCarrierId()}
chen xudd44d812018-11-02 17:49:57 -07004681 * while your app is running. You can also use a {@link JobService} to ensure your app
4682 * is notified of changes to the {@link Uri} even when it is not running.
4683 * Note, however, that using a {@link JobService} does not guarantee timely delivery of
4684 * updates to the {@link Uri}.
4685 *
4686 * @param subscriptionId the subscriptionId to receive updates on
chen xu45f66212019-03-06 14:43:40 -08004687 * @return the Uri used to observe specific carrier identity changes
chen xudd44d812018-11-02 17:49:57 -07004688 */
chen xu81653862019-02-28 10:44:54 -08004689 @NonNull
chen xu45f66212019-03-06 14:43:40 -08004690 public static Uri getSpecificCarrierIdUriForSubscriptionId(int subscriptionId) {
4691 return Uri.withAppendedPath(Uri.withAppendedPath(CONTENT_URI, "specific"),
chen xudd44d812018-11-02 17:49:57 -07004692 String.valueOf(subscriptionId));
4693 }
4694
4695 /**
fionaxu58278be2018-01-29 14:08:12 -08004696 * A user facing carrier name.
fionaxuc8d483e2018-03-07 21:52:05 -08004697 * @see TelephonyManager#getSimCarrierIdName()
fionaxu3d0ad1f2017-10-25 23:09:36 -07004698 * <P>Type: TEXT </P>
4699 */
fionaxu62bc7472018-02-28 11:18:45 -08004700 public static final String CARRIER_NAME = "carrier_name";
fionaxu3d0ad1f2017-10-25 23:09:36 -07004701
4702 /**
4703 * A unique carrier id
fionaxuc8d483e2018-03-07 21:52:05 -08004704 * @see TelephonyManager#getSimCarrierId()
fionaxu3d0ad1f2017-10-25 23:09:36 -07004705 * <P>Type: INTEGER </P>
4706 */
fionaxu62bc7472018-02-28 11:18:45 -08004707 public static final String CARRIER_ID = "carrier_id";
fionaxu3d0ad1f2017-10-25 23:09:36 -07004708
4709 /**
chen xudd44d812018-11-02 17:49:57 -07004710 * A fine-grained carrier id.
chen xu45f66212019-03-06 14:43:40 -08004711 * The specific carrier ID would be used for configuration purposes, but apps wishing to
4712 * know about the carrier itself should use the regular carrier ID returned by
4713 * {@link TelephonyManager#getSimCarrierId()}.
4714 *
4715 * @see TelephonyManager#getSimSpecificCarrierId()
chen xudd44d812018-11-02 17:49:57 -07004716 * This is not a database column, only used to notify content observers for
chen xu45f66212019-03-06 14:43:40 -08004717 * {@link #getSpecificCarrierIdUriForSubscriptionId(int)}
chen xudd44d812018-11-02 17:49:57 -07004718 */
chen xu45f66212019-03-06 14:43:40 -08004719 public static final String SPECIFIC_CARRIER_ID = "specific_carrier_id";
chen xudd44d812018-11-02 17:49:57 -07004720
4721 /**
chen xu45f66212019-03-06 14:43:40 -08004722 * A user facing carrier name for specific carrier id {@link #SPECIFIC_CARRIER_ID}.
4723 * @see TelephonyManager#getSimSpecificCarrierIdName()
chen xud47a0682018-12-06 15:34:05 -08004724 * This is not a database column, only used to notify content observers for
chen xu45f66212019-03-06 14:43:40 -08004725 * {@link #getSpecificCarrierIdUriForSubscriptionId(int)}
chen xud47a0682018-12-06 15:34:05 -08004726 */
chen xu45f66212019-03-06 14:43:40 -08004727 public static final String SPECIFIC_CARRIER_ID_NAME = "specific_carrier_id_name";
chen xud47a0682018-12-06 15:34:05 -08004728
4729 /**
chen xudd44d812018-11-02 17:49:57 -07004730 * A unique parent carrier id. The parent-child
4731 * relationship can be used to further differentiate a single carrier by different networks,
chen xu45f66212019-03-06 14:43:40 -08004732 * by prepaid v.s. postpaid. It's an optional field.
4733 * A carrier id with a valid parent_carrier_id is considered fine-grained specific carrier
4734 * ID, will not be returned as {@link #CARRIER_ID} but {@link #SPECIFIC_CARRIER_ID}.
chen xudd44d812018-11-02 17:49:57 -07004735 * <P>Type: INTEGER </P>
4736 * @hide
4737 */
4738 public static final String PARENT_CARRIER_ID = "parent_carrier_id";
4739
4740 /**
fionaxu58278be2018-01-29 14:08:12 -08004741 * Contains mappings between matching rules with carrier id for all carriers.
4742 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07004743 */
zoey chencb52ec32019-11-01 15:09:11 +08004744 @SystemApi
fionaxu58278be2018-01-29 14:08:12 -08004745 public static final class All implements BaseColumns {
zoey chencb52ec32019-11-01 15:09:11 +08004746
4747 /**
4748 * Not instantiable.
4749 * @hide
4750 */
4751 private All() {
4752 }
4753
fionaxu58278be2018-01-29 14:08:12 -08004754 /**
4755 * Numeric operator ID (as String). {@code MCC + MNC}
4756 * <P>Type: TEXT </P>
4757 */
4758 public static final String MCCMNC = "mccmnc";
4759
4760 /**
4761 * Group id level 1 (as String).
4762 * <P>Type: TEXT </P>
4763 */
4764 public static final String GID1 = "gid1";
4765
4766 /**
4767 * Group id level 2 (as String).
4768 * <P>Type: TEXT </P>
4769 */
4770 public static final String GID2 = "gid2";
4771
4772 /**
4773 * Public Land Mobile Network name.
4774 * <P>Type: TEXT </P>
4775 */
4776 public static final String PLMN = "plmn";
4777
4778 /**
4779 * Prefix xpattern of IMSI (International Mobile Subscriber Identity).
4780 * <P>Type: TEXT </P>
4781 */
4782 public static final String IMSI_PREFIX_XPATTERN = "imsi_prefix_xpattern";
4783
4784 /**
4785 * Service Provider Name.
4786 * <P>Type: TEXT </P>
4787 */
4788 public static final String SPN = "spn";
4789
4790 /**
4791 * Prefer APN name.
4792 * <P>Type: TEXT </P>
4793 */
4794 public static final String APN = "apn";
4795
4796 /**
4797 * Prefix of Integrated Circuit Card Identifier.
4798 * <P>Type: TEXT </P>
4799 */
4800 public static final String ICCID_PREFIX = "iccid_prefix";
4801
4802 /**
fionaxuf9583572018-06-08 16:55:25 -07004803 * Certificate for carrier privilege access rules.
4804 * <P>Type: TEXT in hex string </P>
4805 */
4806 public static final String PRIVILEGE_ACCESS_RULE = "privilege_access_rule";
4807
4808 /**
fionaxu58278be2018-01-29 14:08:12 -08004809 * The {@code content://} URI for this table.
4810 */
zoey chencb52ec32019-11-01 15:09:11 +08004811 @NonNull
fionaxu62bc7472018-02-28 11:18:45 -08004812 public static final Uri CONTENT_URI = Uri.parse("content://carrier_id/all");
fionaxu58278be2018-01-29 14:08:12 -08004813 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07004814 }
Dan Willemsen4980bf42017-02-14 14:17:12 -08004815}