blob: b6f5138a6582b051762f8620a81ae739cbfc046a [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 Xua32c7fc2019-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;
Hall Liu45a351e2019-11-21 16:35:37 -080027import android.compat.annotation.ChangeId;
Artur Satayevdf439592019-12-10 17:47:53 +000028import android.compat.annotation.UnsupportedAppUsage;
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;
Chen Xuad2f91f2019-12-30 00:29:01 -080039import android.os.Bundle;
Peter Wang37916d62019-11-25 16:50:50 -080040import android.telephony.CarrierConfigManager;
Jordan Liub9b75ed2017-02-28 18:15:07 -080041import android.telephony.Rlog;
42import android.telephony.ServiceState;
Dan Willemsen4980bf42017-02-14 14:17:12 -080043import android.telephony.SmsMessage;
44import android.telephony.SubscriptionManager;
fionaxu58278be2018-01-29 14:08:12 -080045import android.telephony.TelephonyManager;
Peter Wang37916d62019-11-25 16:50:50 -080046import android.telephony.UiccAccessRule;
Dan Willemsen4980bf42017-02-14 14:17:12 -080047import android.text.TextUtils;
Dan Willemsen4980bf42017-02-14 14:17:12 -080048import android.util.Patterns;
49
Dan Willemsen4980bf42017-02-14 14:17:12 -080050import com.android.internal.telephony.SmsApplication;
51
chen xu5caa18c2018-11-28 00:21:50 -080052import java.lang.annotation.Retention;
53import java.lang.annotation.RetentionPolicy;
Dan Willemsen4980bf42017-02-14 14:17:12 -080054import java.util.HashSet;
55import java.util.Set;
56import java.util.regex.Matcher;
57import java.util.regex.Pattern;
58
59/**
60 * The Telephony provider contains data related to phone operation, specifically SMS and MMS
Jordan Liub9b75ed2017-02-28 18:15:07 -080061 * messages, access to the APN list, including the MMSC to use, and the service state.
Dan Willemsen4980bf42017-02-14 14:17:12 -080062 *
63 * <p class="note"><strong>Note:</strong> These APIs are not available on all Android-powered
64 * devices. If your app depends on telephony features such as for managing SMS messages, include
65 * a <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}
66 * </a> element in your manifest that declares the {@code "android.hardware.telephony"} hardware
67 * feature. Alternatively, you can check for telephony availability at runtime using either
68 * {@link android.content.pm.PackageManager#hasSystemFeature
69 * hasSystemFeature(PackageManager.FEATURE_TELEPHONY)} or {@link
70 * android.telephony.TelephonyManager#getPhoneType}.</p>
71 *
72 * <h3>Creating an SMS app</h3>
73 *
74 * <p>Only the default SMS app (selected by the user in system settings) is able to write to the
75 * SMS Provider (the tables defined within the {@code Telephony} class) and only the default SMS
76 * app receives the {@link android.provider.Telephony.Sms.Intents#SMS_DELIVER_ACTION} broadcast
77 * when the user receives an SMS or the {@link
78 * android.provider.Telephony.Sms.Intents#WAP_PUSH_DELIVER_ACTION} broadcast when the user
79 * receives an MMS.</p>
80 *
81 * <p>Any app that wants to behave as the user's default SMS app must handle the following intents:
82 * <ul>
83 * <li>In a broadcast receiver, include an intent filter for {@link Sms.Intents#SMS_DELIVER_ACTION}
84 * (<code>"android.provider.Telephony.SMS_DELIVER"</code>). The broadcast receiver must also
85 * require the {@link android.Manifest.permission#BROADCAST_SMS} permission.
86 * <p>This allows your app to directly receive incoming SMS messages.</p></li>
87 * <li>In a broadcast receiver, include an intent filter for {@link
88 * Sms.Intents#WAP_PUSH_DELIVER_ACTION}} ({@code "android.provider.Telephony.WAP_PUSH_DELIVER"})
89 * with the MIME type <code>"application/vnd.wap.mms-message"</code>.
90 * The broadcast receiver must also require the {@link
91 * android.Manifest.permission#BROADCAST_WAP_PUSH} permission.
92 * <p>This allows your app to directly receive incoming MMS messages.</p></li>
93 * <li>In your activity that delivers new messages, include an intent filter for
94 * {@link android.content.Intent#ACTION_SENDTO} (<code>"android.intent.action.SENDTO"
95 * </code>) with schemas, <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and
96 * <code>mmsto:</code>.
97 * <p>This allows your app to receive intents from other apps that want to deliver a
98 * message.</p></li>
99 * <li>In a service, include an intent filter for {@link
100 * android.telephony.TelephonyManager#ACTION_RESPOND_VIA_MESSAGE}
101 * (<code>"android.intent.action.RESPOND_VIA_MESSAGE"</code>) with schemas,
102 * <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and <code>mmsto:</code>.
103 * This service must also require the {@link
104 * android.Manifest.permission#SEND_RESPOND_VIA_MESSAGE} permission.
105 * <p>This allows users to respond to incoming phone calls with an immediate text message
106 * using your app.</p></li>
107 * </ul>
108 *
109 * <p>Other apps that are not selected as the default SMS app can only <em>read</em> the SMS
110 * Provider, but may also be notified when a new SMS arrives by listening for the {@link
111 * Sms.Intents#SMS_RECEIVED_ACTION}
112 * broadcast, which is a non-abortable broadcast that may be delivered to multiple apps. This
113 * broadcast is intended for apps that&mdash;while not selected as the default SMS app&mdash;need to
114 * read special incoming messages such as to perform phone number verification.</p>
115 *
116 * <p>For more information about building SMS apps, read the blog post, <a
117 * href="http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html"
118 * >Getting Your SMS Apps Ready for KitKat</a>.</p>
119 *
120 */
121public final class Telephony {
122 private static final String TAG = "Telephony";
123
124 /**
125 * Not instantiable.
126 * @hide
127 */
128 private Telephony() {
129 }
130
131 /**
132 * Base columns for tables that contain text-based SMSs.
133 */
134 public interface TextBasedSmsColumns {
135
136 /** Message type: all messages. */
137 public static final int MESSAGE_TYPE_ALL = 0;
138
139 /** Message type: inbox. */
140 public static final int MESSAGE_TYPE_INBOX = 1;
141
142 /** Message type: sent messages. */
143 public static final int MESSAGE_TYPE_SENT = 2;
144
145 /** Message type: drafts. */
146 public static final int MESSAGE_TYPE_DRAFT = 3;
147
148 /** Message type: outbox. */
149 public static final int MESSAGE_TYPE_OUTBOX = 4;
150
151 /** Message type: failed outgoing message. */
152 public static final int MESSAGE_TYPE_FAILED = 5;
153
154 /** Message type: queued to send later. */
155 public static final int MESSAGE_TYPE_QUEUED = 6;
156
157 /**
158 * The type of message.
159 * <P>Type: INTEGER</P>
160 */
161 public static final String TYPE = "type";
162
163 /**
164 * The thread ID of the message.
165 * <P>Type: INTEGER</P>
166 */
167 public static final String THREAD_ID = "thread_id";
168
169 /**
170 * The address of the other party.
171 * <P>Type: TEXT</P>
172 */
173 public static final String ADDRESS = "address";
174
175 /**
176 * The date the message was received.
177 * <P>Type: INTEGER (long)</P>
178 */
179 public static final String DATE = "date";
180
181 /**
182 * The date the message was sent.
183 * <P>Type: INTEGER (long)</P>
184 */
185 public static final String DATE_SENT = "date_sent";
186
187 /**
188 * Has the message been read?
189 * <P>Type: INTEGER (boolean)</P>
190 */
191 public static final String READ = "read";
192
193 /**
194 * Has the message been seen by the user? The "seen" flag determines
195 * whether we need to show a notification.
196 * <P>Type: INTEGER (boolean)</P>
197 */
198 public static final String SEEN = "seen";
199
200 /**
201 * {@code TP-Status} value for the message, or -1 if no status has been received.
202 * <P>Type: INTEGER</P>
203 */
204 public static final String STATUS = "status";
205
206 /** TP-Status: no status received. */
207 public static final int STATUS_NONE = -1;
208 /** TP-Status: complete. */
209 public static final int STATUS_COMPLETE = 0;
210 /** TP-Status: pending. */
211 public static final int STATUS_PENDING = 32;
212 /** TP-Status: failed. */
213 public static final int STATUS_FAILED = 64;
214
215 /**
216 * The subject of the message, if present.
217 * <P>Type: TEXT</P>
218 */
219 public static final String SUBJECT = "subject";
220
221 /**
222 * The body of the message.
223 * <P>Type: TEXT</P>
224 */
225 public static final String BODY = "body";
226
227 /**
228 * The ID of the sender of the conversation, if present.
229 * <P>Type: INTEGER (reference to item in {@code content://contacts/people})</P>
230 */
231 public static final String PERSON = "person";
232
233 /**
234 * The protocol identifier code.
235 * <P>Type: INTEGER</P>
236 */
237 public static final String PROTOCOL = "protocol";
238
239 /**
240 * Is the {@code TP-Reply-Path} flag set?
241 * <P>Type: BOOLEAN</P>
242 */
243 public static final String REPLY_PATH_PRESENT = "reply_path_present";
244
245 /**
246 * The service center (SC) through which to send the message, if present.
247 * <P>Type: TEXT</P>
248 */
249 public static final String SERVICE_CENTER = "service_center";
250
251 /**
252 * Is the message locked?
253 * <P>Type: INTEGER (boolean)</P>
254 */
255 public static final String LOCKED = "locked";
256
257 /**
258 * The subscription to which the message belongs to. Its value will be
259 * < 0 if the sub id cannot be determined.
260 * <p>Type: INTEGER (long) </p>
261 */
262 public static final String SUBSCRIPTION_ID = "sub_id";
263
264 /**
265 * The MTU size of the mobile interface to which the APN connected
266 * @hide
267 */
268 public static final String MTU = "mtu";
269
270 /**
271 * Error code associated with sending or receiving this message
272 * <P>Type: INTEGER</P>
273 */
274 public static final String ERROR_CODE = "error_code";
275
276 /**
277 * The identity of the sender of a sent message. It is
278 * usually the package name of the app which sends the message.
279 * <p class="note"><strong>Note:</strong>
280 * This column is read-only. It is set by the provider and can not be changed by apps.
281 * <p>Type: TEXT</p>
282 */
283 public static final String CREATOR = "creator";
284 }
285
286 /**
Vasu Nori84db0f52018-02-14 15:14:32 -0800287 * Columns in sms_changes table.
288 * @hide
289 */
290 public interface TextBasedSmsChangesColumns {
291 /**
292 * The {@code content://} style URL for this table.
293 * @hide
294 */
295 public static final Uri CONTENT_URI = Uri.parse("content://sms-changes");
296
297 /**
298 * Primary key.
299 * <P>Type: INTEGER (long)</P>
300 * @hide
301 */
302 public static final String ID = "_id";
303
304 /**
305 * Triggers on sms table create a row in this table for each update/delete.
306 * This column is the "_id" of the row from sms table that was updated/deleted.
307 * <P>Type: INTEGER (long)</P>
308 * @hide
309 */
310 public static final String ORIG_ROW_ID = "orig_rowid";
311
312 /**
313 * Triggers on sms table create a row in this table for each update/delete.
314 * This column is the "sub_id" of the row from sms table that was updated/deleted.
315 * @hide
316 * <P>Type: INTEGER (long)</P>
317 */
318 public static final String SUB_ID = "sub_id";
319
320 /**
321 * The type of operation that created this row.
322 * {@link #TYPE_UPDATE} = update op
323 * {@link #TYPE_DELETE} = delete op
324 * @hide
325 * <P>Type: INTEGER (long)</P>
326 */
327 public static final String TYPE = "type";
328
329 /**
330 * One of the possible values for the above column "type". Indicates it is an update op.
331 * @hide
332 */
333 public static final int TYPE_UPDATE = 0;
334
335 /**
336 * One of the possible values for the above column "type". Indicates it is a delete op.
337 * @hide
338 */
339 public static final int TYPE_DELETE = 1;
340
341 /**
342 * This column contains a non-null value only if the operation on sms table is an update op
343 * and the column "read" is changed by the update op.
344 * <P>Type: INTEGER (boolean)</P>
345 * @hide
346 */
347 public static final String NEW_READ_STATUS = "new_read_status";
348 }
349
350 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -0800351 * Contains all text-based SMS messages.
352 */
353 public static final class Sms implements BaseColumns, TextBasedSmsColumns {
354
355 /**
356 * Not instantiable.
357 * @hide
358 */
359 private Sms() {
360 }
361
362 /**
363 * Used to determine the currently configured default SMS package.
364 * @param context context of the requesting application
365 * @return package name for the default SMS package or null
366 */
367 public static String getDefaultSmsPackage(Context context) {
368 ComponentName component = SmsApplication.getDefaultSmsApplication(context, false);
369 if (component != null) {
370 return component.getPackageName();
371 }
372 return null;
373 }
374
375 /**
376 * Return cursor for table query.
377 * @hide
378 */
379 public static Cursor query(ContentResolver cr, String[] projection) {
380 return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER);
381 }
382
383 /**
384 * Return cursor for table query.
385 * @hide
386 */
Mathew Inwood8c854f82018-09-14 12:35:36 +0100387 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Dan Willemsen4980bf42017-02-14 14:17:12 -0800388 public static Cursor query(ContentResolver cr, String[] projection,
389 String where, String orderBy) {
390 return cr.query(CONTENT_URI, projection, where,
391 null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
392 }
393
394 /**
395 * The {@code content://} style URL for this table.
396 */
397 public static final Uri CONTENT_URI = Uri.parse("content://sms");
398
399 /**
400 * The default sort order for this table.
401 */
402 public static final String DEFAULT_SORT_ORDER = "date DESC";
403
404 /**
405 * Add an SMS to the given URI.
406 *
407 * @param resolver the content resolver to use
408 * @param uri the URI to add the message to
409 * @param address the address of the sender
410 * @param body the body of the message
411 * @param subject the pseudo-subject of the message
412 * @param date the timestamp for the message
413 * @param read true if the message has been read, false if not
414 * @param deliveryReport true if a delivery report was requested, false if not
415 * @return the URI for the new message
416 * @hide
417 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100418 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800419 public static Uri addMessageToUri(ContentResolver resolver,
420 Uri uri, String address, String body, String subject,
421 Long date, boolean read, boolean deliveryReport) {
422 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
423 resolver, uri, address, body, subject, date, read, deliveryReport, -1L);
424 }
425
426 /**
427 * Add an SMS to the given URI.
428 *
429 * @param resolver the content resolver to use
430 * @param uri the URI to add the message to
431 * @param address the address of the sender
432 * @param body the body of the message
433 * @param subject the psuedo-subject of the message
434 * @param date the timestamp for the message
435 * @param read true if the message has been read, false if not
436 * @param deliveryReport true if a delivery report was requested, false if not
437 * @param subId the subscription which the message belongs to
438 * @return the URI for the new message
439 * @hide
440 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100441 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800442 public static Uri addMessageToUri(int subId, ContentResolver resolver,
443 Uri uri, String address, String body, String subject,
444 Long date, boolean read, boolean deliveryReport) {
445 return addMessageToUri(subId, resolver, uri, address, body, subject,
446 date, read, deliveryReport, -1L);
447 }
448
449 /**
450 * Add an SMS to the given URI with the specified thread ID.
451 *
452 * @param resolver the content resolver to use
453 * @param uri the URI to add the message to
454 * @param address the address of the sender
455 * @param body the body of the message
456 * @param subject the pseudo-subject of the message
457 * @param date the timestamp for the message
458 * @param read true if the message has been read, false if not
459 * @param deliveryReport true if a delivery report was requested, false if not
460 * @param threadId the thread_id of the message
461 * @return the URI for the new message
462 * @hide
463 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100464 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800465 public static Uri addMessageToUri(ContentResolver resolver,
466 Uri uri, String address, String body, String subject,
467 Long date, boolean read, boolean deliveryReport, long threadId) {
468 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
469 resolver, uri, address, body, subject,
470 date, read, deliveryReport, threadId);
471 }
472
473 /**
474 * Add an SMS to the given URI with thread_id specified.
475 *
476 * @param resolver the content resolver to use
477 * @param uri the URI to add the message to
478 * @param address the address of the sender
479 * @param body the body of the message
480 * @param subject the psuedo-subject of the message
481 * @param date the timestamp for the message
482 * @param read true if the message has been read, false if not
483 * @param deliveryReport true if a delivery report was requested, false if not
484 * @param threadId the thread_id of the message
485 * @param subId the subscription which the message belongs to
486 * @return the URI for the new message
487 * @hide
488 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100489 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800490 public static Uri addMessageToUri(int subId, ContentResolver resolver,
491 Uri uri, String address, String body, String subject,
492 Long date, boolean read, boolean deliveryReport, long threadId) {
493 ContentValues values = new ContentValues(8);
494 Rlog.v(TAG,"Telephony addMessageToUri sub id: " + subId);
495
496 values.put(SUBSCRIPTION_ID, subId);
497 values.put(ADDRESS, address);
498 if (date != null) {
499 values.put(DATE, date);
500 }
501 values.put(READ, read ? Integer.valueOf(1) : Integer.valueOf(0));
502 values.put(SUBJECT, subject);
503 values.put(BODY, body);
504 if (deliveryReport) {
505 values.put(STATUS, STATUS_PENDING);
506 }
507 if (threadId != -1L) {
508 values.put(THREAD_ID, threadId);
509 }
510 return resolver.insert(uri, values);
511 }
512
513 /**
514 * Move a message to the given folder.
515 *
516 * @param context the context to use
517 * @param uri the message to move
518 * @param folder the folder to move to
519 * @return true if the operation succeeded
520 * @hide
521 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100522 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800523 public static boolean moveMessageToFolder(Context context,
524 Uri uri, int folder, int error) {
525 if (uri == null) {
526 return false;
527 }
528
529 boolean markAsUnread = false;
530 boolean markAsRead = false;
531 switch(folder) {
532 case MESSAGE_TYPE_INBOX:
533 case MESSAGE_TYPE_DRAFT:
534 break;
535 case MESSAGE_TYPE_OUTBOX:
536 case MESSAGE_TYPE_SENT:
537 markAsRead = true;
538 break;
539 case MESSAGE_TYPE_FAILED:
540 case MESSAGE_TYPE_QUEUED:
541 markAsUnread = true;
542 break;
543 default:
544 return false;
545 }
546
547 ContentValues values = new ContentValues(3);
548
549 values.put(TYPE, folder);
550 if (markAsUnread) {
551 values.put(READ, 0);
552 } else if (markAsRead) {
553 values.put(READ, 1);
554 }
555 values.put(ERROR_CODE, error);
556
557 return 1 == SqliteWrapper.update(context, context.getContentResolver(),
558 uri, values, null, null);
559 }
560
561 /**
562 * Returns true iff the folder (message type) identifies an
563 * outgoing message.
564 * @hide
565 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100566 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800567 public static boolean isOutgoingFolder(int messageType) {
568 return (messageType == MESSAGE_TYPE_FAILED)
569 || (messageType == MESSAGE_TYPE_OUTBOX)
570 || (messageType == MESSAGE_TYPE_SENT)
571 || (messageType == MESSAGE_TYPE_QUEUED);
572 }
573
574 /**
575 * Contains all text-based SMS messages in the SMS app inbox.
576 */
577 public static final class Inbox implements BaseColumns, TextBasedSmsColumns {
578
579 /**
580 * Not instantiable.
581 * @hide
582 */
583 private Inbox() {
584 }
585
586 /**
587 * The {@code content://} style URL for this table.
588 */
589 public static final Uri CONTENT_URI = Uri.parse("content://sms/inbox");
590
591 /**
592 * The default sort order for this table.
593 */
594 public static final String DEFAULT_SORT_ORDER = "date DESC";
595
596 /**
597 * Add an SMS to the Draft box.
598 *
599 * @param resolver the content resolver to use
600 * @param address the address of the sender
601 * @param body the body of the message
602 * @param subject the pseudo-subject of the message
603 * @param date the timestamp for the message
604 * @param read true if the message has been read, false if not
605 * @return the URI for the new message
606 * @hide
607 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100608 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800609 public static Uri addMessage(ContentResolver resolver,
610 String address, String body, String subject, Long date,
611 boolean read) {
612 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
613 resolver, CONTENT_URI, address, body, subject, date, read, false);
614 }
615
616 /**
617 * Add an SMS to the Draft box.
618 *
619 * @param resolver the content resolver to use
620 * @param address the address of the sender
621 * @param body the body of the message
622 * @param subject the psuedo-subject of the message
623 * @param date the timestamp for the message
624 * @param read true if the message has been read, false if not
625 * @param subId the subscription which the message belongs to
626 * @return the URI for the new message
627 * @hide
628 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100629 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800630 public static Uri addMessage(int subId, ContentResolver resolver,
631 String address, String body, String subject, Long date, boolean read) {
632 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
633 subject, date, read, false);
634 }
635 }
636
637 /**
638 * Contains all sent text-based SMS messages in the SMS app.
639 */
640 public static final class Sent implements BaseColumns, TextBasedSmsColumns {
641
642 /**
643 * Not instantiable.
644 * @hide
645 */
646 private Sent() {
647 }
648
649 /**
650 * The {@code content://} style URL for this table.
651 */
652 public static final Uri CONTENT_URI = Uri.parse("content://sms/sent");
653
654 /**
655 * The default sort order for this table.
656 */
657 public static final String DEFAULT_SORT_ORDER = "date DESC";
658
659 /**
660 * Add an SMS to the Draft box.
661 *
662 * @param resolver the content resolver to use
663 * @param address the address of the sender
664 * @param body the body of the message
665 * @param subject the pseudo-subject of the message
666 * @param date the timestamp for the message
667 * @return the URI for the new message
668 * @hide
669 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100670 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800671 public static Uri addMessage(ContentResolver resolver,
672 String address, String body, String subject, Long date) {
673 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
674 resolver, CONTENT_URI, address, body, subject, date, true, false);
675 }
676
677 /**
678 * Add an SMS to the Draft box.
679 *
680 * @param resolver the content resolver to use
681 * @param address the address of the sender
682 * @param body the body of the message
683 * @param subject the psuedo-subject of the message
684 * @param date the timestamp for the message
685 * @param subId the subscription which the message belongs to
686 * @return the URI for the new message
687 * @hide
688 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100689 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800690 public static Uri addMessage(int subId, ContentResolver resolver,
691 String address, String body, String subject, Long date) {
692 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
693 subject, date, true, false);
694 }
695 }
696
697 /**
Leland Miller86272562019-08-08 10:16:31 -0700698 * Contains all draft text-based SMS messages in the SMS app.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800699 */
700 public static final class Draft implements BaseColumns, TextBasedSmsColumns {
701
702 /**
703 * Not instantiable.
704 * @hide
705 */
706 private Draft() {
707 }
708
709 /**
710 * The {@code content://} style URL for this table.
711 */
712 public static final Uri CONTENT_URI = Uri.parse("content://sms/draft");
713
714 /**
715 * @hide
716 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100717 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800718 public static Uri addMessage(ContentResolver resolver,
719 String address, String body, String subject, Long date) {
720 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
721 resolver, CONTENT_URI, address, body, subject, date, true, false);
722 }
723
724 /**
725 * Add an SMS to the Draft box.
726 *
727 * @param resolver the content resolver to use
728 * @param address the address of the sender
729 * @param body the body of the message
730 * @param subject the psuedo-subject of the message
731 * @param date the timestamp for the message
732 * @param subId the subscription which the message belongs to
733 * @return the URI for the new message
734 * @hide
735 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100736 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800737 public static Uri addMessage(int subId, ContentResolver resolver,
738 String address, String body, String subject, Long date) {
739 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
740 subject, date, true, false);
741 }
742
743 /**
744 * The default sort order for this table.
745 */
746 public static final String DEFAULT_SORT_ORDER = "date DESC";
747 }
748
749 /**
750 * Contains all pending outgoing text-based SMS messages.
751 */
752 public static final class Outbox implements BaseColumns, TextBasedSmsColumns {
753
754 /**
755 * Not instantiable.
756 * @hide
757 */
758 private Outbox() {
759 }
760
761 /**
762 * The {@code content://} style URL for this table.
763 */
764 public static final Uri CONTENT_URI = Uri.parse("content://sms/outbox");
765
766 /**
767 * The default sort order for this table.
768 */
769 public static final String DEFAULT_SORT_ORDER = "date DESC";
770
771 /**
772 * Add an SMS to the outbox.
773 *
774 * @param resolver the content resolver to use
775 * @param address the address of the sender
776 * @param body the body of the message
777 * @param subject the pseudo-subject of the message
778 * @param date the timestamp for the message
779 * @param deliveryReport whether a delivery report was requested for the message
780 * @return the URI for the new message
781 * @hide
782 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +0100783 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -0800784 public static Uri addMessage(ContentResolver resolver,
785 String address, String body, String subject, Long date,
786 boolean deliveryReport, long threadId) {
787 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(),
788 resolver, CONTENT_URI, address, body, subject, date,
789 true, deliveryReport, threadId);
790 }
791
792 /**
793 * Add an SMS to the Out box.
794 *
795 * @param resolver the content resolver to use
796 * @param address the address of the sender
797 * @param body the body of the message
798 * @param subject the psuedo-subject of the message
799 * @param date the timestamp for the message
800 * @param deliveryReport whether a delivery report was requested for the message
801 * @param subId the subscription which the message belongs to
802 * @return the URI for the new message
803 * @hide
804 */
805 public static Uri addMessage(int subId, ContentResolver resolver,
806 String address, String body, String subject, Long date,
807 boolean deliveryReport, long threadId) {
808 return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
809 subject, date, true, deliveryReport, threadId);
810 }
811 }
812
813 /**
Leland Miller86272562019-08-08 10:16:31 -0700814 * Contains a view of SMS conversations (also referred to as threads). This is similar to
815 * {@link Threads}, but only includes SMS messages and columns relevant to SMS
816 * conversations.
817 * <p>
818 * Note that this view ignores any information about MMS messages, it is a
819 * view of conversations as if MMS messages did not exist at all. This means that all
820 * relevant information, such as snippets and message count, will ignore any MMS messages
821 * that might be in the same thread through other views and present only data based on the
822 * SMS messages in that thread.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800823 */
824 public static final class Conversations
825 implements BaseColumns, TextBasedSmsColumns {
826
827 /**
828 * Not instantiable.
829 * @hide
830 */
831 private Conversations() {
832 }
833
834 /**
835 * The {@code content://} style URL for this table.
836 */
837 public static final Uri CONTENT_URI = Uri.parse("content://sms/conversations");
838
839 /**
840 * The default sort order for this table.
841 */
842 public static final String DEFAULT_SORT_ORDER = "date DESC";
843
844 /**
Gowroji Sunil37ffaec2019-04-24 12:16:13 +0530845 * The first 45 characters of the body of the most recent message.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800846 * <P>Type: TEXT</P>
847 */
848 public static final String SNIPPET = "snippet";
849
850 /**
851 * The number of messages in the conversation.
852 * <P>Type: INTEGER</P>
853 */
854 public static final String MESSAGE_COUNT = "msg_count";
855 }
856
857 /**
858 * Contains constants for SMS related Intents that are broadcast.
859 */
860 public static final class Intents {
861
862 /**
863 * Not instantiable.
864 * @hide
865 */
866 private Intents() {
867 }
868
869 /**
870 * Set by BroadcastReceiver to indicate that the message was handled
871 * successfully.
872 */
873 public static final int RESULT_SMS_HANDLED = 1;
874
875 /**
876 * Set by BroadcastReceiver to indicate a generic error while
877 * processing the message.
878 */
879 public static final int RESULT_SMS_GENERIC_ERROR = 2;
880
881 /**
Tom Taylorccc1c3e2019-10-30 10:08:50 -0700882 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate
883 * insufficient memory to store the message.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800884 */
885 public static final int RESULT_SMS_OUT_OF_MEMORY = 3;
886
887 /**
Tom Taylorccc1c3e2019-10-30 10:08:50 -0700888 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate that
889 * the message, while possibly valid, is of a format or encoding that is not supported.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800890 */
891 public static final int RESULT_SMS_UNSUPPORTED = 4;
892
893 /**
Tom Taylorccc1c3e2019-10-30 10:08:50 -0700894 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a
895 * duplicate incoming message.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800896 */
897 public static final int RESULT_SMS_DUPLICATED = 5;
898
899 /**
Tom Taylorccc1c3e2019-10-30 10:08:50 -0700900 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a
901 * dispatch failure.
902 */
903 public static final int RESULT_SMS_DISPATCH_FAILURE = 6;
904
905 /**
906 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a null
907 * PDU was received.
908 */
909 public static final int RESULT_SMS_NULL_PDU = 7;
910
911 /**
912 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a null
913 * message was encountered.
914 */
915 public static final int RESULT_SMS_NULL_MESSAGE = 8;
916
917 /**
918 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate an sms
919 * was received while the phone was in encrypted state.
920 */
921 public static final int RESULT_SMS_RECEIVED_WHILE_ENCRYPTED = 9;
922
923 /**
924 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a
925 * telephony database error.
926 */
927 public static final int RESULT_SMS_DATABASE_ERROR = 10;
928
929 /**
930 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate an
931 * invalid uri.
932 */
933 public static final int RESULT_SMS_INVALID_URI = 11;
934
935 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -0800936 * Activity action: Ask the user to change the default
937 * SMS application. This will show a dialog that asks the
938 * user whether they want to replace the current default
939 * SMS application with the one specified in
940 * {@link #EXTRA_PACKAGE_NAME}.
Hai Zhang929085f2019-05-03 15:31:43 +0800941 * <p>
942 * This is no longer supported since Q, please use
943 * {@link android.app.role.RoleManager#createRequestRoleIntent(String)} with
944 * {@link android.app.role.RoleManager#ROLE_SMS} instead.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800945 */
946 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
947 public static final String ACTION_CHANGE_DEFAULT =
948 "android.provider.Telephony.ACTION_CHANGE_DEFAULT";
949
950 /**
951 * The PackageName string passed in as an
952 * extra for {@link #ACTION_CHANGE_DEFAULT}
953 *
954 * @see #ACTION_CHANGE_DEFAULT
Hai Zhang929085f2019-05-03 15:31:43 +0800955 * <p>
956 * This is no longer supported since Q, please use
957 * {@link android.app.role.RoleManager#createRequestRoleIntent(String)} with
958 * {@link android.app.role.RoleManager#ROLE_SMS} instead.
Dan Willemsen4980bf42017-02-14 14:17:12 -0800959 */
960 public static final String EXTRA_PACKAGE_NAME = "package";
961
962 /**
963 * Broadcast Action: A new text-based SMS message has been received
964 * by the device. This intent will only be delivered to the default
965 * sms app. That app is responsible for writing the message and notifying
966 * the user. The intent will have the following extra values:</p>
967 *
968 * <ul>
969 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
970 * that make up the message.</li>
971 * <li><em>"format"</em> - A String describing the format of the PDUs. It can
972 * be either "3gpp" or "3gpp2".</li>
973 * <li><em>"subscription"</em> - An optional long value of the subscription id which
974 * received the message.</li>
975 * <li><em>"slot"</em> - An optional int value of the SIM slot containing the
976 * subscription.</li>
977 * <li><em>"phone"</em> - An optional int value of the phone id associated with the
978 * subscription.</li>
979 * <li><em>"errorCode"</em> - An optional int error code associated with receiving
980 * the message.</li>
981 * </ul>
982 *
983 * <p>The extra values can be extracted using
984 * {@link #getMessagesFromIntent(Intent)}.</p>
985 *
986 * <p>If a BroadcastReceiver encounters an error while processing
987 * this intent it should set the result code appropriately.</p>
988 *
989 * <p class="note"><strong>Note:</strong>
990 * The broadcast receiver that filters for this intent must declare
991 * {@link android.Manifest.permission#BROADCAST_SMS} as a required permission in
992 * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code
993 * <receiver>}</a> tag.
994 *
995 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
996 */
997 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
998 public static final String SMS_DELIVER_ACTION =
999 "android.provider.Telephony.SMS_DELIVER";
1000
1001 /**
1002 * Broadcast Action: A new text-based SMS message has been received
1003 * by the device. This intent will be delivered to all registered
1004 * receivers as a notification. These apps are not expected to write the
1005 * message or notify the user. The intent will have the following extra
1006 * values:</p>
1007 *
1008 * <ul>
1009 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
1010 * that make up the message.</li>
1011 * </ul>
1012 *
1013 * <p>The extra values can be extracted using
1014 * {@link #getMessagesFromIntent(Intent)}.</p>
1015 *
1016 * <p>If a BroadcastReceiver encounters an error while processing
1017 * this intent it should set the result code appropriately.</p>
1018 *
1019 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1020 */
1021 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1022 public static final String SMS_RECEIVED_ACTION =
1023 "android.provider.Telephony.SMS_RECEIVED";
1024
1025 /**
1026 * Broadcast Action: A new data based SMS message has been received
1027 * by the device. This intent will be delivered to all registered
1028 * receivers as a notification. The intent will have the following extra
1029 * values:</p>
1030 *
1031 * <ul>
1032 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
1033 * that make up the message.</li>
1034 * </ul>
1035 *
1036 * <p>The extra values can be extracted using
1037 * {@link #getMessagesFromIntent(Intent)}.</p>
1038 *
1039 * <p>If a BroadcastReceiver encounters an error while processing
1040 * this intent it should set the result code appropriately.</p>
1041 *
1042 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1043 */
1044 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1045 public static final String DATA_SMS_RECEIVED_ACTION =
1046 "android.intent.action.DATA_SMS_RECEIVED";
1047
1048 /**
1049 * Broadcast Action: A new WAP PUSH message has been received by the
1050 * device. This intent will only be delivered to the default
1051 * sms app. That app is responsible for writing the message and notifying
1052 * the user. The intent will have the following extra values:</p>
1053 *
1054 * <ul>
1055 * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li>
1056 * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li>
1057 * <li><em>"header"</em> - (byte[]) The header of the message</li>
1058 * <li><em>"data"</em> - (byte[]) The data payload of the message</li>
1059 * <li><em>"contentTypeParameters" </em>
1060 * -(HashMap&lt;String,String&gt;) Any parameters associated with the content type
1061 * (decoded from the WSP Content-Type header)</li>
1062 * <li><em>"subscription"</em> - An optional long value of the subscription id which
1063 * received the message.</li>
1064 * <li><em>"slot"</em> - An optional int value of the SIM slot containing the
1065 * subscription.</li>
1066 * <li><em>"phone"</em> - An optional int value of the phone id associated with the
1067 * subscription.</li>
1068 * </ul>
1069 *
1070 * <p>If a BroadcastReceiver encounters an error while processing
1071 * this intent it should set the result code appropriately.</p>
1072 *
1073 * <p>The contentTypeParameters extra value is map of content parameters keyed by
1074 * their names.</p>
1075 *
1076 * <p>If any unassigned well-known parameters are encountered, the key of the map will
1077 * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If
1078 * a parameter has No-Value the value in the map will be null.</p>
1079 *
1080 * <p>Requires {@link android.Manifest.permission#RECEIVE_MMS} or
1081 * {@link android.Manifest.permission#RECEIVE_WAP_PUSH} (depending on WAP PUSH type) to
1082 * receive.</p>
1083 *
1084 * <p class="note"><strong>Note:</strong>
1085 * The broadcast receiver that filters for this intent must declare
1086 * {@link android.Manifest.permission#BROADCAST_WAP_PUSH} as a required permission in
1087 * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code
1088 * <receiver>}</a> tag.
1089 */
1090 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1091 public static final String WAP_PUSH_DELIVER_ACTION =
1092 "android.provider.Telephony.WAP_PUSH_DELIVER";
1093
1094 /**
1095 * Broadcast Action: A new WAP PUSH message has been received by the
1096 * device. This intent will be delivered to all registered
1097 * receivers as a notification. These apps are not expected to write the
1098 * message or notify the user. The intent will have the following extra
1099 * values:</p>
1100 *
1101 * <ul>
1102 * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li>
1103 * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li>
1104 * <li><em>"header"</em> - (byte[]) The header of the message</li>
1105 * <li><em>"data"</em> - (byte[]) The data payload of the message</li>
1106 * <li><em>"contentTypeParameters"</em>
1107 * - (HashMap&lt;String,String&gt;) Any parameters associated with the content type
1108 * (decoded from the WSP Content-Type header)</li>
1109 * </ul>
1110 *
1111 * <p>If a BroadcastReceiver encounters an error while processing
1112 * this intent it should set the result code appropriately.</p>
1113 *
1114 * <p>The contentTypeParameters extra value is map of content parameters keyed by
1115 * their names.</p>
1116 *
1117 * <p>If any unassigned well-known parameters are encountered, the key of the map will
1118 * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If
1119 * a parameter has No-Value the value in the map will be null.</p>
1120 *
1121 * <p>Requires {@link android.Manifest.permission#RECEIVE_MMS} or
1122 * {@link android.Manifest.permission#RECEIVE_WAP_PUSH} (depending on WAP PUSH type) to
1123 * receive.</p>
1124 */
1125 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1126 public static final String WAP_PUSH_RECEIVED_ACTION =
1127 "android.provider.Telephony.WAP_PUSH_RECEIVED";
1128
1129 /**
1130 * Broadcast Action: A new Cell Broadcast message has been received
1131 * by the device. The intent will have the following extra
1132 * values:</p>
1133 *
1134 * <ul>
1135 * <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message
1136 * data. This is not an emergency alert, so ETWS and CMAS data will be null.</li>
1137 * </ul>
1138 *
1139 * <p>The extra values can be extracted using
1140 * {@link #getMessagesFromIntent(Intent)}.</p>
1141 *
1142 * <p>If a BroadcastReceiver encounters an error while processing
1143 * this intent it should set the result code appropriately.</p>
1144 *
1145 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1146 */
1147 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1148 public static final String SMS_CB_RECEIVED_ACTION =
1149 "android.provider.Telephony.SMS_CB_RECEIVED";
1150
1151 /**
1152 * Action: A SMS based carrier provision intent. Used to identify default
1153 * carrier provisioning app on the device.
1154 * @hide
1155 */
1156 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1157 @TestApi
1158 public static final String SMS_CARRIER_PROVISION_ACTION =
1159 "android.provider.Telephony.SMS_CARRIER_PROVISION";
1160
1161 /**
1162 * Broadcast Action: A new Emergency Broadcast message has been received
1163 * by the device. The intent will have the following extra
1164 * values:</p>
1165 *
1166 * <ul>
Chen Xu9c1260c2019-11-06 20:30:58 -08001167 * <li><em>"message"</em> - An {@link android.telephony.SmsCbMessage} object
1168 * containing the broadcast message data, including ETWS or CMAS warning notification
1169 * info if present.</li>
Dan Willemsen4980bf42017-02-14 14:17:12 -08001170 * </ul>
1171 *
1172 * <p>The extra values can be extracted using
1173 * {@link #getMessagesFromIntent(Intent)}.</p>
1174 *
1175 * <p>If a BroadcastReceiver encounters an error while processing
1176 * this intent it should set the result code appropriately.</p>
1177 *
1178 * <p>Requires {@link android.Manifest.permission#RECEIVE_EMERGENCY_BROADCAST} to
1179 * receive.</p>
Chen Xu9c1260c2019-11-06 20:30:58 -08001180 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08001181 */
1182 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
Chen Xu9c1260c2019-11-06 20:30:58 -08001183 @SystemApi
1184 public static final String ACTION_SMS_EMERGENCY_CB_RECEIVED =
1185 "android.provider.action.SMS_EMERGENCY_CB_RECEIVED";
Dan Willemsen4980bf42017-02-14 14:17:12 -08001186
1187 /**
1188 * Broadcast Action: A new CDMA SMS has been received containing Service Category
1189 * Program Data (updates the list of enabled broadcast channels). The intent will
1190 * have the following extra values:</p>
1191 *
1192 * <ul>
1193 * <li><em>"operations"</em> - An array of CdmaSmsCbProgramData objects containing
1194 * the service category operations (add/delete/clear) to perform.</li>
1195 * </ul>
1196 *
1197 * <p>The extra values can be extracted using
1198 * {@link #getMessagesFromIntent(Intent)}.</p>
1199 *
1200 * <p>If a BroadcastReceiver encounters an error while processing
1201 * this intent it should set the result code appropriately.</p>
1202 *
1203 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1204 */
1205 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1206 public static final String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION =
1207 "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED";
1208
1209 /**
1210 * Broadcast Action: The SIM storage for SMS messages is full. If
1211 * space is not freed, messages targeted for the SIM (class 2) may
1212 * not be saved.
1213 *
1214 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1215 */
1216 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1217 public static final String SIM_FULL_ACTION =
1218 "android.provider.Telephony.SIM_FULL";
1219
1220 /**
1221 * Broadcast Action: An incoming SMS has been rejected by the
1222 * telephony framework. This intent is sent in lieu of any
1223 * of the RECEIVED_ACTION intents. The intent will have the
1224 * following extra value:</p>
1225 *
1226 * <ul>
1227 * <li><em>"result"</em> - An int result code, e.g. {@link #RESULT_SMS_OUT_OF_MEMORY}
1228 * indicating the error returned to the network.</li>
1229 * </ul>
1230 *
1231 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p>
1232 */
1233 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1234 public static final String SMS_REJECTED_ACTION =
1235 "android.provider.Telephony.SMS_REJECTED";
1236
1237 /**
1238 * Broadcast Action: An incoming MMS has been downloaded. The intent is sent to all
1239 * users, except for secondary users where SMS has been disabled and to managed
1240 * profiles.
1241 * @hide
1242 */
1243 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1244 public static final String MMS_DOWNLOADED_ACTION =
1245 "android.provider.Telephony.MMS_DOWNLOADED";
1246
1247 /**
Cassie5b97cf12018-02-22 09:58:33 -08001248 * Broadcast Action: A debug code has been entered in the dialer. This intent is
1249 * broadcast by the system and OEM telephony apps may need to receive these broadcasts.
1250 * These "secret codes" are used to activate developer menus by dialing certain codes.
Alan Stokesa9b5b2a2019-02-28 16:45:47 +00001251 * And they are of the form {@code *#*#<code>#*#*}. The intent will have the data
1252 * URI: {@code android_secret_code://<code>}. It is possible that a manifest
Cassie5b97cf12018-02-22 09:58:33 -08001253 * receiver would be woken up even if it is not currently running.
1254 *
1255 * <p>Requires {@code android.Manifest.permission#CONTROL_INCALL_EXPERIENCE} to
1256 * send and receive.</p>
Cassie6d0a5712018-08-21 13:38:39 -07001257 * @deprecated it is no longer supported, use {@link
1258 * TelephonyManager#ACTION_SECRET_CODE} instead
Cassie866f4942018-01-19 17:23:36 -08001259 */
Cassie6d0a5712018-08-21 13:38:39 -07001260 @Deprecated
Cassie866f4942018-01-19 17:23:36 -08001261 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1262 public static final String SECRET_CODE_ACTION =
1263 "android.provider.Telephony.SECRET_CODE";
1264
1265 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08001266 * Broadcast action: When the default SMS package changes,
1267 * the previous default SMS package and the new default SMS
1268 * package are sent this broadcast to notify them of the change.
1269 * A boolean is specified in {@link #EXTRA_IS_DEFAULT_SMS_APP} to
1270 * indicate whether the package is the new default SMS package.
1271 */
1272 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1273 public static final String ACTION_DEFAULT_SMS_PACKAGE_CHANGED =
1274 "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED";
1275
1276 /**
1277 * The IsDefaultSmsApp boolean passed as an
1278 * extra for {@link #ACTION_DEFAULT_SMS_PACKAGE_CHANGED} to indicate whether the
1279 * SMS app is becoming the default SMS app or is no longer the default.
1280 *
1281 * @see #ACTION_DEFAULT_SMS_PACKAGE_CHANGED
1282 */
1283 public static final String EXTRA_IS_DEFAULT_SMS_APP =
1284 "android.provider.extra.IS_DEFAULT_SMS_APP";
1285
1286 /**
1287 * Broadcast action: When a change is made to the SmsProvider or
1288 * MmsProvider by a process other than the default SMS application,
1289 * this intent is broadcast to the default SMS application so it can
1290 * re-sync or update the change. The uri that was used to call the provider
1291 * can be retrieved from the intent with getData(). The actual affected uris
1292 * (which would depend on the selection specified) are not included.
1293 */
1294 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1295 public static final String ACTION_EXTERNAL_PROVIDER_CHANGE =
1296 "android.provider.action.EXTERNAL_PROVIDER_CHANGE";
1297
1298 /**
Amit Mahajan8c1c45a2018-10-22 10:43:34 -07001299 * Broadcast action: When SMS-MMS db is being created. If file-based encryption is
1300 * supported, this broadcast indicates creation of the db in credential-encrypted
1301 * storage. A boolean is specified in {@link #EXTRA_IS_INITIAL_CREATE} to indicate if
Jayachandran C1637e442019-12-12 18:51:56 -08001302 * this is the initial create of the db.
Amit Mahajan8c1c45a2018-10-22 10:43:34 -07001303 *
1304 * @see #EXTRA_IS_INITIAL_CREATE
1305 *
1306 * @hide
1307 */
1308 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1309 public static final String ACTION_SMS_MMS_DB_CREATED =
1310 "android.provider.action.SMS_MMS_DB_CREATED";
1311
1312 /**
1313 * Boolean flag passed as an extra with {@link #ACTION_SMS_MMS_DB_CREATED} to indicate
1314 * whether the DB creation is the initial creation on the device, that is it is after a
1315 * factory-data reset or a new device. Any subsequent creations of the DB (which
1316 * happens only in error scenarios) will have this flag set to false.
1317 *
1318 * @see #ACTION_SMS_MMS_DB_CREATED
1319 *
1320 * @hide
1321 */
1322 public static final String EXTRA_IS_INITIAL_CREATE =
1323 "android.provider.extra.IS_INITIAL_CREATE";
Jayachandran C349b9ba2018-10-30 15:09:06 -07001324
1325 /**
1326 * Broadcast intent action indicating that the telephony provider SMS MMS database is
1327 * corrupted. A boolean is specified in {@link #EXTRA_IS_CORRUPTED} to indicate if the
1328 * database is corrupted. Requires the
1329 * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE permission.
1330 *
1331 * @hide
1332 */
1333 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1334 @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
1335 public static final String ACTION_SMS_MMS_DB_LOST =
1336 "android.provider.action.SMS_MMS_DB_LOST";
1337
1338 /**
1339 * Boolean flag passed as an extra with {@link #ACTION_SMS_MMS_DB_LOST} to indicate
1340 * whether the DB got corrupted or not.
1341 *
1342 * @see #ACTION_SMS_MMS_DB_LOST
1343 *
1344 * @hide
1345 */
1346 public static final String EXTRA_IS_CORRUPTED =
1347 "android.provider.extra.IS_CORRUPTED";
1348
Amit Mahajan8c1c45a2018-10-22 10:43:34 -07001349 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08001350 * Read the PDUs out of an {@link #SMS_RECEIVED_ACTION} or a
1351 * {@link #DATA_SMS_RECEIVED_ACTION} intent.
1352 *
1353 * @param intent the intent to read from
1354 * @return an array of SmsMessages for the PDUs
1355 */
1356 public static SmsMessage[] getMessagesFromIntent(Intent intent) {
1357 Object[] messages;
1358 try {
1359 messages = (Object[]) intent.getSerializableExtra("pdus");
1360 }
1361 catch (ClassCastException e) {
1362 Rlog.e(TAG, "getMessagesFromIntent: " + e);
1363 return null;
1364 }
1365
1366 if (messages == null) {
1367 Rlog.e(TAG, "pdus does not exist in the intent");
1368 return null;
1369 }
1370
1371 String format = intent.getStringExtra("format");
Meng Wang646dcbd2019-12-05 12:12:20 -08001372 int subId = intent.getIntExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX,
Dan Willemsen4980bf42017-02-14 14:17:12 -08001373 SubscriptionManager.getDefaultSmsSubscriptionId());
1374
1375 Rlog.v(TAG, " getMessagesFromIntent sub_id : " + subId);
1376
1377 int pduCount = messages.length;
1378 SmsMessage[] msgs = new SmsMessage[pduCount];
1379
1380 for (int i = 0; i < pduCount; i++) {
1381 byte[] pdu = (byte[]) messages[i];
1382 msgs[i] = SmsMessage.createFromPdu(pdu, format);
Dan Willemsen4980bf42017-02-14 14:17:12 -08001383 }
1384 return msgs;
1385 }
1386 }
1387 }
1388
1389 /**
pkanwar16b8a0d2017-06-07 10:59:41 -07001390 * Base column for the table that contain Carrier Public key.
1391 * @hide
1392 */
zoey chenb27edd72019-11-01 15:09:11 +08001393 @SystemApi
pkanwar16b8a0d2017-06-07 10:59:41 -07001394 public interface CarrierColumns extends BaseColumns {
1395
zoey chenb27edd72019-11-01 15:09:11 +08001396 /**
1397 * Mobile Country Code (MCC).
1398 * <P> Type: TEXT </P>
1399 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001400 public static final String MCC = "mcc";
zoey chenb27edd72019-11-01 15:09:11 +08001401
1402 /**
1403 * Mobile Network Code (MNC).
1404 * <P> Type: TEXT </P>
1405 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001406 public static final String MNC = "mnc";
zoey chenb27edd72019-11-01 15:09:11 +08001407
1408 /**
1409 * KeyType whether the key is being used for WLAN or ePDG.
1410 * <P> Type: INTEGER </P>
1411 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001412 public static final String KEY_TYPE = "key_type";
zoey chenb27edd72019-11-01 15:09:11 +08001413
1414 /**
1415 * MVNO type:
1416 * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}.
1417 * <P> Type: TEXT </P>
1418 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001419 public static final String MVNO_TYPE = "mvno_type";
zoey chenb27edd72019-11-01 15:09:11 +08001420
1421 /**
1422 * MVNO data.
1423 * Use the following examples.
1424 * <ul>
1425 * <li>SPN: A MOBILE, BEN NL, ...</li>
1426 * <li>IMSI: 302720x94, 2060188, ...</li>
1427 * <li>GID: 4E, 33, ...</li>
1428 * </ul>
1429 * <P> Type: TEXT </P>
1430 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001431 public static final String MVNO_MATCH_DATA = "mvno_match_data";
zoey chenb27edd72019-11-01 15:09:11 +08001432
1433 /**
1434 * The carrier public key that is used for the IMSI encryption.
1435 * <P> Type: TEXT </P>
1436 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001437 public static final String PUBLIC_KEY = "public_key";
zoey chenb27edd72019-11-01 15:09:11 +08001438
1439 /**
1440 * The key identifier Attribute value pair that helps a server locate
1441 * the private key to decrypt the permanent identity.
1442 * <P> Type: TEXT </P>
1443 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001444 public static final String KEY_IDENTIFIER = "key_identifier";
zoey chenb27edd72019-11-01 15:09:11 +08001445
1446 /**
1447 * Date-Time in UTC when the key will expire.
1448 * <P> Type: INTEGER (long) </P>
1449 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001450 public static final String EXPIRATION_TIME = "expiration_time";
zoey chenb27edd72019-11-01 15:09:11 +08001451
1452 /**
1453 * Timestamp when this table was last modified, in milliseconds since
1454 * January 1, 1970 00:00:00.0 UTC.
1455 * <P> Type: INTEGER (long) </P>
1456 */
pkanwar16b8a0d2017-06-07 10:59:41 -07001457 public static final String LAST_MODIFIED = "last_modified";
1458
1459 /**
1460 * The {@code content://} style URL for this table.
pkanwar16b8a0d2017-06-07 10:59:41 -07001461 */
zoey chenb27edd72019-11-01 15:09:11 +08001462 @NonNull
pkanwar16b8a0d2017-06-07 10:59:41 -07001463 public static final Uri CONTENT_URI = Uri.parse("content://carrier_information/carrier");
1464 }
1465
1466 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08001467 * Base columns for tables that contain MMSs.
1468 */
1469 public interface BaseMmsColumns extends BaseColumns {
1470
1471 /** Message box: all messages. */
1472 public static final int MESSAGE_BOX_ALL = 0;
1473 /** Message box: inbox. */
1474 public static final int MESSAGE_BOX_INBOX = 1;
1475 /** Message box: sent messages. */
1476 public static final int MESSAGE_BOX_SENT = 2;
1477 /** Message box: drafts. */
1478 public static final int MESSAGE_BOX_DRAFTS = 3;
1479 /** Message box: outbox. */
1480 public static final int MESSAGE_BOX_OUTBOX = 4;
1481 /** Message box: failed. */
1482 public static final int MESSAGE_BOX_FAILED = 5;
1483
1484 /**
1485 * The thread ID of the message.
1486 * <P>Type: INTEGER (long)</P>
1487 */
1488 public static final String THREAD_ID = "thread_id";
1489
1490 /**
1491 * The date the message was received.
1492 * <P>Type: INTEGER (long)</P>
1493 */
1494 public static final String DATE = "date";
1495
1496 /**
1497 * The date the message was sent.
1498 * <P>Type: INTEGER (long)</P>
1499 */
1500 public static final String DATE_SENT = "date_sent";
1501
1502 /**
1503 * The box which the message belongs to, e.g. {@link #MESSAGE_BOX_INBOX}.
1504 * <P>Type: INTEGER</P>
1505 */
1506 public static final String MESSAGE_BOX = "msg_box";
1507
1508 /**
1509 * Has the message been read?
1510 * <P>Type: INTEGER (boolean)</P>
1511 */
1512 public static final String READ = "read";
1513
1514 /**
1515 * Has the message been seen by the user? The "seen" flag determines
1516 * whether we need to show a new message notification.
1517 * <P>Type: INTEGER (boolean)</P>
1518 */
1519 public static final String SEEN = "seen";
1520
1521 /**
1522 * Does the message have only a text part (can also have a subject) with
1523 * no picture, slideshow, sound, etc. parts?
1524 * <P>Type: INTEGER (boolean)</P>
1525 */
1526 public static final String TEXT_ONLY = "text_only";
1527
1528 /**
1529 * The {@code Message-ID} of the message.
1530 * <P>Type: TEXT</P>
1531 */
1532 public static final String MESSAGE_ID = "m_id";
1533
1534 /**
1535 * The subject of the message, if present.
1536 * <P>Type: TEXT</P>
1537 */
1538 public static final String SUBJECT = "sub";
1539
1540 /**
1541 * The character set of the subject, if present.
1542 * <P>Type: INTEGER</P>
1543 */
1544 public static final String SUBJECT_CHARSET = "sub_cs";
1545
1546 /**
1547 * The {@code Content-Type} of the message.
1548 * <P>Type: TEXT</P>
1549 */
1550 public static final String CONTENT_TYPE = "ct_t";
1551
1552 /**
1553 * The {@code Content-Location} of the message.
1554 * <P>Type: TEXT</P>
1555 */
1556 public static final String CONTENT_LOCATION = "ct_l";
1557
1558 /**
1559 * The expiry time of the message.
1560 * <P>Type: INTEGER (long)</P>
1561 */
1562 public static final String EXPIRY = "exp";
1563
1564 /**
1565 * The class of the message.
1566 * <P>Type: TEXT</P>
1567 */
1568 public static final String MESSAGE_CLASS = "m_cls";
1569
1570 /**
1571 * The type of the message defined by MMS spec.
1572 * <P>Type: INTEGER</P>
1573 */
1574 public static final String MESSAGE_TYPE = "m_type";
1575
1576 /**
1577 * The version of the specification that this message conforms to.
1578 * <P>Type: INTEGER</P>
1579 */
1580 public static final String MMS_VERSION = "v";
1581
1582 /**
1583 * The size of the message.
1584 * <P>Type: INTEGER</P>
1585 */
1586 public static final String MESSAGE_SIZE = "m_size";
1587
1588 /**
1589 * The priority of the message.
1590 * <P>Type: INTEGER</P>
1591 */
1592 public static final String PRIORITY = "pri";
1593
1594 /**
1595 * The {@code read-report} of the message.
1596 * <P>Type: INTEGER (boolean)</P>
1597 */
1598 public static final String READ_REPORT = "rr";
1599
1600 /**
1601 * Is read report allowed?
1602 * <P>Type: INTEGER (boolean)</P>
1603 */
1604 public static final String REPORT_ALLOWED = "rpt_a";
1605
1606 /**
1607 * The {@code response-status} of the message.
1608 * <P>Type: INTEGER</P>
1609 */
1610 public static final String RESPONSE_STATUS = "resp_st";
1611
1612 /**
1613 * The {@code status} of the message.
1614 * <P>Type: INTEGER</P>
1615 */
1616 public static final String STATUS = "st";
1617
1618 /**
1619 * The {@code transaction-id} of the message.
1620 * <P>Type: TEXT</P>
1621 */
1622 public static final String TRANSACTION_ID = "tr_id";
1623
1624 /**
1625 * The {@code retrieve-status} of the message.
1626 * <P>Type: INTEGER</P>
1627 */
1628 public static final String RETRIEVE_STATUS = "retr_st";
1629
1630 /**
1631 * The {@code retrieve-text} of the message.
1632 * <P>Type: TEXT</P>
1633 */
1634 public static final String RETRIEVE_TEXT = "retr_txt";
1635
1636 /**
1637 * The character set of the retrieve-text.
1638 * <P>Type: INTEGER</P>
1639 */
1640 public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs";
1641
1642 /**
1643 * The {@code read-status} of the message.
1644 * <P>Type: INTEGER</P>
1645 */
1646 public static final String READ_STATUS = "read_status";
1647
1648 /**
1649 * The {@code content-class} of the message.
1650 * <P>Type: INTEGER</P>
1651 */
1652 public static final String CONTENT_CLASS = "ct_cls";
1653
1654 /**
1655 * The {@code delivery-report} of the message.
1656 * <P>Type: INTEGER</P>
1657 */
1658 public static final String DELIVERY_REPORT = "d_rpt";
1659
1660 /**
1661 * The {@code delivery-time-token} of the message.
1662 * <P>Type: INTEGER</P>
1663 * @deprecated this column is no longer supported.
1664 * @hide
1665 */
1666 @Deprecated
1667 public static final String DELIVERY_TIME_TOKEN = "d_tm_tok";
1668
1669 /**
1670 * The {@code delivery-time} of the message.
1671 * <P>Type: INTEGER</P>
1672 */
1673 public static final String DELIVERY_TIME = "d_tm";
1674
1675 /**
1676 * The {@code response-text} of the message.
1677 * <P>Type: TEXT</P>
1678 */
1679 public static final String RESPONSE_TEXT = "resp_txt";
1680
1681 /**
1682 * The {@code sender-visibility} of the message.
1683 * <P>Type: TEXT</P>
1684 * @deprecated this column is no longer supported.
1685 * @hide
1686 */
1687 @Deprecated
1688 public static final String SENDER_VISIBILITY = "s_vis";
1689
1690 /**
1691 * The {@code reply-charging} of the message.
1692 * <P>Type: INTEGER</P>
1693 * @deprecated this column is no longer supported.
1694 * @hide
1695 */
1696 @Deprecated
1697 public static final String REPLY_CHARGING = "r_chg";
1698
1699 /**
1700 * The {@code reply-charging-deadline-token} of the message.
1701 * <P>Type: INTEGER</P>
1702 * @deprecated this column is no longer supported.
1703 * @hide
1704 */
1705 @Deprecated
1706 public static final String REPLY_CHARGING_DEADLINE_TOKEN = "r_chg_dl_tok";
1707
1708 /**
1709 * The {@code reply-charging-deadline} of the message.
1710 * <P>Type: INTEGER</P>
1711 * @deprecated this column is no longer supported.
1712 * @hide
1713 */
1714 @Deprecated
1715 public static final String REPLY_CHARGING_DEADLINE = "r_chg_dl";
1716
1717 /**
1718 * The {@code reply-charging-id} of the message.
1719 * <P>Type: TEXT</P>
1720 * @deprecated this column is no longer supported.
1721 * @hide
1722 */
1723 @Deprecated
1724 public static final String REPLY_CHARGING_ID = "r_chg_id";
1725
1726 /**
1727 * The {@code reply-charging-size} of the message.
1728 * <P>Type: INTEGER</P>
1729 * @deprecated this column is no longer supported.
1730 * @hide
1731 */
1732 @Deprecated
1733 public static final String REPLY_CHARGING_SIZE = "r_chg_sz";
1734
1735 /**
1736 * The {@code previously-sent-by} of the message.
1737 * <P>Type: TEXT</P>
1738 * @deprecated this column is no longer supported.
1739 * @hide
1740 */
1741 @Deprecated
1742 public static final String PREVIOUSLY_SENT_BY = "p_s_by";
1743
1744 /**
1745 * The {@code previously-sent-date} of the message.
1746 * <P>Type: INTEGER</P>
1747 * @deprecated this column is no longer supported.
1748 * @hide
1749 */
1750 @Deprecated
1751 public static final String PREVIOUSLY_SENT_DATE = "p_s_d";
1752
1753 /**
1754 * The {@code store} of the message.
1755 * <P>Type: TEXT</P>
1756 * @deprecated this column is no longer supported.
1757 * @hide
1758 */
1759 @Deprecated
1760 public static final String STORE = "store";
1761
1762 /**
1763 * The {@code mm-state} of the message.
1764 * <P>Type: INTEGER</P>
1765 * @deprecated this column is no longer supported.
1766 * @hide
1767 */
1768 @Deprecated
1769 public static final String MM_STATE = "mm_st";
1770
1771 /**
1772 * The {@code mm-flags-token} of the message.
1773 * <P>Type: INTEGER</P>
1774 * @deprecated this column is no longer supported.
1775 * @hide
1776 */
1777 @Deprecated
1778 public static final String MM_FLAGS_TOKEN = "mm_flg_tok";
1779
1780 /**
1781 * The {@code mm-flags} of the message.
1782 * <P>Type: TEXT</P>
1783 * @deprecated this column is no longer supported.
1784 * @hide
1785 */
1786 @Deprecated
1787 public static final String MM_FLAGS = "mm_flg";
1788
1789 /**
1790 * The {@code store-status} of the message.
1791 * <P>Type: TEXT</P>
1792 * @deprecated this column is no longer supported.
1793 * @hide
1794 */
1795 @Deprecated
1796 public static final String STORE_STATUS = "store_st";
1797
1798 /**
1799 * The {@code store-status-text} of the message.
1800 * <P>Type: TEXT</P>
1801 * @deprecated this column is no longer supported.
1802 * @hide
1803 */
1804 @Deprecated
1805 public static final String STORE_STATUS_TEXT = "store_st_txt";
1806
1807 /**
1808 * The {@code stored} of the message.
1809 * <P>Type: TEXT</P>
1810 * @deprecated this column is no longer supported.
1811 * @hide
1812 */
1813 @Deprecated
1814 public static final String STORED = "stored";
1815
1816 /**
1817 * The {@code totals} of the message.
1818 * <P>Type: TEXT</P>
1819 * @deprecated this column is no longer supported.
1820 * @hide
1821 */
1822 @Deprecated
1823 public static final String TOTALS = "totals";
1824
1825 /**
1826 * The {@code mbox-totals} of the message.
1827 * <P>Type: TEXT</P>
1828 * @deprecated this column is no longer supported.
1829 * @hide
1830 */
1831 @Deprecated
1832 public static final String MBOX_TOTALS = "mb_t";
1833
1834 /**
1835 * The {@code mbox-totals-token} of the message.
1836 * <P>Type: INTEGER</P>
1837 * @deprecated this column is no longer supported.
1838 * @hide
1839 */
1840 @Deprecated
1841 public static final String MBOX_TOTALS_TOKEN = "mb_t_tok";
1842
1843 /**
1844 * The {@code quotas} of the message.
1845 * <P>Type: TEXT</P>
1846 * @deprecated this column is no longer supported.
1847 * @hide
1848 */
1849 @Deprecated
1850 public static final String QUOTAS = "qt";
1851
1852 /**
1853 * The {@code mbox-quotas} of the message.
1854 * <P>Type: TEXT</P>
1855 * @deprecated this column is no longer supported.
1856 * @hide
1857 */
1858 @Deprecated
1859 public static final String MBOX_QUOTAS = "mb_qt";
1860
1861 /**
1862 * The {@code mbox-quotas-token} of the message.
1863 * <P>Type: INTEGER</P>
1864 * @deprecated this column is no longer supported.
1865 * @hide
1866 */
1867 @Deprecated
1868 public static final String MBOX_QUOTAS_TOKEN = "mb_qt_tok";
1869
1870 /**
1871 * The {@code message-count} of the message.
1872 * <P>Type: INTEGER</P>
1873 * @deprecated this column is no longer supported.
1874 * @hide
1875 */
1876 @Deprecated
1877 public static final String MESSAGE_COUNT = "m_cnt";
1878
1879 /**
1880 * The {@code start} of the message.
1881 * <P>Type: INTEGER</P>
1882 * @deprecated this column is no longer supported.
1883 * @hide
1884 */
1885 @Deprecated
1886 public static final String START = "start";
1887
1888 /**
1889 * The {@code distribution-indicator} of the message.
1890 * <P>Type: TEXT</P>
1891 * @deprecated this column is no longer supported.
1892 * @hide
1893 */
1894 @Deprecated
1895 public static final String DISTRIBUTION_INDICATOR = "d_ind";
1896
1897 /**
1898 * The {@code element-descriptor} of the message.
1899 * <P>Type: TEXT</P>
1900 * @deprecated this column is no longer supported.
1901 * @hide
1902 */
1903 @Deprecated
1904 public static final String ELEMENT_DESCRIPTOR = "e_des";
1905
1906 /**
1907 * The {@code limit} of the message.
1908 * <P>Type: INTEGER</P>
1909 * @deprecated this column is no longer supported.
1910 * @hide
1911 */
1912 @Deprecated
1913 public static final String LIMIT = "limit";
1914
1915 /**
1916 * The {@code recommended-retrieval-mode} of the message.
1917 * <P>Type: INTEGER</P>
1918 * @deprecated this column is no longer supported.
1919 * @hide
1920 */
1921 @Deprecated
1922 public static final String RECOMMENDED_RETRIEVAL_MODE = "r_r_mod";
1923
1924 /**
1925 * The {@code recommended-retrieval-mode-text} of the message.
1926 * <P>Type: TEXT</P>
1927 * @deprecated this column is no longer supported.
1928 * @hide
1929 */
1930 @Deprecated
1931 public static final String RECOMMENDED_RETRIEVAL_MODE_TEXT = "r_r_mod_txt";
1932
1933 /**
1934 * The {@code status-text} of the message.
1935 * <P>Type: TEXT</P>
1936 * @deprecated this column is no longer supported.
1937 * @hide
1938 */
1939 @Deprecated
1940 public static final String STATUS_TEXT = "st_txt";
1941
1942 /**
1943 * The {@code applic-id} of the message.
1944 * <P>Type: TEXT</P>
1945 * @deprecated this column is no longer supported.
1946 * @hide
1947 */
1948 @Deprecated
1949 public static final String APPLIC_ID = "apl_id";
1950
1951 /**
1952 * The {@code reply-applic-id} of the message.
1953 * <P>Type: TEXT</P>
1954 * @deprecated this column is no longer supported.
1955 * @hide
1956 */
1957 @Deprecated
1958 public static final String REPLY_APPLIC_ID = "r_apl_id";
1959
1960 /**
1961 * The {@code aux-applic-id} of the message.
1962 * <P>Type: TEXT</P>
1963 * @deprecated this column is no longer supported.
1964 * @hide
1965 */
1966 @Deprecated
1967 public static final String AUX_APPLIC_ID = "aux_apl_id";
1968
1969 /**
1970 * The {@code drm-content} of the message.
1971 * <P>Type: TEXT</P>
1972 * @deprecated this column is no longer supported.
1973 * @hide
1974 */
1975 @Deprecated
1976 public static final String DRM_CONTENT = "drm_c";
1977
1978 /**
1979 * The {@code adaptation-allowed} of the message.
1980 * <P>Type: TEXT</P>
1981 * @deprecated this column is no longer supported.
1982 * @hide
1983 */
1984 @Deprecated
1985 public static final String ADAPTATION_ALLOWED = "adp_a";
1986
1987 /**
1988 * The {@code replace-id} of the message.
1989 * <P>Type: TEXT</P>
1990 * @deprecated this column is no longer supported.
1991 * @hide
1992 */
1993 @Deprecated
1994 public static final String REPLACE_ID = "repl_id";
1995
1996 /**
1997 * The {@code cancel-id} of the message.
1998 * <P>Type: TEXT</P>
1999 * @deprecated this column is no longer supported.
2000 * @hide
2001 */
2002 @Deprecated
2003 public static final String CANCEL_ID = "cl_id";
2004
2005 /**
2006 * The {@code cancel-status} of the message.
2007 * <P>Type: INTEGER</P>
2008 * @deprecated this column is no longer supported.
2009 * @hide
2010 */
2011 @Deprecated
2012 public static final String CANCEL_STATUS = "cl_st";
2013
2014 /**
2015 * Is the message locked?
2016 * <P>Type: INTEGER (boolean)</P>
2017 */
2018 public static final String LOCKED = "locked";
2019
2020 /**
2021 * The subscription to which the message belongs to. Its value will be
2022 * < 0 if the sub id cannot be determined.
2023 * <p>Type: INTEGER (long)</p>
2024 */
2025 public static final String SUBSCRIPTION_ID = "sub_id";
2026
2027 /**
2028 * The identity of the sender of a sent message. It is
2029 * usually the package name of the app which sends the message.
2030 * <p class="note"><strong>Note:</strong>
2031 * This column is read-only. It is set by the provider and can not be changed by apps.
2032 * <p>Type: TEXT</p>
2033 */
2034 public static final String CREATOR = "creator";
2035 }
2036
2037 /**
2038 * Columns for the "canonical_addresses" table used by MMS and SMS.
2039 */
2040 public interface CanonicalAddressesColumns extends BaseColumns {
2041 /**
2042 * An address used in MMS or SMS. Email addresses are
2043 * converted to lower case and are compared by string
2044 * equality. Other addresses are compared using
2045 * PHONE_NUMBERS_EQUAL.
2046 * <P>Type: TEXT</P>
2047 */
2048 public static final String ADDRESS = "address";
2049 }
2050
2051 /**
2052 * Columns for the "threads" table used by MMS and SMS.
2053 */
2054 public interface ThreadsColumns extends BaseColumns {
2055
2056 /**
2057 * The date at which the thread was created.
2058 * <P>Type: INTEGER (long)</P>
2059 */
2060 public static final String DATE = "date";
2061
2062 /**
2063 * A string encoding of the recipient IDs of the recipients of
2064 * the message, in numerical order and separated by spaces.
2065 * <P>Type: TEXT</P>
2066 */
2067 public static final String RECIPIENT_IDS = "recipient_ids";
2068
2069 /**
2070 * The message count of the thread.
2071 * <P>Type: INTEGER</P>
2072 */
2073 public static final String MESSAGE_COUNT = "message_count";
2074
2075 /**
2076 * Indicates whether all messages of the thread have been read.
2077 * <P>Type: INTEGER</P>
2078 */
2079 public static final String READ = "read";
2080
2081 /**
2082 * The snippet of the latest message in the thread.
2083 * <P>Type: TEXT</P>
2084 */
2085 public static final String SNIPPET = "snippet";
2086
2087 /**
2088 * The charset of the snippet.
2089 * <P>Type: INTEGER</P>
2090 */
2091 public static final String SNIPPET_CHARSET = "snippet_cs";
2092
2093 /**
2094 * Type of the thread, either {@link Threads#COMMON_THREAD} or
2095 * {@link Threads#BROADCAST_THREAD}.
2096 * <P>Type: INTEGER</P>
2097 */
2098 public static final String TYPE = "type";
2099
2100 /**
2101 * Indicates whether there is a transmission error in the thread.
2102 * <P>Type: INTEGER</P>
2103 */
2104 public static final String ERROR = "error";
2105
2106 /**
2107 * Indicates whether this thread contains any attachments.
2108 * <P>Type: INTEGER</P>
2109 */
2110 public static final String HAS_ATTACHMENT = "has_attachment";
2111
2112 /**
2113 * If the thread is archived
2114 * <P>Type: INTEGER (boolean)</P>
2115 */
2116 public static final String ARCHIVED = "archived";
2117 }
2118
2119 /**
2120 * Helper functions for the "threads" table used by MMS and SMS.
Leland Millerc445b2b2019-01-09 17:00:09 -08002121 *
2122 * Thread IDs are determined by the participants in a conversation and can be used to match
2123 * both SMS and MMS messages.
2124 *
2125 * To avoid issues where applications might cache a thread ID, the thread ID of a deleted thread
2126 * must not be reused to point at a new thread.
Dan Willemsen4980bf42017-02-14 14:17:12 -08002127 */
2128 public static final class Threads implements ThreadsColumns {
2129
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002130 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002131 private static final String[] ID_PROJECTION = { BaseColumns._ID };
2132
2133 /**
2134 * Private {@code content://} style URL for this table. Used by
2135 * {@link #getOrCreateThreadId(android.content.Context, java.util.Set)}.
2136 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002137 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002138 private static final Uri THREAD_ID_CONTENT_URI = Uri.parse(
2139 "content://mms-sms/threadID");
2140
2141 /**
2142 * The {@code content://} style URL for this table, by conversation.
2143 */
2144 public static final Uri CONTENT_URI = Uri.withAppendedPath(
2145 MmsSms.CONTENT_URI, "conversations");
2146
2147 /**
2148 * The {@code content://} style URL for this table, for obsolete threads.
2149 */
2150 public static final Uri OBSOLETE_THREADS_URI = Uri.withAppendedPath(
2151 CONTENT_URI, "obsolete");
2152
2153 /** Thread type: common thread. */
2154 public static final int COMMON_THREAD = 0;
2155
2156 /** Thread type: broadcast thread. */
2157 public static final int BROADCAST_THREAD = 1;
2158
2159 /**
2160 * Not instantiable.
2161 * @hide
2162 */
2163 private Threads() {
2164 }
2165
2166 /**
2167 * This is a single-recipient version of {@code getOrCreateThreadId}.
2168 * It's convenient for use with SMS messages.
2169 * @param context the context object to use.
2170 * @param recipient the recipient to send to.
2171 */
2172 public static long getOrCreateThreadId(Context context, String recipient) {
2173 Set<String> recipients = new HashSet<String>();
2174
2175 recipients.add(recipient);
2176 return getOrCreateThreadId(context, recipients);
2177 }
2178
2179 /**
Leland Millerc445b2b2019-01-09 17:00:09 -08002180 * Given a set of recipients return its thread ID.
2181 * <p>
2182 * If a thread exists containing the provided participants, return its thread ID. Otherwise,
2183 * this will create a new thread containing the provided participants and return its ID.
Dan Willemsen4980bf42017-02-14 14:17:12 -08002184 */
2185 public static long getOrCreateThreadId(
2186 Context context, Set<String> recipients) {
2187 Uri.Builder uriBuilder = THREAD_ID_CONTENT_URI.buildUpon();
2188
2189 for (String recipient : recipients) {
2190 if (Mms.isEmailAddress(recipient)) {
2191 recipient = Mms.extractAddrSpec(recipient);
2192 }
2193
2194 uriBuilder.appendQueryParameter("recipient", recipient);
2195 }
2196
2197 Uri uri = uriBuilder.build();
2198 //if (DEBUG) Rlog.v(TAG, "getOrCreateThreadId uri: " + uri);
2199
2200 Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(),
2201 uri, ID_PROJECTION, null, null, null);
2202 if (cursor != null) {
2203 try {
2204 if (cursor.moveToFirst()) {
2205 return cursor.getLong(0);
2206 } else {
2207 Rlog.e(TAG, "getOrCreateThreadId returned no rows!");
2208 }
2209 } finally {
2210 cursor.close();
2211 }
2212 }
2213
2214 Rlog.e(TAG, "getOrCreateThreadId failed with " + recipients.size() + " recipients");
2215 throw new IllegalArgumentException("Unable to find or allocate a thread ID.");
2216 }
2217 }
2218
2219 /**
Sahin Caliskanf00a8762019-01-24 14:32:12 -08002220 * Columns for the "rcs_*" tables used by {@link android.telephony.ims.RcsMessageStore} classes.
2221 *
2222 * @hide - not meant for public use
2223 */
2224 public interface RcsColumns {
Leland Millerbd7959d2019-02-13 10:31:31 -08002225 // TODO(sahinc): Turn this to true once the schema finalizes, so that people can update
2226 // their messaging databases. NOTE: move the switch/case update in MmsSmsDatabaseHelper to
2227 // the latest version of the database before turning this flag to true.
2228 boolean IS_RCS_TABLE_SCHEMA_CODE_COMPLETE = false;
2229
Sahin Caliskanf00a8762019-01-24 14:32:12 -08002230 /**
2231 * The authority for the content provider
2232 */
2233 String AUTHORITY = "rcs";
2234
2235 /**
2236 * The URI to start building upon to use {@link com.android.providers.telephony.RcsProvider}
2237 */
2238 Uri CONTENT_AND_AUTHORITY = Uri.parse("content://" + AUTHORITY);
2239
2240 /**
2241 * The value to be used whenever a transaction that expects an integer to be returned
2242 * failed.
2243 */
2244 int TRANSACTION_FAILED = Integer.MIN_VALUE;
2245
2246 /**
2247 * The value that denotes a timestamp was not set before (e.g. a message that is not
2248 * delivered yet will not have a DELIVERED_TIMESTAMP)
2249 */
2250 long TIMESTAMP_NOT_SET = 0;
2251
2252 /**
2253 * The table that {@link android.telephony.ims.RcsThread} gets persisted to
2254 */
2255 interface RcsThreadColumns {
2256 /**
2257 * The path that should be used for referring to
2258 * {@link android.telephony.ims.RcsThread}s in
2259 * {@link com.android.providers.telephony.RcsProvider} URIs.
2260 */
2261 String RCS_THREAD_URI_PART = "thread";
2262
2263 /**
2264 * The URI to query or modify {@link android.telephony.ims.RcsThread} via the content
2265 * provider.
2266 */
2267 Uri RCS_THREAD_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY, RCS_THREAD_URI_PART);
2268
2269 /**
2270 * The unique identifier of an {@link android.telephony.ims.RcsThread}
2271 */
2272 String RCS_THREAD_ID_COLUMN = "rcs_thread_id";
2273 }
2274
2275 /**
2276 * The table that {@link android.telephony.ims.Rcs1To1Thread} gets persisted to
2277 */
2278 interface Rcs1To1ThreadColumns extends RcsThreadColumns {
2279 /**
2280 * The path that should be used for referring to
2281 * {@link android.telephony.ims.Rcs1To1Thread}s in
2282 * {@link com.android.providers.telephony.RcsProvider} URIs.
2283 */
2284 String RCS_1_TO_1_THREAD_URI_PART = "p2p_thread";
2285
2286 /**
2287 * The URI to query or modify {@link android.telephony.ims.Rcs1To1Thread}s via the
Leland Millerdb2337f2019-02-20 07:53:49 -08002288 * content provider. Can also insert to this URI to create a new 1-to-1 thread. When
2289 * performing an insert, ensure that the provided content values contain the other
2290 * participant's ID under the key
2291 * {@link RcsParticipantColumns.RCS_PARTICIPANT_ID_COLUMN}
Sahin Caliskanf00a8762019-01-24 14:32:12 -08002292 */
2293 Uri RCS_1_TO_1_THREAD_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2294 RCS_1_TO_1_THREAD_URI_PART);
2295
2296 /**
2297 * The SMS/MMS thread to fallback to in case of an RCS outage
2298 */
2299 String FALLBACK_THREAD_ID_COLUMN = "rcs_fallback_thread_id";
2300 }
2301
2302 /**
2303 * The table that {@link android.telephony.ims.RcsGroupThread} gets persisted to
2304 */
2305 interface RcsGroupThreadColumns extends RcsThreadColumns {
2306 /**
2307 * The path that should be used for referring to
2308 * {@link android.telephony.ims.RcsGroupThread}s in
2309 * {@link com.android.providers.telephony.RcsProvider} URIs.
2310 */
2311 String RCS_GROUP_THREAD_URI_PART = "group_thread";
2312
2313 /**
2314 * The URI to query or modify {@link android.telephony.ims.RcsGroupThread}s via the
2315 * content provider
2316 */
2317 Uri RCS_GROUP_THREAD_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2318 RCS_GROUP_THREAD_URI_PART);
2319
2320 /**
2321 * The owner/admin of the {@link android.telephony.ims.RcsGroupThread}
2322 */
2323 String OWNER_PARTICIPANT_COLUMN = "owner_participant";
2324
2325 /**
2326 * The user visible name of the group
2327 */
2328 String GROUP_NAME_COLUMN = "group_name";
2329
2330 /**
2331 * The user visible icon of the group
2332 */
2333 String GROUP_ICON_COLUMN = "group_icon";
2334
2335 /**
2336 * The RCS conference URI for this group
2337 */
2338 String CONFERENCE_URI_COLUMN = "conference_uri";
2339 }
2340
2341 /**
2342 * The view that enables polling from all types of RCS threads at once
2343 */
2344 interface RcsUnifiedThreadColumns extends RcsThreadColumns, Rcs1To1ThreadColumns,
2345 RcsGroupThreadColumns {
2346 /**
2347 * The type of this {@link android.telephony.ims.RcsThread}
2348 */
2349 String THREAD_TYPE_COLUMN = "thread_type";
2350
2351 /**
2352 * Integer returned as a result from a database query that denotes the thread is 1 to 1
2353 */
2354 int THREAD_TYPE_1_TO_1 = 0;
2355
2356 /**
2357 * Integer returned as a result from a database query that denotes the thread is 1 to 1
2358 */
2359 int THREAD_TYPE_GROUP = 1;
2360 }
2361
2362 /**
2363 * The table that {@link android.telephony.ims.RcsParticipant} gets persisted to
2364 */
2365 interface RcsParticipantColumns {
2366 /**
2367 * The path that should be used for referring to
2368 * {@link android.telephony.ims.RcsParticipant}s in
2369 * {@link com.android.providers.telephony.RcsProvider} URIs.
2370 */
2371 String RCS_PARTICIPANT_URI_PART = "participant";
2372
2373 /**
2374 * The URI to query or modify {@link android.telephony.ims.RcsParticipant}s via the
2375 * content provider
2376 */
2377 Uri RCS_PARTICIPANT_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2378 RCS_PARTICIPANT_URI_PART);
2379
2380 /**
2381 * The unique identifier of the entry in the database
2382 */
2383 String RCS_PARTICIPANT_ID_COLUMN = "rcs_participant_id";
2384
2385 /**
2386 * A foreign key on canonical_address table, also used by SMS/MMS
2387 */
2388 String CANONICAL_ADDRESS_ID_COLUMN = "canonical_address_id";
2389
2390 /**
2391 * The user visible RCS alias for this participant.
2392 */
2393 String RCS_ALIAS_COLUMN = "rcs_alias";
2394 }
2395
2396 /**
2397 * Additional constants to enable access to {@link android.telephony.ims.RcsParticipant}
2398 * related data
2399 */
2400 interface RcsParticipantHelpers extends RcsParticipantColumns {
2401 /**
2402 * The view that unifies "rcs_participant" and "canonical_addresses" tables for easy
2403 * access to participant address.
2404 */
2405 String RCS_PARTICIPANT_WITH_ADDRESS_VIEW = "rcs_participant_with_address_view";
2406
2407 /**
2408 * The view that unifies "rcs_participant", "canonical_addresses" and
2409 * "rcs_thread_participant" junction table to get full information on participants that
2410 * contribute to threads.
2411 */
2412 String RCS_PARTICIPANT_WITH_THREAD_VIEW = "rcs_participant_with_thread_view";
2413 }
2414
2415 /**
2416 * The table that {@link android.telephony.ims.RcsMessage} gets persisted to
2417 */
2418 interface RcsMessageColumns {
2419 /**
2420 * Denotes the type of this message (i.e.
2421 * {@link android.telephony.ims.RcsIncomingMessage} or
2422 * {@link android.telephony.ims.RcsOutgoingMessage}
2423 */
2424 String MESSAGE_TYPE_COLUMN = "rcs_message_type";
2425
2426 /**
2427 * The unique identifier for the message in the database - i.e. the primary key.
2428 */
2429 String MESSAGE_ID_COLUMN = "rcs_message_row_id";
2430
2431 /**
2432 * The globally unique RCS identifier for the message. Please see 4.4.5.2 - GSMA
2433 * RCC.53 (RCS Device API 1.6 Specification)
2434 */
2435 String GLOBAL_ID_COLUMN = "rcs_message_global_id";
2436
2437 /**
2438 * The subscription where this message was sent from/to.
2439 */
2440 String SUB_ID_COLUMN = "sub_id";
2441
2442 /**
2443 * The sending status of the message.
2444 * @see android.telephony.ims.RcsMessage.RcsMessageStatus
2445 */
2446 String STATUS_COLUMN = "status";
2447
2448 /**
2449 * The creation timestamp of the message.
2450 */
2451 String ORIGINATION_TIMESTAMP_COLUMN = "origination_timestamp";
2452
2453 /**
2454 * The text content of the message.
2455 */
2456 String MESSAGE_TEXT_COLUMN = "rcs_text";
2457
2458 /**
2459 * The latitude content of the message, if it contains a location.
2460 */
2461 String LATITUDE_COLUMN = "latitude";
2462
2463 /**
2464 * The longitude content of the message, if it contains a location.
2465 */
2466 String LONGITUDE_COLUMN = "longitude";
2467 }
2468
2469 /**
2470 * The table that additional information of {@link android.telephony.ims.RcsIncomingMessage}
2471 * gets persisted to.
2472 */
2473 interface RcsIncomingMessageColumns extends RcsMessageColumns {
2474 /**
2475 The path that should be used for referring to
2476 * {@link android.telephony.ims.RcsIncomingMessage}s in
2477 * {@link com.android.providers.telephony.RcsProvider} URIs.
2478 */
2479 String INCOMING_MESSAGE_URI_PART = "incoming_message";
2480
2481 /**
2482 * The URI to query incoming messages through
2483 * {@link com.android.providers.telephony.RcsProvider}
2484 */
2485 Uri INCOMING_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2486 INCOMING_MESSAGE_URI_PART);
2487
2488 /**
2489 * The ID of the {@link android.telephony.ims.RcsParticipant} that sent this message
2490 */
2491 String SENDER_PARTICIPANT_ID_COLUMN = "sender_participant";
2492
2493 /**
2494 * The timestamp of arrival for this message.
2495 */
2496 String ARRIVAL_TIMESTAMP_COLUMN = "arrival_timestamp";
2497
2498 /**
2499 * The time when the recipient has read this message.
2500 */
2501 String SEEN_TIMESTAMP_COLUMN = "seen_timestamp";
2502 }
2503
2504 /**
2505 * The table that additional information of {@link android.telephony.ims.RcsOutgoingMessage}
2506 * gets persisted to.
2507 */
2508 interface RcsOutgoingMessageColumns extends RcsMessageColumns {
2509 /**
2510 * The path that should be used for referring to
2511 * {@link android.telephony.ims.RcsOutgoingMessage}s in
2512 * {@link com.android.providers.telephony.RcsProvider} URIs.
2513 */
2514 String OUTGOING_MESSAGE_URI_PART = "outgoing_message";
2515
2516 /**
2517 * The URI to query or modify {@link android.telephony.ims.RcsOutgoingMessage}s via the
2518 * content provider
2519 */
2520 Uri OUTGOING_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2521 OUTGOING_MESSAGE_URI_PART);
2522 }
2523
2524 /**
2525 * The delivery information of an {@link android.telephony.ims.RcsOutgoingMessage}
2526 */
2527 interface RcsMessageDeliveryColumns extends RcsOutgoingMessageColumns {
2528 /**
2529 * The path that should be used for referring to
2530 * {@link android.telephony.ims.RcsOutgoingMessageDelivery}s in
2531 * {@link com.android.providers.telephony.RcsProvider} URIs.
2532 */
2533 String DELIVERY_URI_PART = "delivery";
2534
2535 /**
2536 * The timestamp of delivery of this message.
2537 */
2538 String DELIVERED_TIMESTAMP_COLUMN = "delivered_timestamp";
2539
2540 /**
2541 * The time when the recipient has read this message.
2542 */
2543 String SEEN_TIMESTAMP_COLUMN = "seen_timestamp";
2544 }
2545
2546 /**
2547 * The views that allow querying {@link android.telephony.ims.RcsIncomingMessage} and
2548 * {@link android.telephony.ims.RcsOutgoingMessage} at the same time.
2549 */
2550 interface RcsUnifiedMessageColumns extends RcsIncomingMessageColumns,
2551 RcsOutgoingMessageColumns {
2552 /**
2553 * The path that is used to query all {@link android.telephony.ims.RcsMessage} in
2554 * {@link com.android.providers.telephony.RcsProvider} URIs.
2555 */
2556 String UNIFIED_MESSAGE_URI_PART = "message";
2557
2558 /**
2559 * The URI to query all types of {@link android.telephony.ims.RcsMessage}s
2560 */
2561 Uri UNIFIED_MESSAGE_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2562 UNIFIED_MESSAGE_URI_PART);
2563
2564 /**
2565 * The name of the view that unites rcs_message and rcs_incoming_message tables.
2566 */
2567 String UNIFIED_INCOMING_MESSAGE_VIEW = "unified_incoming_message_view";
2568
2569 /**
2570 * The name of the view that unites rcs_message and rcs_outgoing_message tables.
2571 */
2572 String UNIFIED_OUTGOING_MESSAGE_VIEW = "unified_outgoing_message_view";
2573
2574 /**
2575 * The column that shows from which table the message entry came from.
2576 */
2577 String MESSAGE_TYPE_COLUMN = "message_type";
2578
2579 /**
2580 * Integer returned as a result from a database query that denotes that the message is
2581 * an incoming message
2582 */
2583 int MESSAGE_TYPE_INCOMING = 1;
2584
2585 /**
2586 * Integer returned as a result from a database query that denotes that the message is
2587 * an outgoing message
2588 */
2589 int MESSAGE_TYPE_OUTGOING = 0;
2590 }
2591
2592 /**
2593 * The table that {@link android.telephony.ims.RcsFileTransferPart} gets persisted to.
2594 */
2595 interface RcsFileTransferColumns {
2596 /**
2597 * The path that should be used for referring to
2598 * {@link android.telephony.ims.RcsFileTransferPart}s in
2599 * {@link com.android.providers.telephony.RcsProvider} URIs.
2600 */
2601 String FILE_TRANSFER_URI_PART = "file_transfer";
2602
2603 /**
2604 * The URI to query or modify {@link android.telephony.ims.RcsFileTransferPart}s via the
2605 * content provider
2606 */
2607 Uri FILE_TRANSFER_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2608 FILE_TRANSFER_URI_PART);
2609
2610 /**
2611 * The globally unique file transfer ID for this RCS file transfer.
2612 */
2613 String FILE_TRANSFER_ID_COLUMN = "rcs_file_transfer_id";
2614
2615 /**
2616 * The RCS session ID for this file transfer. The ID is implementation dependent but
2617 * should be unique.
2618 */
2619 String SESSION_ID_COLUMN = "session_id";
2620
2621 /**
2622 * The URI that points to the content of this file transfer
2623 */
2624 String CONTENT_URI_COLUMN = "content_uri";
2625
2626 /**
2627 * The file type of this file transfer in bytes. The validity of types is not enforced
2628 * in {@link android.telephony.ims.RcsMessageStore} APIs.
2629 */
2630 String CONTENT_TYPE_COLUMN = "content_type";
2631
2632 /**
2633 * The size of the file transfer in bytes.
2634 */
2635 String FILE_SIZE_COLUMN = "file_size";
2636
2637 /**
2638 * Number of bytes that was successfully transmitted for this file transfer
2639 */
2640 String SUCCESSFULLY_TRANSFERRED_BYTES = "transfer_offset";
2641
2642 /**
2643 * The status of this file transfer
2644 * @see android.telephony.ims.RcsFileTransferPart.RcsFileTransferStatus
2645 */
2646 String TRANSFER_STATUS_COLUMN = "transfer_status";
2647
2648 /**
2649 * The on-screen width of the file transfer, if it contains multi-media
2650 */
2651 String WIDTH_COLUMN = "width";
2652
2653 /**
2654 * The on-screen height of the file transfer, if it contains multi-media
2655 */
2656 String HEIGHT_COLUMN = "height";
2657
2658 /**
2659 * The duration of the content in milliseconds if this file transfer contains
2660 * multi-media
2661 */
2662 String DURATION_MILLIS_COLUMN = "duration";
2663
2664 /**
2665 * The URI to the preview of the content of this file transfer
2666 */
2667 String PREVIEW_URI_COLUMN = "preview_uri";
2668
2669 /**
2670 * The type of the preview of the content of this file transfer. The validity of types
2671 * is not enforced in {@link android.telephony.ims.RcsMessageStore} APIs.
2672 */
2673 String PREVIEW_TYPE_COLUMN = "preview_type";
2674 }
2675
2676 /**
2677 * The table that holds the information for
2678 * {@link android.telephony.ims.RcsGroupThreadEvent} and its subclasses.
2679 */
2680 interface RcsThreadEventColumns {
2681 /**
2682 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2683 * refer to participant joined events (example URI:
2684 * {@code content://rcs/group_thread/3/participant_joined_event})
2685 */
2686 String PARTICIPANT_JOINED_URI_PART = "participant_joined_event";
2687
2688 /**
2689 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2690 * refer to participant left events. (example URI:
2691 * {@code content://rcs/group_thread/3/participant_left_event/4})
2692 */
2693 String PARTICIPANT_LEFT_URI_PART = "participant_left_event";
2694
2695 /**
2696 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2697 * refer to name changed events. (example URI:
2698 * {@code content://rcs/group_thread/3/name_changed_event})
2699 */
2700 String NAME_CHANGED_URI_PART = "name_changed_event";
2701
2702 /**
2703 * The string used in the {@link com.android.providers.telephony.RcsProvider} URI to
2704 * refer to icon changed events. (example URI:
2705 * {@code content://rcs/group_thread/3/icon_changed_event})
2706 */
2707 String ICON_CHANGED_URI_PART = "icon_changed_event";
2708
2709 /**
2710 * The unique ID of this event in the database, i.e. the primary key
2711 */
2712 String EVENT_ID_COLUMN = "event_id";
2713
2714 /**
2715 * The type of this event
2716 *
2717 * @see RcsEventTypes
2718 */
2719 String EVENT_TYPE_COLUMN = "event_type";
2720
2721 /**
2722 * The timestamp in milliseconds of when this event happened
2723 */
2724 String TIMESTAMP_COLUMN = "origination_timestamp";
2725
2726 /**
2727 * The participant that generated this event
2728 */
2729 String SOURCE_PARTICIPANT_ID_COLUMN = "source_participant";
2730
2731 /**
2732 * The receiving participant of this event if this was an
2733 * {@link android.telephony.ims.RcsGroupThreadParticipantJoinedEvent} or
2734 * {@link android.telephony.ims.RcsGroupThreadParticipantLeftEvent}
2735 */
2736 String DESTINATION_PARTICIPANT_ID_COLUMN = "destination_participant";
2737
2738 /**
2739 * The URI for the new icon of the group thread if this was an
2740 * {@link android.telephony.ims.RcsGroupThreadIconChangedEvent}
2741 */
2742 String NEW_ICON_URI_COLUMN = "new_icon_uri";
2743
2744 /**
2745 * The URI for the new name of the group thread if this was an
2746 * {@link android.telephony.ims.RcsGroupThreadNameChangedEvent}
2747 */
2748 String NEW_NAME_COLUMN = "new_name";
2749 }
2750
2751 /**
2752 * The table that {@link android.telephony.ims.RcsParticipantAliasChangedEvent} gets
2753 * persisted to
2754 */
2755 interface RcsParticipantEventColumns {
2756 /**
2757 * The path that should be used for referring to
2758 * {@link android.telephony.ims.RcsParticipantAliasChangedEvent}s in
2759 * {@link com.android.providers.telephony.RcsProvider} URIs.
2760 */
2761 String ALIAS_CHANGE_EVENT_URI_PART = "alias_change_event";
2762
2763 /**
2764 * The new alias of the participant
2765 */
2766 String NEW_ALIAS_COLUMN = "new_alias";
2767 }
2768
2769 /**
2770 * These values are used in {@link com.android.providers.telephony.RcsProvider} to determine
2771 * what kind of event is present in the storage.
2772 */
2773 interface RcsEventTypes {
2774 /**
2775 * Integer constant that is stored in the
2776 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2777 * is of type {@link android.telephony.ims.RcsParticipantAliasChangedEvent}
2778 */
2779 int PARTICIPANT_ALIAS_CHANGED_EVENT_TYPE = 1;
2780
2781 /**
2782 * Integer constant that is stored in the
2783 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2784 * is of type {@link android.telephony.ims.RcsGroupThreadParticipantJoinedEvent}
2785 */
2786 int PARTICIPANT_JOINED_EVENT_TYPE = 2;
2787
2788 /**
2789 * Integer constant that is stored in the
2790 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2791 * is of type {@link android.telephony.ims.RcsGroupThreadParticipantLeftEvent}
2792 */
2793 int PARTICIPANT_LEFT_EVENT_TYPE = 4;
2794
2795 /**
2796 * Integer constant that is stored in the
2797 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2798 * is of type {@link android.telephony.ims.RcsGroupThreadIconChangedEvent}
2799 */
2800 int ICON_CHANGED_EVENT_TYPE = 8;
2801
2802 /**
2803 * Integer constant that is stored in the
2804 * {@link com.android.providers.telephony.RcsProvider} database that denotes the event
2805 * is of type {@link android.telephony.ims.RcsGroupThreadNameChangedEvent}
2806 */
2807 int NAME_CHANGED_EVENT_TYPE = 16;
2808 }
2809
2810 /**
2811 * The view that allows unified querying across all events
2812 */
2813 interface RcsUnifiedEventHelper extends RcsParticipantEventColumns, RcsThreadEventColumns {
2814 /**
2815 * The path that should be used for referring to
2816 * {@link android.telephony.ims.RcsEvent}s in
2817 * {@link com.android.providers.telephony.RcsProvider} URIs.
2818 */
2819 String RCS_EVENT_QUERY_URI_PATH = "event";
2820
2821 /**
2822 * The URI to query {@link android.telephony.ims.RcsEvent}s via the content provider.
2823 */
2824 Uri RCS_EVENT_QUERY_URI = Uri.withAppendedPath(CONTENT_AND_AUTHORITY,
2825 RCS_EVENT_QUERY_URI_PATH);
2826 }
Leland Miller7b378ab2019-01-24 16:09:10 -08002827
2828 /**
2829 * Allows RCS specific canonical address handling.
2830 */
2831 interface RcsCanonicalAddressHelper {
2832 /**
2833 * Returns the canonical address ID for a canonical address, if now row exists, this
2834 * will add a row and return its ID. This helper works against the same table used by
2835 * the SMS and MMS threads, but is accessible only by the phone process for use by RCS
2836 * message storage.
2837 *
2838 * @throws IllegalArgumentException if unable to retrieve or create the canonical
2839 * address entry.
2840 */
2841 static long getOrCreateCanonicalAddressId(
2842 ContentResolver contentResolver, String canonicalAddress) {
2843
2844 Uri.Builder uriBuilder = CONTENT_AND_AUTHORITY.buildUpon();
2845 uriBuilder.appendPath("canonical-address");
2846 uriBuilder.appendQueryParameter("address", canonicalAddress);
2847 Uri uri = uriBuilder.build();
2848
2849 try (Cursor cursor = contentResolver.query(uri, null, null, null)) {
2850 if (cursor != null && cursor.moveToFirst()) {
2851 return cursor.getLong(cursor.getColumnIndex(CanonicalAddressesColumns._ID));
2852 } else {
2853 Rlog.e(TAG, "getOrCreateCanonicalAddressId returned no rows");
2854 }
2855 }
2856
2857 Rlog.e(TAG, "getOrCreateCanonicalAddressId failed");
2858 throw new IllegalArgumentException(
2859 "Unable to find or allocate a canonical address ID");
2860 }
2861 }
Sahin Caliskanf00a8762019-01-24 14:32:12 -08002862 }
2863
2864 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08002865 * Contains all MMS messages.
2866 */
2867 public static final class Mms implements BaseMmsColumns {
2868
2869 /**
2870 * Not instantiable.
2871 * @hide
2872 */
2873 private Mms() {
2874 }
2875
2876 /**
2877 * The {@code content://} URI for this table.
2878 */
2879 public static final Uri CONTENT_URI = Uri.parse("content://mms");
2880
2881 /**
2882 * Content URI for getting MMS report requests.
2883 */
2884 public static final Uri REPORT_REQUEST_URI = Uri.withAppendedPath(
2885 CONTENT_URI, "report-request");
2886
2887 /**
2888 * Content URI for getting MMS report status.
2889 */
2890 public static final Uri REPORT_STATUS_URI = Uri.withAppendedPath(
2891 CONTENT_URI, "report-status");
2892
2893 /**
2894 * The default sort order for this table.
2895 */
2896 public static final String DEFAULT_SORT_ORDER = "date DESC";
2897
2898 /**
2899 * Regex pattern for names and email addresses.
2900 * <ul>
2901 * <li><em>mailbox</em> = {@code name-addr}</li>
2902 * <li><em>name-addr</em> = {@code [display-name] angle-addr}</li>
2903 * <li><em>angle-addr</em> = {@code [CFWS] "<" addr-spec ">" [CFWS]}</li>
2904 * </ul>
2905 * @hide
2906 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002907 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002908 public static final Pattern NAME_ADDR_EMAIL_PATTERN =
2909 Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*");
2910
2911 /**
2912 * Helper method to query this table.
2913 * @hide
2914 */
2915 public static Cursor query(
2916 ContentResolver cr, String[] projection) {
2917 return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER);
2918 }
2919
2920 /**
2921 * Helper method to query this table.
2922 * @hide
2923 */
2924 public static Cursor query(
2925 ContentResolver cr, String[] projection,
2926 String where, String orderBy) {
2927 return cr.query(CONTENT_URI, projection,
2928 where, null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
2929 }
2930
2931 /**
2932 * Helper method to extract email address from address string.
2933 * @hide
2934 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002935 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002936 public static String extractAddrSpec(String address) {
2937 Matcher match = NAME_ADDR_EMAIL_PATTERN.matcher(address);
2938
2939 if (match.matches()) {
2940 return match.group(2);
2941 }
2942 return address;
2943 }
2944
2945 /**
2946 * Is the specified address an email address?
2947 *
2948 * @param address the input address to test
2949 * @return true if address is an email address; false otherwise.
2950 * @hide
2951 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002952 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002953 public static boolean isEmailAddress(String address) {
2954 if (TextUtils.isEmpty(address)) {
2955 return false;
2956 }
2957
2958 String s = extractAddrSpec(address);
2959 Matcher match = Patterns.EMAIL_ADDRESS.matcher(s);
2960 return match.matches();
2961 }
2962
2963 /**
2964 * Is the specified number a phone number?
2965 *
2966 * @param number the input number to test
2967 * @return true if number is a phone number; false otherwise.
2968 * @hide
2969 */
Mathew Inwood6750f2e2018-08-10 09:29:25 +01002970 @UnsupportedAppUsage
Dan Willemsen4980bf42017-02-14 14:17:12 -08002971 public static boolean isPhoneNumber(String number) {
2972 if (TextUtils.isEmpty(number)) {
2973 return false;
2974 }
2975
2976 Matcher match = Patterns.PHONE.matcher(number);
2977 return match.matches();
2978 }
2979
2980 /**
2981 * Contains all MMS messages in the MMS app inbox.
2982 */
2983 public static final class Inbox implements BaseMmsColumns {
2984
2985 /**
2986 * Not instantiable.
2987 * @hide
2988 */
2989 private Inbox() {
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/inbox");
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 sent folder.
3006 */
3007 public static final class Sent implements BaseMmsColumns {
3008
3009 /**
3010 * Not instantiable.
3011 * @hide
3012 */
3013 private Sent() {
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/sent");
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 drafts folder.
3030 */
3031 public static final class Draft implements BaseMmsColumns {
3032
3033 /**
3034 * Not instantiable.
3035 * @hide
3036 */
3037 private Draft() {
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/drafts");
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 all MMS messages in the MMS app outbox.
3054 */
3055 public static final class Outbox implements BaseMmsColumns {
3056
3057 /**
3058 * Not instantiable.
3059 * @hide
3060 */
3061 private Outbox() {
3062 }
3063
3064 /**
3065 * The {@code content://} style URL for this table.
3066 */
3067 public static final Uri
3068 CONTENT_URI = Uri.parse("content://mms/outbox");
3069
3070 /**
3071 * The default sort order for this table.
3072 */
3073 public static final String DEFAULT_SORT_ORDER = "date DESC";
3074 }
3075
3076 /**
3077 * Contains address information for an MMS message.
3078 */
3079 public static final class Addr implements BaseColumns {
3080
3081 /**
3082 * Not instantiable.
3083 * @hide
3084 */
3085 private Addr() {
3086 }
3087
3088 /**
3089 * The ID of MM which this address entry belongs to.
3090 * <P>Type: INTEGER (long)</P>
3091 */
3092 public static final String MSG_ID = "msg_id";
3093
3094 /**
3095 * The ID of contact entry in Phone Book.
3096 * <P>Type: INTEGER (long)</P>
3097 */
3098 public static final String CONTACT_ID = "contact_id";
3099
3100 /**
3101 * The address text.
3102 * <P>Type: TEXT</P>
3103 */
3104 public static final String ADDRESS = "address";
3105
3106 /**
3107 * Type of address: must be one of {@code PduHeaders.BCC},
3108 * {@code PduHeaders.CC}, {@code PduHeaders.FROM}, {@code PduHeaders.TO}.
3109 * <P>Type: INTEGER</P>
3110 */
3111 public static final String TYPE = "type";
3112
3113 /**
3114 * Character set of this entry (MMS charset value).
3115 * <P>Type: INTEGER</P>
3116 */
3117 public static final String CHARSET = "charset";
Nagarajaa15ee4d2019-07-09 14:54:33 +05303118
3119 /**
3120 * Generates a Addr {@link Uri} for message, used to perform Addr table operation
3121 * for mms.
3122 *
3123 * @param messageId the messageId used to generate Addr {@link Uri} dynamically
3124 * @return the addrUri used to perform Addr table operation for mms
3125 */
3126 @NonNull
3127 public static Uri getAddrUriForMessage(@NonNull String messageId) {
3128 Uri addrUri = Mms.CONTENT_URI.buildUpon()
3129 .appendPath(String.valueOf(messageId)).appendPath("addr").build();
3130 return addrUri;
3131 }
Dan Willemsen4980bf42017-02-14 14:17:12 -08003132 }
3133
3134 /**
3135 * Contains message parts.
Leland Miller6c753552019-01-22 17:28:55 -08003136 *
3137 * To avoid issues where applications might cache a part ID, the ID of a deleted part must
3138 * not be reused to point at a new part.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003139 */
3140 public static final class Part implements BaseColumns {
3141
3142 /**
3143 * Not instantiable.
3144 * @hide
3145 */
3146 private Part() {
3147 }
3148
3149 /**
Nagarajaa15ee4d2019-07-09 14:54:33 +05303150 * The name of part table.
3151 */
3152 private static final String TABLE_PART = "part";
3153
3154 /**
Leland Miller6c753552019-01-22 17:28:55 -08003155 * The {@code content://} style URL for this table. Can be appended with a part ID to
3156 * address individual parts.
3157 */
Leland Miller7a29ca62019-04-15 15:57:28 -07003158 @NonNull
Nagarajaa15ee4d2019-07-09 14:54:33 +05303159 public static final Uri CONTENT_URI = Uri.withAppendedPath(Mms.CONTENT_URI, TABLE_PART);
Leland Miller6c753552019-01-22 17:28:55 -08003160
3161 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08003162 * The identifier of the message which this part belongs to.
3163 * <P>Type: INTEGER</P>
3164 */
3165 public static final String MSG_ID = "mid";
3166
3167 /**
3168 * The order of the part.
3169 * <P>Type: INTEGER</P>
3170 */
3171 public static final String SEQ = "seq";
3172
3173 /**
3174 * The content type of the part.
3175 * <P>Type: TEXT</P>
3176 */
3177 public static final String CONTENT_TYPE = "ct";
3178
3179 /**
3180 * The name of the part.
3181 * <P>Type: TEXT</P>
3182 */
3183 public static final String NAME = "name";
3184
3185 /**
3186 * The charset of the part.
3187 * <P>Type: TEXT</P>
3188 */
3189 public static final String CHARSET = "chset";
3190
3191 /**
3192 * The file name of the part.
3193 * <P>Type: TEXT</P>
3194 */
3195 public static final String FILENAME = "fn";
3196
3197 /**
3198 * The content disposition of the part.
3199 * <P>Type: TEXT</P>
3200 */
3201 public static final String CONTENT_DISPOSITION = "cd";
3202
3203 /**
3204 * The content ID of the part.
3205 * <P>Type: INTEGER</P>
3206 */
3207 public static final String CONTENT_ID = "cid";
3208
3209 /**
3210 * The content location of the part.
3211 * <P>Type: INTEGER</P>
3212 */
3213 public static final String CONTENT_LOCATION = "cl";
3214
3215 /**
3216 * The start of content-type of the message.
3217 * <P>Type: INTEGER</P>
3218 */
3219 public static final String CT_START = "ctt_s";
3220
3221 /**
3222 * The type of content-type of the message.
3223 * <P>Type: TEXT</P>
3224 */
3225 public static final String CT_TYPE = "ctt_t";
3226
3227 /**
3228 * The location (on filesystem) of the binary data of the part.
3229 * <P>Type: INTEGER</P>
3230 */
3231 public static final String _DATA = "_data";
3232
3233 /**
3234 * The message text.
3235 * <P>Type: TEXT</P>
3236 */
3237 public static final String TEXT = "text";
Nagarajaa15ee4d2019-07-09 14:54:33 +05303238
3239 /**
3240 * Generates a Part {@link Uri} for message, used to perform Part table operation
3241 * for mms.
3242 *
3243 * @param messageId the messageId used to generate Part {@link Uri} dynamically
3244 * @return the partUri used to perform Part table operation for mms
3245 */
3246 @NonNull
3247 public static Uri getPartUriForMessage(@NonNull String messageId) {
3248 Uri partUri = Mms.CONTENT_URI.buildUpon()
3249 .appendPath(String.valueOf(messageId)).appendPath(
3250 TABLE_PART).build();
3251 return partUri;
3252 }
Dan Willemsen4980bf42017-02-14 14:17:12 -08003253 }
3254
3255 /**
3256 * Message send rate table.
3257 */
3258 public static final class Rate {
3259
3260 /**
3261 * Not instantiable.
3262 * @hide
3263 */
3264 private Rate() {
3265 }
3266
3267 /**
3268 * The {@code content://} style URL for this table.
3269 */
3270 public static final Uri CONTENT_URI = Uri.withAppendedPath(
3271 Mms.CONTENT_URI, "rate");
3272
3273 /**
3274 * When a message was successfully sent.
3275 * <P>Type: INTEGER (long)</P>
3276 */
3277 public static final String SENT_TIME = "sent_time";
3278 }
3279
3280 /**
3281 * Intents class.
3282 */
3283 public static final class Intents {
3284
3285 /**
3286 * Not instantiable.
3287 * @hide
3288 */
3289 private Intents() {
3290 }
3291
3292 /**
3293 * Indicates that the contents of specified URIs were changed.
3294 * The application which is showing or caching these contents
3295 * should be updated.
3296 */
3297 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
3298 public static final String CONTENT_CHANGED_ACTION
3299 = "android.intent.action.CONTENT_CHANGED";
3300
3301 /**
3302 * An extra field which stores the URI of deleted contents.
3303 */
3304 public static final String DELETED_CONTENTS = "deleted_contents";
3305 }
3306 }
3307
3308 /**
3309 * Contains all MMS and SMS messages.
3310 */
3311 public static final class MmsSms implements BaseColumns {
3312
3313 /**
3314 * Not instantiable.
3315 * @hide
3316 */
3317 private MmsSms() {
3318 }
3319
3320 /**
3321 * The column to distinguish SMS and MMS messages in query results.
3322 */
3323 public static final String TYPE_DISCRIMINATOR_COLUMN =
3324 "transport_type";
3325
3326 /**
3327 * The {@code content://} style URL for this table.
3328 */
3329 public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/");
3330
3331 /**
3332 * The {@code content://} style URL for this table, by conversation.
3333 */
3334 public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse(
3335 "content://mms-sms/conversations");
3336
3337 /**
3338 * The {@code content://} style URL for this table, by phone number.
3339 */
3340 public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse(
3341 "content://mms-sms/messages/byphone");
3342
3343 /**
3344 * The {@code content://} style URL for undelivered messages in this table.
3345 */
3346 public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse(
3347 "content://mms-sms/undelivered");
3348
3349 /**
3350 * The {@code content://} style URL for draft messages in this table.
3351 */
3352 public static final Uri CONTENT_DRAFT_URI = Uri.parse(
3353 "content://mms-sms/draft");
3354
3355 /**
3356 * The {@code content://} style URL for locked messages in this table.
Nagarajaec816a02019-05-22 15:57:59 +05303357 * <P>This {@link Uri} is used to check at most one locked message found in the union of MMS
3358 * and SMS messages. Also this will return only _id column in response.</P>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003359 */
3360 public static final Uri CONTENT_LOCKED_URI = Uri.parse(
3361 "content://mms-sms/locked");
3362
3363 /**
3364 * Pass in a query parameter called "pattern" which is the text to search for.
3365 * The sort order is fixed to be: {@code thread_id ASC, date DESC}.
3366 */
3367 public static final Uri SEARCH_URI = Uri.parse(
3368 "content://mms-sms/search");
3369
3370 // Constants for message protocol types.
3371
3372 /** SMS protocol type. */
3373 public static final int SMS_PROTO = 0;
3374
3375 /** MMS protocol type. */
3376 public static final int MMS_PROTO = 1;
3377
3378 // Constants for error types of pending messages.
3379
3380 /** Error type: no error. */
3381 public static final int NO_ERROR = 0;
3382
3383 /** Error type: generic transient error. */
3384 public static final int ERR_TYPE_GENERIC = 1;
3385
3386 /** Error type: SMS protocol transient error. */
3387 public static final int ERR_TYPE_SMS_PROTO_TRANSIENT = 2;
3388
3389 /** Error type: MMS protocol transient error. */
3390 public static final int ERR_TYPE_MMS_PROTO_TRANSIENT = 3;
3391
3392 /** Error type: transport failure. */
3393 public static final int ERR_TYPE_TRANSPORT_FAILURE = 4;
3394
3395 /** Error type: permanent error (along with all higher error values). */
3396 public static final int ERR_TYPE_GENERIC_PERMANENT = 10;
3397
3398 /** Error type: SMS protocol permanent error. */
3399 public static final int ERR_TYPE_SMS_PROTO_PERMANENT = 11;
3400
3401 /** Error type: MMS protocol permanent error. */
3402 public static final int ERR_TYPE_MMS_PROTO_PERMANENT = 12;
3403
3404 /**
3405 * Contains pending messages info.
3406 */
3407 public static final class PendingMessages implements BaseColumns {
3408
3409 /**
3410 * Not instantiable.
3411 * @hide
3412 */
3413 private PendingMessages() {
3414 }
3415
3416 public static final Uri CONTENT_URI = Uri.withAppendedPath(
3417 MmsSms.CONTENT_URI, "pending");
3418
3419 /**
3420 * The type of transport protocol (MMS or SMS).
3421 * <P>Type: INTEGER</P>
3422 */
3423 public static final String PROTO_TYPE = "proto_type";
3424
3425 /**
3426 * The ID of the message to be sent or downloaded.
3427 * <P>Type: INTEGER (long)</P>
3428 */
3429 public static final String MSG_ID = "msg_id";
3430
3431 /**
3432 * The type of the message to be sent or downloaded.
3433 * This field is only valid for MM. For SM, its value is always set to 0.
3434 * <P>Type: INTEGER</P>
3435 */
3436 public static final String MSG_TYPE = "msg_type";
3437
3438 /**
3439 * The type of the error code.
3440 * <P>Type: INTEGER</P>
3441 */
3442 public static final String ERROR_TYPE = "err_type";
3443
3444 /**
3445 * The error code of sending/retrieving process.
3446 * <P>Type: INTEGER</P>
3447 */
3448 public static final String ERROR_CODE = "err_code";
3449
3450 /**
3451 * How many times we tried to send or download the message.
3452 * <P>Type: INTEGER</P>
3453 */
3454 public static final String RETRY_INDEX = "retry_index";
3455
3456 /**
3457 * The time to do next retry.
3458 * <P>Type: INTEGER (long)</P>
3459 */
3460 public static final String DUE_TIME = "due_time";
3461
3462 /**
3463 * The time we last tried to send or download the message.
3464 * <P>Type: INTEGER (long)</P>
3465 */
3466 public static final String LAST_TRY = "last_try";
3467
3468 /**
3469 * The subscription to which the message belongs to. Its value will be
3470 * < 0 if the sub id cannot be determined.
3471 * <p>Type: INTEGER (long) </p>
3472 */
3473 public static final String SUBSCRIPTION_ID = "pending_sub_id";
3474 }
3475
3476 /**
3477 * Words table used by provider for full-text searches.
3478 * @hide
3479 */
3480 public static final class WordsTable {
3481
3482 /**
3483 * Not instantiable.
3484 * @hide
3485 */
3486 private WordsTable() {}
3487
3488 /**
3489 * Primary key.
3490 * <P>Type: INTEGER (long)</P>
3491 */
3492 public static final String ID = "_id";
3493
3494 /**
3495 * Source row ID.
3496 * <P>Type: INTEGER (long)</P>
3497 */
3498 public static final String SOURCE_ROW_ID = "source_id";
3499
3500 /**
3501 * Table ID (either 1 or 2).
3502 * <P>Type: INTEGER</P>
3503 */
3504 public static final String TABLE_ID = "table_to_use";
3505
3506 /**
3507 * The words to index.
3508 * <P>Type: TEXT</P>
3509 */
3510 public static final String INDEXED_TEXT = "index_text";
3511 }
3512 }
3513
3514 /**
3515 * Carriers class contains information about APNs, including MMSC information.
3516 */
3517 public static final class Carriers implements BaseColumns {
3518
3519 /**
3520 * Not instantiable.
3521 * @hide
3522 */
3523 private Carriers() {}
3524
3525 /**
3526 * The {@code content://} style URL for this table.
calvinpan5e272372018-12-07 20:03:48 +08003527 * For MSIM, this will return APNs for the default subscription
3528 * {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId for MSIM,
3529 * use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003530 */
calvinpanef7b99a2019-04-12 18:48:18 +08003531 @NonNull
Dan Willemsen4980bf42017-02-14 14:17:12 -08003532 public static final Uri CONTENT_URI = Uri.parse("content://telephony/carriers");
3533
3534 /**
calvinpan5e272372018-12-07 20:03:48 +08003535 * The {@code content://} style URL for this table. Used for APN query based on current
3536 * subscription. Instead of specifying carrier matching information in the selection,
3537 * this API will return all matching APNs from current subscription carrier and queries
3538 * will be applied on top of that. If there is no match for MVNO (Mobile Virtual Network
3539 * Operator) APNs, return APNs from its MNO (based on mccmnc) instead. For MSIM, this will
3540 * return APNs for the default subscription
3541 * {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId for MSIM,
3542 * use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id.
3543 */
calvinpanef7b99a2019-04-12 18:48:18 +08003544 @NonNull
calvinpan5e272372018-12-07 20:03:48 +08003545 public static final Uri SIM_APN_URI = Uri.parse(
3546 "content://telephony/carriers/sim_apn_list");
3547
3548 /**
yuemingw4c0065f2018-01-16 19:48:10 +00003549 * The {@code content://} style URL to be called from DevicePolicyManagerService,
3550 * can manage DPC-owned APNs.
3551 * @hide
3552 */
Hall Liuefc4962e2019-12-27 14:21:58 -08003553 @SystemApi
3554 public static final @NonNull Uri DPC_URI = Uri.parse("content://telephony/carriers/dpc");
yuemingw4c0065f2018-01-16 19:48:10 +00003555
3556 /**
3557 * The {@code content://} style URL to be called from Telephony to query APNs.
3558 * When DPC-owned APNs are enforced, only DPC-owned APNs are returned, otherwise only
calvinpan5e272372018-12-07 20:03:48 +08003559 * non-DPC-owned APNs are returned. For MSIM, this will return APNs for the default
3560 * subscription {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId
3561 * for MSIM, use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id.
yuemingw4c0065f2018-01-16 19:48:10 +00003562 * @hide
3563 */
3564 public static final Uri FILTERED_URI = Uri.parse("content://telephony/carriers/filtered");
3565
3566 /**
3567 * The {@code content://} style URL to be called from DevicePolicyManagerService
3568 * or Telephony to manage whether DPC-owned APNs are enforced.
3569 * @hide
3570 */
3571 public static final Uri ENFORCE_MANAGED_URI = Uri.parse(
3572 "content://telephony/carriers/enforce_managed");
3573
3574 /**
3575 * The column name for ENFORCE_MANAGED_URI, indicates whether DPC-owned APNs are enforced.
3576 * @hide
3577 */
3578 public static final String ENFORCE_KEY = "enforced";
3579
3580 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08003581 * The default sort order for this table.
3582 */
3583 public static final String DEFAULT_SORT_ORDER = "name ASC";
3584
3585 /**
3586 * Entry name.
3587 * <P>Type: TEXT</P>
3588 */
3589 public static final String NAME = "name";
3590
3591 /**
3592 * APN name.
3593 * <P>Type: TEXT</P>
3594 */
3595 public static final String APN = "apn";
3596
3597 /**
3598 * Proxy address.
3599 * <P>Type: TEXT</P>
3600 */
3601 public static final String PROXY = "proxy";
3602
3603 /**
3604 * Proxy port.
3605 * <P>Type: TEXT</P>
3606 */
3607 public static final String PORT = "port";
3608
3609 /**
3610 * MMS proxy address.
3611 * <P>Type: TEXT</P>
3612 */
3613 public static final String MMSPROXY = "mmsproxy";
3614
3615 /**
3616 * MMS proxy port.
3617 * <P>Type: TEXT</P>
3618 */
3619 public static final String MMSPORT = "mmsport";
3620
3621 /**
3622 * Server address.
3623 * <P>Type: TEXT</P>
3624 */
3625 public static final String SERVER = "server";
3626
3627 /**
3628 * APN username.
3629 * <P>Type: TEXT</P>
3630 */
3631 public static final String USER = "user";
3632
3633 /**
3634 * APN password.
3635 * <P>Type: TEXT</P>
3636 */
3637 public static final String PASSWORD = "password";
3638
3639 /**
3640 * MMSC URL.
3641 * <P>Type: TEXT</P>
3642 */
3643 public static final String MMSC = "mmsc";
3644
3645 /**
3646 * Mobile Country Code (MCC).
3647 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003648 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3649 * matching APNs based on current subscription carrier, thus no need to specify MCC and
3650 * other carrier matching information. In the future, Android will not support MCC for
3651 * APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003652 */
3653 public static final String MCC = "mcc";
3654
3655 /**
3656 * Mobile Network Code (MNC).
3657 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003658 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3659 * matching APNs based on current subscription carrier, thus no need to specify MNC and
3660 * other carrier matching information. In the future, Android will not support MNC for
3661 * APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003662 */
3663 public static final String MNC = "mnc";
3664
3665 /**
3666 * Numeric operator ID (as String). Usually {@code MCC + MNC}.
3667 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003668 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3669 * matching APNs based on current subscription carrier, thus no need to specify Numeric
3670 * and other carrier matching information. In the future, Android will not support Numeric
3671 * for APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003672 */
3673 public static final String NUMERIC = "numeric";
3674
3675 /**
3676 * Authentication type.
3677 * <P>Type: INTEGER</P>
3678 */
3679 public static final String AUTH_TYPE = "authtype";
3680
3681 /**
3682 * Comma-delimited list of APN types.
3683 * <P>Type: TEXT</P>
3684 */
3685 public static final String TYPE = "type";
3686
3687 /**
3688 * The protocol to use to connect to this APN.
3689 *
3690 * One of the {@code PDP_type} values in TS 27.007 section 10.1.1.
3691 * For example: {@code IP}, {@code IPV6}, {@code IPV4V6}, or {@code PPP}.
3692 * <P>Type: TEXT</P>
3693 */
3694 public static final String PROTOCOL = "protocol";
3695
3696 /**
3697 * The protocol to use to connect to this APN when roaming.
3698 * The syntax is the same as protocol.
3699 * <P>Type: TEXT</P>
3700 */
3701 public static final String ROAMING_PROTOCOL = "roaming_protocol";
3702
3703 /**
3704 * Is this the current APN?
3705 * <P>Type: INTEGER (boolean)</P>
3706 */
3707 public static final String CURRENT = "current";
3708
3709 /**
3710 * Is this APN enabled?
3711 * <P>Type: INTEGER (boolean)</P>
3712 */
3713 public static final String CARRIER_ENABLED = "carrier_enabled";
3714
3715 /**
3716 * Radio Access Technology info.
3717 * To check what values are allowed, refer to {@link android.telephony.ServiceState}.
3718 * This should be spread to other technologies,
3719 * but is currently only used for LTE (14) and eHRPD (13).
3720 * <P>Type: INTEGER</P>
Cassiee1c88022018-02-22 08:51:03 -08003721 * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead
Dan Willemsen4980bf42017-02-14 14:17:12 -08003722 */
Cassied53df962017-12-05 13:34:33 -08003723 @Deprecated
Dan Willemsen4980bf42017-02-14 14:17:12 -08003724 public static final String BEARER = "bearer";
3725
3726 /**
3727 * Radio Access Technology bitmask.
3728 * To check what values can be contained, refer to {@link android.telephony.ServiceState}.
3729 * 0 indicates all techs otherwise first bit refers to RAT/bearer 1, second bit refers to
3730 * RAT/bearer 2 and so on.
3731 * Bitmask for a radio tech R is (1 << (R - 1))
3732 * <P>Type: INTEGER</P>
3733 * @hide
Cassiee1c88022018-02-22 08:51:03 -08003734 * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead
Dan Willemsen4980bf42017-02-14 14:17:12 -08003735 */
Cassied53df962017-12-05 13:34:33 -08003736 @Deprecated
Daniel Brightd4284232020-01-22 14:54:57 -08003737 @SystemApi
Dan Willemsen4980bf42017-02-14 14:17:12 -08003738 public static final String BEARER_BITMASK = "bearer_bitmask";
3739
3740 /**
Cassied53df962017-12-05 13:34:33 -08003741 * Radio technology (network type) bitmask.
Cassiee1c88022018-02-22 08:51:03 -08003742 * To check what values can be contained, refer to the NETWORK_TYPE_ constants in
Cassied53df962017-12-05 13:34:33 -08003743 * {@link android.telephony.TelephonyManager}.
3744 * Bitmask for a radio tech R is (1 << (R - 1))
3745 * <P>Type: INTEGER</P>
3746 */
3747 public static final String NETWORK_TYPE_BITMASK = "network_type_bitmask";
3748
3749 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08003750 * MVNO type:
3751 * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}.
3752 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003753 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3754 * matching APNs based on current subscription carrier, thus no need to specify MVNO_TYPE
3755 * and other carrier matching information. In the future, Android will not support MVNO_TYPE
3756 * for APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003757 */
3758 public static final String MVNO_TYPE = "mvno_type";
3759
3760 /**
3761 * MVNO data.
3762 * Use the following examples.
3763 * <ul>
3764 * <li>SPN: A MOBILE, BEN NL, ...</li>
3765 * <li>IMSI: 302720x94, 2060188, ...</li>
3766 * <li>GID: 4E, 33, ...</li>
3767 * </ul>
3768 * <P>Type: TEXT</P>
calvinpan5e272372018-12-07 20:03:48 +08003769 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return
3770 * matching APNs based on current subscription carrier, thus no need to specify
3771 * MVNO_MATCH_DATA and other carrier matching information. In the future, Android will not
3772 * support MVNO_MATCH_DATA for APN query.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003773 */
3774 public static final String MVNO_MATCH_DATA = "mvno_match_data";
3775
3776 /**
3777 * The subscription to which the APN belongs to
3778 * <p>Type: INTEGER (long) </p>
3779 */
3780 public static final String SUBSCRIPTION_ID = "sub_id";
3781
3782 /**
chen xu85100482018-10-12 15:30:34 -07003783 * The profile_id to which the APN saved in modem.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003784 * <p>Type: INTEGER</p>
3785 *@hide
3786 */
Daniel Brightd4284232020-01-22 14:54:57 -08003787 @SystemApi
Dan Willemsen4980bf42017-02-14 14:17:12 -08003788 public static final String PROFILE_ID = "profile_id";
3789
3790 /**
chen xu85100482018-10-12 15:30:34 -07003791 * If set to {@code true}, then the APN setting will persist to the modem.
3792 * <p>Type: INTEGER (boolean)</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003793 *@hide
3794 */
chen xu85100482018-10-12 15:30:34 -07003795 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003796 public static final String MODEM_PERSIST = "modem_cognitive";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003797
3798 /**
chen xu5caa18c2018-11-28 00:21:50 -08003799 * The max number of connections of this APN.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003800 * <p>Type: INTEGER</p>
3801 *@hide
3802 */
chen xu85100482018-10-12 15:30:34 -07003803 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003804 public static final String MAX_CONNECTIONS = "max_conns";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003805
3806 /**
chen xu5caa18c2018-11-28 00:21:50 -08003807 * The wait time for retrying the APN, in milliseconds.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003808 * <p>Type: INTEGER</p>
3809 *@hide
3810 */
chen xu85100482018-10-12 15:30:34 -07003811 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003812 public static final String WAIT_TIME_RETRY = "wait_time";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003813
3814 /**
chen xu5caa18c2018-11-28 00:21:50 -08003815 * The max number of seconds this APN will support its maximum number of connections
3816 * as defined in {@link #MAX_CONNECTIONS}.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003817 * <p>Type: INTEGER</p>
3818 *@hide
3819 */
chen xu85100482018-10-12 15:30:34 -07003820 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003821 public static final String TIME_LIMIT_FOR_MAX_CONNECTIONS = "max_conns_time";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003822
3823 /**
chen xu5caa18c2018-11-28 00:21:50 -08003824 * The MTU (maximum transmit unit) size of the mobile interface to which the APN is
3825 * connected, in bytes.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003826 * <p>Type: INTEGER </p>
3827 * @hide
3828 */
chen xu85100482018-10-12 15:30:34 -07003829 @SystemApi
Dan Willemsen4980bf42017-02-14 14:17:12 -08003830 public static final String MTU = "mtu";
3831
3832 /**
chen xu85100482018-10-12 15:30:34 -07003833 * APN edit status. APN could be added/edited/deleted by a user or carrier.
chen xu5caa18c2018-11-28 00:21:50 -08003834 * see all possible returned APN edit status.
3835 * <ul>
3836 * <li>{@link #UNEDITED}</li>
3837 * <li>{@link #USER_EDITED}</li>
3838 * <li>{@link #USER_DELETED}</li>
3839 * <li>{@link #CARRIER_EDITED}</li>
3840 * <li>{@link #CARRIER_DELETED}</li>
3841 * </ul>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003842 * <p>Type: INTEGER </p>
3843 * @hide
3844 */
chen xu85100482018-10-12 15:30:34 -07003845 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003846 public static final String EDITED_STATUS = "edited";
Dan Willemsen4980bf42017-02-14 14:17:12 -08003847
3848 /**
chen xu85100482018-10-12 15:30:34 -07003849 * {@code true} if this APN visible to the user, {@code false} otherwise.
3850 * <p>Type: INTEGER (boolean)</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003851 * @hide
3852 */
chen xu85100482018-10-12 15:30:34 -07003853 @SystemApi
Dan Willemsen4980bf42017-02-14 14:17:12 -08003854 public static final String USER_VISIBLE = "user_visible";
3855
3856 /**
chen xu85100482018-10-12 15:30:34 -07003857 * {@code true} if the user allowed to edit this APN, {@code false} otherwise.
3858 * <p>Type: INTEGER (boolean)</p>
Amit Mahajand4977942017-07-17 14:46:39 -07003859 * @hide
3860 */
chen xu85100482018-10-12 15:30:34 -07003861 @SystemApi
Amit Mahajand4977942017-07-17 14:46:39 -07003862 public static final String USER_EDITABLE = "user_editable";
3863
3864 /**
Hall Liuefc4962e2019-12-27 14:21:58 -08003865 * Integer value denoting an invalid APN id
3866 * @hide
3867 */
3868 @SystemApi
3869 public static final int INVALID_APN_ID = -1;
3870
3871 /**
chen xu5caa18c2018-11-28 00:21:50 -08003872 * {@link #EDITED_STATUS APN edit status} indicates that this APN has not been edited or
3873 * fails to edit.
chen xu85100482018-10-12 15:30:34 -07003874 * <p>Type: INTEGER </p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003875 * @hide
3876 */
chen xu85100482018-10-12 15:30:34 -07003877 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003878 public static final @EditStatus int UNEDITED = 0;
chen xu85100482018-10-12 15:30:34 -07003879
Dan Willemsen4980bf42017-02-14 14:17:12 -08003880 /**
chen xu5caa18c2018-11-28 00:21:50 -08003881 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by users.
chen xu85100482018-10-12 15:30:34 -07003882 * <p>Type: INTEGER </p>
3883 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003884 */
chen xu85100482018-10-12 15:30:34 -07003885 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003886 public static final @EditStatus int USER_EDITED = 1;
chen xu85100482018-10-12 15:30:34 -07003887
Dan Willemsen4980bf42017-02-14 14:17:12 -08003888 /**
chen xu5caa18c2018-11-28 00:21:50 -08003889 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by users.
chen xu85100482018-10-12 15:30:34 -07003890 * <p>Type: INTEGER </p>
3891 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003892 */
chen xu85100482018-10-12 15:30:34 -07003893 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003894 public static final @EditStatus int USER_DELETED = 2;
chen xu85100482018-10-12 15:30:34 -07003895
Dan Willemsen4980bf42017-02-14 14:17:12 -08003896 /**
chen xu5caa18c2018-11-28 00:21:50 -08003897 * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an
3898 * entry deleted by the user is still present in the new APN database and therefore must
3899 * remain tagged as user deleted rather than completely removed from the database.
Dan Willemsen4980bf42017-02-14 14:17:12 -08003900 * @hide
3901 */
3902 public static final int USER_DELETED_BUT_PRESENT_IN_XML = 3;
chen xu85100482018-10-12 15:30:34 -07003903
Dan Willemsen4980bf42017-02-14 14:17:12 -08003904 /**
chen xu5caa18c2018-11-28 00:21:50 -08003905 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by
3906 * carriers.
chen xu85100482018-10-12 15:30:34 -07003907 * <p>Type: INTEGER </p>
3908 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003909 */
chen xu85100482018-10-12 15:30:34 -07003910 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003911 public static final @EditStatus int CARRIER_EDITED = 4;
chen xu85100482018-10-12 15:30:34 -07003912
Dan Willemsen4980bf42017-02-14 14:17:12 -08003913 /**
chen xu5caa18c2018-11-28 00:21:50 -08003914 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by
3915 * carriers. CARRIER_DELETED values are currently not used as there is no use case.
3916 * If they are used, delete() will have to change accordingly. Currently it is hardcoded to
3917 * USER_DELETED.
chen xu85100482018-10-12 15:30:34 -07003918 * <p>Type: INTEGER </p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08003919 * @hide
3920 */
chen xu5caa18c2018-11-28 00:21:50 -08003921 public static final @EditStatus int CARRIER_DELETED = 5;
chen xu85100482018-10-12 15:30:34 -07003922
Dan Willemsen4980bf42017-02-14 14:17:12 -08003923 /**
chen xu5caa18c2018-11-28 00:21:50 -08003924 * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an
3925 * entry deleted by the carrier is still present in the new APN database and therefore must
3926 * remain tagged as user deleted rather than completely removed from the database.
chen xu85100482018-10-12 15:30:34 -07003927 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08003928 */
3929 public static final int CARRIER_DELETED_BUT_PRESENT_IN_XML = 6;
yuemingwcf263eb2017-11-08 13:12:18 +00003930
3931 /**
3932 * The owner of the APN.
3933 * <p>Type: INTEGER</p>
3934 * @hide
3935 */
3936 public static final String OWNED_BY = "owned_by";
3937
3938 /**
3939 * Possible value for the OWNED_BY field.
3940 * APN is owned by DPC.
3941 * @hide
3942 */
3943 public static final int OWNED_BY_DPC = 0;
Jordan Liu40617152018-04-06 11:10:12 -07003944
yuemingwcf263eb2017-11-08 13:12:18 +00003945 /**
3946 * Possible value for the OWNED_BY field.
3947 * APN is owned by other sources.
3948 * @hide
3949 */
3950 public static final int OWNED_BY_OTHERS = 1;
Jordan Liu40617152018-04-06 11:10:12 -07003951
3952 /**
3953 * The APN set id. When the user manually selects an APN or the framework sets an APN as
3954 * preferred, all APNs with the same set id as the selected APN should be prioritized over
3955 * APNs in other sets.
chen xu85100482018-10-12 15:30:34 -07003956 * <p>Type: INTEGER</p>
Jordan Liu40617152018-04-06 11:10:12 -07003957 * @hide
3958 */
chen xu85100482018-10-12 15:30:34 -07003959 @SystemApi
Jordan Liu40617152018-04-06 11:10:12 -07003960 public static final String APN_SET_ID = "apn_set_id";
3961
3962 /**
chen xu5caa18c2018-11-28 00:21:50 -08003963 * Possible value for the {@link #APN_SET_ID} field. By default APNs will not belong to a
3964 * set. If the user manually selects an APN without apn set id, there is no need to
3965 * prioritize any specific APN set ids.
chen xu85100482018-10-12 15:30:34 -07003966 * <p>Type: INTEGER</p>
Jordan Liu40617152018-04-06 11:10:12 -07003967 * @hide
3968 */
chen xu85100482018-10-12 15:30:34 -07003969 @SystemApi
chen xu5caa18c2018-11-28 00:21:50 -08003970 public static final int NO_APN_SET_ID = 0;
Jordan Liu40617152018-04-06 11:10:12 -07003971
calvinpanbeb6cb32018-10-19 15:11:22 +08003972 /**
3973 * A unique carrier id associated with this APN
3974 * {@see TelephonyManager#getSimCarrierId()}
3975 * <p>Type: STRING</p>
3976 */
3977 public static final String CARRIER_ID = "carrier_id";
3978
Yuuki Habuaaea4a52019-02-22 11:29:26 +09003979 /**
3980 * The skip 464xlat flag. Flag works as follows.
3981 * {@link #SKIP_464XLAT_DEFAULT}: the APN will skip only APN is IMS and no internet.
3982 * {@link #SKIP_464XLAT_DISABLE}: the APN will NOT skip 464xlat
3983 * {@link #SKIP_464XLAT_ENABLE}: the APN will skip 464xlat
3984 * <p>Type: INTEGER</p>
3985 *
3986 * @hide
3987 */
Daniel Brightd4284232020-01-22 14:54:57 -08003988 @SystemApi
Yuuki Habuaaea4a52019-02-22 11:29:26 +09003989 public static final String SKIP_464XLAT = "skip_464xlat";
3990
3991 /**
3992 * Possible value for the {@link #SKIP_464XLAT} field.
3993 * <p>Type: INTEGER</p>
3994 *
3995 * @hide
3996 */
Daniel Brightd4284232020-01-22 14:54:57 -08003997 @SystemApi
Yuuki Habuaaea4a52019-02-22 11:29:26 +09003998 public static final int SKIP_464XLAT_DEFAULT = -1;
3999
4000 /**
4001 * Possible value for the {@link #SKIP_464XLAT} field.
4002 * <p>Type: INTEGER</p>
4003 *
4004 * @hide
4005 */
Daniel Brightd4284232020-01-22 14:54:57 -08004006 @SystemApi
Yuuki Habuaaea4a52019-02-22 11:29:26 +09004007 public static final int SKIP_464XLAT_DISABLE = 0;
4008
4009 /**
4010 * Possible value for the {@link #SKIP_464XLAT} field.
4011 * <p>Type: INTEGER</p>
4012 *
4013 * @hide
4014 */
Daniel Brightd4284232020-01-22 14:54:57 -08004015 @SystemApi
Yuuki Habuaaea4a52019-02-22 11:29:26 +09004016 public static final int SKIP_464XLAT_ENABLE = 1;
4017
4018
chen xu5caa18c2018-11-28 00:21:50 -08004019 /** @hide */
4020 @IntDef({
4021 UNEDITED,
4022 USER_EDITED,
4023 USER_DELETED,
4024 CARRIER_DELETED,
4025 CARRIER_EDITED,
4026 })
4027 @Retention(RetentionPolicy.SOURCE)
4028 public @interface EditStatus {}
Yuuki Habuaaea4a52019-02-22 11:29:26 +09004029
Hall Liu45a351e2019-11-21 16:35:37 -08004030 /**
4031 * Compat framework change ID for the APN db read permission change.
4032 *
4033 * In API level 30 and beyond, accessing the APN database will require the
4034 * {@link android.Manifest.permission#WRITE_APN_SETTINGS} permission. This change ID tracks
4035 * apps that are affected because they don't hold this permission.
4036 * @hide
4037 */
4038 @ChangeId
4039 public static final long APN_READING_PERMISSION_CHANGE_ID = 124107808L;
Dan Willemsen4980bf42017-02-14 14:17:12 -08004040 }
4041
4042 /**
Chen Xua32c7fc2019-10-21 22:47:27 -07004043 * Contains received cell broadcast messages. More details are available in 3GPP TS 23.041.
Dan Willemsen4980bf42017-02-14 14:17:12 -08004044 * @hide
4045 */
Jordan Liu657ef5a2019-08-16 14:07:03 -07004046 @SystemApi
Chen Xua32c7fc2019-10-21 22:47:27 -07004047 @TestApi
Dan Willemsen4980bf42017-02-14 14:17:12 -08004048 public static final class CellBroadcasts implements BaseColumns {
4049
4050 /**
4051 * Not instantiable.
4052 * @hide
4053 */
4054 private CellBroadcasts() {}
4055
4056 /**
4057 * The {@code content://} URI for this table.
Chen Xua32c7fc2019-10-21 22:47:27 -07004058 * Only privileged framework components running on phone or network stack uid can
4059 * query or modify this table.
Dan Willemsen4980bf42017-02-14 14:17:12 -08004060 */
Jordan Liu657ef5a2019-08-16 14:07:03 -07004061 @NonNull
Dan Willemsen4980bf42017-02-14 14:17:12 -08004062 public static final Uri CONTENT_URI = Uri.parse("content://cellbroadcasts");
4063
4064 /**
Chen Xua32c7fc2019-10-21 22:47:27 -07004065 * The {@code content://} URI for query cellbroadcast message history.
4066 * query results include following entries
4067 * <ul>
4068 * <li>{@link #_ID}</li>
4069 * <li>{@link #SLOT_INDEX}</li>
4070 * <li>{@link #GEOGRAPHICAL_SCOPE}</li>
4071 * <li>{@link #PLMN}</li>
4072 * <li>{@link #LAC}</li>
4073 * <li>{@link #CID}</li>
4074 * <li>{@link #SERIAL_NUMBER}</li>
4075 * <li>{@link #SERVICE_CATEGORY}</li>
4076 * <li>{@link #LANGUAGE_CODE}</li>
4077 * <li>{@link #MESSAGE_BODY}</li>
4078 * <li>{@link #DELIVERY_TIME}</li>
4079 * <li>{@link #MESSAGE_READ}</li>
4080 * <li>{@link #MESSAGE_FORMAT}</li>
4081 * <li>{@link #MESSAGE_PRIORITY}</li>
4082 * <li>{@link #ETWS_WARNING_TYPE}</li>
4083 * <li>{@link #CMAS_MESSAGE_CLASS}</li>
4084 * <li>{@link #CMAS_CATEGORY}</li>
4085 * <li>{@link #CMAS_RESPONSE_TYPE}</li>
4086 * <li>{@link #CMAS_SEVERITY}</li>
4087 * <li>{@link #CMAS_URGENCY}</li>
4088 * <li>{@link #CMAS_CERTAINTY}</li>
4089 * </ul>
4090 */
4091 @RequiresPermission(Manifest.permission.READ_CELL_BROADCASTS)
4092 @NonNull
4093 public static final Uri MESSAGE_HISTORY_URI = Uri.parse("content://cellbroadcasts/history");
4094
4095 /**
Chen Xuad2f91f2019-12-30 00:29:01 -08004096 * The authority for the legacy cellbroadcast provider.
4097 * This is used for OEM data migration. OEMs want to migrate message history or
4098 * sharepreference data to mainlined cellbroadcastreceiver app, should have a
4099 * contentprovider with authority: cellbroadcast-legacy. Mainlined cellbroadcastreceiver
4100 * will interact with this URI to retrieve data and persists to mainlined cellbroadcast app.
4101 *
4102 * @hide
4103 */
4104 @SystemApi
4105 public static final @NonNull String AUTHORITY_LEGACY = "cellbroadcast-legacy";
4106
4107 /**
4108 * A content:// style uri to the authority for the legacy cellbroadcast provider.
4109 * @hide
4110 */
4111 @SystemApi
4112 public static final @NonNull Uri AUTHORITY_LEGACY_URI =
4113 Uri.parse("content://cellbroadcast-legacy");
4114
4115 /**
4116 * Method name to {@link android.content.ContentProvider#call(String, String, Bundle)
4117 * for {@link #AUTHORITY_LEGACY}. Used to query cellbroadcast {@link Preference},
4118 * containing following supported entries
4119 * <ul>
4120 * <li>{@link #ENABLE_AREA_UPDATE_INFO_PREF}</li>
4121 * <li>{@link #ENABLE_TEST_ALERT_PREF}</li>
4122 * <li>{@link #ENABLE_STATE_LOCAL_TEST_PREF}</li>
4123 * <li>{@link #ENABLE_PUBLIC_SAFETY_PREF}</li>
4124 * <li>{@link #ENABLE_CMAS_AMBER_PREF}</li>
4125 * <li>{@link #ENABLE_CMAS_SEVERE_THREAT_PREF}</li>
4126 * <li>{@link #ENABLE_CMAS_EXTREME_THREAT_PREF}</li>
4127 * <li>{@link #ENABLE_CMAS_PRESIDENTIAL_PREF}</li>
4128 * <li>{@link #ENABLE_ALERT_VIBRATION_PREF}</li>
4129 * <li>{@link #ENABLE_EMERGENCY_PERF}</li>
Chen Xuad2f91f2019-12-30 00:29:01 -08004130 * <li>{@link #ENABLE_CMAS_IN_SECOND_LANGUAGE_PREF}</li>
4131 * </ul>
4132 * @hide
4133 */
4134 @SystemApi
4135 public static final @NonNull String CALL_METHOD_GET_PREFERENCE = "get_preference";
4136
4137 /**
4138 * Arg name to {@link android.content.ContentProvider#call(String, String, Bundle)}
4139 * for {@link #AUTHORITY_LEGACY}.
4140 * Contains all supported shared preferences for cellbroadcast.
4141 *
4142 * @hide
4143 */
4144 @SystemApi
4145 public static final class Preference {
4146 /**
4147 * Not Instantiatable.
4148 * @hide
4149 */
4150 private Preference() {}
4151
4152 /** Preference to enable area update info alert */
4153 public static final @NonNull String ENABLE_AREA_UPDATE_INFO_PREF =
4154 "enable_area_update_info_alerts";
4155
4156 /** Preference to enable test alert */
4157 public static final @NonNull String ENABLE_TEST_ALERT_PREF =
4158 "enable_test_alerts";
4159
4160 /** Preference to enable state local test alert */
4161 public static final @NonNull String ENABLE_STATE_LOCAL_TEST_PREF
4162 = "enable_state_local_test_alerts";
4163
4164 /** Preference to enable public safety alert */
4165 public static final @NonNull String ENABLE_PUBLIC_SAFETY_PREF
4166 = "enable_public_safety_messages";
4167
4168 /** Preference to enable amber alert */
4169 public static final @NonNull String ENABLE_CMAS_AMBER_PREF
4170 = "enable_cmas_amber_alerts";
4171
4172 /** Preference to enable severe threat alert */
4173 public static final @NonNull String ENABLE_CMAS_SEVERE_THREAT_PREF
4174 = "enable_cmas_severe_threat_alerts";
4175
4176 /** Preference to enable extreme threat alert */
4177 public static final @NonNull String ENABLE_CMAS_EXTREME_THREAT_PREF =
4178 "enable_cmas_extreme_threat_alerts";
4179
4180 /** Preference to enable presidential alert */
4181 public static final @NonNull String ENABLE_CMAS_PRESIDENTIAL_PREF =
4182 "enable_cmas_presidential_alerts";
4183
4184 /** Preference to enable alert vibration */
4185 public static final @NonNull String ENABLE_ALERT_VIBRATION_PREF =
4186 "enable_alert_vibrate";
4187
4188 /** Preference to enable emergency alert */
4189 public static final @NonNull String ENABLE_EMERGENCY_PERF =
4190 "enable_emergency_alerts";
4191
Chen Xuad2f91f2019-12-30 00:29:01 -08004192 /** Preference to enable receive alerts in second language */
4193 public static final @NonNull String ENABLE_CMAS_IN_SECOND_LANGUAGE_PREF =
4194 "receive_cmas_in_second_language";
4195 }
4196
4197 /**
Chen Xu515285b2019-10-03 16:48:56 -07004198 * The subscription which received this cell broadcast message.
Pengquan Meng02d6ac02019-08-27 11:20:17 -07004199 * <P>Type: INTEGER</P>
Pengquan Meng02d6ac02019-08-27 11:20:17 -07004200 */
Jack Yue94a7a42019-12-19 14:13:43 -08004201 public static final String SUBSCRIPTION_ID = "sub_id";
Pengquan Meng02d6ac02019-08-27 11:20:17 -07004202
4203 /**
Chen Xu515285b2019-10-03 16:48:56 -07004204 * The slot which received this cell broadcast message.
4205 * <P>Type: INTEGER</P>
Chen Xu515285b2019-10-03 16:48:56 -07004206 */
4207 public static final String SLOT_INDEX = "slot_index";
4208
4209 /**
Jordan Liu657ef5a2019-08-16 14:07:03 -07004210 * Message geographical scope. Valid values are:
4211 * <ul>
4212 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_CELL_WIDE}. meaning the
4213 * message is for the radio service cell</li>
4214 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_CELL_WIDE_IMMEDIATE},
4215 * meaning the message is for the radio service cell and immediately displayed</li>
4216 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_PLMN_WIDE}, meaning the
4217 * message is for the PLMN (i.e. MCC/MNC)</li>
4218 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_LOCATION_AREA_WIDE},
4219 * meaning the message is for the location area (in GSM) or service area (in UMTS)</li>
4220 * </ul>
4221 *
4222 * <p>A message meant for a particular scope is automatically dismissed when the device
4223 * exits that scope.</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004224 * <P>Type: INTEGER</P>
4225 */
4226 public static final String GEOGRAPHICAL_SCOPE = "geo_scope";
4227
4228 /**
4229 * Message serial number.
Jordan Liu657ef5a2019-08-16 14:07:03 -07004230 * <p>
4231 * A 16-bit integer which identifies a particular CBS (cell
4232 * broadcast short message service) message. The core network is responsible for
4233 * allocating this value, and the value may be managed cyclically (3GPP TS 23.041 section
4234 * 9.2.1) once the serial message has been incremented a sufficient number of times.
4235 * </p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004236 * <P>Type: INTEGER</P>
4237 */
4238 public static final String SERIAL_NUMBER = "serial_number";
4239
4240 /**
Jordan Liu657ef5a2019-08-16 14:07:03 -07004241 * PLMN (i.e. MCC/MNC) of broadcast sender. {@code SERIAL_NUMBER + PLMN + LAC + CID}
4242 * uniquely identifies a broadcast for duplicate detection purposes.
Dan Willemsen4980bf42017-02-14 14:17:12 -08004243 * <P>Type: TEXT</P>
4244 */
4245 public static final String PLMN = "plmn";
4246
4247 /**
Jordan Liu657ef5a2019-08-16 14:07:03 -07004248 * Location area code (LAC).
4249 * <p>Code representing location area (GSM) or service area (UMTS) of broadcast sender.
4250 * Unused for CDMA. Only included if Geographical Scope of message is not PLMN wide (01).
4251 * This value is sent by the network based on the cell tower.
Dan Willemsen4980bf42017-02-14 14:17:12 -08004252 * <P>Type: INTEGER</P>
4253 */
4254 public static final String LAC = "lac";
4255
4256 /**
4257 * Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the
4258 * Geographical Scope of message is cell wide (00 or 11).
4259 * <P>Type: INTEGER</P>
4260 */
4261 public static final String CID = "cid";
4262
4263 /**
Jordan Liu657ef5a2019-08-16 14:07:03 -07004264 * Service category which represents the general topic of the message.
4265 * <p>
4266 * For GSM/UMTS: message identifier (see 3GPP TS 23.041 section 9.4.1.2.2)
4267 * For CDMA: a 16-bit CDMA service category (see 3GPP2 C.R1001-D section 9.3)
4268 * </p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004269 * <P>Type: INTEGER</P>
4270 */
4271 public static final String SERVICE_CATEGORY = "service_category";
4272
4273 /**
Jordan Liu657ef5a2019-08-16 14:07:03 -07004274 * Message language code. (See 3GPP TS 23.041 section 9.4.1.2.3 for details).
Dan Willemsen4980bf42017-02-14 14:17:12 -08004275 * <P>Type: TEXT</P>
4276 */
4277 public static final String LANGUAGE_CODE = "language";
4278
4279 /**
Jack Yu641db9a2020-01-24 13:24:41 -08004280 * Dats coding scheme of the message.
4281 * <p>
4282 * The data coding scheme (dcs) value defined in 3GPP TS 23.038 section 4
4283 * </p>
4284 * <P>Type: INTEGER</P>
4285 */
4286 public static final String DATA_CODING_SCHEME = "dcs";
4287
4288 /**
Dan Willemsen4980bf42017-02-14 14:17:12 -08004289 * Message body.
4290 * <P>Type: TEXT</P>
4291 */
4292 public static final String MESSAGE_BODY = "body";
4293
4294 /**
4295 * Message delivery time.
Jordan Liu657ef5a2019-08-16 14:07:03 -07004296 * <p>This value is a system timestamp using {@link System#currentTimeMillis}</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004297 * <P>Type: INTEGER (long)</P>
4298 */
4299 public static final String DELIVERY_TIME = "date";
4300
4301 /**
4302 * Has the message been viewed?
4303 * <P>Type: INTEGER (boolean)</P>
4304 */
4305 public static final String MESSAGE_READ = "read";
4306
4307 /**
Jordan Liu657ef5a2019-08-16 14:07:03 -07004308 * Message format ({@link android.telephony.SmsCbMessage#MESSAGE_FORMAT_3GPP} or
4309 * {@link android.telephony.SmsCbMessage#MESSAGE_FORMAT_3GPP2}).
Dan Willemsen4980bf42017-02-14 14:17:12 -08004310 * <P>Type: INTEGER</P>
4311 */
4312 public static final String MESSAGE_FORMAT = "format";
4313
4314 /**
Jordan Liu657ef5a2019-08-16 14:07:03 -07004315 * Message priority.
4316 * <p>This includes
4317 * <ul>
4318 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_NORMAL}</li>
4319 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_INTERACTIVE}</li>
4320 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_URGENT}</li>
4321 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_EMERGENCY}</li>
4322 * </p>
4323 * </ul>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004324 * <P>Type: INTEGER</P>
4325 */
4326 public static final String MESSAGE_PRIORITY = "priority";
4327
4328 /**
Jordan Liu657ef5a2019-08-16 14:07:03 -07004329 * ETWS (Earthquake and Tsunami Warning System) warning type (ETWS alerts only).
4330 * <p>See {@link android.telephony.SmsCbEtwsInfo}</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004331 * <P>Type: INTEGER</P>
4332 */
4333 public static final String ETWS_WARNING_TYPE = "etws_warning_type";
4334
4335 /**
Jordan Liu657ef5a2019-08-16 14:07:03 -07004336 * CMAS (Commercial Mobile Alert System) message class (CMAS alerts only).
4337 * <p>See {@link android.telephony.SmsCbCmasInfo}</p>
Dan Willemsen4980bf42017-02-14 14:17:12 -08004338 * <P>Type: INTEGER</P>
4339 */
4340 public static final String CMAS_MESSAGE_CLASS = "cmas_message_class";
4341
4342 /**
4343 * CMAS category (CMAS alerts only).
4344 * <P>Type: INTEGER</P>
4345 */
4346 public static final String CMAS_CATEGORY = "cmas_category";
4347
4348 /**
4349 * CMAS response type (CMAS alerts only).
4350 * <P>Type: INTEGER</P>
4351 */
4352 public static final String CMAS_RESPONSE_TYPE = "cmas_response_type";
4353
4354 /**
4355 * CMAS severity (CMAS alerts only).
4356 * <P>Type: INTEGER</P>
4357 */
4358 public static final String CMAS_SEVERITY = "cmas_severity";
4359
4360 /**
4361 * CMAS urgency (CMAS alerts only).
4362 * <P>Type: INTEGER</P>
4363 */
4364 public static final String CMAS_URGENCY = "cmas_urgency";
4365
4366 /**
4367 * CMAS certainty (CMAS alerts only).
4368 * <P>Type: INTEGER</P>
4369 */
4370 public static final String CMAS_CERTAINTY = "cmas_certainty";
4371
4372 /** The default sort order for this table. */
4373 public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC";
4374
4375 /**
Jack Yu641db9a2020-01-24 13:24:41 -08004376 * The timestamp in millisecond, reported by {@link System#currentTimeMillis()}, when the
4377 * device received the message.
Pengquan Menge3f37272019-08-12 23:09:34 -07004378 * <P>Type: BIGINT</P>
Pengquan Meng02cfb3b2019-07-18 17:30:04 -07004379 */
4380 public static final String RECEIVED_TIME = "received_time";
4381
4382 /**
Jack Yu641db9a2020-01-24 13:24:41 -08004383 * The timestamp in millisecond, reported by {@link System#currentTimeMillis()}, when
4384 * location was checked last time. Note this is only applicable to geo-targeting message.
4385 * For non geo-targeting message. the field will be set to -1.
4386 * <P>Type: BIGINT</P>
4387 */
4388 public static final String LOCATION_CHECK_TIME = "location_check_time";
4389 /**
Pengquan Meng02cfb3b2019-07-18 17:30:04 -07004390 * Indicates that whether the message has been broadcasted to the application.
4391 * <P>Type: BOOLEAN</P>
4392 */
4393 public static final String MESSAGE_BROADCASTED = "message_broadcasted";
4394
4395 /**
Jack Yu641db9a2020-01-24 13:24:41 -08004396 * Indicates that whether the message has been displayed to the user.
4397 * <P>Type: BOOLEAN</P>
4398 */
4399 public static final String MESSAGE_DISPLAYED = "message_displayed";
4400
4401 /**
Pengquan Meng02cfb3b2019-07-18 17:30:04 -07004402 * The Warning Area Coordinates Elements. This element is used for geo-fencing purpose.
4403 *
4404 * The geometry and its coordinates are separated vertical bar, the first item is the
4405 * geometry type and the remaining items are the parameter of this geometry.
4406 *
4407 * Only circle and polygon are supported. The coordinates are represented in Horizontal
4408 * coordinates format.
4409 *
4410 * Coordinate encoding:
4411 * "latitude, longitude"
4412 * where -90.00000 <= latitude <= 90.00000 and -180.00000 <= longitude <= 180.00000
4413 *
4414 * Polygon encoding:
4415 * "polygon|lat1,lng1|lat2,lng2|...|latn,lngn"
4416 * lat1,lng1 ... latn,lngn are the vertices coordinate of the polygon.
4417 *
4418 * Circle encoding:
4419 * "circle|lat,lng|radius".
4420 * lat,lng is the center of the circle. The unit of circle's radius is meter.
4421 *
4422 * Example:
4423 * "circle|0,0|100" mean a circle which center located at (0,0) and its radius is 100 meter.
4424 * "polygon|0,1.5|0,1|1,1|1,0" mean a polygon has vertices (0,1.5),(0,1),(1,1),(1,0).
4425 *
4426 * There could be more than one geometry store in this field, they are separated by a
4427 * semicolon.
4428 *
4429 * Example:
4430 * "circle|0,0|100;polygon|0,0|0,1.5|1,1|1,0;circle|100.123,100|200.123"
4431 *
4432 * <P>Type: TEXT</P>
4433 */
4434 public static final String GEOMETRIES = "geometries";
4435
4436 /**
Pengquan Meng02d6ac02019-08-27 11:20:17 -07004437 * Geo-Fencing Maximum Wait Time in second. The range of the time is [0, 255]. A device
4438 * shall allow to determine its position meeting operator policy. If the device is unable to
4439 * determine its position meeting operator policy within the GeoFencing Maximum Wait Time,
4440 * it shall present the alert to the user and discontinue further positioning determination
4441 * for the alert.
4442 *
4443 * <P>Type: INTEGER</P>
Pengquan Meng02d6ac02019-08-27 11:20:17 -07004444 */
4445 public static final String MAXIMUM_WAIT_TIME = "maximum_wait_time";
4446
4447 /**
Chen Xu515285b2019-10-03 16:48:56 -07004448 * Query columns for instantiating com.android.cellbroadcastreceiver.CellBroadcastMessage.
Jordan Liu657ef5a2019-08-16 14:07:03 -07004449 * @hide
Dan Willemsen4980bf42017-02-14 14:17:12 -08004450 */
Jordan Liu657ef5a2019-08-16 14:07:03 -07004451 @NonNull
Dan Willemsen4980bf42017-02-14 14:17:12 -08004452 public static final String[] QUERY_COLUMNS = {
4453 _ID,
4454 GEOGRAPHICAL_SCOPE,
4455 PLMN,
4456 LAC,
4457 CID,
4458 SERIAL_NUMBER,
4459 SERVICE_CATEGORY,
4460 LANGUAGE_CODE,
4461 MESSAGE_BODY,
4462 DELIVERY_TIME,
4463 MESSAGE_READ,
4464 MESSAGE_FORMAT,
4465 MESSAGE_PRIORITY,
4466 ETWS_WARNING_TYPE,
4467 CMAS_MESSAGE_CLASS,
4468 CMAS_CATEGORY,
4469 CMAS_RESPONSE_TYPE,
4470 CMAS_SEVERITY,
4471 CMAS_URGENCY,
4472 CMAS_CERTAINTY
4473 };
Pengquan Menge3f37272019-08-12 23:09:34 -07004474
4475 /**
4476 * Query columns for instantiating {@link android.telephony.SmsCbMessage} objects.
Jordan Liu657ef5a2019-08-16 14:07:03 -07004477 * @hide
Pengquan Menge3f37272019-08-12 23:09:34 -07004478 */
4479 public static final String[] QUERY_COLUMNS_FWK = {
4480 _ID,
Chen Xu515285b2019-10-03 16:48:56 -07004481 SLOT_INDEX,
Jack Yue94a7a42019-12-19 14:13:43 -08004482 SUBSCRIPTION_ID,
Pengquan Menge3f37272019-08-12 23:09:34 -07004483 GEOGRAPHICAL_SCOPE,
4484 PLMN,
4485 LAC,
4486 CID,
4487 SERIAL_NUMBER,
4488 SERVICE_CATEGORY,
4489 LANGUAGE_CODE,
4490 MESSAGE_BODY,
4491 MESSAGE_FORMAT,
4492 MESSAGE_PRIORITY,
4493 ETWS_WARNING_TYPE,
4494 CMAS_MESSAGE_CLASS,
4495 CMAS_CATEGORY,
4496 CMAS_RESPONSE_TYPE,
4497 CMAS_SEVERITY,
4498 CMAS_URGENCY,
4499 CMAS_CERTAINTY,
4500 RECEIVED_TIME,
4501 MESSAGE_BROADCASTED,
Pengquan Meng02d6ac02019-08-27 11:20:17 -07004502 GEOMETRIES,
4503 MAXIMUM_WAIT_TIME
Pengquan Menge3f37272019-08-12 23:09:34 -07004504 };
Dan Willemsen4980bf42017-02-14 14:17:12 -08004505 }
Jordan Liub9b75ed2017-02-28 18:15:07 -08004506
4507 /**
4508 * Constants for interfacing with the ServiceStateProvider and the different fields of the
4509 * {@link ServiceState} class accessible through the provider.
4510 */
4511 public static final class ServiceStateTable {
4512
4513 /**
4514 * Not instantiable.
4515 * @hide
4516 */
4517 private ServiceStateTable() {}
4518
4519 /**
4520 * The authority string for the ServiceStateProvider
4521 */
4522 public static final String AUTHORITY = "service-state";
4523
4524 /**
4525 * The {@code content://} style URL for the ServiceStateProvider
4526 */
4527 public static final Uri CONTENT_URI = Uri.parse("content://service-state/");
4528
4529 /**
4530 * Generates a content {@link Uri} used to receive updates on a specific field in the
4531 * ServiceState provider.
4532 * <p>
4533 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
Makoto Onukic8c71142019-08-07 08:59:39 -07004534 * {@link ServiceState} while your app is running.
4535 * You can also use a {@link android.app.job.JobService} to
Jordan Liub9b75ed2017-02-28 18:15:07 -08004536 * ensure your app is notified of changes to the {@link Uri} even when it is not running.
Makoto Onukic8c71142019-08-07 08:59:39 -07004537 * Note, however, that using a {@link android.app.job.JobService}
4538 * does not guarantee timely delivery of
Jordan Liub9b75ed2017-02-28 18:15:07 -08004539 * updates to the {@link Uri}.
4540 *
Jordan Liu0f332522017-04-19 14:25:29 -07004541 * @param subscriptionId the subscriptionId to receive updates on
Jordan Liub9b75ed2017-02-28 18:15:07 -08004542 * @param field the ServiceState field to receive updates on
4543 * @return the Uri used to observe {@link ServiceState} changes
4544 */
Jordan Liu0f332522017-04-19 14:25:29 -07004545 public static Uri getUriForSubscriptionIdAndField(int subscriptionId, String field) {
4546 return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId))
Jordan Liub9b75ed2017-02-28 18:15:07 -08004547 .appendEncodedPath(field).build();
4548 }
4549
4550 /**
4551 * Generates a content {@link Uri} used to receive updates on every field in the
4552 * ServiceState provider.
4553 * <p>
4554 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
Makoto Onukic8c71142019-08-07 08:59:39 -07004555 * {@link ServiceState} while your app is running. You can also use a
4556 * {@link android.app.job.JobService} to
Jordan Liub9b75ed2017-02-28 18:15:07 -08004557 * ensure your app is notified of changes to the {@link Uri} even when it is not running.
Makoto Onukic8c71142019-08-07 08:59:39 -07004558 * Note, however, that using a {@link android.app.job.JobService}
4559 * does not guarantee timely delivery of
Jordan Liub9b75ed2017-02-28 18:15:07 -08004560 * updates to the {@link Uri}.
4561 *
Jordan Liu0f332522017-04-19 14:25:29 -07004562 * @param subscriptionId the subscriptionId to receive updates on
Jordan Liub9b75ed2017-02-28 18:15:07 -08004563 * @return the Uri used to observe {@link ServiceState} changes
4564 */
Jordan Liu0f332522017-04-19 14:25:29 -07004565 public static Uri getUriForSubscriptionId(int subscriptionId) {
4566 return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId)).build();
Jordan Liub9b75ed2017-02-28 18:15:07 -08004567 }
4568
4569 /**
Jordan Liub9b75ed2017-02-28 18:15:07 -08004570 * An integer value indicating the current voice service state.
4571 * <p>
4572 * Valid values: {@link ServiceState#STATE_IN_SERVICE},
4573 * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY},
4574 * {@link ServiceState#STATE_POWER_OFF}.
4575 * <p>
4576 * This is the same as {@link ServiceState#getState()}.
4577 */
4578 public static final String VOICE_REG_STATE = "voice_reg_state";
4579
4580 /**
Jordan Liub9b75ed2017-02-28 18:15:07 -08004581 * The current registered operator numeric id.
4582 * <p>
4583 * In GSM/UMTS, numeric format is 3 digit country code plus 2 or 3 digit
4584 * network code.
4585 * <p>
4586 * This is the same as {@link ServiceState#getOperatorNumeric()}.
4587 */
4588 public static final String VOICE_OPERATOR_NUMERIC = "voice_operator_numeric";
4589
4590 /**
Jordan Liub9b75ed2017-02-28 18:15:07 -08004591 * The current network selection mode.
4592 * <p>
4593 * This is the same as {@link ServiceState#getIsManualSelection()}.
4594 */
4595 public static final String IS_MANUAL_NETWORK_SELECTION = "is_manual_network_selection";
Jordan Liub9b75ed2017-02-28 18:15:07 -08004596 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07004597
4598 /**
fionaxu58278be2018-01-29 14:08:12 -08004599 * Contains carrier identification information for the current subscriptions.
fionaxu3d0ad1f2017-10-25 23:09:36 -07004600 */
fionaxu62bc7472018-02-28 11:18:45 -08004601 public static final class CarrierId implements BaseColumns {
fionaxu3d0ad1f2017-10-25 23:09:36 -07004602 /**
fionaxu58278be2018-01-29 14:08:12 -08004603 * Not instantiable.
4604 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07004605 */
fionaxu62bc7472018-02-28 11:18:45 -08004606 private CarrierId() {}
fionaxu3d0ad1f2017-10-25 23:09:36 -07004607
4608 /**
fionaxu58278be2018-01-29 14:08:12 -08004609 * The {@code content://} style URI for this provider.
fionaxu3d0ad1f2017-10-25 23:09:36 -07004610 */
fionaxu62bc7472018-02-28 11:18:45 -08004611 public static final Uri CONTENT_URI = Uri.parse("content://carrier_id");
fionaxu3d0ad1f2017-10-25 23:09:36 -07004612
4613 /**
fionaxu62bc7472018-02-28 11:18:45 -08004614 * The authority string for the CarrierId Provider
fionaxu58278be2018-01-29 14:08:12 -08004615 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07004616 */
fionaxu62bc7472018-02-28 11:18:45 -08004617 public static final String AUTHORITY = "carrier_id";
fionaxu58278be2018-01-29 14:08:12 -08004618
fionaxu3d0ad1f2017-10-25 23:09:36 -07004619
4620 /**
fionaxu58278be2018-01-29 14:08:12 -08004621 * Generates a content {@link Uri} used to receive updates on carrier identity change
4622 * on the given subscriptionId
4623 * <p>
4624 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
fionaxuc8d483e2018-03-07 21:52:05 -08004625 * carrier identity {@link TelephonyManager#getSimCarrierId()}
Makoto Onukic8c71142019-08-07 08:59:39 -07004626 * while your app is running. You can also use a {@link android.app.job.JobService}
4627 * to ensure your app
fionaxu58278be2018-01-29 14:08:12 -08004628 * is notified of changes to the {@link Uri} even when it is not running.
Makoto Onukic8c71142019-08-07 08:59:39 -07004629 * Note, however, that using a {@link android.app.job.JobService} does not guarantee
4630 * timely delivery of updates to the {@link Uri}.
fionaxu58278be2018-01-29 14:08:12 -08004631 *
4632 * @param subscriptionId the subscriptionId to receive updates on
4633 * @return the Uri used to observe carrier identity changes
fionaxu3d0ad1f2017-10-25 23:09:36 -07004634 */
fionaxu58278be2018-01-29 14:08:12 -08004635 public static Uri getUriForSubscriptionId(int subscriptionId) {
4636 return CONTENT_URI.buildUpon().appendEncodedPath(
4637 String.valueOf(subscriptionId)).build();
4638 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07004639
4640 /**
chen xu45f66212019-03-06 14:43:40 -08004641 * Generates a content {@link Uri} used to receive updates on specific carrier identity
chen xud47a0682018-12-06 15:34:05 -08004642 * change on the given subscriptionId returned by
chen xu45f66212019-03-06 14:43:40 -08004643 * {@link TelephonyManager#getSimSpecificCarrierId()}.
4644 * @see TelephonyManager#ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED
chen xudd44d812018-11-02 17:49:57 -07004645 * <p>
4646 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
chen xu45f66212019-03-06 14:43:40 -08004647 * specific carrier identity {@link TelephonyManager#getSimSpecificCarrierId()}
Makoto Onukic8c71142019-08-07 08:59:39 -07004648 * while your app is running. You can also use a {@link android.app.job.JobService}
4649 * to ensure your app
chen xudd44d812018-11-02 17:49:57 -07004650 * is notified of changes to the {@link Uri} even when it is not running.
Makoto Onukic8c71142019-08-07 08:59:39 -07004651 * Note, however, that using a {@link android.app.job.JobService} does not guarantee timely
4652 * delivery of updates to the {@link Uri}.
chen xudd44d812018-11-02 17:49:57 -07004653 *
4654 * @param subscriptionId the subscriptionId to receive updates on
chen xu45f66212019-03-06 14:43:40 -08004655 * @return the Uri used to observe specific carrier identity changes
chen xudd44d812018-11-02 17:49:57 -07004656 */
chen xu81653862019-02-28 10:44:54 -08004657 @NonNull
chen xu45f66212019-03-06 14:43:40 -08004658 public static Uri getSpecificCarrierIdUriForSubscriptionId(int subscriptionId) {
4659 return Uri.withAppendedPath(Uri.withAppendedPath(CONTENT_URI, "specific"),
chen xudd44d812018-11-02 17:49:57 -07004660 String.valueOf(subscriptionId));
4661 }
4662
4663 /**
fionaxu58278be2018-01-29 14:08:12 -08004664 * A user facing carrier name.
fionaxuc8d483e2018-03-07 21:52:05 -08004665 * @see TelephonyManager#getSimCarrierIdName()
fionaxu3d0ad1f2017-10-25 23:09:36 -07004666 * <P>Type: TEXT </P>
4667 */
fionaxu62bc7472018-02-28 11:18:45 -08004668 public static final String CARRIER_NAME = "carrier_name";
fionaxu3d0ad1f2017-10-25 23:09:36 -07004669
4670 /**
4671 * A unique carrier id
fionaxuc8d483e2018-03-07 21:52:05 -08004672 * @see TelephonyManager#getSimCarrierId()
fionaxu3d0ad1f2017-10-25 23:09:36 -07004673 * <P>Type: INTEGER </P>
4674 */
fionaxu62bc7472018-02-28 11:18:45 -08004675 public static final String CARRIER_ID = "carrier_id";
fionaxu3d0ad1f2017-10-25 23:09:36 -07004676
4677 /**
chen xudd44d812018-11-02 17:49:57 -07004678 * A fine-grained carrier id.
chen xu45f66212019-03-06 14:43:40 -08004679 * The specific carrier ID would be used for configuration purposes, but apps wishing to
4680 * know about the carrier itself should use the regular carrier ID returned by
4681 * {@link TelephonyManager#getSimCarrierId()}.
4682 *
4683 * @see TelephonyManager#getSimSpecificCarrierId()
chen xudd44d812018-11-02 17:49:57 -07004684 * This is not a database column, only used to notify content observers for
chen xu45f66212019-03-06 14:43:40 -08004685 * {@link #getSpecificCarrierIdUriForSubscriptionId(int)}
chen xudd44d812018-11-02 17:49:57 -07004686 */
chen xu45f66212019-03-06 14:43:40 -08004687 public static final String SPECIFIC_CARRIER_ID = "specific_carrier_id";
chen xudd44d812018-11-02 17:49:57 -07004688
4689 /**
chen xu45f66212019-03-06 14:43:40 -08004690 * A user facing carrier name for specific carrier id {@link #SPECIFIC_CARRIER_ID}.
4691 * @see TelephonyManager#getSimSpecificCarrierIdName()
chen xud47a0682018-12-06 15:34:05 -08004692 * This is not a database column, only used to notify content observers for
chen xu45f66212019-03-06 14:43:40 -08004693 * {@link #getSpecificCarrierIdUriForSubscriptionId(int)}
chen xud47a0682018-12-06 15:34:05 -08004694 */
chen xu45f66212019-03-06 14:43:40 -08004695 public static final String SPECIFIC_CARRIER_ID_NAME = "specific_carrier_id_name";
chen xud47a0682018-12-06 15:34:05 -08004696
4697 /**
chen xudd44d812018-11-02 17:49:57 -07004698 * A unique parent carrier id. The parent-child
4699 * relationship can be used to further differentiate a single carrier by different networks,
chen xu45f66212019-03-06 14:43:40 -08004700 * by prepaid v.s. postpaid. It's an optional field.
4701 * A carrier id with a valid parent_carrier_id is considered fine-grained specific carrier
4702 * ID, will not be returned as {@link #CARRIER_ID} but {@link #SPECIFIC_CARRIER_ID}.
chen xudd44d812018-11-02 17:49:57 -07004703 * <P>Type: INTEGER </P>
4704 * @hide
4705 */
4706 public static final String PARENT_CARRIER_ID = "parent_carrier_id";
4707
4708 /**
fionaxu58278be2018-01-29 14:08:12 -08004709 * Contains mappings between matching rules with carrier id for all carriers.
4710 * @hide
fionaxu3d0ad1f2017-10-25 23:09:36 -07004711 */
zoey chenb27edd72019-11-01 15:09:11 +08004712 @SystemApi
fionaxu58278be2018-01-29 14:08:12 -08004713 public static final class All implements BaseColumns {
zoey chenb27edd72019-11-01 15:09:11 +08004714
4715 /**
4716 * Not instantiable.
4717 * @hide
4718 */
4719 private All() {
4720 }
4721
fionaxu58278be2018-01-29 14:08:12 -08004722 /**
4723 * Numeric operator ID (as String). {@code MCC + MNC}
4724 * <P>Type: TEXT </P>
4725 */
4726 public static final String MCCMNC = "mccmnc";
4727
4728 /**
4729 * Group id level 1 (as String).
4730 * <P>Type: TEXT </P>
4731 */
4732 public static final String GID1 = "gid1";
4733
4734 /**
4735 * Group id level 2 (as String).
4736 * <P>Type: TEXT </P>
4737 */
4738 public static final String GID2 = "gid2";
4739
4740 /**
4741 * Public Land Mobile Network name.
4742 * <P>Type: TEXT </P>
4743 */
4744 public static final String PLMN = "plmn";
4745
4746 /**
4747 * Prefix xpattern of IMSI (International Mobile Subscriber Identity).
4748 * <P>Type: TEXT </P>
4749 */
4750 public static final String IMSI_PREFIX_XPATTERN = "imsi_prefix_xpattern";
4751
4752 /**
4753 * Service Provider Name.
4754 * <P>Type: TEXT </P>
4755 */
4756 public static final String SPN = "spn";
4757
4758 /**
4759 * Prefer APN name.
4760 * <P>Type: TEXT </P>
4761 */
4762 public static final String APN = "apn";
4763
4764 /**
4765 * Prefix of Integrated Circuit Card Identifier.
4766 * <P>Type: TEXT </P>
4767 */
4768 public static final String ICCID_PREFIX = "iccid_prefix";
4769
4770 /**
fionaxuf9583572018-06-08 16:55:25 -07004771 * Certificate for carrier privilege access rules.
4772 * <P>Type: TEXT in hex string </P>
4773 */
4774 public static final String PRIVILEGE_ACCESS_RULE = "privilege_access_rule";
4775
4776 /**
fionaxu58278be2018-01-29 14:08:12 -08004777 * The {@code content://} URI for this table.
4778 */
zoey chenb27edd72019-11-01 15:09:11 +08004779 @NonNull
fionaxu62bc7472018-02-28 11:18:45 -08004780 public static final Uri CONTENT_URI = Uri.parse("content://carrier_id/all");
fionaxu58278be2018-01-29 14:08:12 -08004781 }
fionaxu3d0ad1f2017-10-25 23:09:36 -07004782 }
changbettyc14ee332019-12-02 15:04:49 +08004783
4784 /**
4785 * Contains SIM Information
4786 * @hide
4787 */
4788 @SystemApi
4789 public static final class SimInfo {
4790 /**
4791 * Not instantiable.
4792 * @hide
4793 */
4794 private SimInfo() {}
4795
4796 /**
4797 * The {@code content://} style URI for this provider.
4798 */
4799 @NonNull
4800 public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo");
Peter Wang37916d62019-11-25 16:50:50 -08004801
4802 /**
4803 * TelephonyProvider unique key column name is the subscription id.
4804 * <P>Type: TEXT (String)</P>
4805 */
4806 public static final String UNIQUE_KEY_SUBSCRIPTION_ID = "_id";
4807
4808 /**
4809 * TelephonyProvider column name for a unique identifier for the subscription within the
4810 * specific subscription type. For example, it contains SIM ICC Identifier subscriptions
4811 * on Local SIMs. and Mac-address for Remote-SIM Subscriptions for Bluetooth devices.
4812 * <P>Type: TEXT (String)</P>
4813 */
4814 public static final String ICC_ID = "icc_id";
4815
4816 /**
4817 * TelephonyProvider column name for user SIM_SlOT_INDEX
4818 * <P>Type: INTEGER (int)</P>
4819 */
4820 public static final String SIM_SLOT_INDEX = "sim_id";
4821
4822 /**
4823 * SIM is not inserted
4824 */
4825 public static final int SIM_NOT_INSERTED = -1;
4826
4827 /**
4828 * TelephonyProvider column name Subscription-type.
4829 * <P>Type: INTEGER (int)</P> {@link #SUBSCRIPTION_TYPE_LOCAL_SIM} for Local-SIM
4830 * Subscriptions, {@link #SUBSCRIPTION_TYPE_REMOTE_SIM} for Remote-SIM Subscriptions.
4831 * Default value is 0.
4832 */
4833 public static final String SUBSCRIPTION_TYPE = "subscription_type";
4834
4835 /**
4836 * This constant is to designate a subscription as a Local-SIM Subscription.
4837 * <p> A Local-SIM can be a physical SIM inserted into a sim-slot in the device, or eSIM on
4838 * the device.
4839 * </p>
4840 */
4841 public static final int SUBSCRIPTION_TYPE_LOCAL_SIM = 0;
4842
4843 /**
4844 * This constant is to designate a subscription as a Remote-SIM Subscription.
4845 * <p>
4846 * A Remote-SIM subscription is for a SIM on a phone connected to this device via some
4847 * connectivity mechanism, for example bluetooth. Similar to Local SIM, this subscription
4848 * can be used for SMS, Voice and data by proxying data through the connected device.
4849 * Certain data of the SIM, such as IMEI, are not accessible for Remote SIMs.
4850 * </p>
4851 *
4852 * <p>
4853 * A Remote-SIM is available only as long the phone stays connected to this device.
4854 * When the phone disconnects, Remote-SIM subscription is removed from this device and is
4855 * no longer known. All data associated with the subscription, such as stored SMS, call
4856 * logs, contacts etc, are removed from this device.
4857 * </p>
4858 *
4859 * <p>
4860 * If the phone re-connects to this device, a new Remote-SIM subscription is created for
4861 * the phone. The Subscription Id associated with the new subscription is different from
4862 * the Subscription Id of the previous Remote-SIM subscription created (and removed) for the
4863 * phone; i.e., new Remote-SIM subscription treats the reconnected phone as a Remote-SIM
4864 * that was never seen before.
4865 * </p>
4866 */
4867 public static final int SUBSCRIPTION_TYPE_REMOTE_SIM = 1;
4868
4869 /**
4870 * TelephonyProvider column name data_enabled_override_rules.
4871 * It's a list of rules for overriding data enabled settings. The syntax is
4872 * For example, "mms=nonDefault" indicates enabling data for mms in non-default
4873 * subscription.
4874 * "default=nonDefault&inVoiceCall" indicates enabling data for internet in non-default
4875 * subscription and while is in voice call.
4876 *
4877 * Default value is empty string.
4878 */
4879 public static final String DATA_ENABLED_OVERRIDE_RULES = "data_enabled_override_rules";
4880
4881 /**
4882 * TelephonyProvider column name for user displayed name.
4883 * <P>Type: TEXT (String)</P>
4884 */
4885 public static final String DISPLAY_NAME = "display_name";
4886
4887 /**
4888 * TelephonyProvider column name for the service provider name for the SIM.
4889 * <P>Type: TEXT (String)</P>
4890 */
4891 public static final String CARRIER_NAME = "carrier_name";
4892
4893 /**
4894 * TelephonyProvider column name for source of the user displayed name.
4895 * <P>Type: INT (int)</P> with one of the NAME_SOURCE_XXXX values below
4896 */
4897 public static final String NAME_SOURCE = "name_source";
4898
4899 /** The name_source is the default, which is from the carrier id. */
4900 public static final int NAME_SOURCE_DEFAULT = 0;
4901
4902 /**
4903 * The name_source is from SIM EF_SPN.
4904 */
4905 public static final int NAME_SOURCE_SIM_SPN = 1;
4906
4907 /**
4908 * The name_source is from user input
4909 */
4910 public static final int NAME_SOURCE_USER_INPUT = 2;
4911
4912 /**
4913 * The name_source is carrier (carrier app, carrier config, etc.)
4914 */
4915 public static final int NAME_SOURCE_CARRIER = 3;
4916
4917 /**
4918 * The name_source is from SIM EF_PNN.
4919 */
4920 public static final int NAME_SOURCE_SIM_PNN = 4;
4921
4922 /**
4923 * TelephonyProvider column name for the color of a SIM.
4924 * <P>Type: INTEGER (int)</P>
4925 */
4926 public static final String COLOR = "color";
4927
4928 /** TelephonyProvider column name for the default color of a SIM {@hide} */
4929 public static final int COLOR_DEFAULT = 0;
4930
4931 /**
4932 * TelephonyProvider column name for the phone number of a SIM.
4933 * <P>Type: TEXT (String)</P>
4934 */
4935 public static final String NUMBER = "number";
4936
4937 /**
4938 * TelephonyProvider column name for the number display format of a SIM.
4939 * <P>Type: INTEGER (int)</P>
4940 * @hide
4941 */
4942 public static final String DISPLAY_NUMBER_FORMAT = "display_number_format";
4943
4944 /**
4945 * TelephonyProvider column name for the default display format of a SIM
4946 * @hide
4947 */
4948 public static final int DISPLAY_NUMBER_DEFAULT = 1;
4949
4950 /**
4951 * TelephonyProvider column name for whether data roaming is enabled.
4952 * <P>Type: INTEGER (int)</P>
4953 */
4954 public static final String DATA_ROAMING = "data_roaming";
4955
4956 /** Indicates that data roaming is enabled for a subscription */
4957 public static final int DATA_ROAMING_ENABLE = 1;
4958
4959 /** Indicates that data roaming is disabled for a subscription */
4960 public static final int DATA_ROAMING_DISABLE = 0;
4961
4962 /** TelephonyProvider column name for default data roaming setting: disable */
4963 public static final int DATA_ROAMING_DEFAULT = DATA_ROAMING_DISABLE;
4964
4965 /**
4966 * TelephonyProvider column name for subscription carrier id.
4967 * @see TelephonyManager#getSimCarrierId()
4968 * <p>Type: INTEGER (int) </p>
4969 */
4970 public static final String CARRIER_ID = "carrier_id";
4971
4972 /**
4973 * A comma-separated list of EHPLMNs associated with the subscription
4974 * <P>Type: TEXT (String)</P>
4975 */
4976 public static final String EHPLMNS = "ehplmns";
4977
4978 /**
4979 * A comma-separated list of HPLMNs associated with the subscription
4980 * <P>Type: TEXT (String)</P>
4981 */
4982 public static final String HPLMNS = "hplmns";
4983
4984 /**
4985 * TelephonyProvider column name for the MCC associated with a SIM, stored as a string.
4986 * <P>Type: TEXT (String)</P>
4987 */
4988 public static final String MCC_STRING = "mcc_string";
4989
4990 /**
4991 * TelephonyProvider column name for the MNC associated with a SIM, stored as a string.
4992 * <P>Type: TEXT (String)</P>
4993 */
4994 public static final String MNC_STRING = "mnc_string";
4995
4996 /**
4997 * TelephonyProvider column name for the MCC associated with a SIM.
4998 * <P>Type: INTEGER (int)</P>
4999 */
5000 public static final String MCC = "mcc";
5001
5002 /**
5003 * TelephonyProvider column name for the MNC associated with a SIM.
5004 * <P>Type: INTEGER (int)</P>
5005 */
5006 public static final String MNC = "mnc";
5007
5008 /**
5009 * TelephonyProvider column name for the iso country code associated with a SIM.
5010 * <P>Type: TEXT (String)</P>
5011 */
5012 public static final String ISO_COUNTRY_CODE = "iso_country_code";
5013
5014 /**
5015 * TelephonyProvider column name for the sim provisioning status associated with a SIM.
5016 * <P>Type: INTEGER (int)</P>
5017 * @hide
5018 */
5019 public static final String SIM_PROVISIONING_STATUS = "sim_provisioning_status";
5020
5021 /** The sim is provisioned {@hide} */
5022 public static final int SIM_PROVISIONED = 0;
5023
5024 /**
5025 * TelephonyProvider column name for whether a subscription is embedded (that is, present on
5026 * an eSIM).
5027 * <p>Type: INTEGER (int), 1 for embedded or 0 for non-embedded.
5028 */
5029 public static final String IS_EMBEDDED = "is_embedded";
5030
5031 /**
5032 * TelephonyProvider column name for SIM card identifier. For UICC card it is the ICCID of
5033 * the current enabled profile on the card, while for eUICC card it is the EID of the card.
5034 * <P>Type: TEXT (String)</P>
5035 */
5036 public static final String CARD_ID = "card_id";
5037
5038 /**
5039 * TelephonyProvider column name for the encoded {@link UiccAccessRule}s from
5040 * {@link UiccAccessRule#encodeRules}. Only present if {@link #IS_EMBEDDED} is 1.
5041 * <p>TYPE: BLOB
5042 */
5043 public static final String ACCESS_RULES = "access_rules";
5044
5045 /**
5046 * TelephonyProvider column name for the encoded {@link UiccAccessRule}s from
5047 * {@link UiccAccessRule#encodeRules} but for the rules that come from CarrierConfigs.
5048 * Only present if there are access rules in CarrierConfigs
5049 * <p>TYPE: BLOB
5050 */
5051 public static final String ACCESS_RULES_FROM_CARRIER_CONFIGS =
5052 "access_rules_from_carrier_configs";
5053
5054 /**
5055 * TelephonyProvider column name identifying whether an embedded subscription is on a
5056 * removable card. Such subscriptions are marked inaccessible as soon as the current card
5057 * is removed. Otherwise, they will remain accessible unless explicitly deleted. Only
5058 * present if {@link #IS_EMBEDDED} is 1.
5059 * <p>TYPE: INTEGER (int), 1 for removable or 0 for non-removable.
5060 */
5061 public static final String IS_REMOVABLE = "is_removable";
5062
5063 /** TelephonyProvider column name for extreme threat in CB settings */
5064 public static final String CB_EXTREME_THREAT_ALERT = "enable_cmas_extreme_threat_alerts";
5065
5066 /** TelephonyProvider column name for severe threat in CB settings */
5067 public static final String CB_SEVERE_THREAT_ALERT = "enable_cmas_severe_threat_alerts";
5068
5069 /** TelephonyProvider column name for amber alert in CB settings */
5070 public static final String CB_AMBER_ALERT = "enable_cmas_amber_alerts";
5071
5072 /** TelephonyProvider column name for emergency alert in CB settings */
5073 public static final String CB_EMERGENCY_ALERT = "enable_emergency_alerts";
5074
5075 /** TelephonyProvider column name for alert sound duration in CB settings */
5076 public static final String CB_ALERT_SOUND_DURATION = "alert_sound_duration";
5077
5078 /** TelephonyProvider column name for alert reminder interval in CB settings */
5079 public static final String CB_ALERT_REMINDER_INTERVAL = "alert_reminder_interval";
5080
5081 /** TelephonyProvider column name for enabling vibrate in CB settings */
5082 public static final String CB_ALERT_VIBRATE = "enable_alert_vibrate";
5083
5084 /** TelephonyProvider column name for enabling alert speech in CB settings */
5085 public static final String CB_ALERT_SPEECH = "enable_alert_speech";
5086
5087 /** TelephonyProvider column name for ETWS test alert in CB settings */
5088 public static final String CB_ETWS_TEST_ALERT = "enable_etws_test_alerts";
5089
5090 /** TelephonyProvider column name for enable channel50 alert in CB settings */
5091 public static final String CB_CHANNEL_50_ALERT = "enable_channel_50_alerts";
5092
5093 /** TelephonyProvider column name for CMAS test alert in CB settings */
5094 public static final String CB_CMAS_TEST_ALERT = "enable_cmas_test_alerts";
5095
5096 /** TelephonyProvider column name for Opt out dialog in CB settings */
5097 public static final String CB_OPT_OUT_DIALOG = "show_cmas_opt_out_dialog";
5098
5099 /**
5100 * TelephonyProvider column name for enable Volte.
5101 *
5102 * If this setting is not initialized (set to -1) then we use the Carrier Config value
5103 * {@link CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL}.
5104 */
5105 public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled";
5106
5107 /** TelephonyProvider column name for enable VT (Video Telephony over IMS) */
5108 public static final String VT_IMS_ENABLED = "vt_ims_enabled";
5109
5110 /** TelephonyProvider column name for enable Wifi calling */
5111 public static final String WFC_IMS_ENABLED = "wfc_ims_enabled";
5112
5113 /** TelephonyProvider column name for Wifi calling mode */
5114 public static final String WFC_IMS_MODE = "wfc_ims_mode";
5115
5116 /** TelephonyProvider column name for Wifi calling mode in roaming */
5117 public static final String WFC_IMS_ROAMING_MODE = "wfc_ims_roaming_mode";
5118
5119 /** TelephonyProvider column name for enable Wifi calling in roaming */
5120 public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled";
5121
5122 /**
Brad Ebinger071d4202020-01-22 16:09:57 -08005123 * Determines if the user has enabled IMS RCS User Capability Exchange (UCE) for this
5124 * subscription.
5125 */
5126 public static final String IMS_RCS_UCE_ENABLED = "ims_rcs_uce_enabled";
5127
5128 /**
Peter Wang37916d62019-11-25 16:50:50 -08005129 * TelephonyProvider column name for whether a subscription is opportunistic, that is,
5130 * whether the network it connects to is limited in functionality or coverage.
5131 * For example, CBRS.
5132 * <p>Type: INTEGER (int), 1 for opportunistic or 0 for non-opportunistic.
5133 */
5134 public static final String IS_OPPORTUNISTIC = "is_opportunistic";
5135
5136 /**
5137 * TelephonyProvider column name for group ID. Subscriptions with same group ID
5138 * are considered bundled together, and should behave as a single subscription at
5139 * certain scenarios.
5140 */
5141 public static final String GROUP_UUID = "group_uuid";
5142
5143 /**
5144 * TelephonyProvider column name for group owner. It's the package name who created
5145 * the subscription group.
5146 */
5147 public static final String GROUP_OWNER = "group_owner";
5148
5149 /**
5150 * TelephonyProvider column name for whether a subscription is metered or not, that is,
5151 * whether the network it connects to charges for subscription or not. For example, paid
5152 * CBRS or unpaid.
5153 * @hide
5154 */
5155 public static final String IS_METERED = "is_metered";
5156
5157 /**
5158 * TelephonyProvider column name for the profile class of a subscription
5159 * Only present if {@link #IS_EMBEDDED} is 1.
5160 * <P>Type: INTEGER (int)</P>
5161 */
5162 public static final String PROFILE_CLASS = "profile_class";
5163
5164 /**
5165 * A testing profile can be pre-loaded or downloaded onto
5166 * the eUICC and provides connectivity to test equipment
5167 * for the purpose of testing the device and the eUICC. It
5168 * is not intended to store any operator credentials.
5169 */
5170 public static final int PROFILE_CLASS_TESTING = 0;
5171
5172 /**
5173 * A provisioning profile is pre-loaded onto the eUICC and
5174 * provides connectivity to a mobile network solely for the
5175 * purpose of provisioning profiles.
5176 */
5177 public static final int PROFILE_CLASS_PROVISIONING = 1;
5178
5179 /**
5180 * An operational profile can be pre-loaded or downloaded
5181 * onto the eUICC and provides services provided by the
5182 * operator.
5183 */
5184 public static final int PROFILE_CLASS_OPERATIONAL = 2;
5185
5186 /**
5187 * The profile class is unset. This occurs when profile class
5188 * info is not available. The subscription either has no profile
5189 * metadata or the profile metadata did not encode profile class.
5190 */
5191 public static final int PROFILE_CLASS_UNSET = -1;
5192
5193 /** Default profile class */
5194 public static final int PROFILE_CLASS_DEFAULT = PROFILE_CLASS_UNSET;
5195
5196 /**
5197 * IMSI (International Mobile Subscriber Identity).
5198 * <P>Type: TEXT </P>
5199 */
5200 public static final String IMSI = "imsi";
5201
5202 /** Whether uicc applications is set to be enabled or disabled. By default it's enabled. */
5203 public static final String UICC_APPLICATIONS_ENABLED = "uicc_applications_enabled";
calvinpand11c1212020-01-14 20:37:31 +08005204
5205 /**
5206 * TelephonyProvider column name for allowed network types. Indicate which network types
5207 * are allowed. Default is -1.
5208 */
5209 public static final String ALLOWED_NETWORK_TYPES = "allowed_network_types";
changbettyc14ee332019-12-02 15:04:49 +08005210 }
Dan Willemsen4980bf42017-02-14 14:17:12 -08005211}